2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
26 #ifndef SHADER_ENUMS_H
27 #define SHADER_ENUMS_H
30 #include "mesa/main/config.h"
39 * The order must match how shaders are ordered in the pipeline.
40 * The GLSL linker assumes that if i<j, then the j-th shader is
41 * executed later than the i-th shader.
45 MESA_SHADER_NONE
= -1,
46 MESA_SHADER_VERTEX
= 0,
47 MESA_SHADER_TESS_CTRL
= 1,
48 MESA_SHADER_TESS_EVAL
= 2,
49 MESA_SHADER_GEOMETRY
= 3,
50 MESA_SHADER_FRAGMENT
= 4,
51 MESA_SHADER_COMPUTE
= 5,
52 /* must be last so it doesn't affect the GL pipeline */
53 MESA_SHADER_KERNEL
= 6,
57 gl_shader_stage_is_compute(gl_shader_stage stage
)
59 return stage
== MESA_SHADER_COMPUTE
|| stage
== MESA_SHADER_KERNEL
;
63 * Number of STATE_* values we need to address any GL state.
64 * Used to dimension arrays.
66 #define STATE_LENGTH 5
68 typedef short gl_state_index16
; /* see enum gl_state_index */
70 const char *gl_shader_stage_name(gl_shader_stage stage
);
73 * Translate a gl_shader_stage to a short shader stage name for debug
74 * printouts and error messages.
76 const char *_mesa_shader_stage_to_string(unsigned stage
);
79 * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
80 * for debug printouts and error messages.
82 const char *_mesa_shader_stage_to_abbrev(unsigned stage
);
85 * GL related stages (not including CL)
87 #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1)
92 #define MESA_ALL_SHADER_STAGES (MESA_SHADER_KERNEL + 1)
96 * Indexes for vertex program attributes.
97 * GL_NV_vertex_program aliases generic attributes over the conventional
98 * attributes. In GL_ARB_vertex_program shader the aliasing is optional.
99 * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
100 * generic attributes are distinct/separate).
109 VERT_ATTRIB_COLOR_INDEX
,
110 VERT_ATTRIB_EDGEFLAG
,
119 VERT_ATTRIB_POINT_SIZE
,
120 VERT_ATTRIB_GENERIC0
,
121 VERT_ATTRIB_GENERIC1
,
122 VERT_ATTRIB_GENERIC2
,
123 VERT_ATTRIB_GENERIC3
,
124 VERT_ATTRIB_GENERIC4
,
125 VERT_ATTRIB_GENERIC5
,
126 VERT_ATTRIB_GENERIC6
,
127 VERT_ATTRIB_GENERIC7
,
128 VERT_ATTRIB_GENERIC8
,
129 VERT_ATTRIB_GENERIC9
,
130 VERT_ATTRIB_GENERIC10
,
131 VERT_ATTRIB_GENERIC11
,
132 VERT_ATTRIB_GENERIC12
,
133 VERT_ATTRIB_GENERIC13
,
134 VERT_ATTRIB_GENERIC14
,
135 VERT_ATTRIB_GENERIC15
,
139 const char *gl_vert_attrib_name(gl_vert_attrib attrib
);
142 * Symbolic constats to help iterating over
143 * specific blocks of vertex attributes.
146 * includes all fixed function attributes as well as
147 * the aliased GL_NV_vertex_program shader attributes.
149 * include the classic texture coordinate attributes.
150 * Is a subset of VERT_ATTRIB_FF.
151 * VERT_ATTRIB_GENERIC
152 * include the OpenGL 2.0+ GLSL generic shader attributes.
153 * These alias the generic GL_ARB_vertex_shader attributes.
155 * include the generic shader attributes used to alias
156 * varying material values for the TNL shader programs.
157 * They are located at the end of the generic attribute
158 * block not to overlap with the generic 0 attribute.
160 #define VERT_ATTRIB_FF(i) (VERT_ATTRIB_POS + (i))
161 #define VERT_ATTRIB_FF_MAX VERT_ATTRIB_GENERIC0
163 #define VERT_ATTRIB_TEX(i) (VERT_ATTRIB_TEX0 + (i))
164 #define VERT_ATTRIB_TEX_MAX MAX_TEXTURE_COORD_UNITS
166 #define VERT_ATTRIB_GENERIC(i) (VERT_ATTRIB_GENERIC0 + (i))
167 #define VERT_ATTRIB_GENERIC_MAX MAX_VERTEX_GENERIC_ATTRIBS
169 #define VERT_ATTRIB_MAT0 \
170 (VERT_ATTRIB_GENERIC_MAX - VERT_ATTRIB_MAT_MAX)
171 #define VERT_ATTRIB_MAT(i) \
172 VERT_ATTRIB_GENERIC((i) + VERT_ATTRIB_MAT0)
173 #define VERT_ATTRIB_MAT_MAX MAT_ATTRIB_MAX
176 * Bitflags for vertex attributes.
177 * These are used in bitfields in many places.
180 #define VERT_BIT_POS BITFIELD_BIT(VERT_ATTRIB_POS)
181 #define VERT_BIT_NORMAL BITFIELD_BIT(VERT_ATTRIB_NORMAL)
182 #define VERT_BIT_COLOR0 BITFIELD_BIT(VERT_ATTRIB_COLOR0)
183 #define VERT_BIT_COLOR1 BITFIELD_BIT(VERT_ATTRIB_COLOR1)
184 #define VERT_BIT_FOG BITFIELD_BIT(VERT_ATTRIB_FOG)
185 #define VERT_BIT_COLOR_INDEX BITFIELD_BIT(VERT_ATTRIB_COLOR_INDEX)
186 #define VERT_BIT_EDGEFLAG BITFIELD_BIT(VERT_ATTRIB_EDGEFLAG)
187 #define VERT_BIT_TEX0 BITFIELD_BIT(VERT_ATTRIB_TEX0)
188 #define VERT_BIT_TEX1 BITFIELD_BIT(VERT_ATTRIB_TEX1)
189 #define VERT_BIT_TEX2 BITFIELD_BIT(VERT_ATTRIB_TEX2)
190 #define VERT_BIT_TEX3 BITFIELD_BIT(VERT_ATTRIB_TEX3)
191 #define VERT_BIT_TEX4 BITFIELD_BIT(VERT_ATTRIB_TEX4)
192 #define VERT_BIT_TEX5 BITFIELD_BIT(VERT_ATTRIB_TEX5)
193 #define VERT_BIT_TEX6 BITFIELD_BIT(VERT_ATTRIB_TEX6)
194 #define VERT_BIT_TEX7 BITFIELD_BIT(VERT_ATTRIB_TEX7)
195 #define VERT_BIT_POINT_SIZE BITFIELD_BIT(VERT_ATTRIB_POINT_SIZE)
196 #define VERT_BIT_GENERIC0 BITFIELD_BIT(VERT_ATTRIB_GENERIC0)
198 #define VERT_BIT(i) BITFIELD_BIT(i)
199 #define VERT_BIT_ALL BITFIELD_RANGE(0, VERT_ATTRIB_MAX)
201 #define VERT_BIT_FF(i) VERT_BIT(i)
202 #define VERT_BIT_FF_ALL BITFIELD_RANGE(0, VERT_ATTRIB_FF_MAX)
203 #define VERT_BIT_TEX(i) VERT_BIT(VERT_ATTRIB_TEX(i))
204 #define VERT_BIT_TEX_ALL \
205 BITFIELD_RANGE(VERT_ATTRIB_TEX(0), VERT_ATTRIB_TEX_MAX)
207 #define VERT_BIT_GENERIC(i) VERT_BIT(VERT_ATTRIB_GENERIC(i))
208 #define VERT_BIT_GENERIC_ALL \
209 BITFIELD_RANGE(VERT_ATTRIB_GENERIC(0), VERT_ATTRIB_GENERIC_MAX)
211 #define VERT_BIT_MAT(i) VERT_BIT(VERT_ATTRIB_MAT(i))
212 #define VERT_BIT_MAT_ALL \
213 BITFIELD_RANGE(VERT_ATTRIB_MAT(0), VERT_ATTRIB_MAT_MAX)
216 #define MAX_VARYING 32 /**< number of float[4] vectors */
219 * Indexes for vertex shader outputs, geometry shader inputs/outputs, and
220 * fragment shader inputs.
222 * Note that some of these values are not available to all pipeline stages.
224 * When this enum is updated, the following code must be updated too:
225 * - vertResults (in prog_print.c's arb_output_attrib_string())
226 * - fragAttribs (in prog_print.c's arb_input_attrib_string())
227 * - _mesa_varying_slot_in_fs()
232 VARYING_SLOT_COL0
, /* COL0 and COL1 must be contiguous */
235 VARYING_SLOT_TEX0
, /* TEX0-TEX7 must be contiguous */
243 VARYING_SLOT_PSIZ
, /* Does not appear in FS */
244 VARYING_SLOT_BFC0
, /* Does not appear in FS */
245 VARYING_SLOT_BFC1
, /* Does not appear in FS */
246 VARYING_SLOT_EDGE
, /* Does not appear in FS */
247 VARYING_SLOT_CLIP_VERTEX
, /* Does not appear in FS */
248 VARYING_SLOT_CLIP_DIST0
,
249 VARYING_SLOT_CLIP_DIST1
,
250 VARYING_SLOT_CULL_DIST0
,
251 VARYING_SLOT_CULL_DIST1
,
252 VARYING_SLOT_PRIMITIVE_ID
, /* Does not appear in VS */
253 VARYING_SLOT_LAYER
, /* Appears as VS or GS output */
254 VARYING_SLOT_VIEWPORT
, /* Appears as VS or GS output */
255 VARYING_SLOT_FACE
, /* FS only */
256 VARYING_SLOT_PNTC
, /* FS only */
257 VARYING_SLOT_TESS_LEVEL_OUTER
, /* Only appears as TCS output. */
258 VARYING_SLOT_TESS_LEVEL_INNER
, /* Only appears as TCS output. */
259 VARYING_SLOT_BOUNDING_BOX0
, /* Only appears as TCS output. */
260 VARYING_SLOT_BOUNDING_BOX1
, /* Only appears as TCS output. */
261 VARYING_SLOT_VIEW_INDEX
,
262 VARYING_SLOT_VAR0
, /* First generic varying slot */
263 /* the remaining are simply for the benefit of gl_varying_slot_name()
264 * and not to be construed as an upper bound:
300 #define VARYING_SLOT_MAX (VARYING_SLOT_VAR0 + MAX_VARYING)
301 #define VARYING_SLOT_PATCH0 (VARYING_SLOT_MAX)
302 #define VARYING_SLOT_TESS_MAX (VARYING_SLOT_PATCH0 + MAX_VARYING)
303 #define MAX_VARYINGS_INCL_PATCH (VARYING_SLOT_TESS_MAX - VARYING_SLOT_VAR0)
305 const char *gl_varying_slot_name(gl_varying_slot slot
);
308 * Bitflags for varying slots.
311 #define VARYING_BIT_POS BITFIELD64_BIT(VARYING_SLOT_POS)
312 #define VARYING_BIT_COL0 BITFIELD64_BIT(VARYING_SLOT_COL0)
313 #define VARYING_BIT_COL1 BITFIELD64_BIT(VARYING_SLOT_COL1)
314 #define VARYING_BIT_FOGC BITFIELD64_BIT(VARYING_SLOT_FOGC)
315 #define VARYING_BIT_TEX0 BITFIELD64_BIT(VARYING_SLOT_TEX0)
316 #define VARYING_BIT_TEX1 BITFIELD64_BIT(VARYING_SLOT_TEX1)
317 #define VARYING_BIT_TEX2 BITFIELD64_BIT(VARYING_SLOT_TEX2)
318 #define VARYING_BIT_TEX3 BITFIELD64_BIT(VARYING_SLOT_TEX3)
319 #define VARYING_BIT_TEX4 BITFIELD64_BIT(VARYING_SLOT_TEX4)
320 #define VARYING_BIT_TEX5 BITFIELD64_BIT(VARYING_SLOT_TEX5)
321 #define VARYING_BIT_TEX6 BITFIELD64_BIT(VARYING_SLOT_TEX6)
322 #define VARYING_BIT_TEX7 BITFIELD64_BIT(VARYING_SLOT_TEX7)
323 #define VARYING_BIT_TEX(U) BITFIELD64_BIT(VARYING_SLOT_TEX0 + (U))
324 #define VARYING_BITS_TEX_ANY BITFIELD64_RANGE(VARYING_SLOT_TEX0, \
325 MAX_TEXTURE_COORD_UNITS)
326 #define VARYING_BIT_PSIZ BITFIELD64_BIT(VARYING_SLOT_PSIZ)
327 #define VARYING_BIT_BFC0 BITFIELD64_BIT(VARYING_SLOT_BFC0)
328 #define VARYING_BIT_BFC1 BITFIELD64_BIT(VARYING_SLOT_BFC1)
329 #define VARYING_BIT_EDGE BITFIELD64_BIT(VARYING_SLOT_EDGE)
330 #define VARYING_BIT_CLIP_VERTEX BITFIELD64_BIT(VARYING_SLOT_CLIP_VERTEX)
331 #define VARYING_BIT_CLIP_DIST0 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0)
332 #define VARYING_BIT_CLIP_DIST1 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1)
333 #define VARYING_BIT_CULL_DIST0 BITFIELD64_BIT(VARYING_SLOT_CULL_DIST0)
334 #define VARYING_BIT_CULL_DIST1 BITFIELD64_BIT(VARYING_SLOT_CULL_DIST1)
335 #define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID)
336 #define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER)
337 #define VARYING_BIT_VIEWPORT BITFIELD64_BIT(VARYING_SLOT_VIEWPORT)
338 #define VARYING_BIT_FACE BITFIELD64_BIT(VARYING_SLOT_FACE)
339 #define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC)
340 #define VARYING_BIT_TESS_LEVEL_OUTER BITFIELD64_BIT(VARYING_SLOT_TESS_LEVEL_OUTER)
341 #define VARYING_BIT_TESS_LEVEL_INNER BITFIELD64_BIT(VARYING_SLOT_TESS_LEVEL_INNER)
342 #define VARYING_BIT_BOUNDING_BOX0 BITFIELD64_BIT(VARYING_SLOT_BOUNDING_BOX0)
343 #define VARYING_BIT_BOUNDING_BOX1 BITFIELD64_BIT(VARYING_SLOT_BOUNDING_BOX1)
344 #define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
348 * Bitflags for system values.
350 #define SYSTEM_BIT_SAMPLE_ID ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_ID)
351 #define SYSTEM_BIT_SAMPLE_POS ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_POS)
352 #define SYSTEM_BIT_SAMPLE_MASK_IN ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_MASK_IN)
353 #define SYSTEM_BIT_LOCAL_INVOCATION_ID ((uint64_t)1 << SYSTEM_VALUE_LOCAL_INVOCATION_ID)
356 * If the gl_register_file is PROGRAM_SYSTEM_VALUE, the register index will be
357 * one of these values. If a NIR variable's mode is nir_var_system_value, it
358 * will be one of these values.
363 * \name System values applicable to all shaders
368 * Builtin variables added by GL_ARB_shader_ballot.
373 * From the GL_ARB_shader-ballot spec:
375 * "A sub-group is a collection of invocations which execute in lockstep.
376 * The variable <gl_SubGroupSizeARB> is the maximum number of
377 * invocations in a sub-group. The maximum <gl_SubGroupSizeARB>
378 * supported in this extension is 64."
380 * The spec defines this as a uniform. However, it's highly unlikely that
381 * implementations actually treat it as a uniform (which is loaded from a
382 * constant buffer). Most likely, this is an implementation-wide constant,
383 * or perhaps something that depends on the shader stage.
385 SYSTEM_VALUE_SUBGROUP_SIZE
,
388 * From the GL_ARB_shader_ballot spec:
390 * "The variable <gl_SubGroupInvocationARB> holds the index of the
391 * invocation within sub-group. This variable is in the range 0 to
392 * <gl_SubGroupSizeARB>-1, where <gl_SubGroupSizeARB> is the total
393 * number of invocations in a sub-group."
395 SYSTEM_VALUE_SUBGROUP_INVOCATION
,
398 * From the GL_ARB_shader_ballot spec:
400 * "The <gl_SubGroup??MaskARB> variables provide a bitmask for all
401 * invocations, with one bit per invocation starting with the least
402 * significant bit, according to the following table,
404 * variable equation for bit values
405 * -------------------- ------------------------------------
406 * gl_SubGroupEqMaskARB bit index == gl_SubGroupInvocationARB
407 * gl_SubGroupGeMaskARB bit index >= gl_SubGroupInvocationARB
408 * gl_SubGroupGtMaskARB bit index > gl_SubGroupInvocationARB
409 * gl_SubGroupLeMaskARB bit index <= gl_SubGroupInvocationARB
410 * gl_SubGroupLtMaskARB bit index < gl_SubGroupInvocationARB
412 SYSTEM_VALUE_SUBGROUP_EQ_MASK
,
413 SYSTEM_VALUE_SUBGROUP_GE_MASK
,
414 SYSTEM_VALUE_SUBGROUP_GT_MASK
,
415 SYSTEM_VALUE_SUBGROUP_LE_MASK
,
416 SYSTEM_VALUE_SUBGROUP_LT_MASK
,
420 * Builtin variables added by VK_KHR_subgroups
423 SYSTEM_VALUE_NUM_SUBGROUPS
,
424 SYSTEM_VALUE_SUBGROUP_ID
,
430 * \name Vertex shader system values
434 * OpenGL-style vertex ID.
436 * Section 2.11.7 (Shader Execution), subsection Shader Inputs, of the
437 * OpenGL 3.3 core profile spec says:
439 * "gl_VertexID holds the integer index i implicitly passed by
440 * DrawArrays or one of the other drawing commands defined in section
443 * Section 2.8.3 (Drawing Commands) of the same spec says:
445 * "The commands....are equivalent to the commands with the same base
446 * name (without the BaseVertex suffix), except that the ith element
447 * transferred by the corresponding draw call will be taken from
448 * element indices[i] + basevertex of each enabled array."
450 * Additionally, the overview in the GL_ARB_shader_draw_parameters spec
453 * "In unextended GL, vertex shaders have inputs named gl_VertexID and
454 * gl_InstanceID, which contain, respectively the index of the vertex
455 * and instance. The value of gl_VertexID is the implicitly passed
456 * index of the vertex being processed, which includes the value of
457 * baseVertex, for those commands that accept it."
459 * gl_VertexID gets basevertex added in. This differs from DirectX where
460 * SV_VertexID does \b not get basevertex added in.
463 * If all system values are available, \c SYSTEM_VALUE_VERTEX_ID will be
464 * equal to \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus
465 * \c SYSTEM_VALUE_BASE_VERTEX.
467 * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_BASE_VERTEX
469 SYSTEM_VALUE_VERTEX_ID
,
472 * Instanced ID as supplied to gl_InstanceID
474 * Values assigned to gl_InstanceID always begin with zero, regardless of
475 * the value of baseinstance.
477 * Section 11.1.3.9 (Shader Inputs) of the OpenGL 4.4 core profile spec
480 * "gl_InstanceID holds the integer instance number of the current
481 * primitive in an instanced draw call (see section 10.5)."
483 * Through a big chain of pseudocode, section 10.5 describes that
484 * baseinstance is not counted by gl_InstanceID. In that section, notice
486 * "If an enabled vertex attribute array is instanced (it has a
487 * non-zero divisor as specified by VertexAttribDivisor), the element
488 * index that is transferred to the GL, for all vertices, is given by
490 * floor(instance/divisor) + baseinstance
492 * If an array corresponding to an attribute required by a vertex
493 * shader is not enabled, then the corresponding element is taken from
494 * the current attribute state (see section 10.2)."
496 * Note that baseinstance is \b not included in the value of instance.
498 SYSTEM_VALUE_INSTANCE_ID
,
501 * Vulkan InstanceIndex.
503 * InstanceIndex = gl_InstanceID + gl_BaseInstance
505 SYSTEM_VALUE_INSTANCE_INDEX
,
508 * DirectX-style vertex ID.
510 * Unlike \c SYSTEM_VALUE_VERTEX_ID, this system value does \b not include
511 * the value of basevertex.
513 * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX
515 SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
,
518 * Value of \c basevertex passed to \c glDrawElementsBaseVertex and similar
521 * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
523 SYSTEM_VALUE_BASE_VERTEX
,
526 * Depending on the type of the draw call (indexed or non-indexed),
527 * is the value of \c basevertex passed to \c glDrawElementsBaseVertex and
528 * similar, or is the value of \c first passed to \c glDrawArrays and
532 * It can be used to calculate the \c SYSTEM_VALUE_VERTEX_ID as
533 * \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus \c SYSTEM_VALUE_FIRST_VERTEX.
535 * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_VERTEX_ID
537 SYSTEM_VALUE_FIRST_VERTEX
,
540 * If the Draw command used to start the rendering was an indexed draw
541 * or not (~0/0). Useful to calculate \c SYSTEM_VALUE_BASE_VERTEX as
542 * \c SYSTEM_VALUE_IS_INDEXED_DRAW & \c SYSTEM_VALUE_FIRST_VERTEX.
544 SYSTEM_VALUE_IS_INDEXED_DRAW
,
547 * Value of \c baseinstance passed to instanced draw entry points
549 * \sa SYSTEM_VALUE_INSTANCE_ID
551 SYSTEM_VALUE_BASE_INSTANCE
,
554 * From _ARB_shader_draw_parameters:
556 * "Additionally, this extension adds a further built-in variable,
557 * gl_DrawID to the shading language. This variable contains the index
558 * of the draw currently being processed by a Multi* variant of a
559 * drawing command (such as MultiDrawElements or
560 * MultiDrawArraysIndirect)."
562 * If GL_ARB_multi_draw_indirect is not supported, this is always 0.
564 SYSTEM_VALUE_DRAW_ID
,
568 * \name Geometry shader system values
571 SYSTEM_VALUE_INVOCATION_ID
, /**< (Also in Tessellation Control shader) */
575 * \name Fragment shader system values
578 SYSTEM_VALUE_FRAG_COORD
,
579 SYSTEM_VALUE_POINT_COORD
,
580 SYSTEM_VALUE_FRONT_FACE
,
581 SYSTEM_VALUE_SAMPLE_ID
,
582 SYSTEM_VALUE_SAMPLE_POS
,
583 SYSTEM_VALUE_SAMPLE_MASK_IN
,
584 SYSTEM_VALUE_HELPER_INVOCATION
,
590 * \name Tessellation Evaluation shader system values
593 SYSTEM_VALUE_TESS_COORD
,
594 SYSTEM_VALUE_VERTICES_IN
, /**< Tessellation vertices in input patch */
595 SYSTEM_VALUE_PRIMITIVE_ID
,
596 SYSTEM_VALUE_TESS_LEVEL_OUTER
, /**< TES input */
597 SYSTEM_VALUE_TESS_LEVEL_INNER
, /**< TES input */
598 SYSTEM_VALUE_TESS_LEVEL_OUTER_DEFAULT
, /**< TCS input for passthru TCS */
599 SYSTEM_VALUE_TESS_LEVEL_INNER_DEFAULT
, /**< TCS input for passthru TCS */
603 * \name Compute shader system values
606 SYSTEM_VALUE_LOCAL_INVOCATION_ID
,
607 SYSTEM_VALUE_LOCAL_INVOCATION_INDEX
,
608 SYSTEM_VALUE_GLOBAL_INVOCATION_ID
,
609 SYSTEM_VALUE_GLOBAL_INVOCATION_INDEX
,
610 SYSTEM_VALUE_WORK_GROUP_ID
,
611 SYSTEM_VALUE_NUM_WORK_GROUPS
,
612 SYSTEM_VALUE_LOCAL_GROUP_SIZE
,
613 SYSTEM_VALUE_GLOBAL_GROUP_SIZE
,
614 SYSTEM_VALUE_WORK_DIM
,
615 SYSTEM_VALUE_USER_DATA_AMD
,
618 /** Required for VK_KHR_device_group */
619 SYSTEM_VALUE_DEVICE_INDEX
,
621 /** Required for VK_KHX_multiview */
622 SYSTEM_VALUE_VIEW_INDEX
,
625 * Driver internal vertex-count, used (for example) for drivers to
626 * calculate stride for stream-out outputs. Not externally visible.
628 SYSTEM_VALUE_VERTEX_CNT
,
631 * Driver internal varying-coords, used for varying-fetch instructions.
632 * Not externally visible.
634 * The _SIZE value is "primitive size", used to scale i/j in primitive
635 * space to pixel space.
637 SYSTEM_VALUE_BARYCENTRIC_PIXEL
,
638 SYSTEM_VALUE_BARYCENTRIC_SAMPLE
,
639 SYSTEM_VALUE_BARYCENTRIC_CENTROID
,
640 SYSTEM_VALUE_BARYCENTRIC_SIZE
,
642 SYSTEM_VALUE_MAX
/**< Number of values */
645 const char *gl_system_value_name(gl_system_value sysval
);
648 * The possible interpolation qualifiers that can be applied to a fragment
649 * shader input in GLSL.
651 * Note: INTERP_MODE_NONE must be 0 so that memsetting the
652 * ir_variable data structure to 0 causes the default behavior.
654 enum glsl_interp_mode
656 INTERP_MODE_NONE
= 0,
659 INTERP_MODE_NOPERSPECTIVE
,
660 INTERP_MODE_COUNT
/**< Number of interpolation qualifiers */
663 enum glsl_interface_packing
{
664 GLSL_INTERFACE_PACKING_STD140
,
665 GLSL_INTERFACE_PACKING_SHARED
,
666 GLSL_INTERFACE_PACKING_PACKED
,
667 GLSL_INTERFACE_PACKING_STD430
670 const char *glsl_interp_mode_name(enum glsl_interp_mode qual
);
673 * Fragment program results
677 FRAG_RESULT_DEPTH
= 0,
678 FRAG_RESULT_STENCIL
= 1,
679 /* If a single color should be written to all render targets, this
680 * register is written. No FRAG_RESULT_DATAn will be written.
682 FRAG_RESULT_COLOR
= 2,
683 FRAG_RESULT_SAMPLE_MASK
= 3,
685 /* FRAG_RESULT_DATAn are the per-render-target (GLSL gl_FragData[n]
686 * or ARB_fragment_program fragment.color[n]) color results. If
687 * any are written, FRAG_RESULT_COLOR will not be written.
688 * FRAG_RESULT_DATA1 and up are simply for the benefit of
689 * gl_frag_result_name() and not to be construed as an upper bound
691 FRAG_RESULT_DATA0
= 4,
701 const char *gl_frag_result_name(gl_frag_result result
);
703 #define FRAG_RESULT_MAX (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
706 * \brief Layout qualifiers for gl_FragDepth.
708 * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with
709 * a layout qualifier.
711 * \see enum ir_depth_layout
713 enum gl_frag_depth_layout
715 FRAG_DEPTH_LAYOUT_NONE
, /**< No layout is specified. */
716 FRAG_DEPTH_LAYOUT_ANY
,
717 FRAG_DEPTH_LAYOUT_GREATER
,
718 FRAG_DEPTH_LAYOUT_LESS
,
719 FRAG_DEPTH_LAYOUT_UNCHANGED
723 * \brief Buffer access qualifiers
725 enum gl_access_qualifier
727 ACCESS_COHERENT
= (1 << 0),
728 ACCESS_RESTRICT
= (1 << 1),
729 ACCESS_VOLATILE
= (1 << 2),
730 ACCESS_NON_READABLE
= (1 << 3),
731 ACCESS_NON_WRITEABLE
= (1 << 4),
733 /** The access may use a non-uniform buffer or image index */
734 ACCESS_NON_UNIFORM
= (1 << 5),
736 /* This has the same semantics as NIR_INTRINSIC_CAN_REORDER, only to be
737 * used with loads. In other words, it means that the load can be
738 * arbitrarily reordered, or combined with other loads to the same address.
739 * It is implied by ACCESS_NON_WRITEABLE together with ACCESS_RESTRICT, and
740 * a lack of ACCESS_COHERENT and ACCESS_VOLATILE.
742 ACCESS_CAN_REORDER
= (1 << 6),
744 /** Use as little cache space as possible. */
745 ACCESS_STREAM_CACHE_POLICY
= (1 << 7),
749 * \brief Blend support qualifiers
751 enum gl_advanced_blend_mode
755 BLEND_MULTIPLY
= 0x0001,
756 BLEND_SCREEN
= 0x0002,
757 BLEND_OVERLAY
= 0x0004,
758 BLEND_DARKEN
= 0x0008,
759 BLEND_LIGHTEN
= 0x0010,
760 BLEND_COLORDODGE
= 0x0020,
761 BLEND_COLORBURN
= 0x0040,
762 BLEND_HARDLIGHT
= 0x0080,
763 BLEND_SOFTLIGHT
= 0x0100,
764 BLEND_DIFFERENCE
= 0x0200,
765 BLEND_EXCLUSION
= 0x0400,
766 BLEND_HSL_HUE
= 0x0800,
767 BLEND_HSL_SATURATION
= 0x1000,
768 BLEND_HSL_COLOR
= 0x2000,
769 BLEND_HSL_LUMINOSITY
= 0x4000,
778 BLEND_FUNC_REVERSE_SUBTRACT
,
786 BLEND_FACTOR_SRC_COLOR
,
787 BLEND_FACTOR_DST_COLOR
,
788 BLEND_FACTOR_SRC_ALPHA
,
789 BLEND_FACTOR_DST_ALPHA
,
790 BLEND_FACTOR_CONSTANT_COLOR
,
791 BLEND_FACTOR_CONSTANT_ALPHA
,
792 BLEND_FACTOR_SRC_ALPHA_SATURATE
,
797 TESS_SPACING_UNSPECIFIED
,
799 TESS_SPACING_FRACTIONAL_ODD
,
800 TESS_SPACING_FRACTIONAL_EVEN
,
804 * A compare function enum for use in compiler lowering passes. This is in
805 * the same order as GL's compare functions (shifted down by GL_NEVER), and is
806 * exactly the same as gallium's PIPE_FUNC_*.
814 COMPARE_FUNC_GREATER
,
815 COMPARE_FUNC_NOTEQUAL
,
821 * Arrangements for grouping invocations from NV_compute_shader_derivatives.
823 * The extension provides new layout qualifiers that support two different
824 * arrangements of compute shader invocations for the purpose of derivative
825 * computation. When specifying
827 * layout(derivative_group_quadsNV) in;
829 * compute shader invocations are grouped into 2x2x1 arrays whose four local
830 * invocation ID values follow the pattern:
832 * +-----------------+------------------+
833 * | (2x+0, 2y+0, z) | (2x+1, 2y+0, z) |
834 * +-----------------+------------------+
835 * | (2x+0, 2y+1, z) | (2x+1, 2y+1, z) |
836 * +-----------------+------------------+
838 * where Y increases from bottom to top. When specifying
840 * layout(derivative_group_linearNV) in;
842 * compute shader invocations are grouped into 2x2x1 arrays whose four local
843 * invocation index values follow the pattern:
851 * If neither layout qualifier is specified, derivatives in compute shaders
852 * return zero, which is consistent with the handling of built-in texture
853 * functions like texture() in GLSL 4.50 compute shaders.
855 enum gl_derivative_group
{
856 DERIVATIVE_GROUP_NONE
= 0,
857 DERIVATIVE_GROUP_QUADS
,
858 DERIVATIVE_GROUP_LINEAR
,
865 #endif /* SHADER_ENUMS_H */