From 76d31ecb83a9fd23a7f60630ccd04621a38eaf63 Mon Sep 17 00:00:00 2001 From: Roman Kuznetsov Date: Tue, 19 Dec 2023 02:35:35 -0800 Subject: [PATCH] Fix stencil enabling in pipeline state Summary: Fix stencil enabling in pipeline state Reviewed By: mmaurer Differential Revision: D52217293 fbshipit-source-id: ea95a84e7064177290d40687d70a948c73355b32 --- lvk/vulkan/VulkanClasses.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lvk/vulkan/VulkanClasses.cpp b/lvk/vulkan/VulkanClasses.cpp index d73c4146c7..243bfdd5a5 100644 --- a/lvk/vulkan/VulkanClasses.cpp +++ b/lvk/vulkan/VulkanClasses.cpp @@ -1970,6 +1970,12 @@ lvk::VulkanPipelineBuilder& lvk::VulkanPipelineBuilder::stencilStateOps(VkStenci VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) { + depthStencilState_.stencilTestEnable = depthStencilState_.stencilTestEnable == VK_TRUE || failOp != VK_STENCIL_OP_KEEP || + passOp != VK_STENCIL_OP_KEEP || depthFailOp != VK_STENCIL_OP_KEEP || + compareOp != VK_COMPARE_OP_ALWAYS + ? VK_TRUE + : VK_FALSE; + if (faceMask & VK_STENCIL_FACE_FRONT_BIT) { VkStencilOpState& s = depthStencilState_.front; s.failOp = failOp;