Check write vertex support in descriptor indexing
authorMike Byrne <mike.byrne@arm.com>
Wed, 18 Sep 2019 14:50:31 +0000 (15:50 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 30 Sep 2019 08:56:16 +0000 (04:56 -0400)
The descriptor indexing tests which are intended to test vertex write
check if the vertexPipelineStoresAndAtomics feature is supported before
loading the descriptorIndexing_vertx_shaderWrites shader. The vertex
write verifcation needs the same check to ensure the verification is
not run when the shader is not present.

Affects: dEQP-VK.descriptor_indexing*

VK-GL-CTS Issue: 2013

Change-Id: I3870b95b65c0b657708788b9bd2a7adcb5bd8f3d
Components: Vulkan

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

index 76ea227..b7c3446 100644 (file)
@@ -263,6 +263,8 @@ public:
 
        static bool                                     performWritesInVertex                   (VkDescriptorType                                                       descriptorType);
 
+       static bool                                     performWritesInVertex                   (VkDescriptorType                                                       descriptorType,
+                                                                                                                                const Context&                                         context);
        static std::string                      getShaderSource                                 (VkShaderStageFlagBits                                          shaderType,
                                                                                                                                 const TestCaseParams&                                          testCaseParams,
                                                                                                                                 bool                                                                           allowVertexStoring);
@@ -717,8 +719,6 @@ const char* CommonDescriptorInstance::getShaderEpilog                               (void)
 int    CommonDescriptorInstance::constructShaderModules                                (void)
 {
        int                                                             result  = 0;
-       ut::DeviceProperties                    dp              (m_context);
-       const VkPhysicalDeviceFeatures& feats   = dp.physicalDeviceFeatures();
        tcu::TestLog&                                   log             = m_context.getTestContext().getLog();
 
        if (m_testParams.stageFlags & VK_SHADER_STAGE_COMPUTE_BIT)
@@ -730,14 +730,14 @@ int       CommonDescriptorInstance::constructShaderModules                                (void)
        if (m_testParams.stageFlags & VK_SHADER_STAGE_FRAGMENT_BIT)
        {
                ++result;
-               const std::string name = ut::buildShaderName(VK_SHADER_STAGE_FRAGMENT_BIT, m_testParams.descriptorType, m_testParams.updateAfterBind, m_testParams.calculateInLoop, (feats.vertexPipelineStoresAndAtomics != DE_FALSE && m_testParams.allowVertexStoring));
+               const std::string name = ut::buildShaderName(VK_SHADER_STAGE_FRAGMENT_BIT, m_testParams.descriptorType, m_testParams.updateAfterBind, m_testParams.calculateInLoop, m_testParams.allowVertexStoring);
                m_fragmentModule = vk::createShaderModule(m_vki, m_vkd, m_context.getBinaryCollection().get(name), (VkShaderModuleCreateFlags)0);
                log << tcu::TestLog::Message << "Finally used fragment shader: " << name << '\n' << tcu::TestLog::EndMessage;
        }
        if (m_testParams.stageFlags & VK_SHADER_STAGE_VERTEX_BIT)
        {
                ++result;
-               const std::string name = ut::buildShaderName(VK_SHADER_STAGE_VERTEX_BIT, m_testParams.descriptorType, m_testParams.updateAfterBind, m_testParams.calculateInLoop, (feats.vertexPipelineStoresAndAtomics != DE_FALSE && m_testParams.allowVertexStoring));
+               const std::string name = ut::buildShaderName(VK_SHADER_STAGE_VERTEX_BIT, m_testParams.descriptorType, m_testParams.updateAfterBind, m_testParams.calculateInLoop, m_testParams.allowVertexStoring);
                m_vertexModule = vk::createShaderModule(m_vki, m_vkd, m_context.getBinaryCollection().get(name), (VkShaderModuleCreateFlags)0);
                log << tcu::TestLog::Message << "Finally used vertex shader: " << name << '\n' << tcu::TestLog::EndMessage;
        }
@@ -1616,6 +1616,22 @@ bool CommonDescriptorInstance::performWritesInVertex                             (VkDescriptorType
        return result;
 }
 
+bool CommonDescriptorInstance::performWritesInVertex                           (VkDescriptorType                                                       descriptorType,
+                                                                                                                                       const Context&                                                          context)
+{
+       bool result = false;
+
+       ut::DeviceProperties                    dp              (context);
+       const VkPhysicalDeviceFeatures& feats   = dp.physicalDeviceFeatures();
+
+       if (feats.vertexPipelineStoresAndAtomics != DE_FALSE)
+       {
+               result = CommonDescriptorInstance::performWritesInVertex(descriptorType);
+       }
+
+       return result;
+}
+
 std::string CommonDescriptorInstance::getShaderSource                          (VkShaderStageFlagBits                                          shaderType,
                                                                                                                                         const TestCaseParams&                                          testCaseParams,
                                                                                                                                         bool                                                                           allowVertexStoring)
@@ -1815,7 +1831,7 @@ StorageBufferInstance::StorageBufferInstance                                              (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        false,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -1890,7 +1906,7 @@ UniformBufferInstance::UniformBufferInstance                                              (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        false,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -1935,7 +1951,7 @@ StorageTexelInstance::StorageTexelInstance                                                        (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        false,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -1999,7 +2015,7 @@ UniformTexelInstance::UniformTexelInstance                                                        (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        false,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -2150,7 +2166,7 @@ DynamicStorageBufferInstance::DynamicStorageBufferInstance                        (Context&                                       conte
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        false,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams)),
                        DynamicBuffersInstance(context, m_testParams), StorageBufferInstance(context, testCaseParams)
 {
@@ -2195,7 +2211,7 @@ DynamicUniformBufferInstance::DynamicUniformBufferInstance                        (Context&                                       conte
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        false,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams)),
                        DynamicBuffersInstance(context, m_testParams), UniformBufferInstance(context, testCaseParams)
 {
@@ -2238,7 +2254,7 @@ InputAttachmentInstance::InputAttachmentInstance                                  (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_UNDEFINED,
                        BINDING_Undefined,
                        true,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -2374,7 +2390,7 @@ SamplerInstance::SamplerInstance                                                                  (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
                        BINDING_SampledImage,
                        true,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -2487,7 +2503,7 @@ SampledImageInstance::SampledImageInstance                                                        (Context&                                                                       context,
                        VK_DESCRIPTOR_TYPE_SAMPLER,
                        BINDING_Sampler,
                        true,
-                       performWritesInVertex(testCaseParams.descriptorType),
+                       performWritesInVertex(testCaseParams.descriptorType, context),
                        testCaseParams))
 {
 }
@@ -2722,7 +2738,7 @@ StorageImageInstance::StorageImageInstance                                                        (Context&                                                                       context,
                                        VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
                                        (BINDING_StorageImage + 1),
                                        true,
-                                       performWritesInVertex(testCaseParams.descriptorType),
+                                       performWritesInVertex(testCaseParams.descriptorType, context),
                                        testCaseParams))
        , m_buffer              ()
        , m_fillColor   (10)