Clear the stencil attachment if it exists
authorPiers Daniell <pdaniell@nvidia.com>
Thu, 20 Jul 2017 21:53:13 +0000 (15:53 -0600)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 9 Aug 2017 12:12:39 +0000 (08:12 -0400)
The test uses VK_STENCIL_OP_INCREMENT_AND_WRAP which needs the
stencil attachment in a known state in order to produce
predictable results.

Affects:

dEQP-VK.renderpass.suballocation.multisample.s8_uint.samples_*
dEQP-VK.renderpass.suballocation.multisample.d16_unorm_s8_uint.samples_*
dEQP-VK.renderpass.suballocation.multisample.d24_unorm_s8_uint.samples_*
dEQP-VK.renderpass.suballocation.multisample.d32_sfloat_s8_uint.samples_*
dEQP-VK.renderpass.multisample.s8_uint.samples_*
dEQP-VK.renderpass.multisample.d16_unorm_s8_uint.samples_*
dEQP-VK.renderpass.multisample.d24_unorm_s8_uint.samples_*
dEQP-VK.renderpass.multisample.d32_sfloat_s8_uint.samples_*

Components: Vulkan

VK-GL-CTS issue: 584

Change-Id: I7ed5ced8b77a4563301320e50b2c247e95c34936

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

index ed5063b..1256fe7 100644 (file)
@@ -1462,6 +1462,29 @@ tcu::TestStatus MultisampleRenderPassTestInstance::iterate (void)
                        DE_NULL
                };
                vkd.cmdBeginRenderPass(*commandBuffer, &beginInfo, VK_SUBPASS_CONTENTS_INLINE);
+
+               // Stencil needs to be cleared if it exists.
+               if (tcu::hasStencilComponent(mapVkFormat(m_srcFormat).order))
+               {
+                       const VkClearAttachment clearAttachment =
+                       {
+                               VK_IMAGE_ASPECT_STENCIL_BIT,                                            // VkImageAspectFlags   aspectMask;
+                               0,                                                                                                      // deUint32                             colorAttachment;
+                               makeClearValueDepthStencil(0, 0)                                        // VkClearValue                 clearValue;
+                       };
+
+                       const VkClearRect clearRect =
+                       {
+                               {
+                                       { 0u, 0u },
+                                       { m_width, m_height }
+                               },
+                               0,                                                                                                      // deUint32     baseArrayLayer;
+                               1                                                                                                       // deUint32     layerCount;
+                       };
+
+                       vkd.cmdClearAttachments(*commandBuffer, 1, &clearAttachment, 1, &clearRect);
+               }
        }
 
        vkd.cmdBindPipeline(*commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_renderPipeline);