1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #ifndef SHADER_ENUMS_H
27 #define SHADER_ENUMS_H
28
29 #include <stdbool.h>
30
31 /* Project-wide (GL and Vulkan) maximum. */
32 #define MAX_DRAW_BUFFERS 8
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /**
39 * Shader stages.
40 *
41 * The order must match how shaders are ordered in the pipeline.
42 * The GLSL linker assumes that if i<j, then the j-th shader is
43 * executed later than the i-th shader.
44 */
45 typedef enum
46 {
47 MESA_SHADER_NONE = -1,
48 MESA_SHADER_VERTEX = 0,
49 MESA_SHADER_TESS_CTRL = 1,
50 MESA_SHADER_TESS_EVAL = 2,
51 MESA_SHADER_GEOMETRY = 3,
52 MESA_SHADER_FRAGMENT = 4,
53 MESA_SHADER_COMPUTE = 5,
54
55 /* Vulkan-only stages. */
56 MESA_SHADER_TASK = 6,
57 MESA_SHADER_MESH = 7,
58 MESA_SHADER_RAYGEN = 8,
59 MESA_SHADER_ANY_HIT = 9,
60 MESA_SHADER_CLOSEST_HIT = 10,
61 MESA_SHADER_MISS = 11,
62 MESA_SHADER_INTERSECTION = 12,
63 MESA_SHADER_CALLABLE = 13,
64
65 /* must be last so it doesn't affect the GL pipeline */
66 MESA_SHADER_KERNEL = 14,
67 } gl_shader_stage;
68
69 static inline bool
gl_shader_stage_is_compute(gl_shader_stage stage)70 gl_shader_stage_is_compute(gl_shader_stage stage)
71 {
72 return stage == MESA_SHADER_COMPUTE || stage == MESA_SHADER_KERNEL;
73 }
74
75 static inline bool
gl_shader_stage_uses_workgroup(gl_shader_stage stage)76 gl_shader_stage_uses_workgroup(gl_shader_stage stage)
77 {
78 return stage == MESA_SHADER_COMPUTE ||
79 stage == MESA_SHADER_KERNEL ||
80 stage == MESA_SHADER_TASK ||
81 stage == MESA_SHADER_MESH;
82 }
83
84 static inline bool
gl_shader_stage_is_callable(gl_shader_stage stage)85 gl_shader_stage_is_callable(gl_shader_stage stage)
86 {
87 return stage == MESA_SHADER_ANY_HIT ||
88 stage == MESA_SHADER_CLOSEST_HIT ||
89 stage == MESA_SHADER_MISS ||
90 stage == MESA_SHADER_INTERSECTION ||
91 stage == MESA_SHADER_CALLABLE;
92 }
93
94 /**
95 * Number of STATE_* values we need to address any GL state.
96 * Used to dimension arrays.
97 */
98 #define STATE_LENGTH 4
99
100 typedef short gl_state_index16; /* see enum gl_state_index */
101
102 const char *gl_shader_stage_name(gl_shader_stage stage);
103
104 /**
105 * Translate a gl_shader_stage to a short shader stage name for debug
106 * printouts and error messages.
107 */
108 const char *_mesa_shader_stage_to_string(unsigned stage);
109
110 /**
111 * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
112 * for debug printouts and error messages.
113 */
114 const char *_mesa_shader_stage_to_abbrev(unsigned stage);
115
116 /**
117 * GL related stages (not including CL)
118 */
119 #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1)
120
121 /**
122 * Vulkan stages (not including CL)
123 */
124 #define MESA_VULKAN_SHADER_STAGES (MESA_SHADER_CALLABLE + 1)
125
126 /**
127 * All stages
128 */
129 #define MESA_ALL_SHADER_STAGES (MESA_SHADER_KERNEL + 1)
130
131
132 /**
133 * Indexes for vertex program attributes.
134 * GL_NV_vertex_program aliases generic attributes over the conventional
135 * attributes. In GL_ARB_vertex_program shader the aliasing is optional.
136 * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
137 * generic attributes are distinct/separate).
138 */
139 typedef enum
140 {
141 VERT_ATTRIB_POS,
142 VERT_ATTRIB_NORMAL,
143 VERT_ATTRIB_COLOR0,
144 VERT_ATTRIB_COLOR1,
145 VERT_ATTRIB_FOG,
146 VERT_ATTRIB_COLOR_INDEX,
147 VERT_ATTRIB_TEX0,
148 VERT_ATTRIB_TEX1,
149 VERT_ATTRIB_TEX2,
150 VERT_ATTRIB_TEX3,
151 VERT_ATTRIB_TEX4,
152 VERT_ATTRIB_TEX5,
153 VERT_ATTRIB_TEX6,
154 VERT_ATTRIB_TEX7,
155 VERT_ATTRIB_POINT_SIZE,
156 VERT_ATTRIB_GENERIC0,
157 VERT_ATTRIB_GENERIC1,
158 VERT_ATTRIB_GENERIC2,
159 VERT_ATTRIB_GENERIC3,
160 VERT_ATTRIB_GENERIC4,
161 VERT_ATTRIB_GENERIC5,
162 VERT_ATTRIB_GENERIC6,
163 VERT_ATTRIB_GENERIC7,
164 VERT_ATTRIB_GENERIC8,
165 VERT_ATTRIB_GENERIC9,
166 VERT_ATTRIB_GENERIC10,
167 VERT_ATTRIB_GENERIC11,
168 VERT_ATTRIB_GENERIC12,
169 VERT_ATTRIB_GENERIC13,
170 VERT_ATTRIB_GENERIC14,
171 VERT_ATTRIB_GENERIC15,
172 /* This must be last to keep VS inputs and vertex attributes in the same
173 * order in st/mesa, and st/mesa always adds edgeflags as the last input.
174 */
175 VERT_ATTRIB_EDGEFLAG,
176 VERT_ATTRIB_MAX
177 } gl_vert_attrib;
178
179 const char *gl_vert_attrib_name(gl_vert_attrib attrib);
180
181 /**
182 * Max number of texture coordinate units. This mainly just applies to
183 * the fixed-function vertex code. This will be difficult to raise above
184 * eight because of various vertex attribute bitvectors.
185 */
186 #define MAX_TEXTURE_COORD_UNITS 8
187 #define MAX_VERTEX_GENERIC_ATTRIBS 16
188
189 /**
190 * Symbolic constats to help iterating over
191 * specific blocks of vertex attributes.
192 *
193 * VERT_ATTRIB_TEX
194 * include the classic texture coordinate attributes.
195 * VERT_ATTRIB_GENERIC
196 * include the OpenGL 2.0+ GLSL generic shader attributes.
197 * These alias the generic GL_ARB_vertex_shader attributes.
198 * VERT_ATTRIB_MAT
199 * include the generic shader attributes used to alias
200 * varying material values for the TNL shader programs.
201 * They are located at the end of the generic attribute
202 * block not to overlap with the generic 0 attribute.
203 */
204 #define VERT_ATTRIB_TEX(i) (VERT_ATTRIB_TEX0 + (i))
205 #define VERT_ATTRIB_TEX_MAX MAX_TEXTURE_COORD_UNITS
206
207 #define VERT_ATTRIB_GENERIC(i) (VERT_ATTRIB_GENERIC0 + (i))
208 #define VERT_ATTRIB_GENERIC_MAX MAX_VERTEX_GENERIC_ATTRIBS
209
210 #define VERT_ATTRIB_MAT0 \
211 (VERT_ATTRIB_GENERIC_MAX - VERT_ATTRIB_MAT_MAX)
212 #define VERT_ATTRIB_MAT(i) \
213 VERT_ATTRIB_GENERIC((i) + VERT_ATTRIB_MAT0)
214 #define VERT_ATTRIB_MAT_MAX MAT_ATTRIB_MAX
215
216 /**
217 * Bitflags for vertex attributes.
218 * These are used in bitfields in many places.
219 */
220 /*@{*/
221 #define VERT_BIT_POS BITFIELD_BIT(VERT_ATTRIB_POS)
222 #define VERT_BIT_NORMAL BITFIELD_BIT(VERT_ATTRIB_NORMAL)
223 #define VERT_BIT_COLOR0 BITFIELD_BIT(VERT_ATTRIB_COLOR0)
224 #define VERT_BIT_COLOR1 BITFIELD_BIT(VERT_ATTRIB_COLOR1)
225 #define VERT_BIT_FOG BITFIELD_BIT(VERT_ATTRIB_FOG)
226 #define VERT_BIT_COLOR_INDEX BITFIELD_BIT(VERT_ATTRIB_COLOR_INDEX)
227 #define VERT_BIT_TEX0 BITFIELD_BIT(VERT_ATTRIB_TEX0)
228 #define VERT_BIT_TEX1 BITFIELD_BIT(VERT_ATTRIB_TEX1)
229 #define VERT_BIT_TEX2 BITFIELD_BIT(VERT_ATTRIB_TEX2)
230 #define VERT_BIT_TEX3 BITFIELD_BIT(VERT_ATTRIB_TEX3)
231 #define VERT_BIT_TEX4 BITFIELD_BIT(VERT_ATTRIB_TEX4)
232 #define VERT_BIT_TEX5 BITFIELD_BIT(VERT_ATTRIB_TEX5)
233 #define VERT_BIT_TEX6 BITFIELD_BIT(VERT_ATTRIB_TEX6)
234 #define VERT_BIT_TEX7 BITFIELD_BIT(VERT_ATTRIB_TEX7)
235 #define VERT_BIT_POINT_SIZE BITFIELD_BIT(VERT_ATTRIB_POINT_SIZE)
236 #define VERT_BIT_GENERIC0 BITFIELD_BIT(VERT_ATTRIB_GENERIC0)
237 #define VERT_BIT_EDGEFLAG BITFIELD_BIT(VERT_ATTRIB_EDGEFLAG)
238
239 #define VERT_BIT(i) BITFIELD_BIT(i)
240 #define VERT_BIT_ALL BITFIELD_RANGE(0, VERT_ATTRIB_MAX)
241
242 #define VERT_BIT_FF_ALL (BITFIELD_RANGE(0, VERT_ATTRIB_GENERIC0) | \
243 VERT_BIT_EDGEFLAG)
244 #define VERT_BIT_TEX(i) VERT_BIT(VERT_ATTRIB_TEX(i))
245 #define VERT_BIT_TEX_ALL \
246 BITFIELD_RANGE(VERT_ATTRIB_TEX(0), VERT_ATTRIB_TEX_MAX)
247
248 #define VERT_BIT_GENERIC(i) VERT_BIT(VERT_ATTRIB_GENERIC(i))
249 #define VERT_BIT_GENERIC_ALL \
250 BITFIELD_RANGE(VERT_ATTRIB_GENERIC(0), VERT_ATTRIB_GENERIC_MAX)
251
252 #define VERT_BIT_MAT(i) VERT_BIT(VERT_ATTRIB_MAT(i))
253 #define VERT_BIT_MAT_ALL \
254 BITFIELD_RANGE(VERT_ATTRIB_MAT(0), VERT_ATTRIB_MAT_MAX)
255 /*@}*/
256
257 #define MAX_VARYING 32 /**< number of float[4] vectors */
258
259 /**
260 * Indexes for vertex shader outputs, geometry shader inputs/outputs, and
261 * fragment shader inputs.
262 *
263 * Note that some of these values are not available to all pipeline stages.
264 *
265 * When this enum is updated, the following code must be updated too:
266 * - vertResults (in prog_print.c's arb_output_attrib_string())
267 * - fragAttribs (in prog_print.c's arb_input_attrib_string())
268 * - _mesa_varying_slot_in_fs()
269 * - _mesa_varying_slot_name_for_stage()
270 */
271 typedef enum
272 {
273 VARYING_SLOT_POS,
274 VARYING_SLOT_COL0, /* COL0 and COL1 must be contiguous */
275 VARYING_SLOT_COL1,
276 VARYING_SLOT_FOGC,
277 VARYING_SLOT_TEX0, /* TEX0-TEX7 must be contiguous */
278 VARYING_SLOT_TEX1,
279 VARYING_SLOT_TEX2,
280 VARYING_SLOT_TEX3,
281 VARYING_SLOT_TEX4,
282 VARYING_SLOT_TEX5,
283 VARYING_SLOT_TEX6,
284 VARYING_SLOT_TEX7,
285 VARYING_SLOT_PSIZ, /* Does not appear in FS */
286 VARYING_SLOT_BFC0, /* Does not appear in FS */
287 VARYING_SLOT_BFC1, /* Does not appear in FS */
288 VARYING_SLOT_EDGE, /* Does not appear in FS */
289 VARYING_SLOT_CLIP_VERTEX, /* Does not appear in FS */
290 VARYING_SLOT_CLIP_DIST0,
291 VARYING_SLOT_CLIP_DIST1,
292 VARYING_SLOT_CULL_DIST0,
293 VARYING_SLOT_CULL_DIST1,
294 VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */
295 VARYING_SLOT_LAYER, /* Appears as VS or GS output */
296 VARYING_SLOT_VIEWPORT, /* Appears as VS or GS output */
297 VARYING_SLOT_FACE, /* FS only */
298 VARYING_SLOT_PNTC, /* FS only */
299 VARYING_SLOT_TESS_LEVEL_OUTER, /* Only appears as TCS output. */
300 VARYING_SLOT_TESS_LEVEL_INNER, /* Only appears as TCS output. */
301 VARYING_SLOT_BOUNDING_BOX0, /* Only appears as TCS output. */
302 VARYING_SLOT_BOUNDING_BOX1, /* Only appears as TCS output. */
303 VARYING_SLOT_VIEW_INDEX,
304 VARYING_SLOT_VIEWPORT_MASK, /* Does not appear in FS */
305 VARYING_SLOT_PRIMITIVE_SHADING_RATE = VARYING_SLOT_FACE, /* Does not appear in FS. */
306
307 VARYING_SLOT_PRIMITIVE_COUNT = VARYING_SLOT_TESS_LEVEL_OUTER, /* Only appears in MESH. */
308 VARYING_SLOT_PRIMITIVE_INDICES = VARYING_SLOT_TESS_LEVEL_INNER, /* Only appears in MESH. */
309 VARYING_SLOT_TASK_COUNT = VARYING_SLOT_BOUNDING_BOX0, /* Only appears in TASK. */
310
311 VARYING_SLOT_VAR0 = 32, /* First generic varying slot */
312 /* the remaining are simply for the benefit of gl_varying_slot_name()
313 * and not to be construed as an upper bound:
314 */
315 VARYING_SLOT_VAR1,
316 VARYING_SLOT_VAR2,
317 VARYING_SLOT_VAR3,
318 VARYING_SLOT_VAR4,
319 VARYING_SLOT_VAR5,
320 VARYING_SLOT_VAR6,
321 VARYING_SLOT_VAR7,
322 VARYING_SLOT_VAR8,
323 VARYING_SLOT_VAR9,
324 VARYING_SLOT_VAR10,
325 VARYING_SLOT_VAR11,
326 VARYING_SLOT_VAR12,
327 VARYING_SLOT_VAR13,
328 VARYING_SLOT_VAR14,
329 VARYING_SLOT_VAR15,
330 VARYING_SLOT_VAR16,
331 VARYING_SLOT_VAR17,
332 VARYING_SLOT_VAR18,
333 VARYING_SLOT_VAR19,
334 VARYING_SLOT_VAR20,
335 VARYING_SLOT_VAR21,
336 VARYING_SLOT_VAR22,
337 VARYING_SLOT_VAR23,
338 VARYING_SLOT_VAR24,
339 VARYING_SLOT_VAR25,
340 VARYING_SLOT_VAR26,
341 VARYING_SLOT_VAR27,
342 VARYING_SLOT_VAR28,
343 VARYING_SLOT_VAR29,
344 VARYING_SLOT_VAR30,
345 VARYING_SLOT_VAR31,
346 /* Per-patch varyings for tessellation. */
347 VARYING_SLOT_PATCH0,
348 VARYING_SLOT_PATCH1,
349 VARYING_SLOT_PATCH2,
350 VARYING_SLOT_PATCH3,
351 VARYING_SLOT_PATCH4,
352 VARYING_SLOT_PATCH5,
353 VARYING_SLOT_PATCH6,
354 VARYING_SLOT_PATCH7,
355 VARYING_SLOT_PATCH8,
356 VARYING_SLOT_PATCH9,
357 VARYING_SLOT_PATCH10,
358 VARYING_SLOT_PATCH11,
359 VARYING_SLOT_PATCH12,
360 VARYING_SLOT_PATCH13,
361 VARYING_SLOT_PATCH14,
362 VARYING_SLOT_PATCH15,
363 VARYING_SLOT_PATCH16,
364 VARYING_SLOT_PATCH17,
365 VARYING_SLOT_PATCH18,
366 VARYING_SLOT_PATCH19,
367 VARYING_SLOT_PATCH20,
368 VARYING_SLOT_PATCH21,
369 VARYING_SLOT_PATCH22,
370 VARYING_SLOT_PATCH23,
371 VARYING_SLOT_PATCH24,
372 VARYING_SLOT_PATCH25,
373 VARYING_SLOT_PATCH26,
374 VARYING_SLOT_PATCH27,
375 VARYING_SLOT_PATCH28,
376 VARYING_SLOT_PATCH29,
377 VARYING_SLOT_PATCH30,
378 VARYING_SLOT_PATCH31,
379 /* 32 16-bit vec4 slots packed in 16 32-bit vec4 slots for GLES/mediump.
380 * They are really just additional generic slots used for 16-bit data to
381 * prevent conflicts between neighboring mediump and non-mediump varyings
382 * that can't be packed without breaking one or the other, which is
383 * a limitation of separate shaders. This allows linking shaders in 32 bits
384 * and then get an optimally packed 16-bit varyings by remapping the IO
385 * locations to these slots. The remapping can also be undone trivially.
386 *
387 * nir_io_semantics::high_16bit determines which half of the slot is
388 * accessed. The low and high halves share the same IO "base" number.
389 * Drivers can treat these as 32-bit slots everywhere except for FP16
390 * interpolation.
391 */
392 VARYING_SLOT_VAR0_16BIT,
393 VARYING_SLOT_VAR1_16BIT,
394 VARYING_SLOT_VAR2_16BIT,
395 VARYING_SLOT_VAR3_16BIT,
396 VARYING_SLOT_VAR4_16BIT,
397 VARYING_SLOT_VAR5_16BIT,
398 VARYING_SLOT_VAR6_16BIT,
399 VARYING_SLOT_VAR7_16BIT,
400 VARYING_SLOT_VAR8_16BIT,
401 VARYING_SLOT_VAR9_16BIT,
402 VARYING_SLOT_VAR10_16BIT,
403 VARYING_SLOT_VAR11_16BIT,
404 VARYING_SLOT_VAR12_16BIT,
405 VARYING_SLOT_VAR13_16BIT,
406 VARYING_SLOT_VAR14_16BIT,
407 VARYING_SLOT_VAR15_16BIT,
408
409 NUM_TOTAL_VARYING_SLOTS,
410 } gl_varying_slot;
411
412
413 #define VARYING_SLOT_MAX (VARYING_SLOT_VAR0 + MAX_VARYING)
414 #define VARYING_SLOT_TESS_MAX (VARYING_SLOT_PATCH0 + MAX_VARYING)
415 #define MAX_VARYINGS_INCL_PATCH (VARYING_SLOT_TESS_MAX - VARYING_SLOT_VAR0)
416
417 const char *gl_varying_slot_name_for_stage(gl_varying_slot slot,
418 gl_shader_stage stage);
419
420
421 /**
422 * Bitflags for varying slots.
423 */
424 /*@{*/
425 #define VARYING_BIT_POS BITFIELD64_BIT(VARYING_SLOT_POS)
426 #define VARYING_BIT_COL0 BITFIELD64_BIT(VARYING_SLOT_COL0)
427 #define VARYING_BIT_COL1 BITFIELD64_BIT(VARYING_SLOT_COL1)
428 #define VARYING_BIT_FOGC BITFIELD64_BIT(VARYING_SLOT_FOGC)
429 #define VARYING_BIT_TEX0 BITFIELD64_BIT(VARYING_SLOT_TEX0)
430 #define VARYING_BIT_TEX1 BITFIELD64_BIT(VARYING_SLOT_TEX1)
431 #define VARYING_BIT_TEX2 BITFIELD64_BIT(VARYING_SLOT_TEX2)
432 #define VARYING_BIT_TEX3 BITFIELD64_BIT(VARYING_SLOT_TEX3)
433 #define VARYING_BIT_TEX4 BITFIELD64_BIT(VARYING_SLOT_TEX4)
434 #define VARYING_BIT_TEX5 BITFIELD64_BIT(VARYING_SLOT_TEX5)
435 #define VARYING_BIT_TEX6 BITFIELD64_BIT(VARYING_SLOT_TEX6)
436 #define VARYING_BIT_TEX7 BITFIELD64_BIT(VARYING_SLOT_TEX7)
437 #define VARYING_BIT_TEX(U) BITFIELD64_BIT(VARYING_SLOT_TEX0 + (U))
438 #define VARYING_BITS_TEX_ANY BITFIELD64_RANGE(VARYING_SLOT_TEX0, \
439 MAX_TEXTURE_COORD_UNITS)
440 #define VARYING_BIT_PSIZ BITFIELD64_BIT(VARYING_SLOT_PSIZ)
441 #define VARYING_BIT_BFC0 BITFIELD64_BIT(VARYING_SLOT_BFC0)
442 #define VARYING_BIT_BFC1 BITFIELD64_BIT(VARYING_SLOT_BFC1)
443 #define VARYING_BITS_COLOR (VARYING_BIT_COL0 | \
444 VARYING_BIT_COL1 | \
445 VARYING_BIT_BFC0 | \
446 VARYING_BIT_BFC1)
447 #define VARYING_BIT_EDGE BITFIELD64_BIT(VARYING_SLOT_EDGE)
448 #define VARYING_BIT_CLIP_VERTEX BITFIELD64_BIT(VARYING_SLOT_CLIP_VERTEX)
449 #define VARYING_BIT_CLIP_DIST0 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0)
450 #define VARYING_BIT_CLIP_DIST1 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1)
451 #define VARYING_BIT_CULL_DIST0 BITFIELD64_BIT(VARYING_SLOT_CULL_DIST0)
452 #define VARYING_BIT_CULL_DIST1 BITFIELD64_BIT(VARYING_SLOT_CULL_DIST1)
453 #define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID)
454 #define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER)
455 #define VARYING_BIT_VIEWPORT BITFIELD64_BIT(VARYING_SLOT_VIEWPORT)
456 #define VARYING_BIT_FACE BITFIELD64_BIT(VARYING_SLOT_FACE)
457 #define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC)
458 #define VARYING_BIT_TESS_LEVEL_OUTER BITFIELD64_BIT(VARYING_SLOT_TESS_LEVEL_OUTER)
459 #define VARYING_BIT_TESS_LEVEL_INNER BITFIELD64_BIT(VARYING_SLOT_TESS_LEVEL_INNER)
460 #define VARYING_BIT_BOUNDING_BOX0 BITFIELD64_BIT(VARYING_SLOT_BOUNDING_BOX0)
461 #define VARYING_BIT_BOUNDING_BOX1 BITFIELD64_BIT(VARYING_SLOT_BOUNDING_BOX1)
462 #define VARYING_BIT_VIEWPORT_MASK BITFIELD64_BIT(VARYING_SLOT_VIEWPORT_MASK)
463 #define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
464 /*@}*/
465
466 /**
467 * If the gl_register_file is PROGRAM_SYSTEM_VALUE, the register index will be
468 * one of these values. If a NIR variable's mode is nir_var_system_value, it
469 * will be one of these values.
470 */
471 typedef enum
472 {
473 /**
474 * \name System values applicable to all shaders
475 */
476 /*@{*/
477
478 /**
479 * Builtin variables added by GL_ARB_shader_ballot.
480 */
481 /*@{*/
482
483 /**
484 * From the GL_ARB_shader-ballot spec:
485 *
486 * "A sub-group is a collection of invocations which execute in lockstep.
487 * The variable <gl_SubGroupSizeARB> is the maximum number of
488 * invocations in a sub-group. The maximum <gl_SubGroupSizeARB>
489 * supported in this extension is 64."
490 *
491 * The spec defines this as a uniform. However, it's highly unlikely that
492 * implementations actually treat it as a uniform (which is loaded from a
493 * constant buffer). Most likely, this is an implementation-wide constant,
494 * or perhaps something that depends on the shader stage.
495 */
496 SYSTEM_VALUE_SUBGROUP_SIZE,
497
498 /**
499 * From the GL_ARB_shader_ballot spec:
500 *
501 * "The variable <gl_SubGroupInvocationARB> holds the index of the
502 * invocation within sub-group. This variable is in the range 0 to
503 * <gl_SubGroupSizeARB>-1, where <gl_SubGroupSizeARB> is the total
504 * number of invocations in a sub-group."
505 */
506 SYSTEM_VALUE_SUBGROUP_INVOCATION,
507
508 /**
509 * From the GL_ARB_shader_ballot spec:
510 *
511 * "The <gl_SubGroup??MaskARB> variables provide a bitmask for all
512 * invocations, with one bit per invocation starting with the least
513 * significant bit, according to the following table,
514 *
515 * variable equation for bit values
516 * -------------------- ------------------------------------
517 * gl_SubGroupEqMaskARB bit index == gl_SubGroupInvocationARB
518 * gl_SubGroupGeMaskARB bit index >= gl_SubGroupInvocationARB
519 * gl_SubGroupGtMaskARB bit index > gl_SubGroupInvocationARB
520 * gl_SubGroupLeMaskARB bit index <= gl_SubGroupInvocationARB
521 * gl_SubGroupLtMaskARB bit index < gl_SubGroupInvocationARB
522 */
523 SYSTEM_VALUE_SUBGROUP_EQ_MASK,
524 SYSTEM_VALUE_SUBGROUP_GE_MASK,
525 SYSTEM_VALUE_SUBGROUP_GT_MASK,
526 SYSTEM_VALUE_SUBGROUP_LE_MASK,
527 SYSTEM_VALUE_SUBGROUP_LT_MASK,
528 /*@}*/
529
530 /**
531 * Builtin variables added by VK_KHR_subgroups
532 */
533 /*@{*/
534 SYSTEM_VALUE_NUM_SUBGROUPS,
535 SYSTEM_VALUE_SUBGROUP_ID,
536 /*@}*/
537
538 /*@}*/
539
540 /**
541 * \name Vertex shader system values
542 */
543 /*@{*/
544 /**
545 * OpenGL-style vertex ID.
546 *
547 * Section 2.11.7 (Shader Execution), subsection Shader Inputs, of the
548 * OpenGL 3.3 core profile spec says:
549 *
550 * "gl_VertexID holds the integer index i implicitly passed by
551 * DrawArrays or one of the other drawing commands defined in section
552 * 2.8.3."
553 *
554 * Section 2.8.3 (Drawing Commands) of the same spec says:
555 *
556 * "The commands....are equivalent to the commands with the same base
557 * name (without the BaseVertex suffix), except that the ith element
558 * transferred by the corresponding draw call will be taken from
559 * element indices[i] + basevertex of each enabled array."
560 *
561 * Additionally, the overview in the GL_ARB_shader_draw_parameters spec
562 * says:
563 *
564 * "In unextended GL, vertex shaders have inputs named gl_VertexID and
565 * gl_InstanceID, which contain, respectively the index of the vertex
566 * and instance. The value of gl_VertexID is the implicitly passed
567 * index of the vertex being processed, which includes the value of
568 * baseVertex, for those commands that accept it."
569 *
570 * gl_VertexID gets basevertex added in. This differs from DirectX where
571 * SV_VertexID does \b not get basevertex added in.
572 *
573 * \note
574 * If all system values are available, \c SYSTEM_VALUE_VERTEX_ID will be
575 * equal to \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus
576 * \c SYSTEM_VALUE_BASE_VERTEX.
577 *
578 * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_BASE_VERTEX
579 */
580 SYSTEM_VALUE_VERTEX_ID,
581
582 /**
583 * Instanced ID as supplied to gl_InstanceID
584 *
585 * Values assigned to gl_InstanceID always begin with zero, regardless of
586 * the value of baseinstance.
587 *
588 * Section 11.1.3.9 (Shader Inputs) of the OpenGL 4.4 core profile spec
589 * says:
590 *
591 * "gl_InstanceID holds the integer instance number of the current
592 * primitive in an instanced draw call (see section 10.5)."
593 *
594 * Through a big chain of pseudocode, section 10.5 describes that
595 * baseinstance is not counted by gl_InstanceID. In that section, notice
596 *
597 * "If an enabled vertex attribute array is instanced (it has a
598 * non-zero divisor as specified by VertexAttribDivisor), the element
599 * index that is transferred to the GL, for all vertices, is given by
600 *
601 * floor(instance/divisor) + baseinstance
602 *
603 * If an array corresponding to an attribute required by a vertex
604 * shader is not enabled, then the corresponding element is taken from
605 * the current attribute state (see section 10.2)."
606 *
607 * Note that baseinstance is \b not included in the value of instance.
608 */
609 SYSTEM_VALUE_INSTANCE_ID,
610
611 /**
612 * Vulkan InstanceIndex.
613 *
614 * InstanceIndex = gl_InstanceID + gl_BaseInstance
615 */
616 SYSTEM_VALUE_INSTANCE_INDEX,
617
618 /**
619 * DirectX-style vertex ID.
620 *
621 * Unlike \c SYSTEM_VALUE_VERTEX_ID, this system value does \b not include
622 * the value of basevertex.
623 *
624 * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX
625 */
626 SYSTEM_VALUE_VERTEX_ID_ZERO_BASE,
627
628 /**
629 * Value of \c basevertex passed to \c glDrawElementsBaseVertex and similar
630 * functions.
631 *
632 * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
633 */
634 SYSTEM_VALUE_BASE_VERTEX,
635
636 /**
637 * Depending on the type of the draw call (indexed or non-indexed),
638 * is the value of \c basevertex passed to \c glDrawElementsBaseVertex and
639 * similar, or is the value of \c first passed to \c glDrawArrays and
640 * similar.
641 *
642 * \note
643 * It can be used to calculate the \c SYSTEM_VALUE_VERTEX_ID as
644 * \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus \c SYSTEM_VALUE_FIRST_VERTEX.
645 *
646 * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_VERTEX_ID
647 */
648 SYSTEM_VALUE_FIRST_VERTEX,
649
650 /**
651 * If the Draw command used to start the rendering was an indexed draw
652 * or not (~0/0). Useful to calculate \c SYSTEM_VALUE_BASE_VERTEX as
653 * \c SYSTEM_VALUE_IS_INDEXED_DRAW & \c SYSTEM_VALUE_FIRST_VERTEX.
654 */
655 SYSTEM_VALUE_IS_INDEXED_DRAW,
656
657 /**
658 * Value of \c baseinstance passed to instanced draw entry points
659 *
660 * \sa SYSTEM_VALUE_INSTANCE_ID
661 */
662 SYSTEM_VALUE_BASE_INSTANCE,
663
664 /**
665 * From _ARB_shader_draw_parameters:
666 *
667 * "Additionally, this extension adds a further built-in variable,
668 * gl_DrawID to the shading language. This variable contains the index
669 * of the draw currently being processed by a Multi* variant of a
670 * drawing command (such as MultiDrawElements or
671 * MultiDrawArraysIndirect)."
672 *
673 * If GL_ARB_multi_draw_indirect is not supported, this is always 0.
674 */
675 SYSTEM_VALUE_DRAW_ID,
676 /*@}*/
677
678 /**
679 * \name Geometry shader system values
680 */
681 /*@{*/
682 SYSTEM_VALUE_INVOCATION_ID, /**< (Also in Tessellation Control shader) */
683 /*@}*/
684
685 /**
686 * \name Fragment shader system values
687 */
688 /*@{*/
689 SYSTEM_VALUE_FRAG_COORD,
690 SYSTEM_VALUE_POINT_COORD,
691 SYSTEM_VALUE_LINE_COORD, /**< Coord along axis perpendicular to line */
692 SYSTEM_VALUE_FRONT_FACE,
693 SYSTEM_VALUE_SAMPLE_ID,
694 SYSTEM_VALUE_SAMPLE_POS,
695 SYSTEM_VALUE_SAMPLE_MASK_IN,
696 SYSTEM_VALUE_HELPER_INVOCATION,
697 SYSTEM_VALUE_COLOR0,
698 SYSTEM_VALUE_COLOR1,
699 /*@}*/
700
701 /**
702 * \name Tessellation Evaluation shader system values
703 */
704 /*@{*/
705 SYSTEM_VALUE_TESS_COORD,
706 SYSTEM_VALUE_VERTICES_IN, /**< Tessellation vertices in input patch */
707 SYSTEM_VALUE_PRIMITIVE_ID,
708 SYSTEM_VALUE_TESS_LEVEL_OUTER, /**< TES input */
709 SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */
710 SYSTEM_VALUE_TESS_LEVEL_OUTER_DEFAULT, /**< TCS input for passthru TCS */
711 SYSTEM_VALUE_TESS_LEVEL_INNER_DEFAULT, /**< TCS input for passthru TCS */
712 /*@}*/
713
714 /**
715 * \name Compute shader system values
716 */
717 /*@{*/
718 SYSTEM_VALUE_LOCAL_INVOCATION_ID,
719 SYSTEM_VALUE_LOCAL_INVOCATION_INDEX,
720 SYSTEM_VALUE_GLOBAL_INVOCATION_ID,
721 SYSTEM_VALUE_BASE_GLOBAL_INVOCATION_ID,
722 SYSTEM_VALUE_GLOBAL_INVOCATION_INDEX,
723 SYSTEM_VALUE_WORKGROUP_ID,
724 SYSTEM_VALUE_NUM_WORKGROUPS,
725 SYSTEM_VALUE_WORKGROUP_SIZE,
726 SYSTEM_VALUE_GLOBAL_GROUP_SIZE,
727 SYSTEM_VALUE_WORK_DIM,
728 SYSTEM_VALUE_USER_DATA_AMD,
729 /*@}*/
730
731 /** Required for VK_KHR_device_group */
732 SYSTEM_VALUE_DEVICE_INDEX,
733
734 /** Required for VK_KHX_multiview */
735 SYSTEM_VALUE_VIEW_INDEX,
736
737 /**
738 * Driver internal vertex-count, used (for example) for drivers to
739 * calculate stride for stream-out outputs. Not externally visible.
740 */
741 SYSTEM_VALUE_VERTEX_CNT,
742
743 /**
744 * Required for AMD_shader_explicit_vertex_parameter and also used for
745 * varying-fetch instructions.
746 *
747 * The _SIZE value is "primitive size", used to scale i/j in primitive
748 * space to pixel space.
749 */
750 SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL,
751 SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE,
752 SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID,
753 SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE,
754 SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL,
755 SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID,
756 SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE,
757 SYSTEM_VALUE_BARYCENTRIC_PULL_MODEL,
758
759 /**
760 * \name Ray tracing shader system values
761 */
762 /*@{*/
763 SYSTEM_VALUE_RAY_LAUNCH_ID,
764 SYSTEM_VALUE_RAY_LAUNCH_SIZE,
765 SYSTEM_VALUE_RAY_WORLD_ORIGIN,
766 SYSTEM_VALUE_RAY_WORLD_DIRECTION,
767 SYSTEM_VALUE_RAY_OBJECT_ORIGIN,
768 SYSTEM_VALUE_RAY_OBJECT_DIRECTION,
769 SYSTEM_VALUE_RAY_T_MIN,
770 SYSTEM_VALUE_RAY_T_MAX,
771 SYSTEM_VALUE_RAY_OBJECT_TO_WORLD,
772 SYSTEM_VALUE_RAY_WORLD_TO_OBJECT,
773 SYSTEM_VALUE_RAY_HIT_KIND,
774 SYSTEM_VALUE_RAY_FLAGS,
775 SYSTEM_VALUE_RAY_GEOMETRY_INDEX,
776 SYSTEM_VALUE_RAY_INSTANCE_CUSTOM_INDEX,
777 /*@}*/
778
779 /**
780 * IR3 specific geometry shader and tesselation control shader system
781 * values that packs invocation id, thread id and vertex id. Having this
782 * as a nir level system value lets us do the unpacking in nir.
783 */
784 SYSTEM_VALUE_GS_HEADER_IR3,
785 SYSTEM_VALUE_TCS_HEADER_IR3,
786
787 /* IR3 specific system value that contains the patch id for the current
788 * subdraw.
789 */
790 SYSTEM_VALUE_REL_PATCH_ID_IR3,
791
792 /**
793 * Fragment shading rate used for KHR_fragment_shading_rate (Vulkan).
794 */
795 SYSTEM_VALUE_FRAG_SHADING_RATE,
796
797 SYSTEM_VALUE_MAX /**< Number of values */
798 } gl_system_value;
799
800 const char *gl_system_value_name(gl_system_value sysval);
801
802 /**
803 * The possible interpolation qualifiers that can be applied to a fragment
804 * shader input in GLSL.
805 *
806 * Note: INTERP_MODE_NONE must be 0 so that memsetting the
807 * ir_variable data structure to 0 causes the default behavior.
808 */
809 enum glsl_interp_mode
810 {
811 INTERP_MODE_NONE = 0,
812 INTERP_MODE_SMOOTH,
813 INTERP_MODE_FLAT,
814 INTERP_MODE_NOPERSPECTIVE,
815 INTERP_MODE_EXPLICIT,
816 INTERP_MODE_COLOR, /**< glShadeModel determines the interp mode */
817 INTERP_MODE_COUNT /**< Number of interpolation qualifiers */
818 };
819
820 enum glsl_interface_packing {
821 GLSL_INTERFACE_PACKING_STD140,
822 GLSL_INTERFACE_PACKING_SHARED,
823 GLSL_INTERFACE_PACKING_PACKED,
824 GLSL_INTERFACE_PACKING_STD430
825 };
826
827 const char *glsl_interp_mode_name(enum glsl_interp_mode qual);
828
829 /**
830 * Fragment program results
831 */
832 typedef enum
833 {
834 FRAG_RESULT_DEPTH = 0,
835 FRAG_RESULT_STENCIL = 1,
836 /* If a single color should be written to all render targets, this
837 * register is written. No FRAG_RESULT_DATAn will be written.
838 */
839 FRAG_RESULT_COLOR = 2,
840 FRAG_RESULT_SAMPLE_MASK = 3,
841
842 /* FRAG_RESULT_DATAn are the per-render-target (GLSL gl_FragData[n]
843 * or ARB_fragment_program fragment.color[n]) color results. If
844 * any are written, FRAG_RESULT_COLOR will not be written.
845 * FRAG_RESULT_DATA1 and up are simply for the benefit of
846 * gl_frag_result_name() and not to be construed as an upper bound
847 */
848 FRAG_RESULT_DATA0 = 4,
849 FRAG_RESULT_DATA1,
850 FRAG_RESULT_DATA2,
851 FRAG_RESULT_DATA3,
852 FRAG_RESULT_DATA4,
853 FRAG_RESULT_DATA5,
854 FRAG_RESULT_DATA6,
855 FRAG_RESULT_DATA7,
856 } gl_frag_result;
857
858 const char *gl_frag_result_name(gl_frag_result result);
859
860 #define FRAG_RESULT_MAX (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
861
862 /**
863 * \brief Layout qualifiers for gl_FragDepth.
864 *
865 * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with
866 * a layout qualifier.
867 *
868 * \see enum ir_depth_layout
869 */
870 enum gl_frag_depth_layout
871 {
872 FRAG_DEPTH_LAYOUT_NONE, /**< No layout is specified. */
873 FRAG_DEPTH_LAYOUT_ANY,
874 FRAG_DEPTH_LAYOUT_GREATER,
875 FRAG_DEPTH_LAYOUT_LESS,
876 FRAG_DEPTH_LAYOUT_UNCHANGED
877 };
878
879 /**
880 * \brief Buffer access qualifiers
881 */
882 enum gl_access_qualifier
883 {
884 ACCESS_COHERENT = (1 << 0),
885 ACCESS_RESTRICT = (1 << 1),
886 ACCESS_VOLATILE = (1 << 2),
887
888 /* The memory used by the access/variable is not read. */
889 ACCESS_NON_READABLE = (1 << 3),
890
891 /* The memory used by the access/variable is not written. */
892 ACCESS_NON_WRITEABLE = (1 << 4),
893
894 /** The access may use a non-uniform buffer or image index */
895 ACCESS_NON_UNIFORM = (1 << 5),
896
897 /* This has the same semantics as NIR_INTRINSIC_CAN_REORDER, only to be
898 * used with loads. In other words, it means that the load can be
899 * arbitrarily reordered, or combined with other loads to the same address.
900 * It is implied by ACCESS_NON_WRITEABLE and a lack of ACCESS_VOLATILE.
901 */
902 ACCESS_CAN_REORDER = (1 << 6),
903
904 /** Use as little cache space as possible. */
905 ACCESS_STREAM_CACHE_POLICY = (1 << 7),
906 };
907
908 /**
909 * \brief Blend support qualifiers
910 */
911 enum gl_advanced_blend_mode
912 {
913 BLEND_NONE = 0,
914 BLEND_MULTIPLY,
915 BLEND_SCREEN,
916 BLEND_OVERLAY,
917 BLEND_DARKEN,
918 BLEND_LIGHTEN,
919 BLEND_COLORDODGE,
920 BLEND_COLORBURN,
921 BLEND_HARDLIGHT,
922 BLEND_SOFTLIGHT,
923 BLEND_DIFFERENCE,
924 BLEND_EXCLUSION,
925 BLEND_HSL_HUE,
926 BLEND_HSL_SATURATION,
927 BLEND_HSL_COLOR,
928 BLEND_HSL_LUMINOSITY,
929 };
930
931 enum blend_func
932 {
933 BLEND_FUNC_ADD,
934 BLEND_FUNC_SUBTRACT,
935 BLEND_FUNC_REVERSE_SUBTRACT,
936 BLEND_FUNC_MIN,
937 BLEND_FUNC_MAX,
938 };
939
940 enum blend_factor
941 {
942 BLEND_FACTOR_ZERO,
943 BLEND_FACTOR_SRC_COLOR,
944 BLEND_FACTOR_SRC1_COLOR,
945 BLEND_FACTOR_DST_COLOR,
946 BLEND_FACTOR_SRC_ALPHA,
947 BLEND_FACTOR_SRC1_ALPHA,
948 BLEND_FACTOR_DST_ALPHA,
949 BLEND_FACTOR_CONSTANT_COLOR,
950 BLEND_FACTOR_CONSTANT_ALPHA,
951 BLEND_FACTOR_SRC_ALPHA_SATURATE,
952 };
953
954 enum gl_tess_spacing
955 {
956 TESS_SPACING_UNSPECIFIED,
957 TESS_SPACING_EQUAL,
958 TESS_SPACING_FRACTIONAL_ODD,
959 TESS_SPACING_FRACTIONAL_EVEN,
960 };
961
962 /**
963 * A compare function enum for use in compiler lowering passes. This is in
964 * the same order as GL's compare functions (shifted down by GL_NEVER), and is
965 * exactly the same as gallium's PIPE_FUNC_*.
966 */
967 enum compare_func
968 {
969 COMPARE_FUNC_NEVER,
970 COMPARE_FUNC_LESS,
971 COMPARE_FUNC_EQUAL,
972 COMPARE_FUNC_LEQUAL,
973 COMPARE_FUNC_GREATER,
974 COMPARE_FUNC_NOTEQUAL,
975 COMPARE_FUNC_GEQUAL,
976 COMPARE_FUNC_ALWAYS,
977 };
978
979 /**
980 * Arrangements for grouping invocations from NV_compute_shader_derivatives.
981 *
982 * The extension provides new layout qualifiers that support two different
983 * arrangements of compute shader invocations for the purpose of derivative
984 * computation. When specifying
985 *
986 * layout(derivative_group_quadsNV) in;
987 *
988 * compute shader invocations are grouped into 2x2x1 arrays whose four local
989 * invocation ID values follow the pattern:
990 *
991 * +-----------------+------------------+
992 * | (2x+0, 2y+0, z) | (2x+1, 2y+0, z) |
993 * +-----------------+------------------+
994 * | (2x+0, 2y+1, z) | (2x+1, 2y+1, z) |
995 * +-----------------+------------------+
996 *
997 * where Y increases from bottom to top. When specifying
998 *
999 * layout(derivative_group_linearNV) in;
1000 *
1001 * compute shader invocations are grouped into 2x2x1 arrays whose four local
1002 * invocation index values follow the pattern:
1003 *
1004 * +------+------+
1005 * | 4n+0 | 4n+1 |
1006 * +------+------+
1007 * | 4n+2 | 4n+3 |
1008 * +------+------+
1009 *
1010 * If neither layout qualifier is specified, derivatives in compute shaders
1011 * return zero, which is consistent with the handling of built-in texture
1012 * functions like texture() in GLSL 4.50 compute shaders.
1013 */
1014 enum gl_derivative_group {
1015 DERIVATIVE_GROUP_NONE = 0,
1016 DERIVATIVE_GROUP_QUADS,
1017 DERIVATIVE_GROUP_LINEAR,
1018 };
1019
1020 enum float_controls
1021 {
1022 FLOAT_CONTROLS_DEFAULT_FLOAT_CONTROL_MODE = 0x0000,
1023 FLOAT_CONTROLS_DENORM_PRESERVE_FP16 = 0x0001,
1024 FLOAT_CONTROLS_DENORM_PRESERVE_FP32 = 0x0002,
1025 FLOAT_CONTROLS_DENORM_PRESERVE_FP64 = 0x0004,
1026 FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP16 = 0x0008,
1027 FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP32 = 0x0010,
1028 FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP64 = 0x0020,
1029 FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP16 = 0x0040,
1030 FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP32 = 0x0080,
1031 FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP64 = 0x0100,
1032 FLOAT_CONTROLS_ROUNDING_MODE_RTE_FP16 = 0x0200,
1033 FLOAT_CONTROLS_ROUNDING_MODE_RTE_FP32 = 0x0400,
1034 FLOAT_CONTROLS_ROUNDING_MODE_RTE_FP64 = 0x0800,
1035 FLOAT_CONTROLS_ROUNDING_MODE_RTZ_FP16 = 0x1000,
1036 FLOAT_CONTROLS_ROUNDING_MODE_RTZ_FP32 = 0x2000,
1037 FLOAT_CONTROLS_ROUNDING_MODE_RTZ_FP64 = 0x4000,
1038 };
1039
1040 /**
1041 * Enums to describe sampler properties used by OpenCL's inline constant samplers.
1042 * These values match the meanings described in the SPIR-V spec.
1043 */
1044 enum cl_sampler_addressing_mode {
1045 SAMPLER_ADDRESSING_MODE_NONE = 0,
1046 SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE = 1,
1047 SAMPLER_ADDRESSING_MODE_CLAMP = 2,
1048 SAMPLER_ADDRESSING_MODE_REPEAT = 3,
1049 SAMPLER_ADDRESSING_MODE_REPEAT_MIRRORED = 4,
1050 };
1051
1052 enum cl_sampler_filter_mode {
1053 SAMPLER_FILTER_MODE_NEAREST = 0,
1054 SAMPLER_FILTER_MODE_LINEAR = 1,
1055 };
1056
1057 #ifdef __cplusplus
1058 } /* extern "C" */
1059 #endif
1060
1061 #endif /* SHADER_ENUMS_H */
1062