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_CC_H
29 #define ILO_STATE_CC_H
31 #include "genhw/genhw.h"
37 * From the Sandy Bridge PRM, volume 2 part 1, page 38:
39 * "Render Target Index. Specifies the render target index that will be
40 * used to select blend state from BLEND_STATE.
43 #define ILO_STATE_CC_BLEND_MAX_RT_COUNT 8
45 enum ilo_state_cc_dirty_bits
{
46 ILO_STATE_CC_3DSTATE_WM_DEPTH_STENCIL
= (1 << 0),
47 ILO_STATE_CC_3DSTATE_PS_BLEND
= (1 << 1),
48 ILO_STATE_CC_DEPTH_STENCIL_STATE
= (1 << 2),
49 ILO_STATE_CC_BLEND_STATE
= (1 << 3),
50 ILO_STATE_CC_COLOR_CALC_STATE
= (1 << 4),
54 * AlphaCoverage and AlphaTest.
56 struct ilo_state_cc_alpha_info
{
57 bool cv_sample_count_one
;
58 bool cv_float_source0_alpha
;
60 bool alpha_to_coverage
;
64 enum gen_compare_function test_func
;
67 struct ilo_state_cc_stencil_op_info
{
68 enum gen_compare_function test_func
;
69 enum gen_stencil_op fail_op
;
70 enum gen_stencil_op zfail_op
;
71 enum gen_stencil_op zpass_op
;
77 struct ilo_state_cc_stencil_info
{
83 struct ilo_state_cc_stencil_op_info front
;
84 struct ilo_state_cc_stencil_op_info back
;
90 struct ilo_state_cc_depth_info
{
94 /* independent from test_enable */
97 enum gen_compare_function test_func
;
100 struct ilo_state_cc_blend_rt_info
{
105 uint8_t argb_write_disables
;
108 enum gen_logic_op logicop_func
;
111 bool force_dst_alpha_one
;
112 enum gen_blend_factor rgb_src
;
113 enum gen_blend_factor rgb_dst
;
114 enum gen_blend_function rgb_func
;
115 enum gen_blend_factor a_src
;
116 enum gen_blend_factor a_dst
;
117 enum gen_blend_function a_func
;
121 * ColorBufferBlending, Dithering, and LogicOps.
123 struct ilo_state_cc_blend_info
{
124 const struct ilo_state_cc_blend_rt_info
*rt
;
130 struct ilo_state_cc_stencil_params_info
{
139 struct ilo_state_cc_params_info
{
142 struct ilo_state_cc_stencil_params_info stencil_front
;
143 struct ilo_state_cc_stencil_params_info stencil_back
;
151 struct ilo_state_cc_info
{
152 struct ilo_state_cc_alpha_info alpha
;
153 struct ilo_state_cc_stencil_info stencil
;
154 struct ilo_state_cc_depth_info depth
;
155 struct ilo_state_cc_blend_info blend
;
157 struct ilo_state_cc_params_info params
;
160 struct ilo_state_cc
{
163 uint8_t blend_state_count
;
164 uint32_t blend
[1 + 1 + 2 * ILO_STATE_CC_BLEND_MAX_RT_COUNT
];
169 struct ilo_state_cc_delta
{
174 ilo_state_cc_init(struct ilo_state_cc
*cc
,
175 const struct ilo_dev
*dev
,
176 const struct ilo_state_cc_info
*info
);
179 ilo_state_cc_set_info(struct ilo_state_cc
*cc
,
180 const struct ilo_dev
*dev
,
181 const struct ilo_state_cc_info
*info
);
184 ilo_state_cc_set_params(struct ilo_state_cc
*cc
,
185 const struct ilo_dev
*dev
,
186 const struct ilo_state_cc_params_info
*params
);
189 ilo_state_cc_full_delta(const struct ilo_state_cc
*cc
,
190 const struct ilo_dev
*dev
,
191 struct ilo_state_cc_delta
*delta
);
194 ilo_state_cc_get_delta(const struct ilo_state_cc
*cc
,
195 const struct ilo_dev
*dev
,
196 const struct ilo_state_cc
*old
,
197 struct ilo_state_cc_delta
*delta
);
199 #endif /* ILO_STATE_CC_H */