From 1ba400208361b5eaf408c49514ce112ba6178c07 Mon Sep 17 00:00:00 2001 From: Graeme Leese Date: Fri, 28 Jun 2019 09:36:22 +0100 Subject: [PATCH] Cast invocation ID correctly in allequal tests The gl_SubgroupInvocationID was not being cast to the appropriate type in the vote.allequal tests, so every type was testing the uint version. The ARB extension tests worked around this by specifically casting to bool because there is no uint version in the ARB extension. This version casts the invocation ID to the appropriate type for the test. This part of the test is skipped for boolean types because there may not be an invocation with ID 0, so the results may all be equal ( == true), contrary to the test's expectation. Component: Vulkan VK-GL-CTS issue: 1845 Affects: dEQP-VK.subgroups.vote.* Change-Id: I98a01fa2398cc4cdc18125af2cc64f59a5d559ca --- .../vulkan/subgroups/vktSubgroupsVoteTests.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsVoteTests.cpp b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsVoteTests.cpp index b0b7eb7..49577db 100755 --- a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsVoteTests.cpp +++ b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsVoteTests.cpp @@ -123,7 +123,6 @@ const string stageTestSource(CaseDefinition caseDef) { const bool formatIsBoolean = VK_FORMAT_R8_USCALED == caseDef.format || VK_FORMAT_R8G8_USCALED == caseDef.format || VK_FORMAT_R8G8B8_USCALED == caseDef.format || VK_FORMAT_R8G8B8A8_USCALED == caseDef.format; - const bool arbFunctions = caseDef.opType > OPTYPE_LAST_NON_ARB; const string op = getOpTypeName(caseDef.opType); const string fmt = subgroups::getFormatNameForGLSL(caseDef.format); @@ -141,7 +140,9 @@ const string stageTestSource(CaseDefinition caseDef) " " + fmt + " valueEqual = " + fmt + "(1.25 * float(data[gl_SubgroupInvocationID]) + 5.0);\n" + " " + fmt + " valueNoEqual = " + fmt + (formatIsBoolean ? "(subgroupElect());\n" : "(12.0 * float(data[gl_SubgroupInvocationID]) + gl_SubgroupInvocationID);\n") + " result = " + op + "(" + fmt + "(1)) ? 0x1 : 0;\n" - " result |= " + op + (arbFunctions ? "(bool" : "") + "(gl_SubgroupInvocationID)" + (arbFunctions ? ")" : "") + " ? 0 : 0x2;\n" + " result |= " + + (formatIsBoolean ? "0x2" : op + "(" + fmt + "(gl_SubgroupInvocationID)) ? 0 : 0x2") + + ";\n" " result |= " + op + "(data[0]) ? 0x4 : 0;\n" " result |= " + op + "(valueEqual) ? 0x8 : 0x0;\n" " result |= " + op + "(valueNoEqual) ? 0x0 : 0x10;\n" @@ -301,8 +302,9 @@ void initFrameBufferPrograms (SourceCollections& programCollection, CaseDefiniti " " + subgroups::getFormatNameForGLSL(caseDef.format) + " valueNoEqual = " + subgroups::getFormatNameForGLSL(caseDef.format) + (formatIsBoolean ? "(subgroupElect());\n" : "(12.0 * float(data[gl_SubgroupInvocationID]) + int(gl_FragCoord.x*gl_SubgroupInvocationID));\n") + " result |= " + getOpTypeName(caseDef.opType) + "(" + subgroups::getFormatNameForGLSL(caseDef.format) + "(1)) ? 0x10 : 0;\n" - " result |= " + getOpTypeName(caseDef.opType) + (arbFunctions ? "(bool" : "") + - "(gl_SubgroupInvocationID)" + (arbFunctions ? ")" : "") + " ? 0 : 0x2;\n" + " result |= " + + (formatIsBoolean ? "0x2" : getOpTypeName(caseDef.opType) + "(" + subgroups::getFormatNameForGLSL(caseDef.format) + "(gl_SubgroupInvocationID)) ? 0 : 0x2") + + ";\n" " result |= " + getOpTypeName(caseDef.opType) + "(data[0]) ? 0x4 : 0;\n" " result |= " + getOpTypeName(caseDef.opType) + "(valueEqual) ? 0x8 : 0x0;\n" " result |= " + getOpTypeName(caseDef.opType) + "(gl_HelperInvocation) ? 0x0 : 0x1;\n" @@ -372,8 +374,9 @@ void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef) " " + subgroups::getFormatNameForGLSL(caseDef.format) + " valueNoEqual = " + subgroups::getFormatNameForGLSL(caseDef.format) + (formatIsBoolean ? "(subgroupElect());\n" : "(12.0 * float(data[gl_SubgroupInvocationID]) + offset);\n") + " result = " + getOpTypeName(caseDef.opType) + "(" + subgroups::getFormatNameForGLSL(caseDef.format) + "(1)) ? 0x1 : 0;\n" - " result |= " + getOpTypeName(caseDef.opType) + (arbFunctions ? "(bool" : "") + - "(gl_SubgroupInvocationID)" + (arbFunctions ? ")" : "") + " ? 0x0 : 0x2;\n" + " result |= " + + (formatIsBoolean ? "0x2" : getOpTypeName(caseDef.opType) + "(" + subgroups::getFormatNameForGLSL(caseDef.format) + "(gl_SubgroupInvocationID)) ? 0 : 0x2") + + ";\n" " result |= " + getOpTypeName(caseDef.opType) + "(data[0]) ? 0x4 : 0x0;\n" " result |= "+ getOpTypeName(caseDef.opType) + "(valueEqual) ? 0x8 : 0x0;\n" " result |= "+ getOpTypeName(caseDef.opType) + "(valueNoEqual) ? 0x0 : 0x10;\n" @@ -546,8 +549,9 @@ void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef) " " + subgroups::getFormatNameForGLSL(caseDef.format) + " valueNoEqual = " + subgroups::getFormatNameForGLSL(caseDef.format) + (formatIsBoolean ? "(subgroupElect());\n" : "(12.0 * float(data[gl_SubgroupInvocationID]) + int(gl_FragCoord.x*gl_SubgroupInvocationID));\n") + " result = " + getOpTypeName(caseDef.opType) + "(" + subgroups::getFormatNameForGLSL(caseDef.format) + "(1)) ? 0x1 : 0;\n" - " result |= " + getOpTypeName(caseDef.opType) + (arbFunctions ? "(bool" : "") + - "(gl_SubgroupInvocationID)" + (arbFunctions ? ")" : "") + " ? 0 : 0x2;\n" + " result |= " + + (formatIsBoolean ? "0x2" : getOpTypeName(caseDef.opType) + "(" + subgroups::getFormatNameForGLSL(caseDef.format) + "(gl_SubgroupInvocationID)) ? 0 : 0x2") + + ";\n" " result |= " + getOpTypeName(caseDef.opType) + "(data[0]) ? 0x4 : 0;\n" " result |= " + getOpTypeName(caseDef.opType) + "(valueEqual) ? 0x8 : 0x0;\n" " result |= " + getOpTypeName(caseDef.opType) + "(valueNoEqual) ? 0x0 : 0x10;\n" -- 2.7.4