From 12fa2e5448123817fa09b8428dbf8307385b5999 Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Wed, 8 Mar 2023 08:14:41 +0000 Subject: [PATCH] Fix regression in SetOutlineDepth::Real. --- src/outline.wgsl | 2 +- src/pipeline.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/outline.wgsl b/src/outline.wgsl index 0993fc6..f82e5d3 100644 --- a/src/outline.wgsl +++ b/src/outline.wgsl @@ -63,7 +63,7 @@ fn vertex(vertex: VertexInput) -> @builtin(position) vec4 { #ifdef FLAT_DEPTH let out_zw = vec2(model_origin_z(vstage.origin, view.view_proj) * clip_pos.w, clip_pos.w); #else - let out_zw = clip_pos.wz; + let out_zw = clip_pos.zw; #endif #ifdef OFFSET_ZERO let out_xy = clip_pos.xy; diff --git a/src/pipeline.rs b/src/pipeline.rs index 1224c08..a368b50 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -304,7 +304,9 @@ impl SpecializedMeshPipeline for OutlinePipeline { depth_compare: CompareFunction::Greater, stencil: StencilState::default(), bias: DepthBiasState { - constant: if key.pass_type() == PassType::Stencil { + constant: if key.depth_mode() == DepthMode::Flat + && key.pass_type() == PassType::Stencil + { 2 // 1 is empirically not enough to prevent Z-fighting. } else { 0