Atomic counter tests rely on stores to SSBOs
authorAlexander Galazin <alexander.galazin@arm.com>
Thu, 1 Jun 2017 06:59:16 +0000 (08:59 +0200)
committerAlexander Galazin <alexander.galazin@arm.com>
Thu, 1 Jun 2017 10:39:38 +0000 (12:39 +0200)
Stores to SSBOs are supported if
vertexPipelineStoresAndAtomics/fragmentStoresAndAtomics
are advertised.

VK-GL-CTS issue: 458

Components: Vulkan

Affects:
dEQP-VK.glsl.opaque_type_indexing.atomic_counter.*

Change-Id: I8bd3617522221e646526112978b8d13069f88ec3

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

index bf0f17a..ae6d8ef 100644 (file)
@@ -1604,7 +1604,6 @@ AtomicCounterIndexingCaseInstance::~AtomicCounterIndexingCaseInstance (void)
 
 tcu::TestStatus AtomicCounterIndexingCaseInstance::iterate (void)
 {
-       // \todo [2015-12-02 elecro] Add vertexPipelineStoresAndAtomics feature check.
        const int                                       numInvocations          = NUM_INVOCATIONS;
        const int                                       numCounters                     = NUM_COUNTERS;
        const int                                       numOps                          = NUM_OPS;
@@ -1613,8 +1612,29 @@ tcu::TestStatus AtomicCounterIndexingCaseInstance::iterate (void)
        std::vector<void*>                      outputs;
        std::vector<deUint32>           outValues                       (numInvocations*numOps);
 
-       const DeviceInterface&          vkd                                     = m_context.getDeviceInterface();
-       const VkDevice                          device                          = m_context.getDevice();
+       const DeviceInterface&                  vkd                             = m_context.getDeviceInterface();
+       const VkDevice                                  device                  = m_context.getDevice();
+       const VkPhysicalDeviceFeatures& deviceFeatures  = m_context.getDeviceFeatures();
+
+       //Check stores and atomic operation support.
+       switch (m_shaderType)
+       {
+               case glu::SHADERTYPE_VERTEX:
+               case glu::SHADERTYPE_TESSELLATION_CONTROL:
+               case glu::SHADERTYPE_TESSELLATION_EVALUATION:
+               case glu::SHADERTYPE_GEOMETRY:
+                       if(!deviceFeatures.vertexPipelineStoresAndAtomics)
+                               TCU_THROW(NotSupportedError, "Stores and atomic operations are not supported in Vertex, Tessellation, and Geometry shader.");
+                       break;
+               case glu::SHADERTYPE_FRAGMENT:
+                       if(!deviceFeatures.fragmentStoresAndAtomics)
+                               TCU_THROW(NotSupportedError, "Stores and atomic operations are not supported in fragment shader.");
+                       break;
+               case glu::SHADERTYPE_COMPUTE:
+                       break;
+               default:
+                       throw tcu::InternalError("Unsupported shader type");
+       }
 
        // \note Using separate buffer per element - might want to test
        // offsets & single buffer in the future.