glslang/Test/baseResults/spv.ext.meshShaderBuiltinsShadingRate.mesh.out
Arseny Kapoulkine 34d4f78f03
Fix interaction between GL_EXT_mesh_shader and GL_EXT_fragment_shading_rate
Before this change, using gl_MeshPrimitivesEXT in mesh shader would
unconditionally create gl_MeshPrimitivesEXT.gl_PrimitiveShadingRateEXT
field and add PrimitiveShadingRateKHR capability to the output SPIRV
file, which would subsequently trigger validation errors when creating
the shader module unless the application requested primitive shading
rate feature.

What should happen instead is that unless GL_EXT_fragment_shading_rate
extension is enabled, we should not allow using
gl_PrimitiveShadingRateEXT and should not emit the associated fields
into the output.

This change fixes this by using existing filterMember mechanism that is
already used in a few other cases like this, and adjusting the required
extension on the field member which will generate an error when
gl_PrimitiveShadingRateEXT is used without enabling the extension.
2023-08-07 11:38:17 -06:00

282 lines
15 KiB
Plaintext

spv.ext.meshShaderBuiltinsShadingRate.mesh
// Module Version 10400
// Generated by (magic number): 8000b
// Id's are bound by 164
Capability ClipDistance
Capability CullDistance
Capability FragmentShadingRateKHR
Capability DrawParameters
Capability MultiView
Capability MeshShadingEXT
Extension "SPV_EXT_mesh_shader"
Extension "SPV_KHR_fragment_shading_rate"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint MeshEXT 4 "main" 13 19 24 41 93 140 158 161
ExecutionMode 4 LocalSize 32 1 1
ExecutionMode 4 OutputVertices 81
ExecutionMode 4 OutputPrimitivesNV 32
ExecutionMode 4 OutputTrianglesNV
Source GLSL 460
SourceExtension "GL_ARB_shader_draw_parameters"
SourceExtension "GL_EXT_fragment_shading_rate"
SourceExtension "GL_EXT_mesh_shader"
SourceExtension "GL_EXT_multiview"
Name 4 "main"
Name 6 "testAdditionalBuiltins("
Name 10 "iid"
Name 13 "gl_LocalInvocationID"
Name 18 "gid"
Name 19 "gl_WorkGroupID"
Name 23 "numWorkGrous"
Name 24 "gl_NumWorkGroups"
Name 26 "vertexCount"
Name 28 "primitiveCount"
Name 38 "gl_MeshPerVertexEXT"
MemberName 38(gl_MeshPerVertexEXT) 0 "gl_Position"
MemberName 38(gl_MeshPerVertexEXT) 1 "gl_PointSize"
MemberName 38(gl_MeshPerVertexEXT) 2 "gl_ClipDistance"
MemberName 38(gl_MeshPerVertexEXT) 3 "gl_CullDistance"
Name 41 "gl_MeshVerticesEXT"
Name 90 "gl_MeshPerPrimitiveEXT"
MemberName 90(gl_MeshPerPrimitiveEXT) 0 "gl_PrimitiveID"
MemberName 90(gl_MeshPerPrimitiveEXT) 1 "gl_Layer"
MemberName 90(gl_MeshPerPrimitiveEXT) 2 "gl_ViewportIndex"
MemberName 90(gl_MeshPerPrimitiveEXT) 3 "gl_CullPrimitiveEXT"
MemberName 90(gl_MeshPerPrimitiveEXT) 4 "gl_PrimitiveShadingRateEXT"
Name 93 "gl_MeshPrimitivesEXT"
Name 140 "gl_PrimitiveTriangleIndicesEXT"
Name 156 "id"
Name 158 "gl_DrawIDARB"
Name 160 "viewIdx"
Name 161 "gl_ViewIndex"
Decorate 13(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 19(gl_WorkGroupID) BuiltIn WorkgroupId
Decorate 24(gl_NumWorkGroups) BuiltIn NumWorkgroups
MemberDecorate 38(gl_MeshPerVertexEXT) 0 BuiltIn Position
MemberDecorate 38(gl_MeshPerVertexEXT) 1 BuiltIn PointSize
MemberDecorate 38(gl_MeshPerVertexEXT) 2 BuiltIn ClipDistance
MemberDecorate 38(gl_MeshPerVertexEXT) 3 BuiltIn CullDistance
Decorate 38(gl_MeshPerVertexEXT) Block
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 0 PerPrimitiveNV
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 0 BuiltIn PrimitiveId
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 1 PerPrimitiveNV
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 1 BuiltIn Layer
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 2 PerPrimitiveNV
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 2 BuiltIn ViewportIndex
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 3 PerPrimitiveNV
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 3 BuiltIn CullPrimitiveEXT
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 4 PerPrimitiveNV
MemberDecorate 90(gl_MeshPerPrimitiveEXT) 4 BuiltIn PrimitiveShadingRateKHR
Decorate 90(gl_MeshPerPrimitiveEXT) Block
Decorate 140(gl_PrimitiveTriangleIndicesEXT) BuiltIn PrimitiveTriangleIndicesEXT
Decorate 158(gl_DrawIDARB) BuiltIn DrawIndex
Decorate 161(gl_ViewIndex) BuiltIn ViewIndex
Decorate 163 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
8: TypeInt 32 0
9: TypePointer Function 8(int)
11: TypeVector 8(int) 3
12: TypePointer Input 11(ivec3)
13(gl_LocalInvocationID): 12(ptr) Variable Input
14: 8(int) Constant 0
15: TypePointer Input 8(int)
19(gl_WorkGroupID): 12(ptr) Variable Input
22: TypePointer Function 11(ivec3)
24(gl_NumWorkGroups): 12(ptr) Variable Input
27: 8(int) Constant 81
29: 8(int) Constant 32
32: TypeFloat 32
33: TypeVector 32(float) 4
34: 8(int) Constant 4
35: TypeArray 32(float) 34
36: 8(int) Constant 3
37: TypeArray 32(float) 36
38(gl_MeshPerVertexEXT): TypeStruct 33(fvec4) 32(float) 35 37
39: TypeArray 38(gl_MeshPerVertexEXT) 27
40: TypePointer Output 39
41(gl_MeshVerticesEXT): 40(ptr) Variable Output
43: TypeInt 32 1
44: 43(int) Constant 0
45: 32(float) Constant 1065353216
46: 33(fvec4) ConstantComposite 45 45 45 45
47: TypePointer Output 33(fvec4)
50: 43(int) Constant 1
51: 32(float) Constant 1073741824
52: TypePointer Output 32(float)
55: 43(int) Constant 2
56: 43(int) Constant 3
57: 32(float) Constant 1077936128
60: 32(float) Constant 1082130432
62: 8(int) Constant 1
63: 8(int) Constant 264
64: 8(int) Constant 2
89: TypeBool
90(gl_MeshPerPrimitiveEXT): TypeStruct 43(int) 43(int) 43(int) 89(bool) 43(int)
91: TypeArray 90(gl_MeshPerPrimitiveEXT) 29
92: TypePointer Output 91
93(gl_MeshPrimitivesEXT): 92(ptr) Variable Output
95: 43(int) Constant 6
96: TypePointer Output 43(int)
99: 43(int) Constant 7
102: 43(int) Constant 8
105: 89(bool) ConstantFalse
106: TypePointer Output 89(bool)
109: 43(int) Constant 4
138: TypeArray 11(ivec3) 29
139: TypePointer Output 138
140(gl_PrimitiveTriangleIndicesEXT): 139(ptr) Variable Output
141: 8(int) Constant 257
142: 11(ivec3) ConstantComposite 141 141 141
143: TypePointer Output 11(ivec3)
147: 11(ivec3) ConstantComposite 64 64 64
155: TypePointer Function 43(int)
157: TypePointer Input 43(int)
158(gl_DrawIDARB): 157(ptr) Variable Input
161(gl_ViewIndex): 157(ptr) Variable Input
163: 11(ivec3) ConstantComposite 29 62 62
4(main): 2 Function None 3
5: Label
10(iid): 9(ptr) Variable Function
18(gid): 9(ptr) Variable Function
23(numWorkGrous): 22(ptr) Variable Function
26(vertexCount): 9(ptr) Variable Function
28(primitiveCount): 9(ptr) Variable Function
16: 15(ptr) AccessChain 13(gl_LocalInvocationID) 14
17: 8(int) Load 16
Store 10(iid) 17
20: 15(ptr) AccessChain 19(gl_WorkGroupID) 14
21: 8(int) Load 20
Store 18(gid) 21
25: 11(ivec3) Load 24(gl_NumWorkGroups)
Store 23(numWorkGrous) 25
Store 26(vertexCount) 27
Store 28(primitiveCount) 29
30: 8(int) Load 26(vertexCount)
31: 8(int) Load 28(primitiveCount)
SetMeshOutputsEXT 30 31
42: 8(int) Load 10(iid)
48: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 42 44
Store 48 46
49: 8(int) Load 10(iid)
53: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 49 50
Store 53 51
54: 8(int) Load 10(iid)
58: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 54 55 56
Store 58 57
59: 8(int) Load 10(iid)
61: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 59 56 55
Store 61 60
MemoryBarrier 62 63
ControlBarrier 64 64 63
65: 8(int) Load 10(iid)
66: 8(int) IAdd 65 62
67: 8(int) Load 10(iid)
68: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 67 44
69: 33(fvec4) Load 68
70: 47(ptr) AccessChain 41(gl_MeshVerticesEXT) 66 44
Store 70 69
71: 8(int) Load 10(iid)
72: 8(int) IAdd 71 62
73: 8(int) Load 10(iid)
74: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 73 50
75: 32(float) Load 74
76: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 72 50
Store 76 75
77: 8(int) Load 10(iid)
78: 8(int) IAdd 77 62
79: 8(int) Load 10(iid)
80: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 79 55 56
81: 32(float) Load 80
82: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 78 55 56
Store 82 81
83: 8(int) Load 10(iid)
84: 8(int) IAdd 83 62
85: 8(int) Load 10(iid)
86: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 85 56 55
87: 32(float) Load 86
88: 52(ptr) AccessChain 41(gl_MeshVerticesEXT) 84 56 55
Store 88 87
MemoryBarrier 62 63
ControlBarrier 64 64 63
94: 8(int) Load 10(iid)
97: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 94 44
Store 97 95
98: 8(int) Load 10(iid)
100: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 98 50
Store 100 99
101: 8(int) Load 10(iid)
103: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 101 55
Store 103 102
104: 8(int) Load 10(iid)
107: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 104 56
Store 107 105
108: 8(int) Load 10(iid)
110: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 108 109
Store 110 44
MemoryBarrier 62 63
ControlBarrier 64 64 63
111: 8(int) Load 10(iid)
112: 8(int) IAdd 111 62
113: 8(int) Load 10(iid)
114: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 113 44
115: 43(int) Load 114
116: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 112 44
Store 116 115
117: 8(int) Load 10(iid)
118: 8(int) IAdd 117 62
119: 8(int) Load 10(iid)
120: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 119 50
121: 43(int) Load 120
122: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 118 50
Store 122 121
123: 8(int) Load 10(iid)
124: 8(int) IAdd 123 62
125: 8(int) Load 10(iid)
126: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 125 55
127: 43(int) Load 126
128: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 124 55
Store 128 127
129: 8(int) Load 10(iid)
130: 8(int) IAdd 129 62
131: 8(int) Load 10(iid)
132: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 131 56
133: 89(bool) Load 132
134: 106(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 130 56
Store 134 133
135: 8(int) Load 10(iid)
136: 8(int) IAdd 135 62
137: 96(ptr) AccessChain 93(gl_MeshPrimitivesEXT) 136 109
Store 137 44
MemoryBarrier 62 63
ControlBarrier 64 64 63
144: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 44
Store 144 142
145: 8(int) Load 28(primitiveCount)
146: 8(int) ISub 145 62
148: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 146
Store 148 147
149: 8(int) Load 18(gid)
150: 8(int) Load 18(gid)
151: 8(int) ISub 150 62
152: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 151
153: 11(ivec3) Load 152
154: 143(ptr) AccessChain 140(gl_PrimitiveTriangleIndicesEXT) 149
Store 154 153
MemoryBarrier 62 63
ControlBarrier 64 64 63
Return
FunctionEnd
6(testAdditionalBuiltins(): 2 Function None 3
7: Label
156(id): 155(ptr) Variable Function
160(viewIdx): 155(ptr) Variable Function
159: 43(int) Load 158(gl_DrawIDARB)
Store 156(id) 159
162: 43(int) Load 161(gl_ViewIndex)
Store 160(viewIdx) 162
Return
FunctionEnd