mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-12 21:20:06 +00:00
Merge pull request #1693 from sparmarNV/fix-NV_mesh_shader
Add missing support for gl_MeshViewCountNV/gl_MeshViewIndicesNV in task shaders
This commit is contained in:
commit
1ff8346b38
@ -1,14 +1,14 @@
|
||||
spv.meshTaskShader.task
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 104
|
||||
// Id's are bound by 116
|
||||
|
||||
Capability StorageImageWriteWithoutFormat
|
||||
Capability MeshShadingNV
|
||||
Extension "SPV_NV_mesh_shader"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TaskNV 4 "main" 11 17 80 101
|
||||
EntryPoint TaskNV 4 "main" 11 17 24 25 90 113
|
||||
ExecutionMode 4 LocalSize 32 1 1
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_NV_mesh_shader"
|
||||
@ -17,34 +17,42 @@ spv.meshTaskShader.task
|
||||
Name 11 "gl_LocalInvocationID"
|
||||
Name 16 "gid"
|
||||
Name 17 "gl_WorkGroupID"
|
||||
Name 20 "i"
|
||||
Name 34 "mem"
|
||||
Name 37 "block0"
|
||||
MemberName 37(block0) 0 "uni_value"
|
||||
Name 39 ""
|
||||
Name 55 "uni_image"
|
||||
Name 78 "Task"
|
||||
MemberName 78(Task) 0 "dummy"
|
||||
MemberName 78(Task) 1 "submesh"
|
||||
Name 80 "mytask"
|
||||
Name 101 "gl_TaskCountNV"
|
||||
Name 20 "viewID"
|
||||
Name 24 "gl_MeshViewIndicesNV"
|
||||
Name 25 "gl_MeshViewCountNV"
|
||||
Name 30 "i"
|
||||
Name 44 "mem"
|
||||
Name 47 "block0"
|
||||
MemberName 47(block0) 0 "uni_value"
|
||||
Name 49 ""
|
||||
Name 65 "uni_image"
|
||||
Name 88 "Task"
|
||||
MemberName 88(Task) 0 "dummy"
|
||||
MemberName 88(Task) 1 "submesh"
|
||||
MemberName 88(Task) 2 "viewID"
|
||||
Name 90 "mytask"
|
||||
Name 113 "gl_TaskCountNV"
|
||||
Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId
|
||||
Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId
|
||||
MemberDecorate 37(block0) 0 Offset 0
|
||||
Decorate 37(block0) Block
|
||||
Decorate 39 DescriptorSet 0
|
||||
Decorate 39 Binding 0
|
||||
Decorate 55(uni_image) DescriptorSet 0
|
||||
Decorate 55(uni_image) Binding 0
|
||||
Decorate 55(uni_image) NonReadable
|
||||
Decorate 77 ArrayStride 8
|
||||
MemberDecorate 78(Task) 0 PerTaskNV
|
||||
MemberDecorate 78(Task) 0 Offset 0
|
||||
MemberDecorate 78(Task) 1 PerTaskNV
|
||||
MemberDecorate 78(Task) 1 Offset 8
|
||||
Decorate 78(Task) Block
|
||||
Decorate 101(gl_TaskCountNV) BuiltIn TaskCountNV
|
||||
Decorate 103 BuiltIn WorkgroupSize
|
||||
Decorate 24(gl_MeshViewIndicesNV) BuiltIn MeshViewIndicesNV
|
||||
Decorate 25(gl_MeshViewCountNV) BuiltIn MeshViewCountNV
|
||||
MemberDecorate 47(block0) 0 Offset 0
|
||||
Decorate 47(block0) Block
|
||||
Decorate 49 DescriptorSet 0
|
||||
Decorate 49 Binding 0
|
||||
Decorate 65(uni_image) DescriptorSet 0
|
||||
Decorate 65(uni_image) Binding 0
|
||||
Decorate 65(uni_image) NonReadable
|
||||
Decorate 87 ArrayStride 8
|
||||
MemberDecorate 88(Task) 0 PerTaskNV
|
||||
MemberDecorate 88(Task) 0 Offset 0
|
||||
MemberDecorate 88(Task) 1 PerTaskNV
|
||||
MemberDecorate 88(Task) 1 Offset 8
|
||||
MemberDecorate 88(Task) 2 PerTaskNV
|
||||
MemberDecorate 88(Task) 2 Offset 32
|
||||
Decorate 88(Task) Block
|
||||
Decorate 113(gl_TaskCountNV) BuiltIn TaskCountNV
|
||||
Decorate 115 BuiltIn WorkgroupSize
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 0
|
||||
@ -55,119 +63,133 @@ spv.meshTaskShader.task
|
||||
12: 6(int) Constant 0
|
||||
13: TypePointer Input 6(int)
|
||||
17(gl_WorkGroupID): 10(ptr) Variable Input
|
||||
27: 6(int) Constant 10
|
||||
28: TypeBool
|
||||
30: TypeFloat 32
|
||||
31: TypeVector 30(float) 4
|
||||
32: TypeArray 31(fvec4) 27
|
||||
33: TypePointer Workgroup 32
|
||||
34(mem): 33(ptr) Variable Workgroup
|
||||
37(block0): TypeStruct 6(int)
|
||||
38: TypePointer Uniform 37(block0)
|
||||
39: 38(ptr) Variable Uniform
|
||||
40: TypeInt 32 1
|
||||
41: 40(int) Constant 0
|
||||
42: TypePointer Uniform 6(int)
|
||||
48: TypePointer Workgroup 31(fvec4)
|
||||
51: 40(int) Constant 1
|
||||
53: TypeImage 30(float) 2D nonsampled format:Unknown
|
||||
54: TypePointer UniformConstant 53
|
||||
55(uni_image): 54(ptr) Variable UniformConstant
|
||||
59: TypeVector 40(int) 2
|
||||
69: 6(int) Constant 1
|
||||
73: 6(int) Constant 264
|
||||
74: 6(int) Constant 2
|
||||
75: TypeVector 30(float) 2
|
||||
76: 6(int) Constant 3
|
||||
77: TypeArray 75(fvec2) 76
|
||||
78(Task): TypeStruct 75(fvec2) 77
|
||||
79: TypePointer Output 78(Task)
|
||||
80(mytask): 79(ptr) Variable Output
|
||||
81: 30(float) Constant 1106247680
|
||||
82: 30(float) Constant 1106771968
|
||||
83: 75(fvec2) ConstantComposite 81 82
|
||||
84: TypePointer Output 75(fvec2)
|
||||
86: 30(float) Constant 1107296256
|
||||
87: 30(float) Constant 1107558400
|
||||
88: 75(fvec2) ConstantComposite 86 87
|
||||
90: 30(float) Constant 1107820544
|
||||
91: 30(float) Constant 1108082688
|
||||
92: 75(fvec2) ConstantComposite 90 91
|
||||
94: 40(int) Constant 2
|
||||
100: TypePointer Output 6(int)
|
||||
101(gl_TaskCountNV): 100(ptr) Variable Output
|
||||
102: 6(int) Constant 32
|
||||
103: 9(ivec3) ConstantComposite 102 69 69
|
||||
21: 6(int) Constant 4
|
||||
22: TypeArray 6(int) 21
|
||||
23: TypePointer Input 22
|
||||
24(gl_MeshViewIndicesNV): 23(ptr) Variable Input
|
||||
25(gl_MeshViewCountNV): 13(ptr) Variable Input
|
||||
37: 6(int) Constant 10
|
||||
38: TypeBool
|
||||
40: TypeFloat 32
|
||||
41: TypeVector 40(float) 4
|
||||
42: TypeArray 41(fvec4) 37
|
||||
43: TypePointer Workgroup 42
|
||||
44(mem): 43(ptr) Variable Workgroup
|
||||
47(block0): TypeStruct 6(int)
|
||||
48: TypePointer Uniform 47(block0)
|
||||
49: 48(ptr) Variable Uniform
|
||||
50: TypeInt 32 1
|
||||
51: 50(int) Constant 0
|
||||
52: TypePointer Uniform 6(int)
|
||||
58: TypePointer Workgroup 41(fvec4)
|
||||
61: 50(int) Constant 1
|
||||
63: TypeImage 40(float) 2D nonsampled format:Unknown
|
||||
64: TypePointer UniformConstant 63
|
||||
65(uni_image): 64(ptr) Variable UniformConstant
|
||||
69: TypeVector 50(int) 2
|
||||
79: 6(int) Constant 1
|
||||
83: 6(int) Constant 264
|
||||
84: 6(int) Constant 2
|
||||
85: TypeVector 40(float) 2
|
||||
86: 6(int) Constant 3
|
||||
87: TypeArray 85(fvec2) 86
|
||||
88(Task): TypeStruct 85(fvec2) 87 6(int)
|
||||
89: TypePointer Output 88(Task)
|
||||
90(mytask): 89(ptr) Variable Output
|
||||
91: 40(float) Constant 1106247680
|
||||
92: 40(float) Constant 1106771968
|
||||
93: 85(fvec2) ConstantComposite 91 92
|
||||
94: TypePointer Output 85(fvec2)
|
||||
96: 40(float) Constant 1107296256
|
||||
97: 40(float) Constant 1107558400
|
||||
98: 85(fvec2) ConstantComposite 96 97
|
||||
100: 40(float) Constant 1107820544
|
||||
101: 40(float) Constant 1108082688
|
||||
102: 85(fvec2) ConstantComposite 100 101
|
||||
104: 50(int) Constant 2
|
||||
111: TypePointer Output 6(int)
|
||||
113(gl_TaskCountNV): 111(ptr) Variable Output
|
||||
114: 6(int) Constant 32
|
||||
115: 9(ivec3) ConstantComposite 114 79 79
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
8(iid): 7(ptr) Variable Function
|
||||
16(gid): 7(ptr) Variable Function
|
||||
20(i): 7(ptr) Variable Function
|
||||
20(viewID): 7(ptr) Variable Function
|
||||
30(i): 7(ptr) Variable Function
|
||||
14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12
|
||||
15: 6(int) Load 14
|
||||
Store 8(iid) 15
|
||||
18: 13(ptr) AccessChain 17(gl_WorkGroupID) 12
|
||||
19: 6(int) Load 18
|
||||
Store 16(gid) 19
|
||||
Store 20(i) 12
|
||||
Branch 21
|
||||
21: Label
|
||||
LoopMerge 23 24 None
|
||||
Branch 25
|
||||
25: Label
|
||||
26: 6(int) Load 20(i)
|
||||
29: 28(bool) ULessThan 26 27
|
||||
BranchConditional 29 22 23
|
||||
22: Label
|
||||
35: 6(int) Load 20(i)
|
||||
36: 6(int) Load 20(i)
|
||||
43: 42(ptr) AccessChain 39 41
|
||||
44: 6(int) Load 43
|
||||
45: 6(int) IAdd 36 44
|
||||
46: 30(float) ConvertUToF 45
|
||||
47: 31(fvec4) CompositeConstruct 46 46 46 46
|
||||
49: 48(ptr) AccessChain 34(mem) 35
|
||||
Store 49 47
|
||||
Branch 24
|
||||
24: Label
|
||||
50: 6(int) Load 20(i)
|
||||
52: 6(int) IAdd 50 51
|
||||
Store 20(i) 52
|
||||
Branch 21
|
||||
23: Label
|
||||
56: 53 Load 55(uni_image)
|
||||
57: 6(int) Load 8(iid)
|
||||
58: 40(int) Bitcast 57
|
||||
60: 59(ivec2) CompositeConstruct 58 58
|
||||
61: 6(int) Load 16(gid)
|
||||
62: 48(ptr) AccessChain 34(mem) 61
|
||||
63: 31(fvec4) Load 62
|
||||
ImageWrite 56 60 63
|
||||
64: 53 Load 55(uni_image)
|
||||
65: 6(int) Load 8(iid)
|
||||
66: 40(int) Bitcast 65
|
||||
67: 59(ivec2) CompositeConstruct 66 66
|
||||
68: 6(int) Load 16(gid)
|
||||
70: 6(int) IAdd 68 69
|
||||
71: 48(ptr) AccessChain 34(mem) 70
|
||||
72: 31(fvec4) Load 71
|
||||
ImageWrite 64 67 72
|
||||
MemoryBarrier 69 73
|
||||
ControlBarrier 74 74 73
|
||||
85: 84(ptr) AccessChain 80(mytask) 41
|
||||
Store 85 83
|
||||
89: 84(ptr) AccessChain 80(mytask) 51 41
|
||||
Store 89 88
|
||||
93: 84(ptr) AccessChain 80(mytask) 51 51
|
||||
Store 93 92
|
||||
95: 6(int) Load 16(gid)
|
||||
96: 6(int) UMod 95 74
|
||||
97: 84(ptr) AccessChain 80(mytask) 51 96
|
||||
98: 75(fvec2) Load 97
|
||||
99: 84(ptr) AccessChain 80(mytask) 51 94
|
||||
26: 6(int) Load 25(gl_MeshViewCountNV)
|
||||
27: 6(int) UMod 26 21
|
||||
28: 13(ptr) AccessChain 24(gl_MeshViewIndicesNV) 27
|
||||
29: 6(int) Load 28
|
||||
Store 20(viewID) 29
|
||||
Store 30(i) 12
|
||||
Branch 31
|
||||
31: Label
|
||||
LoopMerge 33 34 None
|
||||
Branch 35
|
||||
35: Label
|
||||
36: 6(int) Load 30(i)
|
||||
39: 38(bool) ULessThan 36 37
|
||||
BranchConditional 39 32 33
|
||||
32: Label
|
||||
45: 6(int) Load 30(i)
|
||||
46: 6(int) Load 30(i)
|
||||
53: 52(ptr) AccessChain 49 51
|
||||
54: 6(int) Load 53
|
||||
55: 6(int) IAdd 46 54
|
||||
56: 40(float) ConvertUToF 55
|
||||
57: 41(fvec4) CompositeConstruct 56 56 56 56
|
||||
59: 58(ptr) AccessChain 44(mem) 45
|
||||
Store 59 57
|
||||
Branch 34
|
||||
34: Label
|
||||
60: 6(int) Load 30(i)
|
||||
62: 6(int) IAdd 60 61
|
||||
Store 30(i) 62
|
||||
Branch 31
|
||||
33: Label
|
||||
66: 63 Load 65(uni_image)
|
||||
67: 6(int) Load 8(iid)
|
||||
68: 50(int) Bitcast 67
|
||||
70: 69(ivec2) CompositeConstruct 68 68
|
||||
71: 6(int) Load 16(gid)
|
||||
72: 58(ptr) AccessChain 44(mem) 71
|
||||
73: 41(fvec4) Load 72
|
||||
ImageWrite 66 70 73
|
||||
74: 63 Load 65(uni_image)
|
||||
75: 6(int) Load 8(iid)
|
||||
76: 50(int) Bitcast 75
|
||||
77: 69(ivec2) CompositeConstruct 76 76
|
||||
78: 6(int) Load 16(gid)
|
||||
80: 6(int) IAdd 78 79
|
||||
81: 58(ptr) AccessChain 44(mem) 80
|
||||
82: 41(fvec4) Load 81
|
||||
ImageWrite 74 77 82
|
||||
MemoryBarrier 79 83
|
||||
ControlBarrier 84 84 83
|
||||
95: 94(ptr) AccessChain 90(mytask) 51
|
||||
Store 95 93
|
||||
99: 94(ptr) AccessChain 90(mytask) 61 51
|
||||
Store 99 98
|
||||
MemoryBarrier 69 73
|
||||
ControlBarrier 74 74 73
|
||||
Store 101(gl_TaskCountNV) 76
|
||||
103: 94(ptr) AccessChain 90(mytask) 61 61
|
||||
Store 103 102
|
||||
105: 6(int) Load 16(gid)
|
||||
106: 6(int) UMod 105 84
|
||||
107: 94(ptr) AccessChain 90(mytask) 61 106
|
||||
108: 85(fvec2) Load 107
|
||||
109: 94(ptr) AccessChain 90(mytask) 61 104
|
||||
Store 109 108
|
||||
110: 6(int) Load 20(viewID)
|
||||
112: 111(ptr) AccessChain 90(mytask) 104
|
||||
Store 112 110
|
||||
MemoryBarrier 79 83
|
||||
ControlBarrier 84 84 83
|
||||
Store 113(gl_TaskCountNV) 86
|
||||
Return
|
||||
FunctionEnd
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 450
|
||||
|
||||
#define MAX_VIEWS gl_MaxMeshViewCountNV
|
||||
|
||||
#define BARRIER() \
|
||||
memoryBarrierShared(); \
|
||||
barrier();
|
||||
@ -19,12 +21,14 @@ shared vec4 mem[10];
|
||||
taskNV out Task {
|
||||
vec2 dummy;
|
||||
vec2 submesh[3];
|
||||
uint viewID;
|
||||
} mytask;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint iid = gl_LocalInvocationID.x;
|
||||
uint gid = gl_WorkGroupID.x;
|
||||
uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS];
|
||||
|
||||
// 1. shared memory load and stores
|
||||
for (uint i = 0; i < 10; ++i) {
|
||||
@ -41,6 +45,7 @@ void main()
|
||||
mytask.submesh[0] = vec2(32.0, 33.0);
|
||||
mytask.submesh[1] = vec2(34.0, 35.0);
|
||||
mytask.submesh[2] = mytask.submesh[gid%2];
|
||||
mytask.viewID = viewID;
|
||||
|
||||
BARRIER();
|
||||
|
||||
|
@ -5357,6 +5357,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"in highp uvec3 gl_GlobalInvocationID;"
|
||||
"in highp uint gl_LocalInvocationIndex;"
|
||||
|
||||
"in uint gl_MeshViewCountNV;"
|
||||
"in uint gl_MeshViewIndicesNV[4];"
|
||||
|
||||
"\n");
|
||||
}
|
||||
|
||||
@ -8843,6 +8846,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable);
|
||||
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
|
||||
@ -8850,8 +8855,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
|
||||
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
|
||||
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
|
||||
BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);
|
||||
BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);
|
||||
|
||||
symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);
|
||||
|
Loading…
Reference in New Issue
Block a user