diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 48fcb7fee..f60ffaa74 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -1257,6 +1257,8 @@ int C_DECL main(int argc, char* argv[]) // .rchit = ray closest hit // .rmiss = ray miss // .rcall = ray callable +// .mesh = mesh +// .task = task // Additionally, the file names may end in ..glsl and ..hlsl // where is one of the stages listed above. // @@ -1395,7 +1397,7 @@ void usage() " .rahit for a ray any hit shader\n" " .rchit for a ray closest hit shader\n" " .rmiss for a ray miss shader\n" - " .rcall for a ray callable shader" + " .rcall for a ray callable shader\n" #endif " .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n" " .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n" diff --git a/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out b/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out index ef3990721..20b6fa242 100644 --- a/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out +++ b/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out @@ -1,4 +1,4 @@ -spv.meshShaderUserDefined.mesh +spv.320.meshShaderUserDefined.mesh // Module Version 10000 // Generated by (magic number): 80007 // Id's are bound by 140 diff --git a/Test/baseResults/spv.meshShaderBuiltins.mesh.out b/Test/baseResults/spv.meshShaderBuiltins.mesh.out index ef4ff4d8e..8090f7bf0 100644 --- a/Test/baseResults/spv.meshShaderBuiltins.mesh.out +++ b/Test/baseResults/spv.meshShaderBuiltins.mesh.out @@ -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 diff --git a/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out b/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out index c79a5c32f..b912acafc 100644 --- a/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out +++ b/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out @@ -1,7 +1,7 @@ spv.meshShaderPerViewBuiltins.mesh // Module Version 10000 // Generated by (magic number): 80007 -// Id's are bound by 124 +// Id's are bound by 126 Capability MultiViewport Capability PerViewAttributesNV @@ -10,7 +10,7 @@ spv.meshShaderPerViewBuiltins.mesh Extension "SPV_NV_mesh_shader" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshNV 4 "main" 11 20 21 38 70 + EntryPoint MeshNV 4 "main" 11 20 21 40 72 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -23,53 +23,53 @@ spv.meshShaderPerViewBuiltins.mesh Name 16 "viewID" Name 20 "gl_MeshViewIndicesNV" Name 21 "gl_MeshViewCountNV" - Name 34 "gl_MeshPerVertexNV" - MemberName 34(gl_MeshPerVertexNV) 0 "gl_Position" - MemberName 34(gl_MeshPerVertexNV) 1 "gl_PointSize" - MemberName 34(gl_MeshPerVertexNV) 2 "gl_ClipDistance" - MemberName 34(gl_MeshPerVertexNV) 3 "gl_CullDistance" - MemberName 34(gl_MeshPerVertexNV) 4 "gl_PositionPerViewNV" - MemberName 34(gl_MeshPerVertexNV) 5 "gl_ClipDistancePerViewNV" - MemberName 34(gl_MeshPerVertexNV) 6 "gl_CullDistancePerViewNV" - Name 38 "gl_MeshVerticesNV" - Name 66 "gl_MeshPerPrimitiveNV" - MemberName 66(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID" - MemberName 66(gl_MeshPerPrimitiveNV) 1 "gl_Layer" - MemberName 66(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" - MemberName 66(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" - MemberName 66(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV" - MemberName 66(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV" - Name 70 "gl_MeshPrimitivesNV" + Name 36 "gl_MeshPerVertexNV" + MemberName 36(gl_MeshPerVertexNV) 0 "gl_Position" + MemberName 36(gl_MeshPerVertexNV) 1 "gl_PointSize" + MemberName 36(gl_MeshPerVertexNV) 2 "gl_ClipDistance" + MemberName 36(gl_MeshPerVertexNV) 3 "gl_CullDistance" + MemberName 36(gl_MeshPerVertexNV) 4 "gl_PositionPerViewNV" + MemberName 36(gl_MeshPerVertexNV) 5 "gl_ClipDistancePerViewNV" + MemberName 36(gl_MeshPerVertexNV) 6 "gl_CullDistancePerViewNV" + Name 40 "gl_MeshVerticesNV" + Name 68 "gl_MeshPerPrimitiveNV" + MemberName 68(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID" + MemberName 68(gl_MeshPerPrimitiveNV) 1 "gl_Layer" + MemberName 68(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" + MemberName 68(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" + MemberName 68(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV" + MemberName 68(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV" + Name 72 "gl_MeshPrimitivesNV" Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 20(gl_MeshViewIndicesNV) BuiltIn MeshViewIndicesNV Decorate 21(gl_MeshViewCountNV) BuiltIn MeshViewCountNV - MemberDecorate 34(gl_MeshPerVertexNV) 0 BuiltIn Position - MemberDecorate 34(gl_MeshPerVertexNV) 1 BuiltIn PointSize - MemberDecorate 34(gl_MeshPerVertexNV) 2 BuiltIn ClipDistance - MemberDecorate 34(gl_MeshPerVertexNV) 3 BuiltIn CullDistance - MemberDecorate 34(gl_MeshPerVertexNV) 4 PerViewNV - MemberDecorate 34(gl_MeshPerVertexNV) 4 BuiltIn PositionPerViewNV - MemberDecorate 34(gl_MeshPerVertexNV) 5 PerViewNV - MemberDecorate 34(gl_MeshPerVertexNV) 5 BuiltIn ClipDistancePerViewNV - MemberDecorate 34(gl_MeshPerVertexNV) 6 PerViewNV - MemberDecorate 34(gl_MeshPerVertexNV) 6 BuiltIn CullDistancePerViewNV - Decorate 34(gl_MeshPerVertexNV) Block - MemberDecorate 66(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId - MemberDecorate 66(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer - MemberDecorate 66(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex - MemberDecorate 66(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 4 PerPrimitiveNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 4 PerViewNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 4 BuiltIn LayerPerViewNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 5 PerPrimitiveNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 5 PerViewNV - MemberDecorate 66(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV - Decorate 66(gl_MeshPerPrimitiveNV) Block - Decorate 123 BuiltIn WorkgroupSize + MemberDecorate 36(gl_MeshPerVertexNV) 0 BuiltIn Position + MemberDecorate 36(gl_MeshPerVertexNV) 1 BuiltIn PointSize + MemberDecorate 36(gl_MeshPerVertexNV) 2 BuiltIn ClipDistance + MemberDecorate 36(gl_MeshPerVertexNV) 3 BuiltIn CullDistance + MemberDecorate 36(gl_MeshPerVertexNV) 4 PerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 4 BuiltIn PositionPerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 5 PerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 5 BuiltIn ClipDistancePerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 6 PerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 6 BuiltIn CullDistancePerViewNV + Decorate 36(gl_MeshPerVertexNV) Block + MemberDecorate 68(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId + MemberDecorate 68(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer + MemberDecorate 68(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex + MemberDecorate 68(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 4 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 4 PerViewNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 4 BuiltIn LayerPerViewNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 5 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 5 PerViewNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV + Decorate 68(gl_MeshPerPrimitiveNV) Block + Decorate 125 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -89,44 +89,46 @@ spv.meshShaderPerViewBuiltins.mesh 28: 6(int) Constant 1 29: TypeArray 26(float) 28 30: TypeArray 27(fvec4) 17 - 31: 6(int) Constant 8 + 31: 6(int) Constant 3 32: TypeArray 26(float) 31 33: TypeArray 32 17 -34(gl_MeshPerVertexNV): TypeStruct 27(fvec4) 26(float) 29 29 30 33 33 - 35: 6(int) Constant 81 - 36: TypeArray 34(gl_MeshPerVertexNV) 35 - 37: TypePointer Output 36 -38(gl_MeshVerticesNV): 37(ptr) Variable Output - 40: TypeInt 32 1 - 41: 40(int) Constant 4 - 43: 26(float) Constant 1065353216 - 44: 26(float) Constant 1073741824 - 45: 26(float) Constant 1077936128 - 46: 26(float) Constant 1082130432 - 47: 27(fvec4) ConstantComposite 43 44 45 46 - 48: TypePointer Output 27(fvec4) - 51: 40(int) Constant 5 - 53: 40(int) Constant 2 - 54: 26(float) Constant 1084227584 - 55: TypePointer Output 26(float) - 58: 40(int) Constant 6 - 60: 40(int) Constant 3 - 61: 26(float) Constant 1086324736 - 63: TypeArray 40(int) 28 - 64: TypeArray 40(int) 17 - 65: TypeArray 63 17 -66(gl_MeshPerPrimitiveNV): TypeStruct 40(int) 40(int) 40(int) 63 64 65 - 67: 6(int) Constant 32 - 68: TypeArray 66(gl_MeshPerPrimitiveNV) 67 - 69: TypePointer Output 68 -70(gl_MeshPrimitivesNV): 69(ptr) Variable Output - 73: 40(int) Constant 7 - 74: TypePointer Output 40(int) - 78: 40(int) Constant 0 - 79: 40(int) Constant 8 - 81: 6(int) Constant 264 - 82: 6(int) Constant 2 - 123: 9(ivec3) ConstantComposite 67 28 28 + 34: TypeArray 26(float) 17 + 35: TypeArray 34 17 +36(gl_MeshPerVertexNV): TypeStruct 27(fvec4) 26(float) 29 29 30 33 35 + 37: 6(int) Constant 81 + 38: TypeArray 36(gl_MeshPerVertexNV) 37 + 39: TypePointer Output 38 +40(gl_MeshVerticesNV): 39(ptr) Variable Output + 42: TypeInt 32 1 + 43: 42(int) Constant 4 + 45: 26(float) Constant 1065353216 + 46: 26(float) Constant 1073741824 + 47: 26(float) Constant 1077936128 + 48: 26(float) Constant 1082130432 + 49: 27(fvec4) ConstantComposite 45 46 47 48 + 50: TypePointer Output 27(fvec4) + 53: 42(int) Constant 5 + 55: 42(int) Constant 2 + 56: 26(float) Constant 1084227584 + 57: TypePointer Output 26(float) + 60: 42(int) Constant 6 + 62: 42(int) Constant 3 + 63: 26(float) Constant 1086324736 + 65: TypeArray 42(int) 28 + 66: TypeArray 42(int) 17 + 67: TypeArray 65 17 +68(gl_MeshPerPrimitiveNV): TypeStruct 42(int) 42(int) 42(int) 65 66 67 + 69: 6(int) Constant 32 + 70: TypeArray 68(gl_MeshPerPrimitiveNV) 69 + 71: TypePointer Output 70 +72(gl_MeshPrimitivesNV): 71(ptr) Variable Output + 75: 42(int) Constant 7 + 76: TypePointer Output 42(int) + 80: 42(int) Constant 0 + 81: 42(int) Constant 8 + 83: 6(int) Constant 264 + 84: 6(int) Constant 2 + 125: 9(ivec3) ConstantComposite 69 28 28 4(main): 2 Function None 3 5: Label 8(iid): 7(ptr) Variable Function @@ -139,74 +141,74 @@ spv.meshShaderPerViewBuiltins.mesh 24: 13(ptr) AccessChain 20(gl_MeshViewIndicesNV) 23 25: 6(int) Load 24 Store 16(viewID) 25 - 39: 6(int) Load 8(iid) - 42: 6(int) Load 16(viewID) - 49: 48(ptr) AccessChain 38(gl_MeshVerticesNV) 39 41 42 - Store 49 47 - 50: 6(int) Load 8(iid) - 52: 6(int) Load 16(viewID) - 56: 55(ptr) AccessChain 38(gl_MeshVerticesNV) 50 51 52 53 - Store 56 54 - 57: 6(int) Load 8(iid) - 59: 6(int) Load 16(viewID) - 62: 55(ptr) AccessChain 38(gl_MeshVerticesNV) 57 58 59 60 - Store 62 61 - 71: 6(int) Load 8(iid) - 72: 6(int) Load 16(viewID) - 75: 74(ptr) AccessChain 70(gl_MeshPrimitivesNV) 71 41 72 - Store 75 73 - 76: 6(int) Load 8(iid) - 77: 6(int) Load 16(viewID) - 80: 74(ptr) AccessChain 70(gl_MeshPrimitivesNV) 76 51 77 78 - Store 80 79 - MemoryBarrier 28 81 - ControlBarrier 82 82 81 - 83: 6(int) Load 8(iid) - 84: 6(int) IAdd 83 28 - 85: 6(int) Load 16(viewID) - 86: 6(int) Load 8(iid) + 41: 6(int) Load 8(iid) + 44: 6(int) Load 16(viewID) + 51: 50(ptr) AccessChain 40(gl_MeshVerticesNV) 41 43 44 + Store 51 49 + 52: 6(int) Load 8(iid) + 54: 6(int) Load 16(viewID) + 58: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 52 53 54 55 + Store 58 56 + 59: 6(int) Load 8(iid) + 61: 6(int) Load 16(viewID) + 64: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 59 60 61 62 + Store 64 63 + 73: 6(int) Load 8(iid) + 74: 6(int) Load 16(viewID) + 77: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 73 43 74 + Store 77 75 + 78: 6(int) Load 8(iid) + 79: 6(int) Load 16(viewID) + 82: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 78 53 79 80 + Store 82 81 + MemoryBarrier 28 83 + ControlBarrier 84 84 83 + 85: 6(int) Load 8(iid) + 86: 6(int) IAdd 85 28 87: 6(int) Load 16(viewID) - 88: 48(ptr) AccessChain 38(gl_MeshVerticesNV) 86 41 87 - 89: 27(fvec4) Load 88 - 90: 48(ptr) AccessChain 38(gl_MeshVerticesNV) 84 41 85 - Store 90 89 - 91: 6(int) Load 8(iid) - 92: 6(int) IAdd 91 28 - 93: 6(int) Load 16(viewID) - 94: 6(int) Load 8(iid) + 88: 6(int) Load 8(iid) + 89: 6(int) Load 16(viewID) + 90: 50(ptr) AccessChain 40(gl_MeshVerticesNV) 88 43 89 + 91: 27(fvec4) Load 90 + 92: 50(ptr) AccessChain 40(gl_MeshVerticesNV) 86 43 87 + Store 92 91 + 93: 6(int) Load 8(iid) + 94: 6(int) IAdd 93 28 95: 6(int) Load 16(viewID) - 96: 55(ptr) AccessChain 38(gl_MeshVerticesNV) 94 51 95 53 - 97: 26(float) Load 96 - 98: 55(ptr) AccessChain 38(gl_MeshVerticesNV) 92 51 93 53 - Store 98 97 - 99: 6(int) Load 8(iid) - 100: 6(int) IAdd 99 28 - 101: 6(int) Load 16(viewID) - 102: 6(int) Load 8(iid) + 96: 6(int) Load 8(iid) + 97: 6(int) Load 16(viewID) + 98: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 96 53 97 55 + 99: 26(float) Load 98 + 100: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 94 53 95 55 + Store 100 99 + 101: 6(int) Load 8(iid) + 102: 6(int) IAdd 101 28 103: 6(int) Load 16(viewID) - 104: 55(ptr) AccessChain 38(gl_MeshVerticesNV) 102 58 103 60 - 105: 26(float) Load 104 - 106: 55(ptr) AccessChain 38(gl_MeshVerticesNV) 100 58 101 60 - Store 106 105 - 107: 6(int) Load 8(iid) - 108: 6(int) IAdd 107 28 - 109: 6(int) Load 16(viewID) - 110: 6(int) Load 8(iid) + 104: 6(int) Load 8(iid) + 105: 6(int) Load 16(viewID) + 106: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 104 60 105 62 + 107: 26(float) Load 106 + 108: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 102 60 103 62 + Store 108 107 + 109: 6(int) Load 8(iid) + 110: 6(int) IAdd 109 28 111: 6(int) Load 16(viewID) - 112: 74(ptr) AccessChain 70(gl_MeshPrimitivesNV) 110 41 111 - 113: 40(int) Load 112 - 114: 74(ptr) AccessChain 70(gl_MeshPrimitivesNV) 108 41 109 - Store 114 113 - 115: 6(int) Load 8(iid) - 116: 6(int) IAdd 115 28 - 117: 6(int) Load 16(viewID) - 118: 6(int) Load 8(iid) + 112: 6(int) Load 8(iid) + 113: 6(int) Load 16(viewID) + 114: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 112 43 113 + 115: 42(int) Load 114 + 116: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 110 43 111 + Store 116 115 + 117: 6(int) Load 8(iid) + 118: 6(int) IAdd 117 28 119: 6(int) Load 16(viewID) - 120: 74(ptr) AccessChain 70(gl_MeshPrimitivesNV) 118 51 119 78 - 121: 40(int) Load 120 - 122: 74(ptr) AccessChain 70(gl_MeshPrimitivesNV) 116 51 117 78 - Store 122 121 - MemoryBarrier 28 81 - ControlBarrier 82 82 81 + 120: 6(int) Load 8(iid) + 121: 6(int) Load 16(viewID) + 122: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 120 53 121 80 + 123: 42(int) Load 122 + 124: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 118 53 119 80 + Store 124 123 + MemoryBarrier 28 83 + ControlBarrier 84 84 83 Return FunctionEnd diff --git a/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out b/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out new file mode 100644 index 000000000..f4491c0ec --- /dev/null +++ b/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out @@ -0,0 +1,201 @@ +spv.meshShaderRedeclBuiltins.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 120 + + Capability ClipDistance + Capability CullDistance + Capability MultiViewport + Capability ShaderViewportMaskNV + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + Extension "SPV_NV_viewport_array2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 17 28 81 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 460 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "gid" + Name 17 "gl_WorkGroupID" + Name 24 "gl_MeshPerVertexNV" + MemberName 24(gl_MeshPerVertexNV) 0 "gl_Position" + MemberName 24(gl_MeshPerVertexNV) 1 "gl_PointSize" + MemberName 24(gl_MeshPerVertexNV) 2 "gl_ClipDistance" + MemberName 24(gl_MeshPerVertexNV) 3 "gl_CullDistance" + Name 28 "gl_MeshVerticesNV" + Name 77 "gl_MeshPerPrimitiveNV" + MemberName 77(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID" + MemberName 77(gl_MeshPerPrimitiveNV) 1 "gl_Layer" + MemberName 77(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" + MemberName 77(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" + Name 81 "gl_MeshPrimitivesNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 24(gl_MeshPerVertexNV) 0 BuiltIn Position + MemberDecorate 24(gl_MeshPerVertexNV) 1 BuiltIn PointSize + MemberDecorate 24(gl_MeshPerVertexNV) 2 BuiltIn ClipDistance + MemberDecorate 24(gl_MeshPerVertexNV) 3 BuiltIn CullDistance + Decorate 24(gl_MeshPerVertexNV) Block + MemberDecorate 77(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId + MemberDecorate 77(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer + MemberDecorate 77(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex + MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV + Decorate 77(gl_MeshPerPrimitiveNV) Block + Decorate 119 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) +17(gl_WorkGroupID): 10(ptr) Variable Input + 20: TypeFloat 32 + 21: TypeVector 20(float) 4 + 22: 6(int) Constant 4 + 23: TypeArray 20(float) 22 +24(gl_MeshPerVertexNV): TypeStruct 21(fvec4) 20(float) 23 23 + 25: 6(int) Constant 81 + 26: TypeArray 24(gl_MeshPerVertexNV) 25 + 27: TypePointer Output 26 +28(gl_MeshVerticesNV): 27(ptr) Variable Output + 30: TypeInt 32 1 + 31: 30(int) Constant 0 + 32: 20(float) Constant 1065353216 + 33: 21(fvec4) ConstantComposite 32 32 32 32 + 34: TypePointer Output 21(fvec4) + 37: 30(int) Constant 1 + 38: 20(float) Constant 1073741824 + 39: TypePointer Output 20(float) + 42: 30(int) Constant 2 + 43: 30(int) Constant 3 + 44: 20(float) Constant 1077936128 + 47: 20(float) Constant 1082130432 + 49: 6(int) Constant 1 + 50: 6(int) Constant 264 + 51: 6(int) Constant 2 + 76: TypeArray 30(int) 49 +77(gl_MeshPerPrimitiveNV): TypeStruct 30(int) 30(int) 30(int) 76 + 78: 6(int) Constant 32 + 79: TypeArray 77(gl_MeshPerPrimitiveNV) 78 + 80: TypePointer Output 79 +81(gl_MeshPrimitivesNV): 80(ptr) Variable Output + 83: 30(int) Constant 6 + 84: TypePointer Output 30(int) + 87: 30(int) Constant 7 + 90: 30(int) Constant 8 + 93: 30(int) Constant 9 + 119: 9(ivec3) ConstantComposite 78 49 49 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(gid): 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 + 29: 6(int) Load 8(iid) + 35: 34(ptr) AccessChain 28(gl_MeshVerticesNV) 29 31 + Store 35 33 + 36: 6(int) Load 8(iid) + 40: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 36 37 + Store 40 38 + 41: 6(int) Load 8(iid) + 45: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 41 42 43 + Store 45 44 + 46: 6(int) Load 8(iid) + 48: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 46 43 42 + Store 48 47 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + 52: 6(int) Load 8(iid) + 53: 6(int) IAdd 52 49 + 54: 6(int) Load 8(iid) + 55: 34(ptr) AccessChain 28(gl_MeshVerticesNV) 54 31 + 56: 21(fvec4) Load 55 + 57: 34(ptr) AccessChain 28(gl_MeshVerticesNV) 53 31 + Store 57 56 + 58: 6(int) Load 8(iid) + 59: 6(int) IAdd 58 49 + 60: 6(int) Load 8(iid) + 61: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 60 37 + 62: 20(float) Load 61 + 63: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 59 37 + Store 63 62 + 64: 6(int) Load 8(iid) + 65: 6(int) IAdd 64 49 + 66: 6(int) Load 8(iid) + 67: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 66 42 43 + 68: 20(float) Load 67 + 69: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 65 42 43 + Store 69 68 + 70: 6(int) Load 8(iid) + 71: 6(int) IAdd 70 49 + 72: 6(int) Load 8(iid) + 73: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 72 43 42 + 74: 20(float) Load 73 + 75: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 71 43 42 + Store 75 74 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + 82: 6(int) Load 8(iid) + 85: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 82 31 + Store 85 83 + 86: 6(int) Load 8(iid) + 88: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 86 37 + Store 88 87 + 89: 6(int) Load 8(iid) + 91: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 89 42 + Store 91 90 + 92: 6(int) Load 8(iid) + 94: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 92 43 31 + Store 94 93 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + 95: 6(int) Load 8(iid) + 96: 6(int) IAdd 95 49 + 97: 6(int) Load 8(iid) + 98: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 97 31 + 99: 30(int) Load 98 + 100: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 96 31 + Store 100 99 + 101: 6(int) Load 8(iid) + 102: 6(int) IAdd 101 49 + 103: 6(int) Load 8(iid) + 104: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 103 37 + 105: 30(int) Load 104 + 106: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 102 37 + Store 106 105 + 107: 6(int) Load 8(iid) + 108: 6(int) IAdd 107 49 + 109: 6(int) Load 8(iid) + 110: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 109 42 + 111: 30(int) Load 110 + 112: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 108 42 + Store 112 111 + 113: 6(int) Load 8(iid) + 114: 6(int) IAdd 113 49 + 115: 6(int) Load 8(iid) + 116: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 115 43 31 + 117: 30(int) Load 116 + 118: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 114 43 31 + Store 118 117 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + Return + FunctionEnd diff --git a/Test/baseResults/spv.meshShaderRedeclPerViewBuiltins.mesh.out b/Test/baseResults/spv.meshShaderRedeclPerViewBuiltins.mesh.out new file mode 100644 index 000000000..6672dc243 --- /dev/null +++ b/Test/baseResults/spv.meshShaderRedeclPerViewBuiltins.mesh.out @@ -0,0 +1,187 @@ +spv.meshShaderRedeclPerViewBuiltins.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 120 + + Capability PerViewAttributesNV + Capability MeshShadingNV + Extension "SPV_NVX_multiview_per_view_attributes" + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 20 21 35 67 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "viewID" + Name 20 "gl_MeshViewIndicesNV" + Name 21 "gl_MeshViewCountNV" + Name 31 "gl_MeshPerVertexNV" + MemberName 31(gl_MeshPerVertexNV) 0 "gl_PositionPerViewNV" + MemberName 31(gl_MeshPerVertexNV) 1 "gl_ClipDistancePerViewNV" + MemberName 31(gl_MeshPerVertexNV) 2 "gl_CullDistancePerViewNV" + Name 35 "gl_MeshVerticesNV" + Name 63 "gl_MeshPerPrimitiveNV" + MemberName 63(gl_MeshPerPrimitiveNV) 0 "gl_LayerPerViewNV" + MemberName 63(gl_MeshPerPrimitiveNV) 1 "gl_ViewportMaskPerViewNV" + Name 67 "gl_MeshPrimitivesNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 20(gl_MeshViewIndicesNV) BuiltIn MeshViewIndicesNV + Decorate 21(gl_MeshViewCountNV) BuiltIn MeshViewCountNV + MemberDecorate 31(gl_MeshPerVertexNV) 0 PerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 0 BuiltIn PositionPerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 1 PerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 1 BuiltIn ClipDistancePerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 2 PerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 2 BuiltIn CullDistancePerViewNV + Decorate 31(gl_MeshPerVertexNV) Block + MemberDecorate 63(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 0 PerViewNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 0 BuiltIn LayerPerViewNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 1 PerViewNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 1 BuiltIn ViewportMaskPerViewNV + Decorate 63(gl_MeshPerPrimitiveNV) Block + Decorate 119 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 17: 6(int) Constant 4 + 18: TypeArray 6(int) 17 + 19: TypePointer Input 18 +20(gl_MeshViewIndicesNV): 19(ptr) Variable Input +21(gl_MeshViewCountNV): 13(ptr) Variable Input + 26: TypeFloat 32 + 27: TypeVector 26(float) 4 + 28: TypeArray 27(fvec4) 17 + 29: TypeArray 26(float) 17 + 30: TypeArray 29 17 +31(gl_MeshPerVertexNV): TypeStruct 28 30 30 + 32: 6(int) Constant 81 + 33: TypeArray 31(gl_MeshPerVertexNV) 32 + 34: TypePointer Output 33 +35(gl_MeshVerticesNV): 34(ptr) Variable Output + 37: TypeInt 32 1 + 38: 37(int) Constant 0 + 40: 26(float) Constant 1065353216 + 41: 26(float) Constant 1073741824 + 42: 26(float) Constant 1077936128 + 43: 26(float) Constant 1082130432 + 44: 27(fvec4) ConstantComposite 40 41 42 43 + 45: TypePointer Output 27(fvec4) + 48: 37(int) Constant 1 + 50: 37(int) Constant 2 + 51: 26(float) Constant 1084227584 + 52: TypePointer Output 26(float) + 56: 37(int) Constant 3 + 57: 26(float) Constant 1086324736 + 59: TypeArray 37(int) 17 + 60: 6(int) Constant 1 + 61: TypeArray 37(int) 60 + 62: TypeArray 61 17 +63(gl_MeshPerPrimitiveNV): TypeStruct 59 62 + 64: 6(int) Constant 32 + 65: TypeArray 63(gl_MeshPerPrimitiveNV) 64 + 66: TypePointer Output 65 +67(gl_MeshPrimitivesNV): 66(ptr) Variable Output + 70: 37(int) Constant 7 + 71: TypePointer Output 37(int) + 75: 37(int) Constant 8 + 77: 6(int) Constant 264 + 78: 6(int) Constant 2 + 119: 9(ivec3) ConstantComposite 64 60 60 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(viewID): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 22: 6(int) Load 21(gl_MeshViewCountNV) + 23: 6(int) UMod 22 17 + 24: 13(ptr) AccessChain 20(gl_MeshViewIndicesNV) 23 + 25: 6(int) Load 24 + Store 16(viewID) 25 + 36: 6(int) Load 8(iid) + 39: 6(int) Load 16(viewID) + 46: 45(ptr) AccessChain 35(gl_MeshVerticesNV) 36 38 39 + Store 46 44 + 47: 6(int) Load 8(iid) + 49: 6(int) Load 16(viewID) + 53: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 47 48 49 50 + Store 53 51 + 54: 6(int) Load 8(iid) + 55: 6(int) Load 16(viewID) + 58: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 54 50 55 56 + Store 58 57 + 68: 6(int) Load 8(iid) + 69: 6(int) Load 16(viewID) + 72: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 68 38 69 + Store 72 70 + 73: 6(int) Load 8(iid) + 74: 6(int) Load 16(viewID) + 76: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 73 48 74 38 + Store 76 75 + MemoryBarrier 60 77 + ControlBarrier 78 78 77 + 79: 6(int) Load 8(iid) + 80: 6(int) IAdd 79 60 + 81: 6(int) Load 16(viewID) + 82: 6(int) Load 8(iid) + 83: 6(int) Load 16(viewID) + 84: 45(ptr) AccessChain 35(gl_MeshVerticesNV) 82 38 83 + 85: 27(fvec4) Load 84 + 86: 45(ptr) AccessChain 35(gl_MeshVerticesNV) 80 38 81 + Store 86 85 + 87: 6(int) Load 8(iid) + 88: 6(int) IAdd 87 60 + 89: 6(int) Load 16(viewID) + 90: 6(int) Load 8(iid) + 91: 6(int) Load 16(viewID) + 92: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 90 48 91 50 + 93: 26(float) Load 92 + 94: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 88 48 89 50 + Store 94 93 + 95: 6(int) Load 8(iid) + 96: 6(int) IAdd 95 60 + 97: 6(int) Load 16(viewID) + 98: 6(int) Load 8(iid) + 99: 6(int) Load 16(viewID) + 100: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 98 50 99 56 + 101: 26(float) Load 100 + 102: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 96 50 97 56 + Store 102 101 + 103: 6(int) Load 8(iid) + 104: 6(int) IAdd 103 60 + 105: 6(int) Load 16(viewID) + 106: 6(int) Load 8(iid) + 107: 6(int) Load 16(viewID) + 108: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 106 38 107 + 109: 37(int) Load 108 + 110: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 104 38 105 + Store 110 109 + 111: 6(int) Load 8(iid) + 112: 6(int) IAdd 111 60 + 113: 6(int) Load 16(viewID) + 114: 6(int) Load 8(iid) + 115: 6(int) Load 16(viewID) + 116: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 114 48 115 38 + 117: 37(int) Load 116 + 118: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 112 48 113 38 + Store 118 117 + MemoryBarrier 60 77 + ControlBarrier 78 78 77 + Return + FunctionEnd diff --git a/Test/spv.meshShaderRedeclBuiltins.mesh b/Test/spv.meshShaderRedeclBuiltins.mesh new file mode 100644 index 000000000..38107b295 --- /dev/null +++ b/Test/spv.meshShaderRedeclBuiltins.mesh @@ -0,0 +1,66 @@ +#version 460 + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of redeclared single-view builtins in mesh shaders: + +out gl_MeshPerVertexNV { + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[4]; + float gl_CullDistance[4]; +} gl_MeshVerticesNV[]; + +perprimitiveNV out gl_MeshPerPrimitiveNV { + int gl_PrimitiveID; + int gl_Layer; + int gl_ViewportIndex; + int gl_ViewportMask[]; +} gl_MeshPrimitivesNV[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint gid = gl_WorkGroupID.x; + + gl_MeshVerticesNV[iid].gl_Position = vec4(1.0); + gl_MeshVerticesNV[iid].gl_PointSize = 2.0; + gl_MeshVerticesNV[iid].gl_ClipDistance[3] = 3.0; + gl_MeshVerticesNV[iid].gl_CullDistance[2] = 4.0; + + BARRIER(); + + gl_MeshVerticesNV[iid+1].gl_Position = gl_MeshVerticesNV[iid].gl_Position; + gl_MeshVerticesNV[iid+1].gl_PointSize = gl_MeshVerticesNV[iid].gl_PointSize; + gl_MeshVerticesNV[iid+1].gl_ClipDistance[3] = gl_MeshVerticesNV[iid].gl_ClipDistance[3]; + gl_MeshVerticesNV[iid+1].gl_CullDistance[2] = gl_MeshVerticesNV[iid].gl_CullDistance[2]; + + BARRIER(); + + gl_MeshPrimitivesNV[iid].gl_PrimitiveID = 6; + gl_MeshPrimitivesNV[iid].gl_Layer = 7; + gl_MeshPrimitivesNV[iid].gl_ViewportIndex = 8; + gl_MeshPrimitivesNV[iid].gl_ViewportMask[0] = 9; + + BARRIER(); + + gl_MeshPrimitivesNV[iid+1].gl_PrimitiveID = gl_MeshPrimitivesNV[iid].gl_PrimitiveID; + gl_MeshPrimitivesNV[iid+1].gl_Layer = gl_MeshPrimitivesNV[iid].gl_Layer; + gl_MeshPrimitivesNV[iid+1].gl_ViewportIndex = gl_MeshPrimitivesNV[iid].gl_ViewportIndex; + gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0]; + + BARRIER(); +} diff --git a/Test/spv.meshShaderRedeclPerViewBuiltins.mesh b/Test/spv.meshShaderRedeclPerViewBuiltins.mesh new file mode 100644 index 000000000..3b75b5583 --- /dev/null +++ b/Test/spv.meshShaderRedeclPerViewBuiltins.mesh @@ -0,0 +1,53 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 +#define MAX_VIEWS gl_MaxMeshViewCountNV + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of redeclared per-view builtin attributes + +out gl_MeshPerVertexNV { + perviewNV vec4 gl_PositionPerViewNV[MAX_VIEWS]; // explicitly sized view dim + perviewNV float gl_ClipDistancePerViewNV[MAX_VIEWS][4]; // explicitly sized view dim + perviewNV float gl_CullDistancePerViewNV[MAX_VIEWS][4]; // explicitly sized view dim +} gl_MeshVerticesNV[]; + +perprimitiveNV out gl_MeshPerPrimitiveNV { + perviewNV int gl_LayerPerViewNV[]; // implicitly sized view dim + perviewNV int gl_ViewportMaskPerViewNV[][1]; // implicitly sized view dim +} gl_MeshPrimitivesNV[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS]; + + gl_MeshVerticesNV[iid].gl_PositionPerViewNV[viewID] = vec4(1.0, 2.0, 3.0, 4.0); + gl_MeshVerticesNV[iid].gl_ClipDistancePerViewNV[viewID][2] = 5.0; + gl_MeshVerticesNV[iid].gl_CullDistancePerViewNV[viewID][3] = 6.0; + gl_MeshPrimitivesNV[iid].gl_LayerPerViewNV[viewID] = 7; + gl_MeshPrimitivesNV[iid].gl_ViewportMaskPerViewNV[viewID][0] = 8; + + BARRIER(); + + gl_MeshVerticesNV[iid+1].gl_PositionPerViewNV[viewID] = gl_MeshVerticesNV[iid].gl_PositionPerViewNV[viewID]; + gl_MeshVerticesNV[iid+1].gl_ClipDistancePerViewNV[viewID][2] = gl_MeshVerticesNV[iid].gl_ClipDistancePerViewNV[viewID][2]; + gl_MeshVerticesNV[iid+1].gl_CullDistancePerViewNV[viewID][3] = gl_MeshVerticesNV[iid].gl_CullDistancePerViewNV[viewID][3]; + gl_MeshPrimitivesNV[iid+1].gl_LayerPerViewNV[viewID] = gl_MeshPrimitivesNV[iid].gl_LayerPerViewNV[viewID]; + gl_MeshPrimitivesNV[iid+1].gl_ViewportMaskPerViewNV[viewID][0] = gl_MeshPrimitivesNV[iid].gl_ViewportMaskPerViewNV[viewID][0]; + + BARRIER(); +} + diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 7793c2c19..453686045 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -1644,6 +1644,11 @@ public: { if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed())) changeOuterArraySize(getImplicitArraySize()); +#ifdef NV_EXTENSIONS + // For multi-dim per-view arrays, set unsized inner dimension size to 1 + if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized()) + arraySizes->clearInnerUnsized(); +#endif if (isStruct() && structure->size() > 0) { int lastMember = (int)structure->size() - 1; for (int i = 0; i < lastMember; ++i) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index ff5417b02..7e7eaba34 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -5296,8 +5296,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "float gl_ClipDistance[];" "float gl_CullDistance[];" "perviewNV vec4 gl_PositionPerViewNV[];" - "perviewNV float gl_ClipDistancePerViewNV[][8];" - "perviewNV float gl_CullDistancePerViewNV[][8];" + "perviewNV float gl_ClipDistancePerViewNV[][];" + "perviewNV float gl_CullDistancePerViewNV[][];" "} gl_MeshVerticesNV[];" ); @@ -5309,7 +5309,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "int gl_ViewportIndex;" "int gl_ViewportMask[];" "perviewNV int gl_LayerPerViewNV[];" - "perviewNV int gl_ViewportMaskPerViewNV[][1];" + "perviewNV int gl_ViewportMaskPerViewNV[][];" "} gl_MeshPrimitivesNV[];" ); diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index df29560a0..a6821deb2 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -400,9 +400,21 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn handleIoResizeArrayAccess(loc, base); if (index->getQualifier().isFrontEndConstant()) { - if (base->getType().isUnsizedArray()) + if (base->getType().isUnsizedArray()) { base->getWritableType().updateImplicitArraySize(indexValue + 1); - else +#ifdef NV_EXTENSIONS + // For 2D per-view builtin arrays, update the inner dimension size in parent type + if (base->getQualifier().isPerView() && base->getQualifier().builtIn != EbvNone) { + TIntermBinary* binaryNode = base->getAsBinaryNode(); + if (binaryNode) { + TType& leftType = binaryNode->getLeft()->getWritableType(); + TArraySizes& arraySizes = *leftType.getArraySizes(); + assert(arraySizes.getNumDims() == 2); + arraySizes.setDimSize(1, std::max(arraySizes.getDimSize(1), indexValue + 1)); + } + } +#endif + } else checkIndex(loc, base->getType(), indexValue); result = intermediate.addIndex(EOpIndexDirect, base, index, loc); } else { @@ -813,6 +825,8 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm TIntermTyped* index = intermediate.addConstantUnion(member, loc); result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc); result->setType(*(*fields)[member].type); + if ((*fields)[member].type->getQualifier().isIo()) + intermediate.addIoAccessed(field); } } else error(loc, "no such field in structure", field.c_str(), ""); @@ -4059,10 +4073,31 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT error(memberLoc, "cannot redeclare block member with a different type", member->type->getFieldName().c_str(), ""); if (oldType.isArray() != newType.isArray()) error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), ""); - else if (! oldType.sameArrayness(newType) && oldType.isSizedArray()) + else if (! oldType.getQualifier().isPerView() && ! oldType.sameArrayness(newType) && oldType.isSizedArray()) error(memberLoc, "cannot change array size of redeclared block member", member->type->getFieldName().c_str(), ""); - else if (newType.isArray()) + else if (! oldType.getQualifier().isPerView() && newType.isArray()) arrayLimitCheck(loc, member->type->getFieldName(), newType.getOuterArraySize()); +#ifdef NV_EXTENSIONS + if (oldType.getQualifier().isPerView() && ! newType.getQualifier().isPerView()) + error(memberLoc, "missing perviewNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! oldType.getQualifier().isPerView() && newType.getQualifier().isPerView()) + error(memberLoc, "cannot add perviewNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + else if (newType.getQualifier().isPerView()) { + if (oldType.getArraySizes()->getNumDims() != newType.getArraySizes()->getNumDims()) + error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! newType.isUnsizedArray() && newType.getOuterArraySize() != resources.maxMeshViewCountNV) + error(loc, "mesh view output array size must be gl_MaxMeshViewCountNV or implicitly sized", "[]", ""); + else if (newType.getArraySizes()->getNumDims() == 2) { + int innerDimSize = newType.getArraySizes()->getDimSize(1); + arrayLimitCheck(memberLoc, member->type->getFieldName(), innerDimSize); + oldType.getArraySizes()->setDimSize(1, innerDimSize); + } + } + if (oldType.getQualifier().isPerPrimitive() && ! newType.getQualifier().isPerPrimitive()) + error(memberLoc, "missing perprimitiveNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! oldType.getQualifier().isPerPrimitive() && newType.getQualifier().isPerPrimitive()) + error(memberLoc, "cannot add perprimitiveNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); +#endif if (newType.getQualifier().isMemory()) error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); if (newType.getQualifier().hasNonXfbLayout()) @@ -4421,6 +4456,12 @@ void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identi limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistance array size"); else if (identifier.compare("gl_CullDistance") == 0) limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistance array size"); +#ifdef NV_EXTENSIONS + else if (identifier.compare("gl_ClipDistancePerViewNV") == 0) + limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistancePerViewNV array size"); + else if (identifier.compare("gl_CullDistancePerViewNV") == 0) + limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistancePerViewNV array size"); +#endif } // See if the provided value is less than or equal to the symbol indicated by limit, diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index 566d56392..4f78c1350 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -715,6 +715,17 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) error(infoSink, "Only one shaderRecordNVX buffer block is allowed per stage"); break; case EShLangMeshNV: + // NV_mesh_shader doesn't allow use of both single-view and per-view builtins. + if (inIoAccessed("gl_Position") && inIoAccessed("gl_PositionPerViewNV")) + error(infoSink, "Can only use one of gl_Position or gl_PositionPerViewNV"); + if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipDistancePerViewNV")) + error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipDistancePerViewNV"); + if (inIoAccessed("gl_CullDistance") && inIoAccessed("gl_CullDistancePerViewNV")) + error(infoSink, "Can only use one of gl_CullDistance or gl_CullDistancePerViewNV"); + if (inIoAccessed("gl_Layer") && inIoAccessed("gl_LayerPerViewNV")) + error(infoSink, "Can only use one of gl_Layer or gl_LayerPerViewNV"); + if (inIoAccessed("gl_ViewportMask") && inIoAccessed("gl_ViewportMaskPerViewNV")) + error(infoSink, "Can only use one of gl_ViewportMask or gl_ViewportMaskPerViewNV"); if (outputPrimitive == ElgNone) error(infoSink, "At least one shader must specify an output layout primitive"); if (vertices == TQualifier::layoutNotSet) diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 29e75bb6f..815839143 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -524,6 +524,9 @@ INSTANTIATE_TEST_CASE_P( "spv.meshShaderPerViewUserDefined.mesh", "spv.meshShaderSharedMem.mesh", "spv.meshShaderTaskMem.mesh", + "spv.320.meshShaderUserDefined.mesh", + "spv.meshShaderRedeclBuiltins.mesh", + "spv.meshShaderRedeclPerViewBuiltins.mesh", "spv.meshTaskShader.task", })), FileNameAsCustomTestSuffix