Merge branch 'gallium-nopointsizeminmax'
[platform/upstream/mesa.git] / src / gallium / docs / source / cso / rasterizer.rst
1 .. _rasterizer:
2
3 Rasterizer
4 ==========
5
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.
9
10 Members
11 -------
12
13 bypass_vs_clip_and_viewport
14 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
15
16 Whether the entire TCL pipeline should be bypassed. This implies that
17 vertices are pre-transformed for the viewport, and will not be run
18 through the vertex shader.
19
20 .. note::
21    
22    Implementations may still clip away vertices that are not in the viewport
23    when this is set.
24
25 flatshade
26 ^^^^^^^^^
27
28 If set, the provoking vertex of each polygon is used to determine the color
29 of the entire polygon.  If not set, fragment colors will be interpolated
30 between the vertex colors.
31
32 The actual interpolated shading algorithm is obviously
33 implementation-dependent, but will usually be Gourard for most hardware.
34
35 .. note::
36
37     This is separate from the fragment shader input attributes
38     CONSTANT, LINEAR and PERSPECTIVE. The flatshade state is needed at
39     clipping time to determine how to set the color of new vertices.
40
41     :ref:`Draw` can implement flat shading by copying the provoking vertex
42     color to all the other vertices in the primitive.
43
44 flatshade_first
45 ^^^^^^^^^^^^^^^
46
47 Whether the first vertex should be the provoking vertex, for most primitives.
48 If not set, the last vertex is the provoking vertex.
49
50 There are several important exceptions to the specification of this rule.
51
52 * ``PIPE_PRIMITIVE_POLYGON``: The provoking vertex is always the first
53   vertex. If the caller wishes to change the provoking vertex, they merely
54   need to rotate the vertices themselves.
55 * ``PIPE_PRIMITIVE_QUAD``, ``PIPE_PRIMITIVE_QUAD_STRIP``: This option has no
56   effect; the provoking vertex is always the last vertex.
57 * ``PIPE_PRIMITIVE_TRIANGLE_FAN``: When set, the provoking vertex is the
58   second vertex, not the first. This permits each segment of the fan to have
59   a different color.
60
61 Other Members
62 ^^^^^^^^^^^^^
63
64 light_twoside
65     If set, there are per-vertex back-facing colors. :ref:`Draw`
66     uses this state along with the front/back information to set the
67     final vertex colors prior to rasterization.
68
69 front_winding
70     Indicates the window order of front-facing polygons, either
71     PIPE_WINDING_CW or PIPE_WINDING_CCW
72
73 cull_mode
74     Indicates which polygons to cull, either PIPE_WINDING_NONE (cull no
75     polygons), PIPE_WINDING_CW (cull clockwise-winding polygons),
76     PIPE_WINDING_CCW (cull counter clockwise-winding polygons), or
77     PIPE_WINDING_BOTH (cull all polygons).
78
79 fill_cw
80     Indicates how to fill clockwise polygons, either PIPE_POLYGON_MODE_FILL,
81     PIPE_POLYGON_MODE_LINE or PIPE_POLYGON_MODE_POINT.
82 fill_ccw
83     Indicates how to fill counter clockwise polygons, either
84     PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or PIPE_POLYGON_MODE_POINT.
85
86 poly_stipple_enable
87     Whether polygon stippling is enabled.
88 poly_smooth
89     Controls OpenGL-style polygon smoothing/antialiasing
90 offset_cw
91     If set, clockwise polygons will have polygon offset factors applied
92 offset_ccw
93     If set, counter clockwise polygons will have polygon offset factors applied
94 offset_units
95     Specifies the polygon offset bias
96 offset_scale
97     Specifies the polygon offset scale
98
99 line_width
100     The width of lines.
101 line_smooth
102     Whether lines should be smoothed. Line smoothing is simply anti-aliasing.
103 line_stipple_enable
104     Whether line stippling is enabled.
105 line_stipple_pattern
106     16-bit bitfield of on/off flags, used to pattern the line stipple.
107 line_stipple_factor
108     When drawing a stippled line, each bit in the stipple pattern is
109     repeated N times, where N = line_stipple_factor + 1.
110 line_last_pixel
111     Controls whether the last pixel in a line is drawn or not.  OpenGL
112     omits the last pixel to avoid double-drawing pixels at the ends of lines
113     when drawing connected lines.
114
115 point_smooth
116     Whether points should be smoothed. Point smoothing turns rectangular
117     points into circles or ovals.
118 point_size_per_vertex
119     Whether vertices have a point size element.
120 point_size
121     The size of points, if not specified per-vertex.
122 sprite_coord_enable
123     Specifies if a coord has its texture coordinates replaced or not. This
124     is a packed bitfield containing the enable for all coords - if all are 0
125     point sprites are effectively disabled, though points may still be
126     rendered slightly different according to point_quad_rasterization.
127     If any coord is non-zero, point_smooth should be disabled, and
128     point_quad_rasterization enabled.
129     If enabled, the four vertices of the resulting quad will be assigned
130     texture coordinates, according to sprite_coord_mode.
131 sprite_coord_mode
132     Specifies how the value for each shader output should be computed when
133     drawing sprites, for each coord which has sprite_coord_enable set.
134     For PIPE_SPRITE_COORD_LOWER_LEFT, the lower left vertex will have
135     coordinate (0,0,0,1).
136     For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left vertex will have
137     coordinate (0,0,0,1).
138     This state is needed by :ref:`Draw` because that's where each
139     point vertex is converted into four quad vertices.  There's no other
140     place to emit the new vertex texture coordinates which are required for
141     sprite rendering.
142     Note that when geometry shaders are available, this state could be
143     removed.  A special geometry shader defined by the state tracker could
144     convert the incoming points into quads with the proper texture coords.
145 point_quad_rasterization
146     This determines if points should be rasterized as quads or points.
147     d3d always uses quad rasterization for points, regardless if point sprites
148     are enabled or not, but OGL has different rules. If point_quad_rasterization
149     is set, point_smooth should be disabled, and points will be rendered as
150     squares even if multisample is enabled.
151     sprite_coord_enable should be zero if point_quad_rasterization is not
152     enabled.
153
154 scissor
155     Whether the scissor test is enabled.
156
157 multisample
158     Whether :term:`MSAA` is enabled.
159
160 gl_rasterization_rules
161     Whether the rasterizer should use (0.5, 0.5) pixel centers. When not set,
162     the rasterizer will use (0, 0) for pixel centers.
163