From 1d5cff5eda7e859336f4cb049d693999e6b4038f Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Mon, 10 Apr 2023 22:19:20 +0100 Subject: [PATCH] Fix panic if DepthMode hasn't propagated (yet). --- src/draw.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/draw.rs b/src/draw.rs index 82704c7..a8fd63e 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -8,8 +8,9 @@ use bevy::render::view::{ExtractedView, RenderLayers}; use crate::node::{OpaqueOutline, StencilOutline, TransparentOutline}; use crate::pipeline::{OutlinePipeline, PassType, PipelineKey}; use crate::uniforms::{ - OutlineFragmentUniform, OutlineStencilFlags, OutlineStencilUniform, OutlineVolumeFlags, - OutlineVolumeUniform, SetOutlineStencilBindGroup, SetOutlineVolumeBindGroup, + DepthMode, OutlineFragmentUniform, OutlineStencilFlags, OutlineStencilUniform, + OutlineVolumeFlags, OutlineVolumeUniform, SetOutlineStencilBindGroup, + SetOutlineVolumeBindGroup, }; use crate::view_uniforms::SetOutlineViewBindGroup; use crate::OutlineRenderLayers; @@ -60,7 +61,10 @@ pub(crate) fn queue_outline_stencil_mesh( material_meshes.iter() { if !view_mask.intersects(outline_mask) { - continue; + continue; // Layer not enabled + } + if stencil_flags.depth_mode == DepthMode::Invalid { + continue; // DepthMode not propagated } if let Some(mesh) = render_meshes.get(mesh_handle) { let key = base_key @@ -134,7 +138,10 @@ pub(crate) fn queue_outline_volume_mesh( material_meshes.iter() { if !view_mask.intersects(outline_mask) { - continue; + continue; // Layer not enabled + } + if volume_flags.depth_mode == DepthMode::Invalid { + continue; // DepthMode not propagated } if let Some(mesh) = render_meshes.get(mesh_handle) { let transparent = fragment_uniform.colour[3] < 1.0;