Fixes for rendering debug overlays#23564
Open
kristoff3r wants to merge 2 commits intobevyengine:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
Tries to fix #23143, fix #23144, and fix artifacts in the
deferred_renderingexample when using the render debug overlays.I'm using this to learn more about the renderer so I'm not 100% confident here, but this is what my investigation found:
Before yeeting the render graph in #22144, the different nodes were a lot more serial due to sync nodes like
EndMainPassPostProcessingand having to manually add edges. Now that stuff is more concurrent we're dependent on the ambiguity checker to help us catch missing dependencies, and it was even enabled for the render world recently. However, all of the post processing systems depend on&ViewTarget, which is read-only but has rendering side effects throughpost_process_write(). This causes the render debug overlay to race against SMAA/FXAA and potentially other effects as well.After this stopped the flickering from the first issue, I noticed the second issue and that the depth debug image was indeed blank. After some digging and the helpful comment about deferred I tracked this down to the early return in
run_prepass_system. The comment above it seems wrong to me: just because there's a deferred prepass it doesn't mean that the forward bins are empty. There is also adeferred_prepass.is_none()check before the depth texture copy that is currently redundant, but would make sense without the early return.After both of these fixes I can no longer reproduce the above 2 issues, and all the debug overlays seem to make sense in the
deferred_renderingexample.Solution
Potential future work
Maybe
ViewTargetshould be taken as mut, so future issues will be caught by the ambiguity checker?Should we have more system sets in the core pipeline, e.g. for debug overlays and UI?
Testing
See the reproductions in the issues, and try different examples with
--features bevy_dev_tools, likecargo run --example deferred_rendering --features bevy_dev_tools@ChristopherBiscardi it would be helpful if you can test this against your project(s) as well.