Rev 4358 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4358 | Rev 4401 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | Copyright (C) Intel Corp. 2006. All Rights Reserved. |
2 | Copyright (C) Intel Corp. 2006. All Rights Reserved. |
3 | Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to |
3 | Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to |
4 | develop this 3D driver. |
4 | develop this 3D driver. |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining |
6 | Permission is hereby granted, free of charge, to any person obtaining |
7 | a copy of this software and associated documentation files (the |
7 | a copy of this software and associated documentation files (the |
8 | "Software"), to deal in the Software without restriction, including |
8 | "Software"), to deal in the Software without restriction, including |
9 | without limitation the rights to use, copy, modify, merge, publish, |
9 | without limitation the rights to use, copy, modify, merge, publish, |
10 | distribute, sublicense, and/or sell copies of the Software, and to |
10 | distribute, sublicense, and/or sell copies of the Software, and to |
11 | permit persons to whom the Software is furnished to do so, subject to |
11 | permit persons to whom the Software is furnished to do so, subject to |
12 | the following conditions: |
12 | the following conditions: |
13 | 13 | ||
14 | The above copyright notice and this permission notice (including the |
14 | The above copyright notice and this permission notice (including the |
15 | next paragraph) shall be included in all copies or substantial |
15 | next paragraph) shall be included in all copies or substantial |
16 | portions of the Software. |
16 | portions of the Software. |
17 | 17 | ||
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
21 | IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE |
21 | IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE |
22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
25 | 25 | ||
26 | **********************************************************************/ |
26 | **********************************************************************/ |
27 | /* |
27 | /* |
28 | * Authors: |
28 | * Authors: |
29 | * Keith Whitwell |
29 | * Keith Whitwell |
30 | */ |
30 | */ |
31 | 31 | ||
32 | 32 | ||
33 | #include "brw_context.h" |
33 | #include "brw_context.h" |
34 | #include "brw_state.h" |
34 | #include "brw_state.h" |
35 | #include "brw_defines.h" |
35 | #include "brw_defines.h" |
36 | #include "brw_util.h" |
36 | #include "brw_util.h" |
37 | #include "main/macros.h" |
37 | #include "main/macros.h" |
38 | #include "main/stencil.h" |
38 | #include "main/stencil.h" |
39 | #include "intel_batchbuffer.h" |
39 | #include "intel_batchbuffer.h" |
40 | 40 | ||
41 | static void |
41 | static void |
42 | brw_upload_cc_vp(struct brw_context *brw) |
42 | brw_upload_cc_vp(struct brw_context *brw) |
43 | { |
43 | { |
44 | struct gl_context *ctx = &brw->ctx; |
44 | struct gl_context *ctx = &brw->ctx; |
45 | struct brw_cc_viewport *ccv; |
45 | struct brw_cc_viewport *ccv; |
46 | 46 | ||
47 | ccv = brw_state_batch(brw, AUB_TRACE_CC_VP_STATE, |
47 | ccv = brw_state_batch(brw, AUB_TRACE_CC_VP_STATE, |
48 | sizeof(*ccv), 32, &brw->cc.vp_offset); |
48 | sizeof(*ccv), 32, &brw->cc.vp_offset); |
49 | 49 | ||
50 | /* _NEW_TRANSFORM */ |
50 | /* _NEW_TRANSFORM */ |
51 | if (ctx->Transform.DepthClamp) { |
51 | if (ctx->Transform.DepthClamp) { |
52 | /* _NEW_VIEWPORT */ |
52 | /* _NEW_VIEWPORT */ |
53 | ccv->min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); |
53 | ccv->min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); |
54 | ccv->max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); |
54 | ccv->max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); |
55 | } else { |
55 | } else { |
56 | ccv->min_depth = 0.0; |
56 | ccv->min_depth = 0.0; |
57 | ccv->max_depth = 1.0; |
57 | ccv->max_depth = 1.0; |
58 | } |
58 | } |
59 | 59 | ||
60 | brw->state.dirty.cache |= CACHE_NEW_CC_VP; |
60 | brw->state.dirty.cache |= CACHE_NEW_CC_VP; |
61 | } |
61 | } |
62 | 62 | ||
63 | const struct brw_tracked_state brw_cc_vp = { |
63 | const struct brw_tracked_state brw_cc_vp = { |
64 | .dirty = { |
64 | .dirty = { |
65 | .mesa = _NEW_VIEWPORT | _NEW_TRANSFORM, |
65 | .mesa = _NEW_VIEWPORT | _NEW_TRANSFORM, |
66 | .brw = BRW_NEW_BATCH, |
66 | .brw = BRW_NEW_BATCH, |
67 | .cache = 0 |
67 | .cache = 0 |
68 | }, |
68 | }, |
69 | .emit = brw_upload_cc_vp |
69 | .emit = brw_upload_cc_vp |
70 | }; |
70 | }; |
71 | 71 | ||
72 | /** |
72 | /** |
73 | * Modify blend function to force destination alpha to 1.0 |
73 | * Modify blend function to force destination alpha to 1.0 |
74 | * |
74 | * |
75 | * If \c function specifies a blend function that uses destination alpha, |
75 | * If \c function specifies a blend function that uses destination alpha, |
76 | * replace it with a function that hard-wires destination alpha to 1.0. This |
76 | * replace it with a function that hard-wires destination alpha to 1.0. This |
77 | * is used when rendering to xRGB targets. |
77 | * is used when rendering to xRGB targets. |
78 | */ |
78 | */ |
79 | GLenum |
79 | GLenum |
80 | brw_fix_xRGB_alpha(GLenum function) |
80 | brw_fix_xRGB_alpha(GLenum function) |
81 | { |
81 | { |
82 | switch (function) { |
82 | switch (function) { |
83 | case GL_DST_ALPHA: |
83 | case GL_DST_ALPHA: |
84 | return GL_ONE; |
84 | return GL_ONE; |
85 | 85 | ||
86 | case GL_ONE_MINUS_DST_ALPHA: |
86 | case GL_ONE_MINUS_DST_ALPHA: |
87 | case GL_SRC_ALPHA_SATURATE: |
87 | case GL_SRC_ALPHA_SATURATE: |
88 | return GL_ZERO; |
88 | return GL_ZERO; |
89 | } |
89 | } |
90 | 90 | ||
91 | return function; |
91 | return function; |
92 | } |
92 | } |
93 | 93 | ||
94 | /** |
94 | /** |
95 | * Creates the state cache entry for the given CC unit key. |
95 | * Creates the state cache entry for the given CC unit key. |
96 | */ |
96 | */ |
97 | static void upload_cc_unit(struct brw_context *brw) |
97 | static void upload_cc_unit(struct brw_context *brw) |
98 | { |
98 | { |
99 | struct gl_context *ctx = &brw->ctx; |
99 | struct gl_context *ctx = &brw->ctx; |
100 | struct brw_cc_unit_state *cc; |
100 | struct brw_cc_unit_state *cc; |
101 | 101 | ||
102 | cc = brw_state_batch(brw, AUB_TRACE_CC_STATE, |
102 | cc = brw_state_batch(brw, AUB_TRACE_CC_STATE, |
103 | sizeof(*cc), 64, &brw->cc.state_offset); |
103 | sizeof(*cc), 64, &brw->cc.state_offset); |
104 | memset(cc, 0, sizeof(*cc)); |
104 | memset(cc, 0, sizeof(*cc)); |
105 | 105 | ||
106 | /* _NEW_STENCIL | _NEW_BUFFERS */ |
106 | /* _NEW_STENCIL | _NEW_BUFFERS */ |
107 | if (ctx->Stencil._Enabled) { |
107 | if (ctx->Stencil._Enabled) { |
108 | const unsigned back = ctx->Stencil._BackFace; |
108 | const unsigned back = ctx->Stencil._BackFace; |
109 | 109 | ||
110 | cc->cc0.stencil_enable = 1; |
110 | cc->cc0.stencil_enable = 1; |
111 | cc->cc0.stencil_func = |
111 | cc->cc0.stencil_func = |
112 | intel_translate_compare_func(ctx->Stencil.Function[0]); |
112 | intel_translate_compare_func(ctx->Stencil.Function[0]); |
113 | cc->cc0.stencil_fail_op = |
113 | cc->cc0.stencil_fail_op = |
114 | intel_translate_stencil_op(ctx->Stencil.FailFunc[0]); |
114 | intel_translate_stencil_op(ctx->Stencil.FailFunc[0]); |
115 | cc->cc0.stencil_pass_depth_fail_op = |
115 | cc->cc0.stencil_pass_depth_fail_op = |
116 | intel_translate_stencil_op(ctx->Stencil.ZFailFunc[0]); |
116 | intel_translate_stencil_op(ctx->Stencil.ZFailFunc[0]); |
117 | cc->cc0.stencil_pass_depth_pass_op = |
117 | cc->cc0.stencil_pass_depth_pass_op = |
118 | intel_translate_stencil_op(ctx->Stencil.ZPassFunc[0]); |
118 | intel_translate_stencil_op(ctx->Stencil.ZPassFunc[0]); |
119 | cc->cc1.stencil_ref = _mesa_get_stencil_ref(ctx, 0); |
119 | cc->cc1.stencil_ref = _mesa_get_stencil_ref(ctx, 0); |
120 | cc->cc1.stencil_write_mask = ctx->Stencil.WriteMask[0]; |
120 | cc->cc1.stencil_write_mask = ctx->Stencil.WriteMask[0]; |
121 | cc->cc1.stencil_test_mask = ctx->Stencil.ValueMask[0]; |
121 | cc->cc1.stencil_test_mask = ctx->Stencil.ValueMask[0]; |
122 | 122 | ||
123 | if (ctx->Stencil._TestTwoSide) { |
123 | if (ctx->Stencil._TestTwoSide) { |
124 | cc->cc0.bf_stencil_enable = 1; |
124 | cc->cc0.bf_stencil_enable = 1; |
125 | cc->cc0.bf_stencil_func = |
125 | cc->cc0.bf_stencil_func = |
126 | intel_translate_compare_func(ctx->Stencil.Function[back]); |
126 | intel_translate_compare_func(ctx->Stencil.Function[back]); |
127 | cc->cc0.bf_stencil_fail_op = |
127 | cc->cc0.bf_stencil_fail_op = |
128 | intel_translate_stencil_op(ctx->Stencil.FailFunc[back]); |
128 | intel_translate_stencil_op(ctx->Stencil.FailFunc[back]); |
129 | cc->cc0.bf_stencil_pass_depth_fail_op = |
129 | cc->cc0.bf_stencil_pass_depth_fail_op = |
130 | intel_translate_stencil_op(ctx->Stencil.ZFailFunc[back]); |
130 | intel_translate_stencil_op(ctx->Stencil.ZFailFunc[back]); |
131 | cc->cc0.bf_stencil_pass_depth_pass_op = |
131 | cc->cc0.bf_stencil_pass_depth_pass_op = |
132 | intel_translate_stencil_op(ctx->Stencil.ZPassFunc[back]); |
132 | intel_translate_stencil_op(ctx->Stencil.ZPassFunc[back]); |
133 | cc->cc1.bf_stencil_ref = _mesa_get_stencil_ref(ctx, back); |
133 | cc->cc1.bf_stencil_ref = _mesa_get_stencil_ref(ctx, back); |
134 | cc->cc2.bf_stencil_write_mask = ctx->Stencil.WriteMask[back]; |
134 | cc->cc2.bf_stencil_write_mask = ctx->Stencil.WriteMask[back]; |
135 | cc->cc2.bf_stencil_test_mask = ctx->Stencil.ValueMask[back]; |
135 | cc->cc2.bf_stencil_test_mask = ctx->Stencil.ValueMask[back]; |
136 | } |
136 | } |
137 | 137 | ||
138 | /* Not really sure about this: |
138 | /* Not really sure about this: |
139 | */ |
139 | */ |
140 | if (ctx->Stencil.WriteMask[0] || |
140 | if (ctx->Stencil.WriteMask[0] || |
141 | (ctx->Stencil._TestTwoSide && ctx->Stencil.WriteMask[back])) |
141 | (ctx->Stencil._TestTwoSide && ctx->Stencil.WriteMask[back])) |
142 | cc->cc0.stencil_write_enable = 1; |
142 | cc->cc0.stencil_write_enable = 1; |
143 | } |
143 | } |
144 | 144 | ||
145 | /* _NEW_COLOR */ |
145 | /* _NEW_COLOR */ |
146 | if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) { |
146 | if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) { |
147 | cc->cc2.logicop_enable = 1; |
147 | cc->cc2.logicop_enable = 1; |
148 | cc->cc5.logicop_func = intel_translate_logic_op(ctx->Color.LogicOp); |
148 | cc->cc5.logicop_func = intel_translate_logic_op(ctx->Color.LogicOp); |
149 | } else if (ctx->Color.BlendEnabled) { |
149 | } else if (ctx->Color.BlendEnabled) { |
150 | GLenum eqRGB = ctx->Color.Blend[0].EquationRGB; |
150 | GLenum eqRGB = ctx->Color.Blend[0].EquationRGB; |
151 | GLenum eqA = ctx->Color.Blend[0].EquationA; |
151 | GLenum eqA = ctx->Color.Blend[0].EquationA; |
152 | GLenum srcRGB = ctx->Color.Blend[0].SrcRGB; |
152 | GLenum srcRGB = ctx->Color.Blend[0].SrcRGB; |
153 | GLenum dstRGB = ctx->Color.Blend[0].DstRGB; |
153 | GLenum dstRGB = ctx->Color.Blend[0].DstRGB; |
154 | GLenum srcA = ctx->Color.Blend[0].SrcA; |
154 | GLenum srcA = ctx->Color.Blend[0].SrcA; |
155 | GLenum dstA = ctx->Color.Blend[0].DstA; |
155 | GLenum dstA = ctx->Color.Blend[0].DstA; |
156 | 156 | ||
157 | /* If the renderbuffer is XRGB, we have to frob the blend function to |
157 | /* If the renderbuffer is XRGB, we have to frob the blend function to |
158 | * force the destination alpha to 1.0. This means replacing GL_DST_ALPHA |
158 | * force the destination alpha to 1.0. This means replacing GL_DST_ALPHA |
159 | * with GL_ONE and GL_ONE_MINUS_DST_ALPHA with GL_ZERO. |
159 | * with GL_ONE and GL_ONE_MINUS_DST_ALPHA with GL_ZERO. |
160 | */ |
160 | */ |
161 | if (ctx->DrawBuffer->Visual.alphaBits == 0) { |
161 | if (ctx->DrawBuffer->Visual.alphaBits == 0) { |
162 | srcRGB = brw_fix_xRGB_alpha(srcRGB); |
162 | srcRGB = brw_fix_xRGB_alpha(srcRGB); |
163 | srcA = brw_fix_xRGB_alpha(srcA); |
163 | srcA = brw_fix_xRGB_alpha(srcA); |
164 | dstRGB = brw_fix_xRGB_alpha(dstRGB); |
164 | dstRGB = brw_fix_xRGB_alpha(dstRGB); |
165 | dstA = brw_fix_xRGB_alpha(dstA); |
165 | dstA = brw_fix_xRGB_alpha(dstA); |
166 | } |
166 | } |
167 | 167 | ||
168 | if (eqRGB == GL_MIN || eqRGB == GL_MAX) { |
168 | if (eqRGB == GL_MIN || eqRGB == GL_MAX) { |
169 | srcRGB = dstRGB = GL_ONE; |
169 | srcRGB = dstRGB = GL_ONE; |
170 | } |
170 | } |
171 | 171 | ||
172 | if (eqA == GL_MIN || eqA == GL_MAX) { |
172 | if (eqA == GL_MIN || eqA == GL_MAX) { |
173 | srcA = dstA = GL_ONE; |
173 | srcA = dstA = GL_ONE; |
174 | } |
174 | } |
175 | 175 | ||
176 | cc->cc6.dest_blend_factor = brw_translate_blend_factor(dstRGB); |
176 | cc->cc6.dest_blend_factor = brw_translate_blend_factor(dstRGB); |
177 | cc->cc6.src_blend_factor = brw_translate_blend_factor(srcRGB); |
177 | cc->cc6.src_blend_factor = brw_translate_blend_factor(srcRGB); |
178 | cc->cc6.blend_function = brw_translate_blend_equation(eqRGB); |
178 | cc->cc6.blend_function = brw_translate_blend_equation(eqRGB); |
179 | 179 | ||
180 | cc->cc5.ia_dest_blend_factor = brw_translate_blend_factor(dstA); |
180 | cc->cc5.ia_dest_blend_factor = brw_translate_blend_factor(dstA); |
181 | cc->cc5.ia_src_blend_factor = brw_translate_blend_factor(srcA); |
181 | cc->cc5.ia_src_blend_factor = brw_translate_blend_factor(srcA); |
182 | cc->cc5.ia_blend_function = brw_translate_blend_equation(eqA); |
182 | cc->cc5.ia_blend_function = brw_translate_blend_equation(eqA); |
183 | 183 | ||
184 | cc->cc3.blend_enable = 1; |
184 | cc->cc3.blend_enable = 1; |
185 | cc->cc3.ia_blend_enable = (srcA != srcRGB || |
185 | cc->cc3.ia_blend_enable = (srcA != srcRGB || |
186 | dstA != dstRGB || |
186 | dstA != dstRGB || |
187 | eqA != eqRGB); |
187 | eqA != eqRGB); |
188 | } |
188 | } |
- | 189 | ||
189 | 190 | /* _NEW_BUFFERS */ |
|
190 | if (ctx->Color.AlphaEnabled) { |
191 | if (ctx->Color.AlphaEnabled && ctx->DrawBuffer->_NumColorDrawBuffers <= 1) { |
191 | cc->cc3.alpha_test = 1; |
192 | cc->cc3.alpha_test = 1; |
192 | cc->cc3.alpha_test_func = |
193 | cc->cc3.alpha_test_func = |
193 | intel_translate_compare_func(ctx->Color.AlphaFunc); |
194 | intel_translate_compare_func(ctx->Color.AlphaFunc); |
194 | cc->cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8; |
195 | cc->cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8; |
195 | 196 | ||
196 | UNCLAMPED_FLOAT_TO_UBYTE(cc->cc7.alpha_ref.ub[0], ctx->Color.AlphaRef); |
197 | UNCLAMPED_FLOAT_TO_UBYTE(cc->cc7.alpha_ref.ub[0], ctx->Color.AlphaRef); |
197 | } |
198 | } |
198 | 199 | ||
199 | if (ctx->Color.DitherFlag) { |
200 | if (ctx->Color.DitherFlag) { |
200 | cc->cc5.dither_enable = 1; |
201 | cc->cc5.dither_enable = 1; |
201 | cc->cc6.y_dither_offset = 0; |
202 | cc->cc6.y_dither_offset = 0; |
202 | cc->cc6.x_dither_offset = 0; |
203 | cc->cc6.x_dither_offset = 0; |
203 | } |
204 | } |
204 | 205 | ||
205 | /* _NEW_DEPTH */ |
206 | /* _NEW_DEPTH */ |
206 | if (ctx->Depth.Test) { |
207 | if (ctx->Depth.Test) { |
207 | cc->cc2.depth_test = 1; |
208 | cc->cc2.depth_test = 1; |
208 | cc->cc2.depth_test_function = |
209 | cc->cc2.depth_test_function = |
209 | intel_translate_compare_func(ctx->Depth.Func); |
210 | intel_translate_compare_func(ctx->Depth.Func); |
210 | cc->cc2.depth_write_enable = ctx->Depth.Mask; |
211 | cc->cc2.depth_write_enable = ctx->Depth.Mask; |
211 | } |
212 | } |
212 | 213 | ||
213 | if (brw->stats_wm || unlikely(INTEL_DEBUG & DEBUG_STATS)) |
214 | if (brw->stats_wm || unlikely(INTEL_DEBUG & DEBUG_STATS)) |
214 | cc->cc5.statistics_enable = 1; |
215 | cc->cc5.statistics_enable = 1; |
215 | 216 | ||
216 | /* CACHE_NEW_CC_VP */ |
217 | /* CACHE_NEW_CC_VP */ |
217 | cc->cc4.cc_viewport_state_offset = (brw->batch.bo->offset + |
218 | cc->cc4.cc_viewport_state_offset = (brw->batch.bo->offset + |
218 | brw->cc.vp_offset) >> 5; /* reloc */ |
219 | brw->cc.vp_offset) >> 5; /* reloc */ |
219 | 220 | ||
220 | brw->state.dirty.cache |= CACHE_NEW_CC_UNIT; |
221 | brw->state.dirty.cache |= CACHE_NEW_CC_UNIT; |
221 | 222 | ||
222 | /* Emit CC viewport relocation */ |
223 | /* Emit CC viewport relocation */ |
223 | drm_intel_bo_emit_reloc(brw->batch.bo, |
224 | drm_intel_bo_emit_reloc(brw->batch.bo, |
224 | (brw->cc.state_offset + |
225 | (brw->cc.state_offset + |
225 | offsetof(struct brw_cc_unit_state, cc4)), |
226 | offsetof(struct brw_cc_unit_state, cc4)), |
226 | brw->batch.bo, brw->cc.vp_offset, |
227 | brw->batch.bo, brw->cc.vp_offset, |
227 | I915_GEM_DOMAIN_INSTRUCTION, 0); |
228 | I915_GEM_DOMAIN_INSTRUCTION, 0); |
228 | } |
229 | } |
229 | 230 | ||
230 | const struct brw_tracked_state brw_cc_unit = { |
231 | const struct brw_tracked_state brw_cc_unit = { |
231 | .dirty = { |
232 | .dirty = { |
232 | .mesa = _NEW_STENCIL | _NEW_COLOR | _NEW_DEPTH | _NEW_BUFFERS, |
233 | .mesa = _NEW_STENCIL | _NEW_COLOR | _NEW_DEPTH | _NEW_BUFFERS, |
233 | .brw = BRW_NEW_BATCH | BRW_NEW_STATS_WM, |
234 | .brw = BRW_NEW_BATCH | BRW_NEW_STATS_WM, |
234 | .cache = CACHE_NEW_CC_VP |
235 | .cache = CACHE_NEW_CC_VP |
235 | }, |
236 | }, |
236 | .emit = upload_cc_unit, |
237 | .emit = upload_cc_unit, |
237 | }; |
238 | }; |
238 | 239 | ||
239 | static void upload_blend_constant_color(struct brw_context *brw) |
240 | static void upload_blend_constant_color(struct brw_context *brw) |
240 | { |
241 | { |
241 | struct gl_context *ctx = &brw->ctx; |
242 | struct gl_context *ctx = &brw->ctx; |
242 | 243 | ||
243 | BEGIN_BATCH(5); |
244 | BEGIN_BATCH(5); |
244 | OUT_BATCH(_3DSTATE_BLEND_CONSTANT_COLOR << 16 | (5-2)); |
245 | OUT_BATCH(_3DSTATE_BLEND_CONSTANT_COLOR << 16 | (5-2)); |
245 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[0]); |
246 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[0]); |
246 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[1]); |
247 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[1]); |
247 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[2]); |
248 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[2]); |
248 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[3]); |
249 | OUT_BATCH_F(ctx->Color.BlendColorUnclamped[3]); |
249 | CACHED_BATCH(); |
250 | CACHED_BATCH(); |
250 | } |
251 | } |
251 | 252 | ||
252 | const struct brw_tracked_state brw_blend_constant_color = { |
253 | const struct brw_tracked_state brw_blend_constant_color = { |
253 | .dirty = { |
254 | .dirty = { |
254 | .mesa = _NEW_COLOR, |
255 | .mesa = _NEW_COLOR, |
255 | .brw = BRW_NEW_CONTEXT, |
256 | .brw = BRW_NEW_CONTEXT, |
256 | .cache = 0 |
257 | .cache = 0 |
257 | }, |
258 | }, |
258 | .emit = upload_blend_constant_color |
259 | .emit = upload_blend_constant_color |
259 | };><> |
260 | };><>=> |