Fix ClearColor in 2d pipelines (#13378)

# Objective

- Fixes #13377
- Fixes https://github.com/bevyengine/bevy/issues/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
This commit is contained in:
Pietro 2024-05-15 22:36:02 +02:00 committed by GitHub
parent 8da4fcb616
commit d17fb160b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
@ -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);
}