Tilers may need to execute vertex pipeline stages more than once,
leading to additional shader invocations. This is a problem for atomic
tests, since their result depends on the number of shader invocations
executed.
This is already handled properly for vertex shaders but not for other
vertex pipeline stages.
Affected tests:
dEQP-VK.glsl.atomic_operations.*
Components: Vulkan
VK-GL-CTS issue: 2987
Co-authored-by: Ricardo Garcia <rgarcia@igalia.com>
Change-Id: Iab08e3fb2ef40fc29dcf073817e5fd5dd49e7875
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 (atomicAdd(buf.data.invocationHitCount[0], 1) < ${N})\n"
+ << "{\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"
;
}