]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/spirvconstants.h
2e952e058bde58b4cc21eca56e745244666959b6
[libs/gl.git] / source / glsl / spirvconstants.h
1 #ifndef MSP_GL_SL_SPIRVCONSTANTS_H_
2 #define MSP_GL_SL_SPIRVCONSTANTS_H_
3
4 namespace Msp {
5 namespace GL {
6 namespace SL {
7
8 enum SpirVConstants
9 {
10         SPIRV_MAGIC = 0x07230203,
11         SPIRV_MAGIC_REVERSED = 0x03022307,
12         SPIRV_GENERATOR_MSP = 29
13 };
14
15 enum SpirVOpcode
16 {
17         OP_NOP = 1,
18         OP_NAME = 5,
19         OP_MEMBER_NAME = 6,
20         OP_EXT_INST_IMPORT = 11,
21         OP_EXT_INST = 12,
22         OP_MEMORY_MODEL = 14,
23         OP_ENTRY_POINT = 15,
24         OP_EXECUTION_MODE = 16,
25         OP_CAPABILITY = 17,
26         OP_TYPE_VOID = 19,
27         OP_TYPE_BOOL = 20,
28         OP_TYPE_INT = 21,
29         OP_TYPE_FLOAT = 22,
30         OP_TYPE_VECTOR = 23,
31         OP_TYPE_MATRIX = 24,
32         OP_TYPE_IMAGE = 25,
33         OP_TYPE_SAMPLED_IMAGE = 27,
34         OP_TYPE_ARRAY = 28,
35         OP_TYPE_RUNTIME_ARRAY = 29,
36         OP_TYPE_STRUCT = 30,
37         OP_TYPE_POINTER = 32,
38         OP_TYPE_FUNCTION = 33,
39         OP_CONSTANT_TRUE = 41,
40         OP_CONSTANT_FALSE = 42,
41         OP_CONSTANT = 43,
42         OP_CONSTANT_COMPOSITE = 44,
43         OP_SPEC_CONSTANT_TRUE = 48,
44         OP_SPEC_CONSTANT_FALSE = 49,
45         OP_SPEC_CONSTANT = 50,
46         OP_SPEC_CONSTANT_COMPOSITE = 51,
47         OP_SPEC_CONSTANT_OP = 52,
48         OP_FUNCTION = 54,
49         OP_FUNCTION_PARAMETER = 55,
50         OP_FUNCTION_END = 56,
51         OP_FUNCTION_CALL = 57,
52         OP_VARIABLE = 59,
53         OP_LOAD = 61,
54         OP_STORE = 62,
55         OP_ACCESS_CHAIN = 65,
56         OP_DECORATE = 71,
57         OP_MEMBER_DECORATE = 72,
58         OP_VECTOR_SHUFFLE = 79,
59         OP_COMPOSITE_CONSTRUCT = 80,
60         OP_COMPOSITE_EXTRACT = 81,
61         OP_TRANSPOSE = 84,
62         OP_IMAGE_SAMPLE_IMPLICIT_LOD = 87,
63         OP_IMAGE_SAMPLE_EXPLICIT_LOD = 88,
64         OP_IMAGE_SAMPLE_DREF_IMPLICIT_LOD = 89,
65         OP_IMAGE_SAMPLE_DREF_EXPLICIT_LOD = 89,
66         OP_IMAGE_FETCH = 95,
67         OP_IMAGE_READ = 98,
68         OP_IMAGE_WRITE = 99,
69         OP_IMAGE = 100,
70         OP_IMAGE_QUERY_SIZE_LOD = 103,
71         OP_IMAGE_QUERY_SIZE = 104,
72         OP_IMAGE_QUERY_LOD = 105,
73         OP_IMAGE_QUERY_LEVELS = 106,
74         OP_IMAGE_QUERY_SAMPLES = 107,
75         OP_CONVERT_F_TO_U = 109,
76         OP_CONVERT_F_TO_S = 110,
77         OP_CONVERT_S_TO_F = 111,
78         OP_CONVERT_U_TO_F = 112,
79         OP_BITCAST = 124,
80         OP_S_NEGATE = 126,
81         OP_F_NEGATE = 127,
82         OP_I_ADD = 128,
83         OP_F_ADD = 129,
84         OP_I_SUB = 130,
85         OP_F_SUB = 131,
86         OP_I_MUL = 132,
87         OP_F_MUL = 133,
88         OP_U_DIV = 134,
89         OP_S_DIV = 135,
90         OP_F_DIV = 136,
91         OP_U_MOD = 137,
92         OP_S_MOD = 139,
93         OP_F_MOD = 141,
94         OP_VECTOR_TIMES_SCALAR = 142,
95         OP_MATRIX_TIMES_SCALAR = 143,
96         OP_VECTOR_TIMES_MATRIX = 144,
97         OP_MATRIX_TIMES_VECTOR = 145,
98         OP_MATRIX_TIMES_MATRIX = 146,
99         OP_OUTER_PRODUCT = 147,
100         OP_DOT = 148,
101         OP_ANY = 154,
102         OP_ALL = 155,
103         OP_IS_NAN = 156,
104         OP_IS_INF = 157,
105         OP_LOGICAL_EQUAL = 164,
106         OP_LOGICAL_NOT_EQUAL = 165,
107         OP_LOGICAL_OR = 166,
108         OP_LOGICAL_AND = 167,
109         OP_LOGICAL_NOT = 168,
110         OP_SELECT = 169,
111         OP_I_EQUAL = 170,
112         OP_I_NOT_EQUAL = 171,
113         OP_U_GREATER_THAN = 172,
114         OP_S_GREATER_THAN = 173,
115         OP_U_GREATER_THAN_EQUAL = 174,
116         OP_S_GREATER_THAN_EQUAL = 175,
117         OP_U_LESS_THAN = 176,
118         OP_S_LESS_THAN = 177,
119         OP_U_LESS_THAN_EQUAL = 178,
120         OP_S_LESS_THAN_EQUAL = 179,
121         OP_F_ORD_EQUAL = 180,
122         OP_F_ORD_NOT_EQUAL = 182,
123         OP_F_ORD_LESS_THAN = 184,
124         OP_F_ORD_GREATER_THAN = 186,
125         OP_F_ORD_LESS_THAN_EQUAL = 188,
126         OP_F_ORD_GREATER_THAN_EQUAL = 190,
127         OP_SHIFT_RIGHT_ARITHMETIC = 195,
128         OP_SHIFT_LEFT_LOGICAL = 196,
129         OP_BITWISE_OR = 197,
130         OP_BITWISE_XOR = 198,
131         OP_BITWISE_AND = 199,
132         OP_NOT = 200,
133         OP_BIT_FIELD_INSERT = 201,
134         OP_BIT_FIELD_S_EXTRACT = 202,
135         OP_BIT_FIELD_U_EXTRACT = 203,
136         OP_BIT_REVERSE = 204,
137         OP_BIT_COUNT = 205,
138         OP_DP_DX = 207,
139         OP_DP_DY = 208,
140         OP_FWIDTH = 209,
141         OP_DP_DX_FINE = 210,
142         OP_DP_DY_FINE = 211,
143         OP_FWIDTH_FINE = 212,
144         OP_DP_DX_COARSE = 213,
145         OP_DP_DY_COARSE = 214,
146         OP_FWIDTH_COARSE = 215,
147         OP_EMIT_VERTEX = 218,
148         OP_END_PRIMITIVE = 219,
149         OP_PHI = 245,
150         OP_LOOP_MERGE = 246,
151         OP_SELECTION_MERGE = 247,
152         OP_LABEL = 248,
153         OP_BRANCH = 249,
154         OP_BRANCH_CONDITIONAL = 250,
155         OP_KILL = 252,
156         OP_RETURN = 253,
157         OP_RETURN_VALUE = 254,
158         OP_UNREACHABLE = 255
159 };
160
161 enum SpirVCapability
162 {
163         CAP_SHADER = 1,
164         CAP_GEOMETRY = 2,
165         CAP_TESSELLATION = 3,
166         CAP_STORAGE_IMAGE_MULTISAMPLE = 27,
167         CAP_IMAGE_CUBE_ARRAY = 34,
168         CAP_SAMPLED_1D = 43,
169         CAP_IMAGE_1D = 44,
170         CAP_SAMPLED_CUBE_ARRAY = 45,
171         CAP_STORAGE_IMAGE_EXTENDED_FORMATS = 49,
172         CAP_IMAGE_QUERY = 50,
173         CAP_DERIVATIVE_CONTROL = 51,
174         CAP_INTERPOLATION_FUNCTION = 52
175 };
176
177 enum SpirVExecutionMode
178 {
179         EXEC_INVOCATIONS = 0,
180         EXEC_SPACING_EQUAL = 1,
181         EXEC_SPACING_FRACTIONAL_EVEN = 2,
182         EXEC_SPACING_FRACTIONAL_ODD = 3,
183         EXEC_VERTEX_ORDER_CW = 4,
184         EXEC_VERTEX_ORDER_CCW = 5,
185         EXEC_ORIGIN_UPPER_LEFT = 7,
186         EXEC_ORIGIN_LOWER_LEFT = 8,
187         EXEC_LOCAL_SIZE = 17,
188         EXEC_INPUT_POINTS = 19,
189         EXEC_INPUT_LINES = 20,
190         EXEC_INPUT_LINES_ADJACENCY = 21,
191         EXEC_TRIANGLES = 22,
192         EXEC_INPUT_TRIANGLES_ADJACENCY = 23,
193         EXEC_QUADS = 24,
194         EXEC_ISOLINES = 25,
195         EXEC_OUTPUT_VERTICES = 26,
196         EXEC_OUTPUT_POINTS = 27,
197         EXEC_OUTPUT_LINE_STRIP = 28,
198         EXEC_OUTPUT_TRIANGLE_STRIP = 29
199 };
200
201 enum SpirVStorageClass
202 {
203         STORAGE_UNIFORM_CONSTANT = 0,
204         STORAGE_INPUT = 1,
205         STORAGE_UNIFORM = 2,
206         STORAGE_OUTPUT = 3,
207         STORAGE_PRIVATE = 6,
208         STORAGE_FUNCTION = 7,
209         STORAGE_PUSH_CONSTANT = 9
210 };
211
212 enum SpirVDecoration
213 {
214         DECO_SPEC_ID = 1,
215         DECO_BLOCK = 2,
216         DECO_ROW_MAJOR = 4,
217         DECO_COL_MAJOR = 5,
218         DECO_ARRAY_STRIDE = 6,
219         DECO_MATRIX_STRIDE = 7,
220         DECO_BUILTIN = 11,
221         DECO_FLAT = 14,
222         DECO_PATCH = 15,
223         DECO_CENTROID = 16,
224         DECO_LOCATION = 30,
225         DECO_BINDING = 33,
226         DECO_DESCRIPTOR_SET = 34,
227         DECO_OFFSET = 35
228 };
229
230 enum SpirVBuiltin
231 {
232         BUILTIN_POSITION = 0,
233         BUILTIN_POINT_SIZE = 1,
234         BUILTIN_CLIP_DISTANCE = 3,
235         BUILTIN_VERTEX_ID = 5,
236         BUILTIN_INSTANCE_ID = 6,
237         BUILTIN_PRIMITIVE_ID = 7,
238         BUILTIN_INVOCATION_ID = 8,
239         BUILTIN_LAYER = 9,
240         BUILTIN_TESS_LEVEL_OUTER = 11,
241         BUILTIN_TESS_LEVEL_INNER = 12,
242         BUILTIN_TESS_COORD = 13,
243         BUILTIN_PATCH_VERTICES = 14,
244         BUILTIN_FRAG_COORD = 15,
245         BUILTIN_POINT_COORD = 16,
246         BUILTIN_FRONT_FACING = 17,
247         BUILTIN_SAMPLE_ID = 18,
248         BUILTIN_SAMPLE_POSITION = 19,
249         BUILTIN_FRAG_DEPTH = 22,
250         BUILTIN_NUM_WORKGROUPS = 24,
251         BUILTIN_WORKGROUP_SIZE = 25,
252         BUILTIN_WORKGROUP_ID = 26,
253         BUILTIN_LOCAL_INVOCATION_ID = 27,
254         BUILTIN_GLOBAL_INVOCATION_ID = 28,
255         BUILTIN_LOCAL_INVOCATION_INDEX = 29
256 };
257
258 enum SpirVFormat
259 {
260         FORMAT_UNKNOWN = 0,
261         FORMAT_RGBA32F = 1,
262         FORMAT_RGBA16F = 2,
263         FORMAT_R32F = 3,
264         FORMAT_RGBA8 = 4,
265         FORMAT_RGBA8_SNORM = 5,
266         FORMAT_RG32F = 6,
267         FORMAT_RG16F = 7,
268         FORMAT_R16F = 9,
269         FORMAT_RGBA16 = 10,
270         FORMAT_RG16 = 12,
271         FORMAT_RG8 = 13,
272         FORMAT_R16 = 14,
273         FORMAT_R8 = 15,
274         FORMAT_RGBA16_SNORM = 16,
275         FORMAT_RG16_SNORM = 17,
276         FORMAT_RG8_SNORM = 18,
277         FORMAT_R16_SNORM = 19,
278         FORMAT_R8_SNORM = 20
279 };
280
281 enum SpirVGlslStd450Opcode
282 {
283         GLSL450_ROUND = 1,
284         GLSL450_ROUND_EVEN = 2,
285         GLSL450_TRUNC = 3,
286         GLSL450_F_ABS = 4,
287         GLSL450_S_ABS = 5,
288         GLSL450_F_SIGN = 6,
289         GLSL450_S_SIGN = 7,
290         GLSL450_FLOOR = 8,
291         GLSL450_CEIL = 9,
292         GLSL450_FRACT = 10,
293         GLSL450_RADIANS = 11,
294         GLSL450_DEGREES = 12,
295         GLSL450_SIN = 13,
296         GLSL450_COS = 14,
297         GLSL450_TAN = 15,
298         GLSL450_ASIN = 16,
299         GLSL450_ACOS = 17,
300         GLSL450_ATAN = 18,
301         GLSL450_SINH = 19,
302         GLSL450_COSH = 20,
303         GLSL450_TANH = 21,
304         GLSL450_ASINH = 22,
305         GLSL450_ACOSH = 23,
306         GLSL450_ATANH = 24,
307         GLSL450_ATAN2 = 25,
308         GLSL450_POW = 26,
309         GLSL450_EXP = 27,
310         GLSL450_LOG = 28,
311         GLSL450_EXP2 = 29,
312         GLSL450_LOG2 = 30,
313         GLSL450_SQRT = 31,
314         GLSL450_INVERSE_SQRT = 32,
315         GLSL450_DETERMINANT = 33,
316         GLSL450_MATRIX_INVERSE = 34,
317         GLSL450_F_MIN = 37,
318         GLSL450_U_MIN = 38,
319         GLSL450_S_MIN = 39,
320         GLSL450_F_MAX = 40,
321         GLSL450_U_MAX = 41,
322         GLSL450_S_MAX = 42,
323         GLSL450_F_CLAMP = 43,
324         GLSL450_U_CLAMP = 44,
325         GLSL450_S_CLAMP = 45,
326         GLSL450_F_MIX = 46,
327         GLSL450_F_STEP = 48,
328         GLSL450_F_SMOOTH_STEP = 49,
329         GLSL450_F_FMA = 50,
330         GLSL450_LENGTH = 66,
331         GLSL450_DISTANCE = 67,
332         GLSL450_CROSS = 68,
333         GLSL450_NORMALIZE = 69,
334         GLSL450_FACE_FORWARD = 70,
335         GLSL450_REFLECT = 71,
336         GLSL450_REFRACT = 72,
337         GLSL450_FIND_I_LSB = 73,
338         GLSL450_FIND_S_MSB = 74,
339         GLSL450_FIND_U_MSB = 75,
340         GLSL450_INTERPOLATE_AT_CENTROID = 76,
341         GLSL450_INTERPOLATE_AT_SAMPLE = 77,
342         GLSL450_INTERPOLATE_AT_OFFSET = 78
343 };
344
345 } // namespace SL
346 } // namespace GL
347 } // namespace Msp
348
349 #endif