Fix color blend state color attachments in depth tests
authorziga-lunarg <ziga@lunarg.com>
Sat, 12 Nov 2022 00:13:43 +0000 (01:13 +0100)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 1 Dec 2022 19:01:42 +0000 (19:01 +0000)
The number of color attachment in pColorBLendState must match the number
of color attachment in the subpass when creating the pipeline

Components: Vulkan

VK-GL-CTS issue: 4058

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

Change-Id: Ibce5ff044c0804218d56d452eea7973c4c3a2990

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

index ba10d40..857962d 100644 (file)
@@ -679,6 +679,9 @@ DepthTestInstance::DepthTestInstance (Context&                                                      context,
                        VK_COLOR_COMPONENT_B_BIT |
                        VK_COLOR_COMPONENT_A_BIT,
                };
+
+               deUint32 colorAttachmentCount = (m_colorFormat != VK_FORMAT_UNDEFINED) ? 1u : 0u;
+
                const VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo
                {
                        VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,               // VkStructureType                                                              sType
@@ -686,7 +689,7 @@ DepthTestInstance::DepthTestInstance (Context&                                                      context,
                        0u,                                                                                                                             // VkPipelineColorBlendStateCreateFlags                 flags
                        VK_FALSE,                                                                                                               // VkBool32                                                                             logicOpEnable
                        VK_LOGIC_OP_CLEAR,                                                                                              // VkLogicOp                                                                    logicOp
-                       1u,                                                                                                                             // deUint32                                                                             attachmentCount
+                       colorAttachmentCount,                                                                                   // deUint32                                                                             attachmentCount
                        &blendState,                                                                                                    // const VkPipelineColorBlendAttachmentState*   pAttachments
                        { 0.0f, 0.0f, 0.0f, 0.0f }                                                                              // float                                                                                blendConstants[4]
                };