6 The rasterizer state controls the rendering of points, lines and triangles.
7 Attributes include polygon culling state, line width, line stipple,
8 multisample state, scissoring and flat/smooth shading.
15 If set, TGSI_SEMANTIC_COLOR registers are clamped to the [0, 1] range after
16 the execution of the vertex shader, before being passed to the geometry
17 shader or fragment shader.
19 OpenGL: glClampColor(GL_CLAMP_VERTEX_COLOR) in GL 3.0 or GL_ARB_color_buffer_float
21 D3D11: seems always disabled
26 Controls whether TGSI_SEMANTIC_COLOR outputs of the fragment shader
27 are clamped to [0, 1].
29 OpenGL: glClampColor(GL_CLAMP_FRAGMENT_COLOR) in GL 3.0 or ARB_color_buffer_float
31 D3D11: seems always disabled
40 If set, the provoking vertex of each polygon is used to determine the color
41 of the entire polygon. If not set, fragment colors will be interpolated
42 between the vertex colors.
44 The actual interpolated shading algorithm is obviously
45 implementation-dependent, but will usually be Gourard for most hardware.
49 This is separate from the fragment shader input attributes
50 CONSTANT, LINEAR and PERSPECTIVE. The flatshade state is needed at
51 clipping time to determine how to set the color of new vertices.
53 :ref:`Draw` can implement flat shading by copying the provoking vertex
54 color to all the other vertices in the primitive.
59 Whether the first vertex should be the provoking vertex, for most primitives.
60 If not set, the last vertex is the provoking vertex.
62 There are several important exceptions to the specification of this rule.
64 * ``PIPE_PRIMITIVE_POLYGON``: The provoking vertex is always the first
65 vertex. If the caller wishes to change the provoking vertex, they merely
66 need to rotate the vertices themselves.
67 * ``PIPE_PRIMITIVE_QUAD``, ``PIPE_PRIMITIVE_QUAD_STRIP``: This option has no
68 effect; the provoking vertex is always the last vertex.
69 * ``PIPE_PRIMITIVE_TRIANGLE_FAN``: When set, the provoking vertex is the
70 second vertex, not the first. This permits each segment of the fan to have
79 If set, there are per-vertex back-facing colors. The hardware
80 (perhaps assisted by :ref:`Draw`) should be set up to use this state
81 along with the front/back information to set the final vertex colors
82 prior to rasterization.
84 The frontface vertex shader color output is marked with TGSI semantic
85 COLOR[0], and backface COLOR[1].
88 Indicates whether the window order of front-facing polygons is
89 counter-clockwise (TRUE) or clockwise (FALSE).
92 Indicates which faces of polygons to cull, either PIPE_FACE_NONE
93 (cull no polygons), PIPE_FACE_FRONT (cull front-facing polygons),
94 PIPE_FACE_BACK (cull back-facing polygons), or
95 PIPE_FACE_FRONT_AND_BACK (cull all polygons).
98 Indicates how to fill front-facing polygons, either
99 PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or
100 PIPE_POLYGON_MODE_POINT.
102 Indicates how to fill back-facing polygons, either
103 PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or
104 PIPE_POLYGON_MODE_POINT.
107 Whether polygon stippling is enabled.
109 Controls OpenGL-style polygon smoothing/antialiasing
112 If set, point-filled polygons will have polygon offset factors applied
114 If set, line-filled polygons will have polygon offset factors applied
116 If set, filled polygons will have polygon offset factors applied
119 Specifies the polygon offset bias
121 Specifies the polygon offset scale
131 Whether lines should be smoothed. Line smoothing is simply anti-aliasing.
133 Whether line stippling is enabled.
135 16-bit bitfield of on/off flags, used to pattern the line stipple.
137 When drawing a stippled line, each bit in the stipple pattern is
138 repeated N times, where N = line_stipple_factor + 1.
140 Controls whether the last pixel in a line is drawn or not. OpenGL
141 omits the last pixel to avoid double-drawing pixels at the ends of lines
142 when drawing connected lines.
151 Controls automatic texture coordinate generation for rendering sprite points.
153 When bit k in the sprite_coord_enable bitfield is set, then generic
154 input k to the fragment shader will get an automatically computed
157 The texture coordinate will be of the form (s, t, 0, 1) where s varies
158 from 0 to 1 from left to right while t varies from 0 to 1 according to
159 the state of 'sprite_coord_mode' (see below).
161 If any bit is set, then point_smooth MUST be disabled (there are no
162 round sprites) and point_quad_rasterization MUST be true (sprites are
163 always rasterized as quads). Any mismatch between these states should
164 be considered a bug in the state-tracker.
166 This feature is implemented in the :ref:`Draw` module but may also be
167 implemented natively by GPUs or implemented with a geometry shader.
173 Specifies how the value for each shader output should be computed when drawing
174 point sprites. For PIPE_SPRITE_COORD_LOWER_LEFT, the lower-left vertex will
175 have coordinates (0,0,0,1). For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left
176 vertex will have coordinates (0,0,0,1).
177 This state is used by :ref:`Draw` to generate texcoords.
180 point_quad_rasterization
181 ^^^^^^^^^^^^^^^^^^^^^^^^
183 Determines if points should be rasterized according to quad or point
186 OpenGL actually has quite different rasterization rules for points and
187 point sprites - hence this indicates if points should be rasterized as
188 points or according to point sprite (which decomposes them into quads,
191 Additionally Direct3D will always use quad rasterization rules for
192 points, regardless of whether point sprites are enabled or not.
194 If this state is enabled, point smoothing and antialiasing are
195 disabled. If it is disabled, point sprite coordinates are not
200 Some renderers always internally translate points into quads; this state
201 still affects those renderers by overriding other rasterization state.
204 Whether points should be smoothed. Point smoothing turns rectangular
205 points into circles or ovals.
206 point_size_per_vertex
207 Whether the vertex shader is expected to have a point size output.
208 Undefined behaviour is permitted if there is disagreement between
209 this flag and the actual bound shader.
211 The size of points, if not specified per-vertex.
219 Whether the scissor test is enabled.
222 Whether :term:`MSAA` is enabled.
224 gl_rasterization_rules
225 Whether the rasterizer should use (0.5, 0.5) pixel centers. When not set,
226 the rasterizer will use (0, 0) for pixel centers.