i965g: wip
[mesa.git] / src / gallium / drivers / i965 / brw_pipe_blend.c
1
2 /* _NEW_COLOR */
3 if (key->logic_op != GL_COPY) {
4 cc.cc2.logicop_enable = 1;
5 cc.cc5.logicop_func = intel_translate_logic_op(key->logic_op);
6 } else if (key->color_blend) {
7 GLenum eqRGB = key->blend_eq_rgb;
8 GLenum eqA = key->blend_eq_a;
9 GLenum srcRGB = key->blend_src_rgb;
10 GLenum dstRGB = key->blend_dst_rgb;
11 GLenum srcA = key->blend_src_a;
12 GLenum dstA = key->blend_dst_a;
13
14 if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
15 srcRGB = dstRGB = GL_ONE;
16 }
17
18 if (eqA == GL_MIN || eqA == GL_MAX) {
19 srcA = dstA = GL_ONE;
20 }
21
22 cc.cc6.dest_blend_factor = brw_translate_blend_factor(dstRGB);
23 cc.cc6.src_blend_factor = brw_translate_blend_factor(srcRGB);
24 cc.cc6.blend_function = brw_translate_blend_equation(eqRGB);
25
26 cc.cc5.ia_dest_blend_factor = brw_translate_blend_factor(dstA);
27 cc.cc5.ia_src_blend_factor = brw_translate_blend_factor(srcA);
28 cc.cc5.ia_blend_function = brw_translate_blend_equation(eqA);
29
30 cc.cc3.blend_enable = 1;
31 cc.cc3.ia_blend_enable = (srcA != srcRGB ||
32 dstA != dstRGB ||
33 eqA != eqRGB);
34 }
35
36 if (key->dither) {
37 cc.cc5.dither_enable = 1;
38 cc.cc6.y_dither_offset = 0;
39 cc.cc6.x_dither_offset = 0;
40 }
41