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 10:15:23 +0000 (05:15 -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
(cherry picked from commit 4708641aeed605da095764bbc2d90df760309db3)

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

index 25bf8f8..13b5c11 100644 (file)
@@ -144,10 +144,11 @@ void initFrameBufferPrograms(SourceCollections& programCollection, CaseDefinitio
 
        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"
@@ -158,6 +159,7 @@ void initFrameBufferPrograms(SourceCollections& programCollection, CaseDefinitio
                        << "      }\n"
                        << "    }\n"
                        << "  }\n";
+               }
        }
        else
        {