-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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: avoid render pass/pipeline attachment mismatches #26376
Conversation
One approach to consider is to cache information of a Many RenderTargets will have similar characteristics, only the stored texture will be different. |
I looked at using something like attachmentState = { color format, sample count, depth-stencil } as well, and agree that there is there is more renderObject creation in some cases. I didn't want to add another layer to the renderContext chain map, but that could be avoided by appending attachmentState to the passId string? On the 'for' side to adding render target to renderContext is more opportunity for caching the renderPass descriptor and avoiding createView() calls. |
Maybe we can implement a function like |
Render pass attachment characteristics and pipeline attachment expectations must match. The following sequence can result in a mismatch followed by WebGPU errors because the chain map keys used to locate matching renderObjects and related pipelines does not represent attachment status.
.render( scene, camera ); // pipelines created and keyed by (scene, camera) etc.
.setRenderTarget( newTarget ); // new target with mismatch of color format or sample count etc.
.render( scene, camera ); // pipelines from (1) used which fail with renderPass for newTarget.
This PR adds the render target to the key for renderContexts and uses renderContext as a replacement key element for renderObjects. This prevents the reuse of incompatible pipelines.