Skip to content

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented Aug 27, 2025

Related issue: #30359

Description

The simple id checks by RenderContext or ComputeNode could conflict with each other, with the main problem being in the RenderContext cache when used in the same frame. This PR adds a more robust UID fixing this bug.

To reproduce this bug you can just duplicate the number of renderer.compute( a ) calls — the result of the sum will always be the same.

Open webgpu_compute_particles_snow and add:

renderer.compute( computeParticles );
renderer.compute( computeParticles );
renderer.compute( computeParticles );
renderer.compute( computeParticles );
renderer.compute( computeParticles );
renderer.resolveTimestampsAsync( THREE.TimestampQuery.COMPUTE );
One Call Multiples calls (Before) Multiples calls (Now)
image image image

The compute graph (CPT) is the most important one in this example.

It’s possible to notice the problem as well when the RenderContext is shared, as in Gaussian blur, where only a single render call is considered.

@github-actions
Copy link

github-actions bot commented Aug 27, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.91
79.11
338.91
79.11
+0 B
+0 B
WebGPU 578.39
159.34
578.81
159.48
+423 B
+133 B
WebGPU Nodes 577
159.1
577.42
159.23
+423 B
+132 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 470.78
113.9
470.78
113.9
+0 B
+0 B
WebGPU 648.93
175.37
649.3
175.46
+376 B
+87 B
WebGPU Nodes 603.02
164.5
603.4
164.59
+376 B
+97 B

@sunag sunag added this to the r180 milestone Aug 27, 2025
@sunag sunag requested a review from RenaudRohlinger August 27, 2025 17:26
@sunag sunag marked this pull request as ready for review August 27, 2025 17:27
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested and LGTM!

@sunag sunag merged commit 3714bd1 into mrdoob:dev Aug 27, 2025
9 checks passed
@sunag sunag deleted the dev-fix-timestamp-conflict branch August 27, 2025 19:44
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.

2 participants