Fix subgroup shuffle tests to do testing
authorGraeme Leese <gleese@broadcom.com>
Thu, 29 Nov 2018 18:22:33 +0000 (18:22 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 12 Dec 2018 16:35:19 +0000 (11:35 -0500)
Modify the subgroup shuffle tests to modify the indices so that they're
in range, rather than just rejecting all the values that were out of
range. In my testing of the old method, every test was skipped so the
tests always passed.

Components: Vulkan
VK-GL-CTS issue: 1490
Affects: dEQP-VK.subgroups.shuffle.*

Change-Id: I51d4511aef60c37f39c634be9dbeaff9aca4717e

external/vulkancts/modules/vulkan/subgroups/vktSubgroupsShuffleTests.cpp

index b540f65..749b9b2 100755 (executable)
@@ -104,16 +104,17 @@ const std::string DeclSource(CaseDefinition caseDef, int baseBinding)
 const std::string TestSource(CaseDefinition caseDef)
 {
        std::string                                             idTable[OPTYPE_LAST];
-       idTable[OPTYPE_SHUFFLE]                 = "data2[gl_SubgroupInvocationID]";
-       idTable[OPTYPE_SHUFFLE_XOR]             = "gl_SubgroupInvocationID ^ data2[gl_SubgroupInvocationID]";
-       idTable[OPTYPE_SHUFFLE_UP]              = "gl_SubgroupInvocationID - data2[gl_SubgroupInvocationID]";
-       idTable[OPTYPE_SHUFFLE_DOWN]    = "gl_SubgroupInvocationID + data2[gl_SubgroupInvocationID]";
+       idTable[OPTYPE_SHUFFLE]                 = "id_in";
+       idTable[OPTYPE_SHUFFLE_XOR]             = "gl_SubgroupInvocationID ^ id_in";
+       idTable[OPTYPE_SHUFFLE_UP]              = "gl_SubgroupInvocationID - id_in";
+       idTable[OPTYPE_SHUFFLE_DOWN]    = "gl_SubgroupInvocationID + id_in";
 
        const std::string testSource =
                "  uint temp_res;\n"
                "  uvec4 mask = subgroupBallot(true);\n"
+               "  uint id_in = data2[gl_SubgroupInvocationID] & (gl_SubgroupSize - 1);\n"
                "  " + subgroups::getFormatNameForGLSL(caseDef.format) + " op = "
-               + getOpTypeName(caseDef.opType) + "(data1[gl_SubgroupInvocationID], data2[gl_SubgroupInvocationID]);\n"
+               + getOpTypeName(caseDef.opType) + "(data1[gl_SubgroupInvocationID], id_in);\n"
                "  uint id = " + idTable[caseDef.opType] + ";\n"
                "  if ((id < gl_SubgroupSize) && subgroupBallotBitExtract(mask, id))\n"
                "  {\n"