Verify results in ballot bitcount tests
authorGraeme Leese <gleese@broadcom.com>
Fri, 17 Jan 2020 12:06:15 +0000 (12:06 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 9 Mar 2020 11:23:01 +0000 (07:23 -0400)
The old code only checked whether or not the results of these operations
were zero. The non-zero results were never checked for correctness. Add
checks that these results are actually correct.

Components: Vulkan
VK-GL-CTS issue: 2192
Affects: dEQP-VK.subgroups.ballot_other.*bitcount*

Change-Id: Icec4f558f556bc126b95bd925455620c5d8815f7

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

index 762be12..951b701 100755 (executable)
@@ -153,14 +153,10 @@ std::string getBodySource(CaseDefinition caseDef)
                                << "  tempResult |= 0x8;\n"
                                << "  for (uint i = 0; i < 128; i++)\n"
                                << "  {\n"
-                               << "    bool shouldBeZero = (i >= inclusiveOffset);\n"
+                               << "    uint ref = inclusiveOffset - min(inclusiveOffset, i);\n"
                                << "    uvec4 b = MAKE_HIGH_BALLOT_RESULT(i);\n"
                                << "    uint inclusiveBitCount = subgroupBallotInclusiveBitCount(b);\n"
-                               << "    if (shouldBeZero && (0 != inclusiveBitCount))\n"
-                               << "    {\n"
-                               << "      tempResult &= ~0x8;\n"
-                               << "    }\n"
-                               << "    else if (!shouldBeZero && (0 == inclusiveBitCount))\n"
+                               << "    if (inclusiveBitCount != ref)\n"
                                << "    {\n"
                                << "      tempResult &= ~0x8;\n"
                                << "    }\n"
@@ -174,14 +170,10 @@ std::string getBodySource(CaseDefinition caseDef)
                                << "  tempResult |= 0x8;\n"
                                << "  for (uint i = 0; i < 128; i++)\n"
                                << "  {\n"
-                               << "    bool shouldBeZero = (i >= exclusiveOffset);\n"
+                               << "    uint ref = exclusiveOffset - min(exclusiveOffset, i);\n"
                                << "    uvec4 b = MAKE_HIGH_BALLOT_RESULT(i);\n"
                                << "    uint exclusiveBitCount = subgroupBallotExclusiveBitCount(b);\n"
-                               << "    if (shouldBeZero && (0 != exclusiveBitCount))\n"
-                               << "    {\n"
-                               << "      tempResult &= ~0x4;\n"
-                               << "    }\n"
-                               << "    else if (!shouldBeZero && (0 == exclusiveBitCount))\n"
+                               << "    if (exclusiveBitCount != ref)\n"
                                << "    {\n"
                                << "      tempResult &= ~0x8;\n"
                                << "    }\n"