Ignore helper pixel invocations with atomic operations tests
authorPiers Daniell <pdaniell@nvidia.com>
Wed, 26 Aug 2020 22:36:10 +0000 (16:36 -0600)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 28 Aug 2020 08:14:32 +0000 (04:14 -0400)
The extra helper pixel invocations caused the test to access array
elements that were out of bounds. The fix is to just ignore
those invocations since they aren't part of the expected test
results anyway.

Affects:

dEQP-VK.glsl.atomic_operations.*

Components: Vulkan

VK-GL-CTS issue: 2563

Change-Id: I1b700c007489dbe72db8bbeda0ca327aac3d055f

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

index 85f4d85..b45b561 100644 (file)
@@ -1083,10 +1083,22 @@ void AtomicOperationCase::createShaderSpec (void)
                        ;
        }
 
-       nonVertexShaderTemplateStream
-               << "int idx = atomicAdd(buf.data.index, 1);\n"
-               << "buf.data.outputValues[idx] = ${ATOMICOP}(buf.data.inoutValues[idx % (${N}/2)], ${COMPARE_ARG}buf.data.inputValues[idx]);\n"
-               ;
+       if (m_shaderType.getType() == glu::SHADERTYPE_FRAGMENT)
+       {
+               nonVertexShaderTemplateStream
+                       << "if (!gl_HelperInvocation) {\n"
+                       << "    int idx = atomicAdd(buf.data.index, 1);\n"
+                       << "    buf.data.outputValues[idx] = ${ATOMICOP}(buf.data.inoutValues[idx % (${N}/2)], ${COMPARE_ARG}buf.data.inputValues[idx]);\n"
+                       << "}\n"
+                       ;
+       }
+       else
+       {
+               nonVertexShaderTemplateStream
+                       << "int idx = atomicAdd(buf.data.index, 1);\n"
+                       << "buf.data.outputValues[idx] = ${ATOMICOP}(buf.data.inoutValues[idx % (${N}/2)], ${COMPARE_ARG}buf.data.inputValues[idx]);\n"
+                       ;
+       }
 
        if (memoryType == AtomicMemoryType::SHARED)
        {