Fix color blend state in multisample tests
authorziga-lunarg <ziga@lunarg.com>
Sat, 24 Sep 2022 00:25:44 +0000 (02:25 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 6 Oct 2022 15:46:53 +0000 (15:46 +0000)
If the subpass the pipeline is created with has no color attachment the
attachmentCount of pColorBlendState must also be 0

Components: Vulkan

VK-GL-CTS issue: 3991

Affected tests:
dEQP-VK.pipeline.multisample.alpha_to_coverage_no_color_attachment.*

Change-Id: I37ca31e3114ca3e840759b118365f41b1a9565a1

external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp

index 6615ada063ecf1407cb373126ed9ae33d9310e4c..cf3f21cbb96ec4a2e7df7d34768461ffe74cff6e 100644 (file)
@@ -3163,7 +3163,7 @@ void MultisampleRenderer::initialize (Context&                                                                    context,
                for (deUint32 attachmentIdx = 0; attachmentIdx < attachmentCount; attachmentIdx++)
                        attachments.push_back(m_colorBlendState);
 
-               const VkPipelineColorBlendStateCreateInfo colorBlendStateParams =
+               VkPipelineColorBlendStateCreateInfo colorBlendStateParams =
                {
                        VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,       // VkStructureType                                                              sType;
                        DE_NULL,                                                                                                        // const void*                                                                  pNext;
@@ -3205,6 +3205,18 @@ void MultisampleRenderer::initialize (Context&                                                                   context,
                const deUint32 numSubpasses = m_renderType == RENDER_TYPE_DEPTHSTENCIL_ONLY ? 2u : 1u;
 
                for (deUint32 subpassIdx = 0; subpassIdx < numSubpasses; subpassIdx++)
+               {
+                       if (m_renderType == RENDER_TYPE_DEPTHSTENCIL_ONLY)
+                       {
+                               if (subpassIdx == 0)
+                               {
+                                       colorBlendStateParams.attachmentCount = 0;
+                               }
+                               else
+                               {
+                                       colorBlendStateParams.attachmentCount = 1;
+                               }
+                       }
                        for (deUint32 i = 0u; i < numTopologies; ++i)
                        {
                                m_graphicsPipelines.push_back(VkPipelineSp(new Unique<VkPipeline>(makeGraphicsPipeline(vk,                                                      // const DeviceInterface&                        vk
@@ -3227,6 +3239,7 @@ void MultisampleRenderer::initialize (Context&                                                                    context,
                                                                                                                                                                                                           &depthStencilStateParams,    // const VkPipelineDepthStencilStateCreateInfo*  depthStencilStateCreateInfo
                                                                                                                                                                                                           &colorBlendStateParams))));  // const VkPipelineColorBlendStateCreateInfo*    colorBlendStateCreateInfo
                        }
+                       }
        }
 
        if (m_renderType == RENDER_TYPE_COPY_SAMPLES)