Fix stencil op in render pass stencil read only tests
authorziga-lunarg <ziga@lunarg.com>
Sun, 5 Mar 2023 13:38:25 +0000 (14:38 +0100)
committerPiotr Byszewski <piotr.byszewski@mobica.com>
Sat, 11 Mar 2023 15:24:21 +0000 (15:24 +0000)
If depth stencil attachment is in a read-only layout for the stencil
aspect and stencil test is enabled, all stencil ops must be
KV_STENCIL_OP_KEEP

Components: Vulkan

VK-GL-CTS issue: 4317

Affected tests:
dEQP-VK.renderpass.*

Change-Id: I1ba6dcb11525c600d42e1653b0aa347e67117adf

external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp

index 5e2f00b..4a5e97e 100644 (file)
@@ -1987,6 +1987,8 @@ Move<VkPipeline> createSubpassPipeline (const DeviceInterface&            vk,
                                                                        ? VK_TRUE
                                                                        : VK_FALSE;
 
+       VkStencilOp             stencilOp               = writeStencil ? VK_STENCIL_OP_REPLACE : VK_STENCIL_OP_KEEP;
+
        const VkPipelineDepthStencilStateCreateInfo depthStencilState =
        {
                VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,     // sType
@@ -1998,18 +2000,18 @@ Move<VkPipeline> createSubpassPipeline (const DeviceInterface&          vk,
                VK_FALSE,                                                                                                       // depthBoundsEnable
                writeStencil,                                                                                           // stencilTestEnable
                {
-                       VK_STENCIL_OP_REPLACE,                                                                  // stencilFailOp
-                       VK_STENCIL_OP_REPLACE,                                                                  // stencilPassOp
-                       VK_STENCIL_OP_REPLACE,                                                                  // stencilDepthFailOp
+                       stencilOp,                                                                                              // stencilFailOp
+                       stencilOp,                                                                                              // stencilPassOp
+                       stencilOp,                                                                                              // stencilDepthFailOp
                        VK_COMPARE_OP_ALWAYS,                                                                   // stencilCompareOp
                        ~0u,                                                                                                    // stencilCompareMask
                        ~0u,                                                                                                    // stencilWriteMask
                        ((stencilIndex % 2) == 0) ? ~0x0u : 0x0u                                // stencilReference
                },                                                                                                                      // front
                {
-                       VK_STENCIL_OP_REPLACE,                                                                  // stencilFailOp
-                       VK_STENCIL_OP_REPLACE,                                                                  // stencilPassOp
-                       VK_STENCIL_OP_REPLACE,                                                                  // stencilDepthFailOp
+                       stencilOp,                                                                                              // stencilFailOp
+                       stencilOp,                                                                                              // stencilPassOp
+                       stencilOp,                                                                                              // stencilDepthFailOp
                        VK_COMPARE_OP_ALWAYS,                                                                   // stencilCompareOp
                        ~0u,                                                                                                    // stencilCompareMask
                        ~0u,                                                                                                    // stencilWriteMask