Skip to content

Commit cf48132

Browse files
committed
clearpass: also clear views without depth (2d) (#3286)
# Objective - after #3209, 2d examples background were not cleared <img width="912" alt="Screenshot 2021-12-10 at 00 48 04" src="https://user-images.githubusercontent.com/8672791/145494415-d4b7a149-6f9a-4036-9ac5-3d1227b4de69.png"> ## Solution - Change the query to also work when there isn't a `ViewDepthTexture`
1 parent a2f0fe2 commit cf48132

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pipelined/bevy_core_pipeline/src/clear_pass.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use bevy_render2::{
88
};
99

1010
pub struct ClearPassNode {
11-
query: QueryState<(&'static ViewTarget, &'static ViewDepthTexture), With<ExtractedView>>,
11+
query:
12+
QueryState<(&'static ViewTarget, Option<&'static ViewDepthTexture>), With<ExtractedView>>,
1213
}
1314

1415
impl ClearPassNode {
@@ -43,7 +44,7 @@ impl Node for ClearPassNode {
4344
load: LoadOp::Clear(clear_color.0.into()),
4445
store: true,
4546
})],
46-
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
47+
depth_stencil_attachment: depth.map(|depth| RenderPassDepthStencilAttachment {
4748
view: &depth.view,
4849
depth_ops: Some(Operations {
4950
load: LoadOp::Clear(0.0),

0 commit comments

Comments
 (0)