Skip to content

Fixes for rendering debug overlays#23564

Open
kristoff3r wants to merge 2 commits intobevyengine:mainfrom
kristoff3r:ks/render-orderings
Open

Fixes for rendering debug overlays#23564
kristoff3r wants to merge 2 commits intobevyengine:mainfrom
kristoff3r:ks/render-orderings

Conversation

@kristoff3r
Copy link
Copy Markdown
Contributor

@kristoff3r kristoff3r commented Mar 28, 2026

Objective

Tries to fix #23143, fix #23144, and fix artifacts in the deferred_rendering example 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 EndMainPassPostProcessing and 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 through post_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 a deferred_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_rendering example.

Solution

  • Move the render debug overlay outside of PostProcess, and order against relevant things.
  • Don't unconditionally skip prepass based on deferred

Potential future work

Maybe ViewTarget should 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, like cargo run --example deferred_rendering --features bevy_dev_tools

@ChristopherBiscardi it would be helpful if you can test this against your project(s) as well.

@kristoff3r kristoff3r added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 28, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Rendering Mar 28, 2026
@kristoff3r kristoff3r marked this pull request as ready for review March 28, 2026 22:57
@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Mar 29, 2026
@alice-i-cecile alice-i-cecile added X-Uncontroversial This work is generally agreed upon D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Depth Buffer... blank? with Atmosphere SMAA flickering

2 participants