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.meshShaderRedeclBuiltins.mesh
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 120
// Id's are bound by 129
Capability ClipDistance
Capability CullDistance
@ -12,7 +12,7 @@ spv.meshShaderRedeclBuiltins.mesh
Extension "SPV_NV_viewport_array2"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint MeshNV 4 "main" 11 17 28 81
EntryPoint MeshNV 4 "main" 11 17 28 81 122 127
ExecutionMode 4 LocalSize 32 1 1
ExecutionMode 4 OutputVertices 81
ExecutionMode 4 OutputPrimitivesNV 32
@ -36,6 +36,8 @@ spv.meshShaderRedeclBuiltins.mesh
MemberName 77(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex"
MemberName 77(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask"
Name 81 "gl_MeshPrimitivesNV"
Name 122 "gl_PrimitiveIndicesNV"
Name 127 "gl_PrimitiveCountNV"
Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId
MemberDecorate 24(gl_MeshPerVertexNV) 0 BuiltIn Position
@ -52,7 +54,9 @@ spv.meshShaderRedeclBuiltins.mesh
MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV
MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV
Decorate 77(gl_MeshPerPrimitiveNV) Block
Decorate 119 BuiltIn WorkgroupSize
Decorate 122(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV
Decorate 127(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV
Decorate 128 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -98,7 +102,14 @@ spv.meshShaderRedeclBuiltins.mesh
87: 30(int) Constant 7
90: 30(int) Constant 8
93: 30(int) Constant 9
119: 9(ivec3) ConstantComposite 78 49 49
119: 6(int) Constant 96
120: TypeArray 6(int) 119
121: TypePointer Output 120
122(gl_PrimitiveIndicesNV): 121(ptr) Variable Output
123: TypePointer Output 6(int)
125: 30(int) Constant 95
127(gl_PrimitiveCountNV): 123(ptr) Variable Output
128: 9(ivec3) ConstantComposite 78 49 49
4(main): 2 Function None 3
5: Label
8(iid): 7(ptr) Variable Function
@ -197,5 +208,10 @@ spv.meshShaderRedeclBuiltins.mesh
Store 118 117
MemoryBarrier 49 50
ControlBarrier 51 51 50
124: 123(ptr) AccessChain 122(gl_PrimitiveIndicesNV) 31
Store 124 49
126: 123(ptr) AccessChain 122(gl_PrimitiveIndicesNV) 125
Store 126 51
Store 127(gl_PrimitiveCountNV) 119
Return
FunctionEnd