From e817292847f97281f1b6810a5c894811c047b0a5 Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 15 May 2024 12:17:45 +0200 Subject: [PATCH 1/4] fix: fixed ClearColor in 2d pipelines --- .../src/core_2d/main_transparent_pass_2d_node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs index 7ee48bd44ce75..7a94c7afe254d 100644 --- a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs +++ b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs @@ -31,7 +31,7 @@ impl ViewNode for MainTransparentPass2dNode { ) -> Result<(), NodeRunError> { let view_entity = graph.view_entity(); - if !transparent_phase.items.is_empty() { + { #[cfg(feature = "trace")] let _main_pass_2d = info_span!("main_transparent_pass_2d").entered(); From 9f3ed07d29c943af6f399ecdc63bd16d2d89424d Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 15 May 2024 12:33:56 +0200 Subject: [PATCH 2/4] chore: added comment --- .../src/core_2d/main_transparent_pass_2d_node.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs index 7a94c7afe254d..efb0941982f18 100644 --- a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs +++ b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs @@ -31,6 +31,7 @@ impl ViewNode for MainTransparentPass2dNode { ) -> Result<(), NodeRunError> { let view_entity = graph.view_entity(); + // 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(); From c48468c2951d36940e68efce2da2c84e7a61d775 Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 15 May 2024 22:24:43 +0200 Subject: [PATCH 3/4] fix: avoid to render the transparent phase if there are no items --- .../src/core_2d/main_transparent_pass_2d_node.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs index efb0941982f18..6d02982b60fcc 100644 --- a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs +++ b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs @@ -52,8 +52,10 @@ 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); } From 02af448db2a53c9fbc433564b0d5333d65925a7b Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 15 May 2024 22:25:10 +0200 Subject: [PATCH 4/4] chore: fmt --- .../src/core_2d/main_transparent_pass_2d_node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs index 6d02982b60fcc..9d3e89e877c93 100644 --- a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs +++ b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs @@ -55,7 +55,7 @@ impl ViewNode for MainTransparentPass2dNode { if !transparent_phase.items.is_empty() { transparent_phase.render(&mut render_pass, world, view_entity); } - + pass_span.end(&mut render_pass); }