Skip to content

TSL: Support primitive values in custom struct constructors#34113

Draft
sunag wants to merge 1 commit into
mrdoob:devfrom
sunag:dev-fix-struct
Draft

TSL: Support primitive values in custom struct constructors#34113
sunag wants to merge 1 commit into
mrdoob:devfrom
sunag:dev-fix-struct

Conversation

@sunag

@sunag sunag commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Related issue: #34085

Description

This PR fixes an issue where instantiating custom structs in TSL using primitive numeric values (e.g., CustomColor( 0.0, 0.0, 1.0 )) was not supported or failed to initialize the struct's fields correctly.

// Define a custom struct type
const CustomColor = struct( { r: 'float', g: 'float', b: 'float' } );

// Fix primitive values passed to a struct
const myColor = CustomColor( 0.0, 0.0, 1.0 );

@sunag sunag added this to the r186 milestone Jul 24, 2026
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 365.88
86.71
365.88
86.71
+0 B
+0 B
WebGPU 685.67
189.48
685.71
189.5
+42 B
+20 B
WebGPU Nodes 683.65
189.16
683.7
189.18
+42 B
+21 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 510.55
124.02
510.55
124.02
+0 B
+0 B
WebGPU 764.04
205.54
764.06
205.54
+22 B
+2 B
WebGPU Nodes 713.54
192.96
713.56
192.96
+22 B
-2 B

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

🖼️ E2E screenshot tests

1 example(s) failed (full artifacts).

Example Expected Actual Diff
webgpu_animation_retargeting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant