From e24e8f643cf0eddb8912a264197bfce9ba3c9af9 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 17 May 2021 18:21:27 -0400 Subject: [PATCH] Fix dynamic stencil reference for Replace ops --- wgpu-types/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 338d23d8ed..d5ad581b3e 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1814,7 +1814,7 @@ impl StencilState { } /// Returns true if the stencil state uses the reference value for testing. pub fn needs_ref_value(&self) -> bool { - self.front.compare.needs_ref_value() || self.back.compare.needs_ref_value() + self.front.needs_ref_value() || self.back.needs_ref_value() } } @@ -1944,6 +1944,14 @@ impl StencilFaceState { depth_fail_op: StencilOperation::Keep, pass_op: StencilOperation::Keep, }; + + /// Returns true if the face state uses the reference value for testing or operation. + pub fn needs_ref_value(&self) -> bool { + self.compare.needs_ref_value() + || self.fail_op == StencilOperation::Replace + || self.depth_fail_op == StencilOperation::Replace + || self.pass_op == StencilOperation::Replace + } } impl Default for StencilFaceState {