Fix: WebGL viewport / scissors not working correctly with PostProcessing in WebGPURenderer #32883
+30
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed #32882
Description
When using
PostProcessingwith the WebGL backend (forceWebGL: true), viewport and scissor settings were incorrectly applied during nested render calls, causing rendered content to appear smaller than expected.Root cause: In WebGL, scissor state is global. When
PassNoderenders the scene to a render target (triggering a nestedrenderer.render()call), thebeginRendermethod didn't reset the scissor whenrenderContext.scissorwasfalse. This left the outer scissor active, causing the render target to only receive content within the outer scissor area.Fix in
WebGLBackend.js:In
beginRender: Added else clause to reset scissor to the full render area whenrenderContext.scissorisfalseIn
finishRender: Added scissor state restoration (matching the existing viewport restoration pattern)This ensures proper scissor state isolation between nested render calls, matching WebGPU's per-render-pass state model.