From de8a6007b7df5bd961511cd321344157fb4b531f Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:28:52 +0100 Subject: [PATCH] check for any prepass phase (#10160) # Objective deferred doesn't currently run unless one of `DepthPrepass`, `ForwardPrepass` or `MotionVectorPrepass` is also present on the camera. ## Solution modify the `queue_prepass_material_meshes` view query to check for any relevant phase, instead of requiring `Opaque3dPrepass` and `AlphaMask3dPrepass` to be present --- crates/bevy_pbr/src/prepass/mod.rs | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index 6e89575bb6b0a..61afa1d0e459c 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -891,18 +891,26 @@ pub fn queue_prepass_material_meshes( render_mesh_instances: Res, render_materials: Res>, render_material_instances: Res>, - mut views: Query<( - &ExtractedView, - &VisibleEntities, - &mut RenderPhase, - &mut RenderPhase, - Option<&mut RenderPhase>, - Option<&mut RenderPhase>, - Option<&DepthPrepass>, - Option<&NormalPrepass>, - Option<&MotionVectorPrepass>, - Option<&DeferredPrepass>, - )>, + mut views: Query< + ( + &ExtractedView, + &VisibleEntities, + Option<&mut RenderPhase>, + Option<&mut RenderPhase>, + Option<&mut RenderPhase>, + Option<&mut RenderPhase>, + Option<&DepthPrepass>, + Option<&NormalPrepass>, + Option<&MotionVectorPrepass>, + Option<&DeferredPrepass>, + ), + Or<( + With>, + With>, + With>, + With>, + )>, + >, ) where M::Data: PartialEq + Eq + Hash + Clone, { @@ -1027,7 +1035,7 @@ pub fn queue_prepass_material_meshes( dynamic_offset: None, }); } else { - opaque_phase.add(Opaque3dPrepass { + opaque_phase.as_mut().unwrap().add(Opaque3dPrepass { entity: *visible_entity, draw_function: opaque_draw_prepass, pipeline_id, @@ -1051,7 +1059,7 @@ pub fn queue_prepass_material_meshes( dynamic_offset: None, }); } else { - alpha_mask_phase.add(AlphaMask3dPrepass { + alpha_mask_phase.as_mut().unwrap().add(AlphaMask3dPrepass { entity: *visible_entity, draw_function: alpha_mask_draw_prepass, pipeline_id,