Provide a highp variable to MAKE_HIGH_BALLOT_RESULT
The MAKE_HIGH_BALLOT_RESULT macro assumes the input is 32bit.
Given a mediump variable, ex: gl_SubgroupSize, would produce an
undefined result when the input value is >= 16 and the computation
is in 16 bits.
Provide a highp input would ensure the computation is in 32 bits.
Affects:
dEQP-VK.subgroups.ballot_other.*
Components: vulkan
VK-GL-CTS issue: 1894
Change-Id: I22987f20be3d08444c52cb722fc23494777a5636
diff --git a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp
index f713922..c4e4b47 100755
--- a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp
+++ b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp
@@ -191,10 +191,12 @@
<< " }\n";
break;
case OPTYPE_BALLOT_BIT_COUNT:
- bdy << " tempResult |= gl_SubgroupSize == subgroupBallotBitCount(allOnes) ? 0x1 : 0;\n"
+ bdy << " /* To ensure a 32-bit computation, use a variable with default highp precision. */\n"
+ << " uint SubgroupSize = gl_SubgroupSize;\n"
+ << " tempResult |= SubgroupSize == subgroupBallotBitCount(allOnes) ? 0x1 : 0;\n"
<< " tempResult |= 0 == subgroupBallotBitCount(allZeros) ? 0x2 : 0;\n"
<< " tempResult |= 0 < subgroupBallotBitCount(subgroupBallot(true)) ? 0x4 : 0;\n"
- << " tempResult |= 0 == subgroupBallotBitCount(MAKE_HIGH_BALLOT_RESULT(gl_SubgroupSize)) ? 0x8 : 0;\n";
+ << " tempResult |= 0 == subgroupBallotBitCount(MAKE_HIGH_BALLOT_RESULT(SubgroupSize)) ? 0x8 : 0;\n";
break;
case OPTYPE_BALLOT_INCLUSIVE_BIT_COUNT:
bdy << " uint inclusiveOffset = gl_SubgroupInvocationID + 1;\n"
@@ -502,6 +504,7 @@
"#version 450\n"
"#extension GL_KHR_shader_subgroup_ballot: enable\n"
"layout(location = 0) out uint result;\n"
+ "precision highp int;\n"
"void main (void)\n"
"{\n"
+ bdyStr +