nvc0: disable tessellation on maxwell
[mesa.git] / src / glsl / shader_enums.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #ifndef SHADER_ENUMS_H
27 #define SHADER_ENUMS_H
28
29 /**
30 * Shader stages. Note that these will become 5 with tessellation.
31 *
32 * The order must match how shaders are ordered in the pipeline.
33 * The GLSL linker assumes that if i<j, then the j-th shader is
34 * executed later than the i-th shader.
35 */
36 typedef enum
37 {
38 MESA_SHADER_VERTEX = 0,
39 MESA_SHADER_TESS_CTRL = 1,
40 MESA_SHADER_TESS_EVAL = 2,
41 MESA_SHADER_GEOMETRY = 3,
42 MESA_SHADER_FRAGMENT = 4,
43 MESA_SHADER_COMPUTE = 5,
44 } gl_shader_stage;
45
46 #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1)
47
48 /**
49 * Bitflags for system values.
50 */
51 #define SYSTEM_BIT_SAMPLE_ID ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_ID)
52 #define SYSTEM_BIT_SAMPLE_POS ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_POS)
53 #define SYSTEM_BIT_SAMPLE_MASK_IN ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_MASK_IN)
54 /**
55 * If the gl_register_file is PROGRAM_SYSTEM_VALUE, the register index will be
56 * one of these values. If a NIR variable's mode is nir_var_system_value, it
57 * will be one of these values.
58 */
59 typedef enum
60 {
61 /**
62 * \name Vertex shader system values
63 */
64 /*@{*/
65 /**
66 * OpenGL-style vertex ID.
67 *
68 * Section 2.11.7 (Shader Execution), subsection Shader Inputs, of the
69 * OpenGL 3.3 core profile spec says:
70 *
71 * "gl_VertexID holds the integer index i implicitly passed by
72 * DrawArrays or one of the other drawing commands defined in section
73 * 2.8.3."
74 *
75 * Section 2.8.3 (Drawing Commands) of the same spec says:
76 *
77 * "The commands....are equivalent to the commands with the same base
78 * name (without the BaseVertex suffix), except that the ith element
79 * transferred by the corresponding draw call will be taken from
80 * element indices[i] + basevertex of each enabled array."
81 *
82 * Additionally, the overview in the GL_ARB_shader_draw_parameters spec
83 * says:
84 *
85 * "In unextended GL, vertex shaders have inputs named gl_VertexID and
86 * gl_InstanceID, which contain, respectively the index of the vertex
87 * and instance. The value of gl_VertexID is the implicitly passed
88 * index of the vertex being processed, which includes the value of
89 * baseVertex, for those commands that accept it."
90 *
91 * gl_VertexID gets basevertex added in. This differs from DirectX where
92 * SV_VertexID does \b not get basevertex added in.
93 *
94 * \note
95 * If all system values are available, \c SYSTEM_VALUE_VERTEX_ID will be
96 * equal to \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus
97 * \c SYSTEM_VALUE_BASE_VERTEX.
98 *
99 * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_BASE_VERTEX
100 */
101 SYSTEM_VALUE_VERTEX_ID,
102
103 /**
104 * Instanced ID as supplied to gl_InstanceID
105 *
106 * Values assigned to gl_InstanceID always begin with zero, regardless of
107 * the value of baseinstance.
108 *
109 * Section 11.1.3.9 (Shader Inputs) of the OpenGL 4.4 core profile spec
110 * says:
111 *
112 * "gl_InstanceID holds the integer instance number of the current
113 * primitive in an instanced draw call (see section 10.5)."
114 *
115 * Through a big chain of pseudocode, section 10.5 describes that
116 * baseinstance is not counted by gl_InstanceID. In that section, notice
117 *
118 * "If an enabled vertex attribute array is instanced (it has a
119 * non-zero divisor as specified by VertexAttribDivisor), the element
120 * index that is transferred to the GL, for all vertices, is given by
121 *
122 * floor(instance/divisor) + baseinstance
123 *
124 * If an array corresponding to an attribute required by a vertex
125 * shader is not enabled, then the corresponding element is taken from
126 * the current attribute state (see section 10.2)."
127 *
128 * Note that baseinstance is \b not included in the value of instance.
129 */
130 SYSTEM_VALUE_INSTANCE_ID,
131
132 /**
133 * DirectX-style vertex ID.
134 *
135 * Unlike \c SYSTEM_VALUE_VERTEX_ID, this system value does \b not include
136 * the value of basevertex.
137 *
138 * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX
139 */
140 SYSTEM_VALUE_VERTEX_ID_ZERO_BASE,
141
142 /**
143 * Value of \c basevertex passed to \c glDrawElementsBaseVertex and similar
144 * functions.
145 *
146 * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
147 */
148 SYSTEM_VALUE_BASE_VERTEX,
149 /*@}*/
150
151 /**
152 * \name Geometry shader system values
153 */
154 /*@{*/
155 SYSTEM_VALUE_INVOCATION_ID, /**< (Also in Tessellation Control shader) */
156 /*@}*/
157
158 /**
159 * \name Fragment shader system values
160 */
161 /*@{*/
162 SYSTEM_VALUE_FRONT_FACE, /**< (not done yet) */
163 SYSTEM_VALUE_SAMPLE_ID,
164 SYSTEM_VALUE_SAMPLE_POS,
165 SYSTEM_VALUE_SAMPLE_MASK_IN,
166 /*@}*/
167
168 /**
169 * \name Tessellation Evaluation shader system values
170 */
171 /*@{*/
172 SYSTEM_VALUE_TESS_COORD,
173 SYSTEM_VALUE_VERTICES_IN, /**< Tessellation vertices in input patch */
174 SYSTEM_VALUE_PRIMITIVE_ID, /**< (currently not used by GS) */
175 SYSTEM_VALUE_TESS_LEVEL_OUTER, /**< TES input */
176 SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */
177 /*@}*/
178
179 SYSTEM_VALUE_MAX /**< Number of values */
180 } gl_system_value;
181
182
183 /**
184 * The possible interpolation qualifiers that can be applied to a fragment
185 * shader input in GLSL.
186 *
187 * Note: INTERP_QUALIFIER_NONE must be 0 so that memsetting the
188 * gl_fragment_program data structure to 0 causes the default behavior.
189 */
190 enum glsl_interp_qualifier
191 {
192 INTERP_QUALIFIER_NONE = 0,
193 INTERP_QUALIFIER_SMOOTH,
194 INTERP_QUALIFIER_FLAT,
195 INTERP_QUALIFIER_NOPERSPECTIVE,
196 INTERP_QUALIFIER_COUNT /**< Number of interpolation qualifiers */
197 };
198
199
200 #endif /* SHADER_ENUMS_H */