Skip to content

Commit

Permalink
Fix ClearColor in 2d pipelines (#13378)
Browse files Browse the repository at this point in the history
# Objective

- Fixes #13377
- Fixes #13383

## Solution

- Even if the number of renderables is empty, the transparent phase need
to run to set the clear color.

## Testing

- Tested on the `clear_color` example
  • Loading branch information
pietrosophya authored May 15, 2024
1 parent 8da4fcb commit d17fb16
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ impl ViewNode for MainTransparentPass2dNode {
) -> Result<(), NodeRunError> {
let view_entity = graph.view_entity();

if !transparent_phase.items.is_empty() {
// This needs to run at least once to clear the background color, even if there are no items to render
{
#[cfg(feature = "trace")]
let _main_pass_2d = info_span!("main_transparent_pass_2d").entered();

Expand All @@ -51,7 +52,9 @@ impl ViewNode for MainTransparentPass2dNode {
render_pass.set_camera_viewport(viewport);
}

transparent_phase.render(&mut render_pass, world, view_entity);
if !transparent_phase.items.is_empty() {
transparent_phase.render(&mut render_pass, world, view_entity);
}

pass_span.end(&mut render_pass);
}
Expand Down

0 comments on commit d17fb16

Please sign in to comment.