WebGLBackground: Split adding to render list and clearing of buffers #28118
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.
Related issue: #28078
Description
At the start of the frame the WebXR framebuffer is bound. When rendering transmission pass(es) or shadow maps, a switch happens to a different render target. This is basically free, unless something has been written to the WebXR framebuffer already. Meaning the contents need to be stored and later loaded again.
The
WebGLBackground
handles various kinds of backgrounds. Some of which induce a clear, others insert themselves into the render list. To avoid the above mentioned overhead, any clear operation should happen after the transmission pass, at the same time the transmission pass expects backgrounds to be in the render list. This PR splits these two background paths so the render list is complete before the transmission pass and any applicable clears happens after it.Compare the following outputs of
ovrgpuprofiler
before and after:Notice the
StoreColor
,StoreDepthStencil
on surface 0 andLoadColor
andLoadDepthStencil
on surface 3. Which are gone when looking at the output with this PR in place:This contribution is funded by Fern Solutions