-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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: Move the textures.updateRenderTarget
logic to Renderer.setRenderTarget
#28392
WebGPURenderer: Move the textures.updateRenderTarget
logic to Renderer.setRenderTarget
#28392
Conversation
…ey were destroyed by setSize destroy event
Do you think we can check this inside WebGPUBindingUtils for example? Adding |
For the moment I simply handle the issue in In any case, the original error might be related to an issue even higher in the pipeline such as As mentioned this issue is very difficult to isolate and to reproduce, and debugging might be a real adventure, so finding all potential improvement along the way in the pipeline to solidify it still a good thing. Anyway, this PR still improve the renderer logic, and I would push the fact that we add functions similar to This would align it with the same logic as the rest of the renderer utilities functions and handle cases where the device has not been initialized via: if ( this._initialized === false ) await this.init(); |
I updated the PR consequently. |
I think I would like to make sure whether or not we can avoid adding another async function. Do you think it might be related to some |
I see, and yes I'm 100% affirmative on the issue being related to the |
In the meantime I will handle the error in user-land I guess. I lack of knowledge regarding all the binding setup part. I will open an issue if I find anything more verbose leading to a potential real fix. Sorry about spamming on this subject, this issue is quite a rabbit hole, but we're getting somewhere! |
As demonstrated here, the issue comes from the This small condition added in const textureData = backend.get( binding.texture );
const isTextureGPUNotAvailable = textureData.texture === undefined && textureData.externalTexture === undefined;
if ( isTextureGPUNotAvailable ) {
// TODO: Remove this once we found why updated === false doesn't generate a texture in the WebGPU backend
console.error( 'Bindings._update: should be available binding:', binding, updated, binding.texture, binding.textureNode.value );
this.textures.updateTexture( binding.texture );
needsBindingsUpdate = true;
} Should I open a PR with this small patch so that it does fix our issue while adding a log to help fix the potential real issue in the future? /cc @sunag |
Related issue: #28289 #28372
Description
This PR moves the logic of updating the textures bound to a renderTarget into the
setRenderTarget
method:At my company, we are currently working on a complex WebGPU project since months and have a deeply nested postprocessing setup. Occasionally, when the FPS drops or the CPU/GPU are under heavy load, when resizing the window a rare error occurs when trying to access the texture bound to the RTT in WebGPUBindingUtils, notably using RTT inside an
node.updateBefore
call:This PR is the 3rd attempt of trying to fix this issue as I'm now pretty sure it is an issue inside the core of the
WebGPURenderer
pipeline.I believe relocating this logic to the
setRenderTarget
method of theRenderer
pipeline make more sense as it is where we want to bind and allocate the proper ressources associated to aRenderTarget
, additionally, this change appears to resolve my issue.This contribution is funded by Utsubo