From 829f02340693ba88e36d3d4d4ee5ccb55ce7c489 Mon Sep 17 00:00:00 2001 From: Hsin-Hsiao Lin Date: Thu, 25 Jul 2019 09:13:34 +0200 Subject: [PATCH] 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 --- .../modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp index c16cbe0..b9353e0 100755 --- a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp +++ b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotOtherTests.cpp @@ -133,10 +133,12 @@ std::string getBodySource(CaseDefinition caseDef) << " }\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" @@ -444,6 +446,7 @@ void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef) "#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 + -- 2.7.4