Fix non-constant Id in subgroupBroadcast
authorAlexander Galazin <alexander.galazin@arm.com>
Wed, 28 Nov 2018 18:32:31 +0000 (19:32 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 30 Nov 2018 09:49:28 +0000 (04:49 -0500)
Glslang started to enforce constantness of
the ID parameter in subgroupBroadcast.
This fixes some tests that used to have
non-constant Id by manually unrolling the loop.

Components: Vulkan

Affects: dEQP-VK.subgroups.ballot_broadcast.subgroupbroadcas*

VK-GL-CTS issue: 1489

Change-Id: I291875f94b9781fc4920617106c4f86786fd82d8

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

index d6a7484..2ba32f9 100755 (executable)
@@ -143,10 +143,11 @@ std::string getBodySource(CaseDefinition caseDef)
 
        if (OPTYPE_BROADCAST == caseDef.opType)
        {
-               bdy     << "  tempResult = 0x3;\n"
-                       << "  for (int i = 0; i < " << subgroups::maxSupportedSubgroupSize() << "; i++)\n"
-                       << "  {\n"
-                       << "    const uint id = i;\n"
+               bdy     << "  tempResult = 0x3;\n";
+               for (int i = 0; i < (int)subgroups::maxSupportedSubgroupSize(); i++)
+               {
+                       bdy << "  {\n"
+                       << "    const uint id = "<< i << ";\n"
                        << "    " << subgroups::getFormatNameForGLSL(caseDef.format)
                        << " op = subgroupBroadcast(data1[gl_SubgroupInvocationID], id);\n"
                        << "    if ((0 <= id) && (id < gl_SubgroupSize) && subgroupBallotBitExtract(mask, id))\n"
@@ -157,6 +158,7 @@ std::string getBodySource(CaseDefinition caseDef)
                        << "      }\n"
                        << "    }\n"
                        << "  }\n";
+               }
        }
        else
        {