Skip to content
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

WebGPURenderer: Fix getArrayBufferAsync race condition and ensure proper buffer sequencing #29293

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Sep 2, 2024

Fixed #29270

WebGL Errors:

  • performance warning: READ-usage buffer was read back without waiting on a fence. This caused a graphics pipeline stall.
  • GL_INVALID_OPERATION: A transform feedback buffer that would be written to is also bound to a non-transform-feedback target

WebGPU Error:

  • Failed to execute 'mapAsync' on 'GPUBuffer': Buffer was unmapped before mapping was resolved.

Description

Resolved #29270 by re-binding immediately after the fencing operation and correctly unbinding buffers post-operation in the WebGL backend.

Additionally, removed the readBufferGPU caching system in the WebGPU backend, which could cause race conditions during stress tests on subsequent calls.

This contribution is funded by Segments.AI & Utsubo

@RenaudRohlinger RenaudRohlinger added this to the r169 milestone Sep 2, 2024
Copy link

github-actions bot commented Sep 2, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 685.4 kB
169.7 kB
685.4 kB
169.7 kB
+0 B
+0 B
WebGPU 821.7 kB
220.7 kB
821.7 kB
220.7 kB
+42 B
-11 B
WebGPU Nodes 821.2 kB
220.6 kB
821.3 kB
220.6 kB
+461 B
+81 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 462 kB
111.4 kB
462 kB
111.4 kB
+0 B
+0 B
WebGPU 522.1 kB
140.7 kB
522.1 kB
140.6 kB
+42 B
-20 B
WebGPU Nodes 478.7 kB
130.5 kB
478.8 kB
130.5 kB
-43.31 kB
-22 B

@RenaudRohlinger RenaudRohlinger merged commit 6e11310 into mrdoob:dev Sep 2, 2024
12 checks passed
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.

Race condition with getArrayBufferAsync and compute shader in the WebGPURenderer
2 participants