]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/spirvconstants.h
Implement textureSize as a visitor function in the SPIR-V generator
[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 = 100,
68         OP_IMAGE_QUERY_SIZE_LOD = 103,
69         OP_CONVERT_F_TO_U = 109,
70         OP_CONVERT_F_TO_S = 110,
71         OP_CONVERT_S_TO_F = 111,
72         OP_CONVERT_U_TO_F = 112,
73         OP_BITCAST = 124,
74         OP_S_NEGATE = 126,
75         OP_F_NEGATE = 127,
76         OP_I_ADD = 128,
77         OP_F_ADD = 129,
78         OP_I_SUB = 130,
79         OP_F_SUB = 131,
80         OP_I_MUL = 132,
81         OP_F_MUL = 133,
82         OP_U_DIV = 134,
83         OP_S_DIV = 135,
84         OP_F_DIV = 136,
85         OP_U_MOD = 137,
86         OP_S_MOD = 139,
87         OP_F_MOD = 141,
88         OP_VECTOR_TIMES_SCALAR = 142,
89         OP_MATRIX_TIMES_SCALAR = 143,
90         OP_VECTOR_TIMES_MATRIX = 144,
91         OP_MATRIX_TIMES_VECTOR = 145,
92         OP_MATRIX_TIMES_MATRIX = 146,
93         OP_OUTER_PRODUCT = 147,
94         OP_DOT = 148,
95         OP_ANY = 154,
96         OP_ALL = 155,
97         OP_IS_NAN = 156,
98         OP_IS_INF = 157,
99         OP_LOGICAL_EQUAL = 164,
100         OP_LOGICAL_NOT_EQUAL = 165,
101         OP_LOGICAL_OR = 166,
102         OP_LOGICAL_AND = 167,
103         OP_LOGICAL_NOT = 168,
104         OP_SELECT = 169,
105         OP_I_EQUAL = 170,
106         OP_I_NOT_EQUAL = 171,
107         OP_U_GREATER_THAN = 172,
108         OP_S_GREATER_THAN = 173,
109         OP_U_GREATER_THAN_EQUAL = 174,
110         OP_S_GREATER_THAN_EQUAL = 175,
111         OP_U_LESS_THAN = 176,
112         OP_S_LESS_THAN = 177,
113         OP_U_LESS_THAN_EQUAL = 178,
114         OP_S_LESS_THAN_EQUAL = 179,
115         OP_F_ORD_EQUAL = 180,
116         OP_F_ORD_NOT_EQUAL = 182,
117         OP_F_ORD_LESS_THAN = 184,
118         OP_F_ORD_GREATER_THAN = 186,
119         OP_F_ORD_LESS_THAN_EQUAL = 188,
120         OP_F_ORD_GREATER_THAN_EQUAL = 190,
121         OP_SHIFT_RIGHT_ARITHMETIC = 195,
122         OP_SHIFT_LEFT_LOGICAL = 196,
123         OP_BITWISE_OR = 197,
124         OP_BITWISE_XOR = 198,
125         OP_BITWISE_AND = 199,
126         OP_NOT = 200,
127         OP_BIT_FIELD_INSERT = 201,
128         OP_BIT_FIELD_S_EXTRACT = 202,
129         OP_BIT_FIELD_U_EXTRACT = 203,
130         OP_BIT_REVERSE = 204,
131         OP_BIT_COUNT = 205,
132         OP_DP_DX = 207,
133         OP_DP_DY = 208,
134         OP_FWIDTH = 209,
135         OP_DP_DX_FINE = 210,
136         OP_DP_DY_FINE = 211,
137         OP_FWIDTH_FINE = 212,
138         OP_DP_DX_COARSE = 213,
139         OP_DP_DY_COARSE = 214,
140         OP_FWIDTH_COARSE = 215,
141         OP_EMIT_VERTEX = 218,
142         OP_END_PRIMITIVE = 219,
143         OP_PHI = 245,
144         OP_LOOP_MERGE = 246,
145         OP_SELECTION_MERGE = 247,
146         OP_LABEL = 248,
147         OP_BRANCH = 249,
148         OP_BRANCH_CONDITIONAL = 250,
149         OP_KILL = 252,
150         OP_RETURN = 253,
151         OP_RETURN_VALUE = 254,
152         OP_UNREACHABLE = 255
153 };
154
155 enum SpirVCapability
156 {
157         CAP_SHADER = 1,
158         CAP_GEOMETRY = 2,
159         CAP_IMAGE_CUBE_ARRAY = 34,
160         CAP_SAMPLED_1D = 43,
161         CAP_IMAGE_1D = 44,
162         CAP_SAMPLED_CUBE_ARRAY = 45,
163         CAP_IMAGE_QUERY = 50,
164         CAP_DERIVATIVE_CONTROL = 51,
165         CAP_INTERPOLATION_FUNCTION = 52
166 };
167
168 enum SpirVExecutionMode
169 {
170         EXEC_ORIGIN_LOWER_LEFT = 8,
171         EXEC_INPUT_POINTS = 19,
172         EXEC_INPUT_LINES = 20,
173         EXEC_INPUT_LINES_ADJACENCY = 21,
174         EXEC_TRIANGLES = 22,
175         EXEC_INPUT_TRIANGLES_ADJACENCY = 23,
176         EXEC_OUTPUT_VERTICES = 26,
177         EXEC_OUTPUT_POINTS = 27,
178         EXEC_OUTPUT_LINE_STRIP = 28,
179         EXEC_OUTPUT_TRIANGLE_STRIP = 29
180 };
181
182 enum SpirVStorageClass
183 {
184         STORAGE_UNIFORM_CONSTANT = 0,
185         STORAGE_INPUT = 1,
186         STORAGE_UNIFORM = 2,
187         STORAGE_OUTPUT = 3,
188         STORAGE_PRIVATE = 6,
189         STORAGE_FUNCTION = 7
190 };
191
192 enum SpirVDecoration
193 {
194         DECO_SPEC_ID = 1,
195         DECO_BLOCK = 2,
196         DECO_ROW_MAJOR = 4,
197         DECO_COL_MAJOR = 5,
198         DECO_ARRAY_STRIDE = 6,
199         DECO_MATRIX_STRIDE = 7,
200         DECO_BUILTIN = 11,
201         DECO_LOCATION = 30,
202         DECO_BINDING = 33,
203         DECO_DESCRIPTOR_SET = 34,
204         DECO_OFFSET = 35
205 };
206
207 enum SpirVBuiltin
208 {
209         BUILTIN_POSITION = 0,
210         BUILTIN_POINT_SIZE = 1,
211         BUILTIN_CLIP_DISTANCE = 3,
212         BUILTIN_VERTEX_ID = 5,
213         BUILTIN_INSTANCE_ID = 6,
214         BUILTIN_PRIMITIVE_ID = 7,
215         BUILTIN_INVOCATION_ID = 8,
216         BUILTIN_LAYER = 9,
217         BUILTIN_FRAG_COORD = 15,
218         BUILTIN_POINT_COORD = 16,
219         BUILTIN_FRONT_FACING = 17,
220         BUILTIN_SAMPLE_ID = 18,
221         BUILTIN_SAMPLE_POSITION = 19,
222         BUILTIN_FRAG_DEPTH = 22
223 };
224
225 enum SpirVGlslStd450Opcode
226 {
227         GLSL450_ROUND = 1,
228         GLSL450_ROUND_EVEN = 2,
229         GLSL450_TRUNC = 3,
230         GLSL450_F_ABS = 4,
231         GLSL450_S_ABS = 5,
232         GLSL450_F_SIGN = 6,
233         GLSL450_S_SIGN = 7,
234         GLSL450_FLOOR = 8,
235         GLSL450_CEIL = 9,
236         GLSL450_FRACT = 10,
237         GLSL450_RADIANS = 11,
238         GLSL450_DEGREES = 12,
239         GLSL450_SIN = 13,
240         GLSL450_COS = 14,
241         GLSL450_TAN = 15,
242         GLSL450_ASIN = 16,
243         GLSL450_ACOS = 17,
244         GLSL450_ATAN = 18,
245         GLSL450_SINH = 19,
246         GLSL450_COSH = 20,
247         GLSL450_TANH = 21,
248         GLSL450_ASINH = 22,
249         GLSL450_ACOSH = 23,
250         GLSL450_ATANH = 24,
251         GLSL450_ATAN2 = 25,
252         GLSL450_POW = 26,
253         GLSL450_EXP = 27,
254         GLSL450_LOG = 28,
255         GLSL450_EXP2 = 29,
256         GLSL450_LOG2 = 30,
257         GLSL450_SQRT = 31,
258         GLSL450_INVERSE_SQRT = 32,
259         GLSL450_DETERMINANT = 33,
260         GLSL450_MATRIX_INVERSE = 34,
261         GLSL450_F_MIN = 37,
262         GLSL450_U_MIN = 38,
263         GLSL450_S_MIN = 39,
264         GLSL450_F_MAX = 40,
265         GLSL450_U_MAX = 41,
266         GLSL450_S_MAX = 42,
267         GLSL450_F_CLAMP = 43,
268         GLSL450_U_CLAMP = 44,
269         GLSL450_S_CLAMP = 45,
270         GLSL450_F_MIX = 46,
271         GLSL450_F_STEP = 48,
272         GLSL450_F_SMOOTH_STEP = 49,
273         GLSL450_F_FMA = 50,
274         GLSL450_LENGTH = 66,
275         GLSL450_DISTANCE = 67,
276         GLSL450_CROSS = 68,
277         GLSL450_NORMALIZE = 69,
278         GLSL450_FACE_FORWARD = 70,
279         GLSL450_REFLECT = 71,
280         GLSL450_REFRACT = 72,
281         GLSL450_FIND_I_LSB = 73,
282         GLSL450_FIND_S_MSB = 74,
283         GLSL450_FIND_U_MSB = 75,
284         GLSL450_INTERPOLATE_AT_CENTROID = 76,
285         GLSL450_INTERPOLATE_AT_SAMPLE = 77,
286         GLSL450_INTERPOLATE_AT_OFFSET = 78
287 };
288
289 } // namespace SL
290 } // namespace GL
291 } // namespace Msp
292
293 #endif