Add scissor matching renderArea to descriptor indexing tests
authorSlawomir Cygan <slawomir.cygan@intel.com>
Thu, 24 Oct 2019 15:45:28 +0000 (17:45 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Sun, 27 Oct 2019 18:21:12 +0000 (14:21 -0400)
This fixes rendering outside of render area, what
is forbidden by spec.

This also fixes regression from 7b7ba4e0, where
looping the RenderPass caused workload execution time
to increase and trigger OS-specific device timeout.

Components: Vulkan

VK-GL-CTS Issue: 2069

Affects: dEQP-VK.descriptor_indexing.*

Change-Id: I40f665ff892d03004860583029eb393e09c1ae95

external/vulkancts/modules/vulkan/descriptor_indexing/vktDescriptorSetsIndexingTests.cpp

index 91e204a285c9efd1bf83848b25c66c59a5c52c70..18ee14b7ced638e64fe3684c0ce56f39d8d316c7 100644 (file)
@@ -878,8 +878,22 @@ Move<VkPipeline> CommonDescriptorInstance::createGraphicsPipeline  (VkPipelineLay
                attributeDescriptions                                           // pVertexAttributeDescriptions
        };
 
+       const   VkDynamicState                                                  dynamicStates[]                         =
+       {
+               VK_DYNAMIC_STATE_SCISSOR
+       };
+
+       const VkPipelineDynamicStateCreateInfo                  dynamicStateCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,  // sType
+               DE_NULL,                                                                                           // pNext
+               0u,                                                                                                        // flags
+               DE_LENGTH_OF_ARRAY(dynamicStates),                                         // dynamicStateCount
+               dynamicStates                                                                              // pDynamicStates
+       };
+
        const std::vector<VkViewport>   viewports       (1, makeViewport(m_testParams.frameResolution.width, m_testParams.frameResolution.height));
-       const std::vector<VkRect2D>             scissors        (1, makeRect2D(m_testParams.frameResolution.width, m_testParams.frameResolution.height));
+       const std::vector<VkRect2D>             scissors        (1, makeRect2D(0u, 0u));
 
        DE_ASSERT(m_vertexModule && m_fragmentModule);
 
@@ -898,7 +912,12 @@ Move<VkPipeline> CommonDescriptorInstance::createGraphicsPipeline  (VkPipelineLay
                VK_PRIMITIVE_TOPOLOGY_POINT_LIST,                               // topology
                0U,                                                                                             // subpass
                0U,                                                                                             // patchControlPoints
-               &vertexInputStateCreateInfo);                                   // vertexInputStateCreateInfo
+               &vertexInputStateCreateInfo,                                    // vertexInputStateCreateInfo
+               nullptr,                                                                                // rasterizationStateCreateInfo
+               nullptr,                                                                                // multisampleStateCreateInfo
+               nullptr,                                                                                // depthStencilStateCreateInfo
+               nullptr,                                                                                // colorBlendStateCreateInfo
+               &dynamicStateCreateInfo);                                               // dynamicStateCreateInfo
 }
 
 VkDeviceSize CommonDescriptorInstance::createBuffers                           (std::vector<VkDescriptorBufferInfo>&           bufferInfos,
@@ -1320,6 +1339,10 @@ tcu::TestStatus  CommonDescriptorInstance::iterate                                       (void)
                {
                        v.renderArea.offset.x           = x * m_testParams.frameResolution.width/2;
                        v.renderArea.offset.y           = y * m_testParams.frameResolution.height/2;
+
+                       vk::VkRect2D scissor = makeRect2D(v.renderArea.offset.x, v.renderArea.offset.y, v.renderArea.extent.width, v.renderArea.extent.height);
+                       m_vki.cmdSetScissor(*v.commandBuffer, 0u, 1u, &scissor);
+
                        vk::beginRenderPass             (m_vki, *v.commandBuffer, *v.renderPass, *v.frameBuffer->buffer, v.renderArea, m_clearColor);
                        m_vki.cmdDraw                   (*v.commandBuffer, v.vertexCount, 1u, 0u, 0u);
                        vk::endRenderPass               (m_vki, *v.commandBuffer);
@@ -2208,6 +2231,9 @@ tcu::TestStatus   DynamicBuffersInstance::iterate                                         (void)
                v.availableDescriptorCount,                             // dynamicOffsetCount
                dynamicOffsets.data());                                 // pDynamicOffsets
 
+       vk::VkRect2D scissor = makeRect2D(m_testParams.frameResolution.width, m_testParams.frameResolution.height);
+       m_vki.cmdSetScissor(*v.commandBuffer, 0u, 1u, &scissor);
+
        vk::beginRenderPass     (m_vki, *v.commandBuffer, *v.renderPass, *v.frameBuffer->buffer, v.renderArea, m_clearColor);
        m_vki.cmdDraw           (*v.commandBuffer, v.vertexCount, 1, 0, 0);
        vk::endRenderPass       (m_vki, *v.commandBuffer);