Fix resizing of gl_PrimitiveIndicesNV[] to max_primitives*geomSize

- This change also allows redeclaration of gl_PrimitiveIndicesNV and
  adds error checks against incorrect explicit array size.
- Also modifies gtests to check array bound limits and redeclare gl_PrimitiveIndicesNV[].
This commit is contained in:
Sahil Parmar
2019-02-11 15:12:13 -08:00
parent 05d12a9461
commit ab027bef3d
6 changed files with 106 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
spv.meshShaderBuiltins.mesh
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 146
// Id's are bound by 148
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 88 128 139 143
EntryPoint MeshNV 4 "main" 11 17 34 88 129 142 146
ExecutionMode 4 LocalSize 32 1 1
ExecutionMode 4 OutputVertices 81
ExecutionMode 4 OutputPrimitivesNV 32
@@ -43,9 +43,9 @@ spv.meshShaderBuiltins.mesh
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"
Name 129 "gl_PrimitiveIndicesNV"
Name 142 "gl_DrawID"
Name 146 "gl_PrimitiveCountNV"
Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId
MemberDecorate 30(gl_MeshPerVertexNV) 0 BuiltIn Position
@@ -74,10 +74,10 @@ spv.meshShaderBuiltins.mesh
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
Decorate 129(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV
Decorate 142(gl_DrawID) BuiltIn DrawIndex
Decorate 146(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV
Decorate 147 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@@ -130,17 +130,18 @@ spv.meshShaderBuiltins.mesh
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
126: 6(int) Constant 96
127: TypeArray 6(int) 126
128: TypePointer Output 127
129(gl_PrimitiveIndicesNV): 128(ptr) Variable Output
130: 6(int) Constant 257
131: TypePointer Output 6(int)
133: 36(int) Constant 95
141: TypePointer Input 36(int)
142(gl_DrawID): 141(ptr) Variable Input
145: 6(int) Constant 16909060
146(gl_PrimitiveCountNV): 131(ptr) Variable Output
147: 9(ivec3) ConstantComposite 85 27 27
4(main): 2 Function None 3
5: Label
8(iid): 7(ptr) Variable Function
@@ -239,19 +240,21 @@ spv.meshShaderBuiltins.mesh
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) 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
132: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 37
Store 132 130
134: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 133
Store 134 56
135: 6(int) Load 16(gid)
136: 6(int) Load 16(gid)
137: 6(int) ISub 136 27
138: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 137
139: 6(int) Load 138
140: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 135
Store 140 139
143: 36(int) Load 142(gl_DrawID)
144: 6(int) Bitcast 143
145: 144 WritePackedPrimitiveIndices4x8NV
Store 146(gl_PrimitiveCountNV) 126
MemoryBarrier 27 55
ControlBarrier 56 56 55
Return