From cf48132efd107bbca85aaea00589a01457ef4872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Fri, 10 Dec 2021 02:32:51 +0000 Subject: [PATCH] clearpass: also clear views without depth (2d) (#3286) # Objective - after #3209, 2d examples background were not cleared Screenshot 2021-12-10 at 00 48 04 ## Solution - Change the query to also work when there isn't a `ViewDepthTexture` --- pipelined/bevy_core_pipeline/src/clear_pass.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipelined/bevy_core_pipeline/src/clear_pass.rs b/pipelined/bevy_core_pipeline/src/clear_pass.rs index 8ce2e66cfe..9371aa7aab 100644 --- a/pipelined/bevy_core_pipeline/src/clear_pass.rs +++ b/pipelined/bevy_core_pipeline/src/clear_pass.rs @@ -8,7 +8,8 @@ use bevy_render2::{ }; pub struct ClearPassNode { - query: QueryState<(&'static ViewTarget, &'static ViewDepthTexture), With>, + query: + QueryState<(&'static ViewTarget, Option<&'static ViewDepthTexture>), With>, } impl ClearPassNode { @@ -43,7 +44,7 @@ impl Node for ClearPassNode { load: LoadOp::Clear(clear_color.0.into()), store: true, })], - depth_stencil_attachment: Some(RenderPassDepthStencilAttachment { + depth_stencil_attachment: depth.map(|depth| RenderPassDepthStencilAttachment { view: &depth.view, depth_ops: Some(Operations { load: LoadOp::Clear(0.0),