Fix dEQP-VK.glsl.opaque_type_indexing.ssbo*_compute validation error
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Fri, 24 Sep 2021 10:55:04 +0000 (12:55 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 1 Oct 2021 20:25:40 +0000 (20:25 +0000)
Tests were not checking maxPerStageDescriptorStorageBuffers limits
in the compute shaders, which use more (6) than the minimum limit
set by the spec for that (4).

Components: Vulkan
VK-GL-CTS issue: 3137

Affected tests:

 dEQP-VK.glsl.opaque_type_indexing.ssbo*_compute

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Change-Id: I016fb5024d637e36869ae7e3f78467c91d0e8817

external/vulkancts/modules/vulkan/shaderexecutor/vktOpaqueTypeIndexingTests.cpp

index 131542721a5d09664a89f16baca8e373a6d8d464..498562053ba76ef405620c8d56454fc3d3149afd 100644 (file)
@@ -185,7 +185,7 @@ public:
                                                                                        generateSources(m_shaderType, m_shaderSpec, programCollection);
                                                                                }
 
-                       void                                            checkSupport                            (Context& context) const;
+       virtual void                                            checkSupport                            (Context& context) const;
 
 protected:
        const char*                                                     m_name;
@@ -1390,6 +1390,7 @@ public:
        virtual                                         ~BlockArrayIndexingCase         (void);
 
        virtual TestInstance*           createInstance                          (Context& ctx) const;
+       virtual void                            checkSupport                            (Context& context) const;
 
 private:
                                                                BlockArrayIndexingCase          (const BlockArrayIndexingCase&);
@@ -1424,6 +1425,33 @@ BlockArrayIndexingCase::~BlockArrayIndexingCase (void)
 {
 }
 
+void BlockArrayIndexingCase::checkSupport(Context &context) const
+{
+       OpaqueTypeIndexingCase::checkSupport(context);
+
+       uint32_t maxDescriptorStorageBuffers = (uint32_t)(m_inValues.size());
+
+       switch (m_shaderType)
+       {
+       case glu::SHADERTYPE_VERTEX:
+       case glu::SHADERTYPE_TESSELLATION_CONTROL:
+       case glu::SHADERTYPE_TESSELLATION_EVALUATION:
+       case glu::SHADERTYPE_GEOMETRY:
+       case glu::SHADERTYPE_FRAGMENT:
+               // No extra storage buffers
+               break;
+       case glu::SHADERTYPE_COMPUTE:
+               // From ComputerShaderExecutor class
+               maxDescriptorStorageBuffers += 2u;
+               break;
+       default:
+               TCU_THROW(InternalError, "Unsupported shader type");
+       }
+
+       if (maxDescriptorStorageBuffers > context.getDeviceProperties2().properties.limits.maxPerStageDescriptorStorageBuffers)
+               TCU_THROW(NotSupportedError, "Driver supports less maxPerStageDescriptorStorageBuffers than the ones required");
+}
+
 TestInstance* BlockArrayIndexingCase::createInstance (Context& ctx) const
 {
        return new BlockArrayIndexingCaseInstance(ctx,