2 * Mesa 3-D graphics library
4 * Copyright (C) 2015 LunarG, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #ifndef ILO_STATE_RASTER_H
29 #define ILO_STATE_RASTER_H
31 #include "genhw/genhw.h"
36 enum ilo_state_raster_dirty_bits
{
37 ILO_STATE_RASTER_3DSTATE_CLIP
= (1 << 0),
38 ILO_STATE_RASTER_3DSTATE_SF
= (1 << 1),
39 ILO_STATE_RASTER_3DSTATE_RASTER
= (1 << 2),
40 ILO_STATE_RASTER_3DSTATE_MULTISAMPLE
= (1 << 3),
41 ILO_STATE_RASTER_3DSTATE_SAMPLE_MASK
= (1 << 4),
42 ILO_STATE_RASTER_3DSTATE_WM
= (1 << 5),
43 ILO_STATE_RASTER_3DSTATE_WM_HZ_OP
= (1 << 6),
44 ILO_STATE_RASTER_3DSTATE_AA_LINE_PARAMETERS
= (1 << 7),
47 enum ilo_state_raster_earlyz_op
{
48 ILO_STATE_RASTER_EARLYZ_NORMAL
,
49 ILO_STATE_RASTER_EARLYZ_DEPTH_CLEAR
,
50 ILO_STATE_RASTER_EARLYZ_DEPTH_RESOLVE
,
51 ILO_STATE_RASTER_EARLYZ_HIZ_RESOLVE
,
55 * VUE readback, VertexClipTest, ClipDetermination, and primitive output.
57 struct ilo_state_raster_clip_info
{
59 /* CL_INVOCATION_COUNT and CL_PRIMITIVES_COUNT */
62 uint8_t viewport_count
;
63 bool force_rtaindex_zero
;
65 /* these should be mutually exclusive */
66 uint8_t user_cull_enables
;
67 uint8_t user_clip_enables
;
72 /* far/near must be enabled together prior to Gen9 */
79 * Primitive assembly, viewport transformation, scissoring, MSAA, etc.
81 struct ilo_state_raster_setup_info
{
84 bool first_vertex_provoking
;
85 bool viewport_transform
;
89 /* MSAA enables for lines and non-lines */
91 bool line_msaa_enable
;
95 * 3DOBJ_POINT rasterization rules.
97 struct ilo_state_raster_point_info
{
98 /* ignored when msaa_enable is set */
101 bool programmable_width
;
105 * 3DOBJ_LINE rasterization rules.
107 struct ilo_state_raster_line_info
{
108 /* ignored when line_msaa_enable is set */
111 /* ignored when line_msaa_enable or aa_enable is set */
118 * 3DOBJ_TRIANGLE rasterization rules.
120 struct ilo_state_raster_tri_info
{
121 enum gen_front_winding front_winding
;
122 enum gen_cull_mode cull_mode
;
123 enum gen_fill_mode fill_mode_front
;
124 enum gen_fill_mode fill_mode_back
;
126 enum gen_depth_format depth_offset_format
;
127 bool depth_offset_solid
;
128 bool depth_offset_wireframe
;
129 bool depth_offset_point
;
131 bool poly_stipple_enable
;
137 struct ilo_state_raster_scan_info
{
138 /* PS_DEPTH_COUNT and PS_INVOCATION_COUNT */
141 uint8_t sample_count
;
143 /* pixel location for non-MSAA or 1x-MSAA */
144 enum gen_pixel_location pixloc
;
146 uint32_t sample_mask
;
149 enum gen_zw_interp zw_interp
;
150 uint8_t barycentric_interps
;
153 enum gen_edsc_mode earlyz_control
;
154 enum ilo_state_raster_earlyz_op earlyz_op
;
155 bool earlyz_stencil_clear
;
161 struct ilo_state_raster_params_info
{
168 /* const term will be scaled by 'r' */
169 float depth_offset_const
;
170 float depth_offset_scale
;
171 float depth_offset_clamp
;
174 struct ilo_state_raster_info
{
175 struct ilo_state_raster_clip_info clip
;
176 struct ilo_state_raster_setup_info setup
;
177 struct ilo_state_raster_point_info point
;
178 struct ilo_state_raster_line_info line
;
179 struct ilo_state_raster_tri_info tri
;
180 struct ilo_state_raster_scan_info scan
;
182 struct ilo_state_raster_params_info params
;
185 struct ilo_state_raster
{
193 bool line_giq_enable
;
196 struct ilo_state_raster_delta
{
200 struct ilo_state_sample_pattern_offset_info
{
206 struct ilo_state_sample_pattern_info
{
207 struct ilo_state_sample_pattern_offset_info pattern_1x
[1];
208 struct ilo_state_sample_pattern_offset_info pattern_2x
[2];
209 struct ilo_state_sample_pattern_offset_info pattern_4x
[4];
210 struct ilo_state_sample_pattern_offset_info pattern_8x
[8];
211 struct ilo_state_sample_pattern_offset_info pattern_16x
[16];
214 struct ilo_state_sample_pattern
{
215 uint8_t pattern_1x
[1];
216 uint8_t pattern_2x
[2];
217 uint8_t pattern_4x
[4];
218 uint8_t pattern_8x
[8];
219 uint8_t pattern_16x
[16];
223 ilo_state_raster_init(struct ilo_state_raster
*rs
,
224 const struct ilo_dev
*dev
,
225 const struct ilo_state_raster_info
*info
);
228 ilo_state_raster_init_for_rectlist(struct ilo_state_raster
*rs
,
229 const struct ilo_dev
*dev
,
230 uint8_t sample_count
,
231 enum ilo_state_raster_earlyz_op earlyz_op
,
232 bool earlyz_stencil_clear
);
235 ilo_state_raster_set_info(struct ilo_state_raster
*rs
,
236 const struct ilo_dev
*dev
,
237 const struct ilo_state_raster_info
*info
);
240 ilo_state_raster_set_params(struct ilo_state_raster
*rs
,
241 const struct ilo_dev
*dev
,
242 const struct ilo_state_raster_params_info
*params
);
245 ilo_state_raster_full_delta(const struct ilo_state_raster
*rs
,
246 const struct ilo_dev
*dev
,
247 struct ilo_state_raster_delta
*delta
);
250 ilo_state_raster_get_delta(const struct ilo_state_raster
*rs
,
251 const struct ilo_dev
*dev
,
252 const struct ilo_state_raster
*old
,
253 struct ilo_state_raster_delta
*delta
);
256 ilo_state_sample_pattern_init(struct ilo_state_sample_pattern
*pattern
,
257 const struct ilo_dev
*dev
,
258 const struct ilo_state_sample_pattern_info
*info
);
261 ilo_state_sample_pattern_init_default(struct ilo_state_sample_pattern
*pattern
,
262 const struct ilo_dev
*dev
);
265 ilo_state_sample_pattern_get_packed_offsets(const struct ilo_state_sample_pattern
*pattern
,
266 const struct ilo_dev
*dev
,
267 uint8_t sample_count
);
270 ilo_state_sample_pattern_get_offset(const struct ilo_state_sample_pattern
*pattern
,
271 const struct ilo_dev
*dev
,
272 uint8_t sample_count
, uint8_t sample_index
,
273 uint8_t *x
, uint8_t *y
);
275 #endif /* ILO_STATE_RASTER_H */