1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
package shader
// SPIR-V 1.5 specification constants.
// Subset needed for Luma shader compilation.
SPIRV_MAGIC :: 0x07230203
SPIRV_VERSION :: 0x00010500 // 1.5
SPIRV_GENERATOR :: 0x4C554D41 // "LUMA"
// Opcodes
SpvOp_Nop :: 0
SpvOp_Undef :: 1
SpvOp_Source :: 3
SpvOp_Name :: 5
SpvOp_MemberName :: 6
SpvOp_String :: 7
SpvOp_Line :: 8
SpvOp_ModuleProcessed :: 330
SpvOp_ExtInstImport :: 11
SpvOp_ExtInst :: 12
SpvOp_MemoryModel :: 14
SpvOp_EntryPoint :: 15
SpvOp_ExecutionMode :: 16
SpvOp_Capability :: 17
SpvOp_TypeVoid :: 19
SpvOp_TypeBool :: 20
SpvOp_TypeInt :: 21
SpvOp_TypeFloat :: 22
SpvOp_TypeVector :: 23
SpvOp_TypeMatrix :: 24
SpvOp_TypeImage :: 25
SpvOp_TypeSampledImage :: 27
SpvOp_TypeArray :: 28
SpvOp_TypeRuntimeArray :: 29
SpvOp_TypeStruct :: 30
SpvOp_TypePointer :: 32
SpvOp_TypeFunction :: 33
SpvOp_ConstantTrue :: 41
SpvOp_ConstantFalse :: 42
SpvOp_Constant :: 43
SpvOp_ConstantComposite :: 44
SpvOp_SpecConstantTrue :: 48
SpvOp_SpecConstantFalse :: 49
SpvOp_SpecConstant :: 50
SpvOp_Function :: 54
SpvOp_FunctionParameter :: 55
SpvOp_FunctionEnd :: 56
SpvOp_FunctionCall :: 57
SpvOp_Variable :: 59
SpvOp_Load :: 61
SpvOp_Store :: 62
SpvOp_AccessChain :: 65
SpvOp_Decorate :: 71
SpvOp_MemberDecorate :: 72
SpvOp_VectorExtractDynamic :: 77
SpvOp_VectorShuffle :: 79
SpvOp_CompositeConstruct :: 80
SpvOp_CompositeExtract :: 81
SpvOp_CompositeInsert :: 82
SpvOp_Transpose :: 84
SpvOp_ImageSampleImplicitLod :: 87
SpvOp_ImageSampleExplicitLod :: 88
SpvOp_ImageSampleDrefImplicitLod :: 89
SpvOp_ConvertFToU :: 109
SpvOp_ConvertFToS :: 110
SpvOp_ConvertSToF :: 111
SpvOp_ConvertUToF :: 112
SpvOp_UConvert :: 113
SpvOp_SConvert :: 114
SpvOp_FConvert :: 115
SpvOp_Bitcast :: 124
SpvOp_SNegate :: 126
SpvOp_FNegate :: 127
SpvOp_IAdd :: 128
SpvOp_FAdd :: 129
SpvOp_ISub :: 130
SpvOp_FSub :: 131
SpvOp_IMul :: 132
SpvOp_FMul :: 133
SpvOp_UDiv :: 134
SpvOp_SDiv :: 135
SpvOp_FDiv :: 136
SpvOp_UMod :: 137
SpvOp_SRem :: 138
SpvOp_SMod :: 139
SpvOp_FRem :: 140
SpvOp_FMod :: 141
SpvOp_VectorTimesScalar :: 142
SpvOp_MatrixTimesScalar :: 143
SpvOp_VectorTimesMatrix :: 144
SpvOp_MatrixTimesVector :: 145
SpvOp_MatrixTimesMatrix :: 146
SpvOp_Dot :: 148
SpvOp_LogicalEqual :: 164
SpvOp_LogicalNotEqual :: 165
SpvOp_LogicalOr :: 166
SpvOp_LogicalAnd :: 167
SpvOp_LogicalNot :: 168
SpvOp_Select :: 169
SpvOp_IEqual :: 170
SpvOp_INotEqual :: 171
SpvOp_UGreaterThan :: 172
SpvOp_SGreaterThan :: 173
SpvOp_UGreaterThanEqual :: 174
SpvOp_SGreaterThanEqual :: 175
SpvOp_ULessThan :: 176
SpvOp_SLessThan :: 177
SpvOp_ULessThanEqual :: 178
SpvOp_SLessThanEqual :: 179
SpvOp_FOrdEqual :: 180
SpvOp_FOrdNotEqual :: 182
SpvOp_FOrdLessThan :: 184
SpvOp_FOrdGreaterThan :: 186
SpvOp_FOrdLessThanEqual :: 188
SpvOp_FOrdGreaterThanEqual :: 190
SpvOp_Phi :: 245
SpvOp_LoopMerge :: 246
SpvOp_SelectionMerge :: 247
SpvOp_Label :: 248
SpvOp_Branch :: 249
SpvOp_BranchConditional :: 250
SpvOp_ControlBarrier :: 224
SpvOp_Return :: 253
SpvOp_ReturnValue :: 254
SpvOp_Kill :: 252
SpvOp_DPdx :: 207
SpvOp_DPdy :: 208
SpvOp_Fwidth :: 209
SpvOp_ImageFetch :: 95
SpvOp_ImageQuerySizeLod :: 103
// Source Language
SpvSourceLanguage_Unknown :: 0
// Capabilities
SpvCapability_Shader :: 1
// Addressing/Memory Models
SpvAddressingModel_Logical :: 0
SpvMemoryModel_GLSL450 :: 1
// Execution Model
SpvExecutionModel_Vertex :: 0
SpvExecutionModel_Fragment :: 4
SpvExecutionModel_GLCompute :: 5
// Execution Mode
SpvExecutionMode_OriginUpperLeft :: 7
SpvExecutionMode_LocalSize :: 17
// Storage Class
SpvStorageClass_UniformConstant :: 0
SpvStorageClass_Input :: 1
SpvStorageClass_Uniform :: 2
SpvStorageClass_Output :: 3
SpvStorageClass_Workgroup :: 4
SpvStorageClass_Function :: 7
SpvStorageClass_PushConstant :: 9
SpvStorageClass_StorageBuffer :: 12
// Decoration
SpvDecoration_SpecId :: 1
SpvDecoration_Block :: 2
SpvDecoration_ColMajor :: 5
SpvDecoration_ArrayStride :: 6
SpvDecoration_MatrixStride :: 7
SpvDecoration_BuiltIn :: 11
SpvDecoration_NoPerspective :: 13
SpvDecoration_Flat :: 14
SpvDecoration_Location :: 30
SpvDecoration_Binding :: 33
SpvDecoration_DescriptorSet :: 34
SpvDecoration_Offset :: 35
// Built-In
SpvBuiltIn_Position :: 0
SpvBuiltIn_PointSize :: 1
SpvBuiltIn_VertexIndex :: 42
SpvBuiltIn_InstanceIndex :: 43
SpvBuiltIn_FragCoord :: 15
SpvBuiltIn_FrontFacing :: 17
SpvBuiltIn_FragDepth :: 22
SpvBuiltIn_LocalInvocationId :: 27
SpvBuiltIn_GlobalInvocationId :: 28
SpvBuiltIn_WorkgroupId :: 26
SpvBuiltIn_NumWorkgroups :: 24
SpvBuiltIn_LocalInvocationIndex :: 29
// Function Control
SpvFunctionControl_None :: 0
// Selection Control
SpvSelectionControl_None :: 0
// Loop Control
SpvLoopControl_None :: 0
// Scope
SpvScope_Workgroup :: 2
// Memory Semantics
SpvMemorySemantics_AcquireRelease :: 0x8
SpvMemorySemantics_WorkgroupMemory :: 0x100
// Image Dimensionality
SpvDim_2D :: 1
SpvDim_3D :: 2
SpvDim_Cube :: 3
// Image Format
SpvImageFormat_Unknown :: 0
// GLSL.std.450 Extended Instruction Set
GLSLstd450_Round :: 1
GLSLstd450_Trunc :: 3
GLSLstd450_FAbs :: 4
GLSLstd450_SAbs :: 5
GLSLstd450_FSign :: 6
GLSLstd450_SSign :: 7
GLSLstd450_Floor :: 8
GLSLstd450_Ceil :: 9
GLSLstd450_Fract :: 10
GLSLstd450_Sin :: 13
GLSLstd450_Cos :: 14
GLSLstd450_Tan :: 15
GLSLstd450_Asin :: 16
GLSLstd450_Acos :: 17
GLSLstd450_Atan :: 18
GLSLstd450_Atan2 :: 25
GLSLstd450_Pow :: 26
GLSLstd450_Exp :: 27
GLSLstd450_Log :: 28
GLSLstd450_Exp2 :: 29
GLSLstd450_Log2 :: 30
GLSLstd450_Sqrt :: 31
GLSLstd450_InverseSqrt :: 32
GLSLstd450_Determinant :: 33
GLSLstd450_MatrixInverse :: 34
GLSLstd450_FMin :: 37
GLSLstd450_UMin :: 38
GLSLstd450_SMin :: 39
GLSLstd450_FMax :: 40
GLSLstd450_UMax :: 41
GLSLstd450_SMax :: 42
GLSLstd450_FClamp :: 43
GLSLstd450_UClamp :: 44
GLSLstd450_SClamp :: 45
GLSLstd450_FMix :: 46
GLSLstd450_Step :: 48
GLSLstd450_SmoothStep :: 49
GLSLstd450_Length :: 66
GLSLstd450_Distance :: 67
GLSLstd450_Cross :: 68
GLSLstd450_Normalize :: 69
GLSLstd450_Reflect :: 71
GLSLstd450_Refract :: 72