Fix color blend state color attachments in depth tests
authorziga-lunarg <ziga@lunarg.com>
Sun, 16 Oct 2022 23:09:01 +0000 (01:09 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 10 Nov 2022 20:05:12 +0000 (20:05 +0000)
The number of color attachments in pColorBlendState must match the
number of color attachments in the subpass when creating the pipeline

Components: Vulkan

VK-GL-CTS issue: 4058

Affected tests:
dEQP-VK.pipeline.*.depth.*

Change-Id: I1b566bd4aec80873631fe1edbb2ced47441c877a

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

index 75386b1..ba10d40 100644 (file)
@@ -665,12 +665,37 @@ DepthTestInstance::DepthTestInstance (Context&                                                    context,
                        de::dataOrNull(dynamicStates),                                                  //      const VkDynamicState*                           pDynamicStates;
                };
 
+               const vk::VkPipelineColorBlendAttachmentState blendState
+               {
+                       VK_FALSE,
+                       VK_BLEND_FACTOR_ONE,
+                       VK_BLEND_FACTOR_ONE,
+                       VK_BLEND_OP_ADD,
+                       VK_BLEND_FACTOR_ONE,
+                       VK_BLEND_FACTOR_ONE,
+                       VK_BLEND_OP_ADD,
+                       VK_COLOR_COMPONENT_R_BIT |
+                       VK_COLOR_COMPONENT_G_BIT |
+                       VK_COLOR_COMPONENT_B_BIT |
+                       VK_COLOR_COMPONENT_A_BIT,
+               };
+               const VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,               // VkStructureType                                                              sType
+                       DE_NULL,                                                                                                                // const void*                                                                  pNext
+                       0u,                                                                                                                             // VkPipelineColorBlendStateCreateFlags                 flags
+                       VK_FALSE,                                                                                                               // VkBool32                                                                             logicOpEnable
+                       VK_LOGIC_OP_CLEAR,                                                                                              // VkLogicOp                                                                    logicOp
+                       1u,                                                                                                                             // deUint32                                                                             attachmentCount
+                       &blendState,                                                                                                    // const VkPipelineColorBlendAttachmentState*   pAttachments
+                       { 0.0f, 0.0f, 0.0f, 0.0f }                                                                              // float                                                                                blendConstants[4]
+               };
+
                for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
                {
                        depthStencilStateParams.depthCompareOp  = depthCompareOps[quadNdx];
 
                        m_graphicsPipelines[quadNdx].setDefaultMultisampleState()
-                                                                               .setDefaultColorBlendState()
                                                                                .setDepthClipControl(hasDepthClipControl ? &depthClipControlCreateInfo : DE_NULL)
                                                                                .setDynamicState(&dynamicStateCreateInfo)
                                                                                .setupVertexInputStete(&vertexInputStateParams)
@@ -686,14 +711,13 @@ DepthTestInstance::DepthTestInstance (Context&                                                    context,
                                                                                                                                        0u,
                                                                                                                                        *m_fragmentShaderModule,
                                                                                                                                        &depthStencilStateParams)
-                                                                               .setupFragmentOutputState(*m_renderPass)
+                                                                               .setupFragmentOutputState(*m_renderPass, 0u, &colorBlendStateCreateInfo)
                                                                                .setMonolithicPipelineLayout(*m_pipelineLayout)
                                                                                .buildPipeline();
 
                        if (useAltGraphicsPipelines)
                        {
                                m_altGraphicsPipelines[quadNdx].setDefaultMultisampleState()
-                                                                                          .setDefaultColorBlendState()
                                                                                           .setDepthClipControl(&depthClipControlCreateInfo01)
                                                                                           .setDynamicState(&dynamicStateCreateInfo)
                                                                                           .setupVertexInputStete(&vertexInputStateParams)
@@ -709,7 +733,7 @@ DepthTestInstance::DepthTestInstance (Context&                                                      context,
                                                                                                                                                                0u,
                                                                                                                                                                *m_fragmentShaderModule,
                                                                                                                                                                &depthStencilStateParams)
-                                                                                          .setupFragmentOutputState(*m_renderPass)
+                                                                                          .setupFragmentOutputState(*m_renderPass, 0u, &colorBlendStateCreateInfo)
                                                                                           .setMonolithicPipelineLayout(*m_pipelineLayout)
                                                                                           .buildPipeline();
                        }