Commit a67800b8 by Neil Henning

Fix subgroup regression whereby gl_* variables were not available in geometry or…

Fix subgroup regression whereby gl_* variables were not available in geometry or tessellation stages.
parent 4d43fd37
spv.subgroup.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
// Module Version 10200
// Generated by (magic number): 80001
// Id's are bound by 17
Capability Shader
Capability GroupNonUniform
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9 11 13
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_KHR_shader_subgroup_basic"
Name 4 "main"
Name 9 "data"
Name 11 "gl_SubgroupSize"
Name 13 "gl_SubgroupInvocationID"
Decorate 9(data) Location 0
Decorate 11(gl_SubgroupSize) RelaxedPrecision
Decorate 11(gl_SubgroupSize) Flat
Decorate 11(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 12 RelaxedPrecision
Decorate 13(gl_SubgroupInvocationID) RelaxedPrecision
Decorate 13(gl_SubgroupInvocationID) Flat
Decorate 13(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId
Decorate 14 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 4
8: TypePointer Output 7(ivec4)
9(data): 8(ptr) Variable Output
10: TypePointer Input 6(int)
11(gl_SubgroupSize): 10(ptr) Variable Input
13(gl_SubgroupInvocationID): 10(ptr) Variable Input
15: 6(int) Constant 0
4(main): 2 Function None 3
5: Label
12: 6(int) Load 11(gl_SubgroupSize)
14: 6(int) Load 13(gl_SubgroupInvocationID)
16: 7(ivec4) CompositeConstruct 12 14 15 15
Store 9(data) 16
Return
FunctionEnd
spv.subgroup.geom
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
// Module Version 10200
// Generated by (magic number): 80001
// Id's are bound by 26
Capability Geometry
Capability GroupNonUniform
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 15 18 20
ExecutionMode 4 InputPoints
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputPoints
ExecutionMode 4 OutputVertices 1
Source GLSL 450
SourceExtension "GL_KHR_shader_subgroup_basic"
Name 4 "main"
Name 9 "Output"
MemberName 9(Output) 0 "result"
Name 11 ""
Name 15 "gl_PrimitiveIDIn"
Name 18 "gl_SubgroupSize"
Name 20 "gl_SubgroupInvocationID"
Decorate 8 ArrayStride 16
MemberDecorate 9(Output) 0 Offset 0
Decorate 9(Output) BufferBlock
Decorate 11 DescriptorSet 0
Decorate 11 Binding 0
Decorate 15(gl_PrimitiveIDIn) BuiltIn PrimitiveId
Decorate 18(gl_SubgroupSize) RelaxedPrecision
Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 19 RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId
Decorate 21 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 4
8: TypeRuntimeArray 7(ivec4)
9(Output): TypeStruct 8
10: TypePointer Uniform 9(Output)
11: 10(ptr) Variable Uniform
12: TypeInt 32 1
13: 12(int) Constant 0
14: TypePointer Input 12(int)
15(gl_PrimitiveIDIn): 14(ptr) Variable Input
17: TypePointer Input 6(int)
18(gl_SubgroupSize): 17(ptr) Variable Input
20(gl_SubgroupInvocationID): 17(ptr) Variable Input
22: 6(int) Constant 0
24: TypePointer Uniform 7(ivec4)
4(main): 2 Function None 3
5: Label
16: 12(int) Load 15(gl_PrimitiveIDIn)
19: 6(int) Load 18(gl_SubgroupSize)
21: 6(int) Load 20(gl_SubgroupInvocationID)
23: 7(ivec4) CompositeConstruct 19 21 22 22
25: 24(ptr) AccessChain 11 13 16
Store 25 23
Return
FunctionEnd
spv.subgroup.tesc
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
// Module Version 10200
// Generated by (magic number): 80001
// Id's are bound by 26
Capability Tessellation
Capability GroupNonUniform
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 15 18 20
ExecutionMode 4 OutputVertices 1
Source GLSL 450
SourceExtension "GL_KHR_shader_subgroup_basic"
Name 4 "main"
Name 9 "Output"
MemberName 9(Output) 0 "result"
Name 11 ""
Name 15 "gl_PrimitiveID"
Name 18 "gl_SubgroupSize"
Name 20 "gl_SubgroupInvocationID"
Decorate 8 ArrayStride 16
MemberDecorate 9(Output) 0 Offset 0
Decorate 9(Output) BufferBlock
Decorate 11 DescriptorSet 0
Decorate 11 Binding 0
Decorate 15(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 18(gl_SubgroupSize) RelaxedPrecision
Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 19 RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId
Decorate 21 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 4
8: TypeRuntimeArray 7(ivec4)
9(Output): TypeStruct 8
10: TypePointer Uniform 9(Output)
11: 10(ptr) Variable Uniform
12: TypeInt 32 1
13: 12(int) Constant 0
14: TypePointer Input 12(int)
15(gl_PrimitiveID): 14(ptr) Variable Input
17: TypePointer Input 6(int)
18(gl_SubgroupSize): 17(ptr) Variable Input
20(gl_SubgroupInvocationID): 17(ptr) Variable Input
22: 6(int) Constant 0
24: TypePointer Uniform 7(ivec4)
4(main): 2 Function None 3
5: Label
16: 12(int) Load 15(gl_PrimitiveID)
19: 6(int) Load 18(gl_SubgroupSize)
21: 6(int) Load 20(gl_SubgroupInvocationID)
23: 7(ivec4) CompositeConstruct 19 21 22 22
25: 24(ptr) AccessChain 11 13 16
Store 25 23
Return
FunctionEnd
spv.subgroup.tese
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
// Module Version 10200
// Generated by (magic number): 80001
// Id's are bound by 26
Capability Tessellation
Capability GroupNonUniform
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationEvaluation 4 "main" 15 18 20
ExecutionMode 4 Isolines
ExecutionMode 4 SpacingEqual
ExecutionMode 4 VertexOrderCcw
Source GLSL 450
SourceExtension "GL_KHR_shader_subgroup_basic"
Name 4 "main"
Name 9 "Output"
MemberName 9(Output) 0 "result"
Name 11 ""
Name 15 "gl_PrimitiveID"
Name 18 "gl_SubgroupSize"
Name 20 "gl_SubgroupInvocationID"
Decorate 8 ArrayStride 16
MemberDecorate 9(Output) 0 Offset 0
Decorate 9(Output) BufferBlock
Decorate 11 DescriptorSet 0
Decorate 11 Binding 0
Decorate 15(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 18(gl_SubgroupSize) RelaxedPrecision
Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 19 RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId
Decorate 21 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 4
8: TypeRuntimeArray 7(ivec4)
9(Output): TypeStruct 8
10: TypePointer Uniform 9(Output)
11: 10(ptr) Variable Uniform
12: TypeInt 32 1
13: 12(int) Constant 0
14: TypePointer Input 12(int)
15(gl_PrimitiveID): 14(ptr) Variable Input
17: TypePointer Input 6(int)
18(gl_SubgroupSize): 17(ptr) Variable Input
20(gl_SubgroupInvocationID): 17(ptr) Variable Input
22: 6(int) Constant 0
24: TypePointer Uniform 7(ivec4)
4(main): 2 Function None 3
5: Label
16: 12(int) Load 15(gl_PrimitiveID)
19: 6(int) Load 18(gl_SubgroupSize)
21: 6(int) Load 20(gl_SubgroupInvocationID)
23: 7(ivec4) CompositeConstruct 19 21 22 22
25: 24(ptr) AccessChain 11 13 16
Store 25 23
Return
FunctionEnd
spv.subgroup.vert
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
// Module Version 10200
// Generated by (magic number): 80001
// Id's are bound by 26
Capability Shader
Capability GroupNonUniform
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 15 18 20
Source GLSL 450
SourceExtension "GL_KHR_shader_subgroup_basic"
Name 4 "main"
Name 9 "Output"
MemberName 9(Output) 0 "result"
Name 11 ""
Name 15 "gl_VertexIndex"
Name 18 "gl_SubgroupSize"
Name 20 "gl_SubgroupInvocationID"
Decorate 8 ArrayStride 16
MemberDecorate 9(Output) 0 Offset 0
Decorate 9(Output) BufferBlock
Decorate 11 DescriptorSet 0
Decorate 11 Binding 0
Decorate 15(gl_VertexIndex) BuiltIn VertexIndex
Decorate 18(gl_SubgroupSize) RelaxedPrecision
Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 19 RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision
Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId
Decorate 21 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 4
8: TypeRuntimeArray 7(ivec4)
9(Output): TypeStruct 8
10: TypePointer Uniform 9(Output)
11: 10(ptr) Variable Uniform
12: TypeInt 32 1
13: 12(int) Constant 0
14: TypePointer Input 12(int)
15(gl_VertexIndex): 14(ptr) Variable Input
17: TypePointer Input 6(int)
18(gl_SubgroupSize): 17(ptr) Variable Input
20(gl_SubgroupInvocationID): 17(ptr) Variable Input
22: 6(int) Constant 0
24: TypePointer Uniform 7(ivec4)
4(main): 2 Function None 3
5: Label
16: 12(int) Load 15(gl_VertexIndex)
19: 6(int) Load 18(gl_SubgroupSize)
21: 6(int) Load 20(gl_SubgroupInvocationID)
23: 7(ivec4) CompositeConstruct 19 21 22 22
25: 24(ptr) AccessChain 11 13 16
Store 25 23
Return
FunctionEnd
#version 450
#extension GL_KHR_shader_subgroup_basic: enable
layout(location = 0) out uvec4 data;
void main (void)
{
data = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
}
#version 450
#extension GL_KHR_shader_subgroup_basic: enable
layout(points) in;
layout(points, max_vertices = 1) out;
layout(set = 0, binding = 0, std430) buffer Output
{
uvec4 result[];
};
void main (void)
{
result[gl_PrimitiveIDIn] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
}
#version 450
#extension GL_KHR_shader_subgroup_basic: enable
layout(vertices=1) out;
layout(set = 0, binding = 0, std430) buffer Output
{
uvec4 result[];
};
void main (void)
{
result[gl_PrimitiveID] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
}
#version 450
#extension GL_KHR_shader_subgroup_basic: enable
layout(isolines) in;
layout(set = 0, binding = 0, std430) buffer Output
{
uvec4 result[];
};
void main (void)
{
result[gl_PrimitiveID] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
}
#version 450
#extension GL_KHR_shader_subgroup_basic: enable
layout(set = 0, binding = 0, std430) buffer Output
{
uvec4 result[];
};
void main (void)
{
result[gl_VertexIndex] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
}
......@@ -5744,25 +5744,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote);
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan >= 100) {
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
}
#ifdef AMD_EXTENSIONS
if (profile != EEsProfile) {
symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
......@@ -5969,6 +5950,25 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan >= 100) {
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
}
break;
......
......@@ -307,6 +307,11 @@ INSTANTIATE_TEST_CASE_P(
"spv.storageBuffer.vert",
"spv.precise.tese",
"spv.precise.tesc",
"spv.subgroup.frag",
"spv.subgroup.geom",
"spv.subgroup.tesc",
"spv.subgroup.tese",
"spv.subgroup.vert",
"spv.subgroupBasic.comp",
"spv.subgroupVote.comp",
"spv.subgroupBallot.comp",
......
......@@ -64,6 +64,11 @@ int main(int argc, char** argv)
return 1;
}
}
if (std::string("--help") == argv[i]) {
printf("\nExtra options:\n\n");
printf(" --update-mode\n Update the golden results for the tests.\n");
printf(" --test-root <arg>\n Specify the test root directory (useful for testing with\n files from another source tree).\n");
}
}
const int result = RUN_ALL_TESTS();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment