Allow redeclaration of builtin interface blocks in mesh shader

Apart from allowing redeclaration of gl_MeshPerVertexNV and gl_MeshPerPrimitiveNV blocks, this change also -
- Resize clip/cull perview distances based on static index use
- Error out use of both single-view and per-view builtins
- Add new gtests with redeclared blocks and edit existing test output
- Fix couple of typos
This commit is contained in:
Sahil Parmar
2018-10-04 16:39:18 -07:00
parent ca042a0ffb
commit 035cbbe3d0
13 changed files with 875 additions and 305 deletions

View File

@@ -1,7 +1,7 @@
spv.meshShaderBuiltins.mesh
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 147
// Id's are bound by 146
Capability ClipDistance
Capability CullDistance
@@ -14,7 +14,7 @@ spv.meshShaderBuiltins.mesh
Extension "SPV_NV_viewport_array2"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint MeshNV 4 "main" 11 17 34 89 129 140 144
EntryPoint MeshNV 4 "main" 11 17 34 88 128 139 143
ExecutionMode 4 LocalSize 32 1 1
ExecutionMode 4 OutputVertices 81
ExecutionMode 4 OutputPrimitivesNV 32
@@ -35,17 +35,17 @@ spv.meshShaderBuiltins.mesh
MemberName 30(gl_MeshPerVertexNV) 5 "gl_ClipDistancePerViewNV"
MemberName 30(gl_MeshPerVertexNV) 6 "gl_CullDistancePerViewNV"
Name 34 "gl_MeshVerticesNV"
Name 85 "gl_MeshPerPrimitiveNV"
MemberName 85(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID"
MemberName 85(gl_MeshPerPrimitiveNV) 1 "gl_Layer"
MemberName 85(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex"
MemberName 85(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask"
MemberName 85(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV"
MemberName 85(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV"
Name 89 "gl_MeshPrimitivesNV"
Name 129 "gl_PrimitiveIndicesNV"
Name 140 "gl_DrawID"
Name 144 "gl_PrimitiveCountNV"
Name 84 "gl_MeshPerPrimitiveNV"
MemberName 84(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID"
MemberName 84(gl_MeshPerPrimitiveNV) 1 "gl_Layer"
MemberName 84(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex"
MemberName 84(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask"
MemberName 84(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV"
MemberName 84(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV"
Name 88 "gl_MeshPrimitivesNV"
Name 128 "gl_PrimitiveIndicesNV"
Name 139 "gl_DrawID"
Name 143 "gl_PrimitiveCountNV"
Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId
MemberDecorate 30(gl_MeshPerVertexNV) 0 BuiltIn Position
@@ -59,25 +59,25 @@ spv.meshShaderBuiltins.mesh
MemberDecorate 30(gl_MeshPerVertexNV) 6 PerViewNV
MemberDecorate 30(gl_MeshPerVertexNV) 6 BuiltIn CullDistancePerViewNV
Decorate 30(gl_MeshPerVertexNV) Block
MemberDecorate 85(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId
MemberDecorate 85(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer
MemberDecorate 85(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex
MemberDecorate 85(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 4 PerPrimitiveNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 4 PerViewNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 4 BuiltIn LayerPerViewNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 5 PerPrimitiveNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 5 PerViewNV
MemberDecorate 85(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV
Decorate 85(gl_MeshPerPrimitiveNV) Block
Decorate 129(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV
Decorate 140(gl_DrawID) BuiltIn DrawIndex
Decorate 144(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV
Decorate 146 BuiltIn WorkgroupSize
MemberDecorate 84(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId
MemberDecorate 84(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer
MemberDecorate 84(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex
MemberDecorate 84(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 4 PerPrimitiveNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 4 PerViewNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 4 BuiltIn LayerPerViewNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 PerPrimitiveNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 PerViewNV
MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV
Decorate 84(gl_MeshPerPrimitiveNV) Block
Decorate 128(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV
Decorate 139(gl_DrawID) BuiltIn DrawIndex
Decorate 143(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV
Decorate 145 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@@ -95,7 +95,7 @@ spv.meshShaderBuiltins.mesh
24: 6(int) Constant 3
25: TypeArray 20(float) 24
26: TypeArray 21(fvec4) 22
27: 6(int) Constant 8
27: 6(int) Constant 1
28: TypeArray 20(float) 27
29: TypeArray 28 22
30(gl_MeshPerVertexNV): TypeStruct 21(fvec4) 20(float) 23 25 26 29 29
@@ -115,33 +115,32 @@ spv.meshShaderBuiltins.mesh
49: 36(int) Constant 3
50: 20(float) Constant 1077936128
53: 20(float) Constant 1082130432
55: 6(int) Constant 1
56: 6(int) Constant 264
57: 6(int) Constant 2
82: TypeArray 36(int) 55
83: TypeArray 36(int) 22
84: TypeArray 82 22
85(gl_MeshPerPrimitiveNV): TypeStruct 36(int) 36(int) 36(int) 82 83 84
86: 6(int) Constant 32
87: TypeArray 85(gl_MeshPerPrimitiveNV) 86
88: TypePointer Output 87
89(gl_MeshPrimitivesNV): 88(ptr) Variable Output
91: 36(int) Constant 6
92: TypePointer Output 36(int)
95: 36(int) Constant 7
98: 36(int) Constant 8
101: 36(int) Constant 9
127: TypeArray 6(int) 31
128: TypePointer Output 127
129(gl_PrimitiveIndicesNV): 128(ptr) Variable Output
130: 6(int) Constant 257
131: TypePointer Output 6(int)
139: TypePointer Input 36(int)
140(gl_DrawID): 139(ptr) Variable Input
143: 6(int) Constant 16909060
144(gl_PrimitiveCountNV): 131(ptr) Variable Output
145: 6(int) Constant 96
146: 9(ivec3) ConstantComposite 86 55 55
55: 6(int) Constant 264
56: 6(int) Constant 2
81: TypeArray 36(int) 27
82: TypeArray 36(int) 22
83: TypeArray 81 22
84(gl_MeshPerPrimitiveNV): TypeStruct 36(int) 36(int) 36(int) 81 82 83
85: 6(int) Constant 32
86: TypeArray 84(gl_MeshPerPrimitiveNV) 85
87: TypePointer Output 86
88(gl_MeshPrimitivesNV): 87(ptr) Variable Output
90: 36(int) Constant 6
91: TypePointer Output 36(int)
94: 36(int) Constant 7
97: 36(int) Constant 8
100: 36(int) Constant 9
126: TypeArray 6(int) 31
127: TypePointer Output 126
128(gl_PrimitiveIndicesNV): 127(ptr) Variable Output
129: 6(int) Constant 257
130: TypePointer Output 6(int)
138: TypePointer Input 36(int)
139(gl_DrawID): 138(ptr) Variable Input
142: 6(int) Constant 16909060
143(gl_PrimitiveCountNV): 130(ptr) Variable Output
144: 6(int) Constant 96
145: 9(ivec3) ConstantComposite 85 27 27
4(main): 2 Function None 3
5: Label
8(iid): 7(ptr) Variable Function
@@ -164,96 +163,96 @@ spv.meshShaderBuiltins.mesh
52: 6(int) Load 8(iid)
54: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 52 49 48
Store 54 53
MemoryBarrier 55 56
ControlBarrier 57 57 56
58: 6(int) Load 8(iid)
59: 6(int) IAdd 58 55
60: 6(int) Load 8(iid)
61: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 60 37
62: 21(fvec4) Load 61
63: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 59 37
Store 63 62
64: 6(int) Load 8(iid)
65: 6(int) IAdd 64 55
66: 6(int) Load 8(iid)
67: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 66 43
68: 20(float) Load 67
69: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 65 43
Store 69 68
70: 6(int) Load 8(iid)
71: 6(int) IAdd 70 55
72: 6(int) Load 8(iid)
73: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 72 48 49
74: 20(float) Load 73
75: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 71 48 49
Store 75 74
76: 6(int) Load 8(iid)
77: 6(int) IAdd 76 55
78: 6(int) Load 8(iid)
79: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 78 49 48
80: 20(float) Load 79
81: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 77 49 48
Store 81 80
MemoryBarrier 55 56
ControlBarrier 57 57 56
90: 6(int) Load 8(iid)
93: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 90 37
Store 93 91
94: 6(int) Load 8(iid)
96: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 94 43
Store 96 95
97: 6(int) Load 8(iid)
99: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 97 48
Store 99 98
100: 6(int) Load 8(iid)
102: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 100 49 37
Store 102 101
MemoryBarrier 55 56
ControlBarrier 57 57 56
103: 6(int) Load 8(iid)
104: 6(int) IAdd 103 55
105: 6(int) Load 8(iid)
106: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 105 37
107: 36(int) Load 106
108: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 104 37
Store 108 107
109: 6(int) Load 8(iid)
110: 6(int) IAdd 109 55
111: 6(int) Load 8(iid)
112: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 111 43
113: 36(int) Load 112
114: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 110 43
Store 114 113
115: 6(int) Load 8(iid)
116: 6(int) IAdd 115 55
117: 6(int) Load 8(iid)
118: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 117 48
119: 36(int) Load 118
120: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 116 48
Store 120 119
121: 6(int) Load 8(iid)
122: 6(int) IAdd 121 55
123: 6(int) Load 8(iid)
124: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 123 49 37
125: 36(int) Load 124
126: 92(ptr) AccessChain 89(gl_MeshPrimitivesNV) 122 49 37
Store 126 125
MemoryBarrier 55 56
ControlBarrier 57 57 56
132: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 37
Store 132 130
MemoryBarrier 27 55
ControlBarrier 56 56 55
57: 6(int) Load 8(iid)
58: 6(int) IAdd 57 27
59: 6(int) Load 8(iid)
60: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 59 37
61: 21(fvec4) Load 60
62: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 58 37
Store 62 61
63: 6(int) Load 8(iid)
64: 6(int) IAdd 63 27
65: 6(int) Load 8(iid)
66: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 65 43
67: 20(float) Load 66
68: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 64 43
Store 68 67
69: 6(int) Load 8(iid)
70: 6(int) IAdd 69 27
71: 6(int) Load 8(iid)
72: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 71 48 49
73: 20(float) Load 72
74: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 70 48 49
Store 74 73
75: 6(int) Load 8(iid)
76: 6(int) IAdd 75 27
77: 6(int) Load 8(iid)
78: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 77 49 48
79: 20(float) Load 78
80: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 76 49 48
Store 80 79
MemoryBarrier 27 55
ControlBarrier 56 56 55
89: 6(int) Load 8(iid)
92: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 89 37
Store 92 90
93: 6(int) Load 8(iid)
95: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 93 43
Store 95 94
96: 6(int) Load 8(iid)
98: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 96 48
Store 98 97
99: 6(int) Load 8(iid)
101: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 99 49 37
Store 101 100
MemoryBarrier 27 55
ControlBarrier 56 56 55
102: 6(int) Load 8(iid)
103: 6(int) IAdd 102 27
104: 6(int) Load 8(iid)
105: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 104 37
106: 36(int) Load 105
107: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 103 37
Store 107 106
108: 6(int) Load 8(iid)
109: 6(int) IAdd 108 27
110: 6(int) Load 8(iid)
111: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 110 43
112: 36(int) Load 111
113: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 109 43
Store 113 112
114: 6(int) Load 8(iid)
115: 6(int) IAdd 114 27
116: 6(int) Load 8(iid)
117: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 116 48
118: 36(int) Load 117
119: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 115 48
Store 119 118
120: 6(int) Load 8(iid)
121: 6(int) IAdd 120 27
122: 6(int) Load 8(iid)
123: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 122 49 37
124: 36(int) Load 123
125: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 121 49 37
Store 125 124
MemoryBarrier 27 55
ControlBarrier 56 56 55
131: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 37
Store 131 129
132: 6(int) Load 16(gid)
133: 6(int) Load 16(gid)
134: 6(int) Load 16(gid)
135: 6(int) ISub 134 55
136: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 135
137: 6(int) Load 136
138: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 133
Store 138 137
141: 36(int) Load 140(gl_DrawID)
142: 6(int) Bitcast 141
143: 142 WritePackedPrimitiveIndices4x8NV
Store 144(gl_PrimitiveCountNV) 145
MemoryBarrier 55 56
ControlBarrier 57 57 56
134: 6(int) ISub 133 27
135: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 134
136: 6(int) Load 135
137: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 132
Store 137 136
140: 36(int) Load 139(gl_DrawID)
141: 6(int) Bitcast 140
142: 141 WritePackedPrimitiveIndices4x8NV
Store 143(gl_PrimitiveCountNV) 144
MemoryBarrier 27 55
ControlBarrier 56 56 55
Return
FunctionEnd