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