Skip to content

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented Nov 11, 2025

Related issue: #32243

Description

It reuses the binding classes generated by nodes, avoiding some unnecessary updates and saving memory.

@sunag sunag added this to the r182 milestone Nov 11, 2025
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 356.24
86.48
356.24
86.48
+0 B
+0 B
WebGPU 613.34
172.13
613.68
172.23
+337 B
+92 B
WebGPU Nodes 611.95
171.88
612.28
171.97
+337 B
+92 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 488.02
121.25
488.02
121.25
+0 B
+0 B
WebGPU 682.75
187.41
683.09
187.49
+337 B
+77 B
WebGPU Nodes 624.47
170.62
624.81
170.73
+337 B
+103 B

@sunag sunag marked this pull request as ready for review November 11, 2025 19:44
@sunag sunag merged commit d31f771 into mrdoob:dev Nov 11, 2025
10 checks passed
@sunag sunag deleted the dev-cache-uniforms branch November 11, 2025 20:38
@sunag
Copy link
Collaborator Author

sunag commented Nov 11, 2025

To reproduce o problem.

  1. Create a buffer and share it in two Material.
  2. Previously it would update the buffer twice in Backend.updateBinding() in the same render call, now only once.
const array = new Float32Array( 8 * 4 );
array.set( [ 1, 0, 0, 1 ] ); // red

const bufferArray = buffer( array, 'vec4', 3 ).setGroup( renderGroup );

// share it

materialA.colorNode = bufferArray.element( 0 );
materialB.colorNode = bufferArray.element( 0 );

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