Skip to content

TSL: Ensure 4 byte alignment for instancedArray() and attributeArray() #31146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented May 22, 2025

Fixes #30983

Description

Ensure 4 byte alignment for instancedArray() and attributeArray().

Example:

const testStruct = struct( {
	a: 'vec3',
	b: 'vec3'
} );

const outputBuffer = instancedArray( 2, testStruct ); // return 8 lengths instead of 6

@sunag sunag added this to the r177 milestone May 22, 2025
Copy link

github-actions bot commented May 22, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.26
78.64
337.26
78.64
+0 B
+0 B
WebGPU 550.56
152.65
550.64
152.68
+76 B
+30 B
WebGPU Nodes 549.91
152.5
549.99
152.53
+76 B
+31 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 468.12
113.14
468.12
113.14
+0 B
+0 B
WebGPU 625.81
169.41
625.95
169.45
+136 B
+41 B
WebGPU Nodes 580.66
158.73
580.8
158.77
+136 B
+44 B

@sunag sunag marked this pull request as ready for review May 22, 2025 05:17
@sunag sunag merged commit efcca9a into mrdoob:dev May 22, 2025
12 checks passed
@sunag sunag deleted the dev-fix-byte-alignment branch May 22, 2025 05:24
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
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.

The structNode does not respect WebGPU memory layout
1 participant