summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_gen_fragment.c20
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_per_fragment.c48
-rw-r--r--src/gallium/drivers/i915/i915_state.c28
-rw-r--r--src/gallium/drivers/i965/brw_pipe_blend.c22
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c19
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c20
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_blend.c72
-rw-r--r--src/gallium/drivers/nv04/nv04_screen.c4
-rw-r--r--src/gallium/drivers/nv04/nv04_state.c10
-rw-r--r--src/gallium/drivers/nv10/nv10_screen.c4
-rw-r--r--src/gallium/drivers/nv10/nv10_state.c20
-rw-r--r--src/gallium/drivers/nv20/nv20_screen.c4
-rw-r--r--src/gallium/drivers/nv20/nv20_state.c20
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c4
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c20
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c4
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c22
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c68
-rw-r--r--src/gallium/drivers/r300/r300_screen.c3
-rw-r--r--src/gallium/drivers/r300/r300_state.c22
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c55
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_video_context.c17
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blend.c18
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c32
28 files changed, 327 insertions, 253 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index 66d4b3b6a31..0dab34075da 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -408,7 +408,7 @@ gen_blend(const struct pipe_blend_state *blend,
int one_reg = -1;
int constR_reg = -1, constG_reg = -1, constB_reg = -1, constA_reg = -1;
- ASSERT(blend->blend_enable);
+ ASSERT(blend->rt[0].blend_enable);
/* packed RGBA -> float colors */
unpack_colors(f, color_format, fbRGBA_reg,
@@ -420,7 +420,7 @@ gen_blend(const struct pipe_blend_state *blend,
* because in some cases (like PIPE_BLENDFACTOR_ONE and
* PIPE_BLENDFACTOR_ZERO) we can avoid doing unnecessary math.
*/
- switch (blend->rgb_src_factor) {
+ switch (blend->rt[0].rgb_src_factor) {
case PIPE_BLENDFACTOR_ONE:
/* factors = (1,1,1), so term = (R,G,B) */
spe_move(f, term1R_reg, fragR_reg);
@@ -574,7 +574,7 @@ gen_blend(const struct pipe_blend_state *blend,
* the full term A*factor, not just the factor itself, because
* in many cases we can avoid doing unnecessary multiplies.
*/
- switch (blend->alpha_src_factor) {
+ switch (blend->rt[0].alpha_src_factor) {
case PIPE_BLENDFACTOR_ZERO:
/* factor = 0, so term = 0 */
spe_load_float(f, term1A_reg, 0.0f);
@@ -648,7 +648,7 @@ gen_blend(const struct pipe_blend_state *blend,
* the full term (Rfb,Gfb,Bfb)*(factor), not just the factor itself, because
* in many cases we can avoid doing unnecessary multiplies.
*/
- switch (blend->rgb_dst_factor) {
+ switch (blend->rt[0].rgb_dst_factor) {
case PIPE_BLENDFACTOR_ONE:
/* factors = (1,1,1), so term = (Rfb,Gfb,Bfb) */
spe_move(f, term2R_reg, fbR_reg);
@@ -786,7 +786,7 @@ gen_blend(const struct pipe_blend_state *blend,
* the full term Afb*factor, not just the factor itself, because
* in many cases we can avoid doing unnecessary multiplies.
*/
- switch (blend->alpha_dst_factor) {
+ switch (blend->rt[0].alpha_dst_factor) {
case PIPE_BLENDFACTOR_ONE:
/* factor = 1, so term = Afb */
spe_move(f, term2A_reg, fbA_reg);
@@ -858,7 +858,7 @@ gen_blend(const struct pipe_blend_state *blend,
/*
* Combine Src/Dest RGB terms as per the blend equation.
*/
- switch (blend->rgb_func) {
+ switch (blend->rt[0].rgb_func) {
case PIPE_BLEND_ADD:
spe_fa(f, fragR_reg, term1R_reg, term2R_reg);
spe_fa(f, fragG_reg, term1G_reg, term2G_reg);
@@ -891,7 +891,7 @@ gen_blend(const struct pipe_blend_state *blend,
/*
* Combine Src/Dest A term
*/
- switch (blend->alpha_func) {
+ switch (blend->rt[0].alpha_func) {
case PIPE_BLEND_ADD:
spe_fa(f, fragA_reg, term1A_reg, term2A_reg);
break;
@@ -2118,7 +2118,7 @@ cell_gen_fragment_function(struct cell_context *cell,
spe_comment(f, 0, "Fetch quad colors from tile");
spe_lqx(f, fbRGBA_reg, color_tile_reg, quad_offset_reg);
- if (blend->blend_enable) {
+ if (blend->rt[0].blend_enable) {
spe_comment(f, 0, "Perform blending");
gen_blend(blend, blend_color, f, color_format,
fragR_reg, fragG_reg, fragB_reg, fragA_reg, fbRGBA_reg);
@@ -2143,9 +2143,9 @@ cell_gen_fragment_function(struct cell_context *cell,
gen_logicop(blend, f, rgba_reg, fbRGBA_reg);
}
- if (blend->colormask != PIPE_MASK_RGBA) {
+ if (blend->rt[0].colormask != PIPE_MASK_RGBA) {
spe_comment(f, 0, "Compute color mask");
- gen_colormask(f, blend->colormask, color_format, rgba_reg, fbRGBA_reg);
+ gen_colormask(f, blend->rt[0].colormask, color_format, rgba_reg, fbRGBA_reg);
}
/* Mix fragment colors with framebuffer colors using the quad/pixel mask:
diff --git a/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c b/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c
index d97c22b2efe..21af7ed1c3f 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c
@@ -999,23 +999,23 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
/* Does the selected blend mode make use of the source / destination
* color (RGB) blend factors?
*/
- boolean need_color_factor = b->blend_enable
- && (b->rgb_func != PIPE_BLEND_MIN)
- && (b->rgb_func != PIPE_BLEND_MAX);
+ boolean need_color_factor = b->rt[0].blend_enable
+ && (b->rt[0].rgb_func != PIPE_BLEND_MIN)
+ && (b->rt[0].rgb_func != PIPE_BLEND_MAX);
/* Does the selected blend mode make use of the source / destination
* alpha blend factors?
*/
- boolean need_alpha_factor = b->blend_enable
- && (b->alpha_func != PIPE_BLEND_MIN)
- && (b->alpha_func != PIPE_BLEND_MAX);
+ boolean need_alpha_factor = b->rt[0].blend_enable
+ && (b->rt[0].alpha_func != PIPE_BLEND_MIN)
+ && (b->rt[0].alpha_func != PIPE_BLEND_MAX);
- if (b->blend_enable) {
- sF[0] = b->rgb_src_factor;
+ if (b->rt[0].blend_enable) {
+ sF[0] = b->rt[0].rgb_src_factor;
sF[1] = sF[0];
sF[2] = sF[0];
- switch (b->alpha_src_factor & 0x0f) {
+ switch (b->rt[0].alpha_src_factor & 0x0f) {
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
sF[3] = PIPE_BLENDFACTOR_ONE;
break;
@@ -1023,30 +1023,30 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
case PIPE_BLENDFACTOR_DST_COLOR:
case PIPE_BLENDFACTOR_CONST_COLOR:
case PIPE_BLENDFACTOR_SRC1_COLOR:
- sF[3] = b->alpha_src_factor + 1;
+ sF[3] = b->rt[0].alpha_src_factor + 1;
break;
default:
- sF[3] = b->alpha_src_factor;
+ sF[3] = b->rt[0].alpha_src_factor;
}
- dF[0] = b->rgb_dst_factor;
+ dF[0] = b->rt[0].rgb_dst_factor;
dF[1] = dF[0];
dF[2] = dF[0];
- switch (b->alpha_dst_factor & 0x0f) {
+ switch (b->rt[0].alpha_dst_factor & 0x0f) {
case PIPE_BLENDFACTOR_SRC_COLOR:
case PIPE_BLENDFACTOR_DST_COLOR:
case PIPE_BLENDFACTOR_CONST_COLOR:
case PIPE_BLENDFACTOR_SRC1_COLOR:
- dF[3] = b->alpha_dst_factor + 1;
+ dF[3] = b->rt[0].alpha_dst_factor + 1;
break;
default:
- dF[3] = b->alpha_dst_factor;
+ dF[3] = b->rt[0].alpha_dst_factor;
}
- func[0] = b->rgb_func;
+ func[0] = b->rt[0].rgb_func;
func[1] = func[0];
func[2] = func[0];
- func[3] = b->alpha_func;
+ func[3] = b->rt[0].alpha_func;
} else {
sF[0] = PIPE_BLENDFACTOR_ONE;
sF[1] = PIPE_BLENDFACTOR_ONE;
@@ -1067,7 +1067,7 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
/* If alpha writing is enabled and the alpha blend mode requires use of
* the alpha factor, calculate the alpha factor.
*/
- if (((b->colormask & 8) != 0) && need_alpha_factor) {
+ if (((b->rt[0].colormask & 8) != 0) && need_alpha_factor) {
src_factor[3] = emit_alpha_factor_calculation(f, sF[3], const_color[3],
frag[3], pixel[3]);
@@ -1091,8 +1091,8 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
src_factor[2] = dst_factor[3];
} else if (need_color_factor) {
emit_color_factor_calculation(f,
- b->rgb_src_factor,
- b->colormask,
+ b->rt[0].rgb_src_factor,
+ b->rt[0].colormask,
frag, pixel, const_color, src_factor);
}
@@ -1111,15 +1111,15 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
dst_factor[2] = src_factor[2];
} else if (need_color_factor) {
emit_color_factor_calculation(f,
- b->rgb_dst_factor,
- b->colormask,
+ b->rt[0].rgb_dst_factor,
+ b->rt[0].colormask,
frag, pixel, const_color, dst_factor);
}
for (i = 0; i < 4; ++i) {
- if ((b->colormask & (1U << i)) != 0) {
+ if ((b->rt[0].colormask & (1U << i)) != 0) {
emit_blend_calculation(f,
func[i], sF[i], dF[i],
frag[i], src_factor[i],
@@ -1216,7 +1216,7 @@ cell_generate_logic_op(struct spe_function *f,
/* Short-circuit the noop and invert cases.
*/
- if ((logic_op == PIPE_LOGICOP_NOOP) || (blend->colormask == 0)) {
+ if ((logic_op == PIPE_LOGICOP_NOOP) || (blend->rt[0].colormask == 0)) {
spe_bi(f, 0, 0, 0);
return;
} else if (logic_op == PIPE_LOGICOP_INVERT) {
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 06949c15f88..23e4d6b9938 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -103,13 +103,13 @@ i915_create_blend_state(struct pipe_context *pipe,
struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state );
{
- unsigned eqRGB = blend->rgb_func;
- unsigned srcRGB = blend->rgb_src_factor;
- unsigned dstRGB = blend->rgb_dst_factor;
+ unsigned eqRGB = blend->rt[0].rgb_func;
+ unsigned srcRGB = blend->rt[0].rgb_src_factor;
+ unsigned dstRGB = blend->rt[0].rgb_dst_factor;
- unsigned eqA = blend->alpha_func;
- unsigned srcA = blend->alpha_src_factor;
- unsigned dstA = blend->alpha_dst_factor;
+ unsigned eqA = blend->rt[0].alpha_func;
+ unsigned srcA = blend->rt[0].alpha_src_factor;
+ unsigned dstA = blend->rt[0].alpha_dst_factor;
/* Special handling for MIN/MAX filter modes handled at
* state_tracker level.
@@ -146,22 +146,22 @@ i915_create_blend_state(struct pipe_context *pipe,
if (blend->dither)
cso_data->LIS5 |= S5_COLOR_DITHER_ENABLE;
- if ((blend->colormask & PIPE_MASK_R) == 0)
+ if ((blend->rt[0].colormask & PIPE_MASK_R) == 0)
cso_data->LIS5 |= S5_WRITEDISABLE_RED;
- if ((blend->colormask & PIPE_MASK_G) == 0)
+ if ((blend->rt[0].colormask & PIPE_MASK_G) == 0)
cso_data->LIS5 |= S5_WRITEDISABLE_GREEN;
- if ((blend->colormask & PIPE_MASK_B) == 0)
+ if ((blend->rt[0].colormask & PIPE_MASK_B) == 0)
cso_data->LIS5 |= S5_WRITEDISABLE_BLUE;
- if ((blend->colormask & PIPE_MASK_A) == 0)
+ if ((blend->rt[0].colormask & PIPE_MASK_A) == 0)
cso_data->LIS5 |= S5_WRITEDISABLE_ALPHA;
- if (blend->blend_enable) {
- unsigned funcRGB = blend->rgb_func;
- unsigned srcRGB = blend->rgb_src_factor;
- unsigned dstRGB = blend->rgb_dst_factor;
+ if (blend->rt[0].blend_enable) {
+ unsigned funcRGB = blend->rt[0].rgb_func;
+ unsigned srcRGB = blend->rt[0].rgb_src_factor;
+ unsigned dstRGB = blend->rt[0].rgb_dst_factor;
cso_data->LIS6 |= (S6_CBUF_BLEND_ENABLE |
SRC_BLND_FACT(i915_translate_blend_factor(srcRGB)) |
diff --git a/src/gallium/drivers/i965/brw_pipe_blend.c b/src/gallium/drivers/i965/brw_pipe_blend.c
index b759a910b63..21f786f8715 100644
--- a/src/gallium/drivers/i965/brw_pipe_blend.c
+++ b/src/gallium/drivers/i965/brw_pipe_blend.c
@@ -118,14 +118,14 @@ static void *brw_create_blend_state( struct pipe_context *pipe,
blend->cc2.logicop_enable = 1;
blend->cc5.logicop_func = translate_logicop(templ->logicop_func);
}
- else if (templ->blend_enable) {
- blend->cc6.dest_blend_factor = translate_blend_factor(templ->rgb_dst_factor);
- blend->cc6.src_blend_factor = translate_blend_factor(templ->rgb_src_factor);
- blend->cc6.blend_function = translate_blend_equation(templ->rgb_func);
+ else if (templ->rt[0].blend_enable) {
+ blend->cc6.dest_blend_factor = translate_blend_factor(templ->rt[0].rgb_dst_factor);
+ blend->cc6.src_blend_factor = translate_blend_factor(templ->rt[0].rgb_src_factor);
+ blend->cc6.blend_function = translate_blend_equation(templ->rt[0].rgb_func);
- blend->cc5.ia_dest_blend_factor = translate_blend_factor(templ->alpha_dst_factor);
- blend->cc5.ia_src_blend_factor = translate_blend_factor(templ->alpha_src_factor);
- blend->cc5.ia_blend_function = translate_blend_equation(templ->alpha_func);
+ blend->cc5.ia_dest_blend_factor = translate_blend_factor(templ->rt[0].alpha_dst_factor);
+ blend->cc5.ia_src_blend_factor = translate_blend_factor(templ->rt[0].alpha_src_factor);
+ blend->cc5.ia_blend_function = translate_blend_equation(templ->rt[0].alpha_func);
blend->cc3.blend_enable = 1;
blend->cc3.ia_blend_enable =
@@ -146,10 +146,10 @@ static void *brw_create_blend_state( struct pipe_context *pipe,
/* Per-surface color mask -- just follow global state:
*/
- blend->ss0.writedisable_red = (templ->colormask & PIPE_MASK_R) ? 0 : 1;
- blend->ss0.writedisable_green = (templ->colormask & PIPE_MASK_G) ? 0 : 1;
- blend->ss0.writedisable_blue = (templ->colormask & PIPE_MASK_B) ? 0 : 1;
- blend->ss0.writedisable_alpha = (templ->colormask & PIPE_MASK_A) ? 0 : 1;
+ blend->ss0.writedisable_red = (templ->rt[0].colormask & PIPE_MASK_R) ? 0 : 1;
+ blend->ss0.writedisable_green = (templ->rt[0].colormask & PIPE_MASK_G) ? 0 : 1;
+ blend->ss0.writedisable_blue = (templ->rt[0].colormask & PIPE_MASK_B) ? 0 : 1;
+ blend->ss0.writedisable_alpha = (templ->rt[0].colormask & PIPE_MASK_A) ? 0 : 1;
return (void *)blend;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
index ced7b9c11d7..ad1dbbc9b19 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
@@ -314,9 +314,10 @@ lp_build_blend_aos(LLVMBuilderRef builder,
LLVMValueRef dst_term;
/* FIXME */
- assert(blend->colormask == 0xf);
+ assert(blend->independent_blend_enable == 0);
+ assert(blend->rt[0].colormask == 0xf);
- if(!blend->blend_enable)
+ if(!blend->rt[0].blend_enable)
return src;
/* It makes no sense to blend unless values are normalized */
@@ -333,14 +334,16 @@ lp_build_blend_aos(LLVMBuilderRef builder,
* combinations it is possible to reorder the operations and therefore saving
* some instructions. */
- src_term = lp_build_blend_factor(&bld, src, blend->rgb_src_factor, blend->alpha_src_factor, alpha_swizzle);
- dst_term = lp_build_blend_factor(&bld, dst, blend->rgb_dst_factor, blend->alpha_dst_factor, alpha_swizzle);
+ src_term = lp_build_blend_factor(&bld, src, blend->rt[0].rgb_src_factor,
+ blend->rt[0].alpha_src_factor, alpha_swizzle);
+ dst_term = lp_build_blend_factor(&bld, dst, blend->rt[0].rgb_dst_factor,
+ blend->rt[0].alpha_dst_factor, alpha_swizzle);
lp_build_name(src_term, "src_term");
lp_build_name(dst_term, "dst_term");
- if(blend->rgb_func == blend->alpha_func) {
- return lp_build_blend_func(&bld.base, blend->rgb_func, src_term, dst_term);
+ if(blend->rt[0].rgb_func == blend->rt[0].alpha_func) {
+ return lp_build_blend_func(&bld.base, blend->rt[0].rgb_func, src_term, dst_term);
}
else {
/* Seperate RGB / A functions */
@@ -348,8 +351,8 @@ lp_build_blend_aos(LLVMBuilderRef builder,
LLVMValueRef rgb;
LLVMValueRef alpha;
- rgb = lp_build_blend_func(&bld.base, blend->rgb_func, src_term, dst_term);
- alpha = lp_build_blend_func(&bld.base, blend->alpha_func, src_term, dst_term);
+ rgb = lp_build_blend_func(&bld.base, blend->rt[0].rgb_func, src_term, dst_term);
+ alpha = lp_build_blend_func(&bld.base, blend->rt[0].alpha_func, src_term, dst_term);
return lp_build_blend_swizzle(&bld, rgb, alpha, LP_BUILD_BLEND_SWIZZLE_RGBA, alpha_swizzle);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
index 5d5ca7a5d43..a73d1158e79 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
@@ -217,7 +217,7 @@ lp_build_blend_soa(LLVMBuilderRef builder,
}
for (i = 0; i < 4; ++i) {
- if (blend->colormask & (1 << i)) {
+ if (blend->rt[0].colormask & (1 << i)) {
if (blend->logicop_enable) {
if(!type.floating) {
res[i] = lp_build_logicop(builder, blend->logicop_func, src[i], dst[i]);
@@ -225,10 +225,10 @@ lp_build_blend_soa(LLVMBuilderRef builder,
else
res[i] = dst[i];
}
- else if (blend->blend_enable) {
- unsigned src_factor = i < 3 ? blend->rgb_src_factor : blend->alpha_src_factor;
- unsigned dst_factor = i < 3 ? blend->rgb_dst_factor : blend->alpha_dst_factor;
- unsigned func = i < 3 ? blend->rgb_func : blend->alpha_func;
+ else if (blend->rt[0].blend_enable) {
+ unsigned src_factor = i < 3 ? blend->rt[0].rgb_src_factor : blend->rt[0].alpha_src_factor;
+ unsigned dst_factor = i < 3 ? blend->rt[0].rgb_dst_factor : blend->rt[0].alpha_dst_factor;
+ unsigned func = i < 3 ? blend->rt[0].rgb_func : blend->rt[0].alpha_func;
boolean func_commutative = lp_build_blend_func_commutative(func);
/* It makes no sense to blend unless values are normalized */
@@ -269,7 +269,7 @@ lp_build_blend_soa(LLVMBuilderRef builder,
/* See if this function has been previously applied */
for(j = 0; j < i; ++j) {
- unsigned prev_func = j < 3 ? blend->rgb_func : blend->alpha_func;
+ unsigned prev_func = j < 3 ? blend->rt[0].rgb_func : blend->rt[0].alpha_func;
unsigned func_reverse = lp_build_blend_func_reverse(func, prev_func);
if((!func_reverse &&
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 9b47415f003..f04c0320ba0 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -110,6 +110,10 @@ llvmpipe_get_param(struct pipe_screen *screen, int param)
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
return 0;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 0cb335fe27a..ddd0740f1b4 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -352,7 +352,7 @@ generate_blend(const struct pipe_blend_state *blend,
lp_build_blend_soa(builder, blend, type, src, dst, con, res);
for(chan = 0; chan < 4; ++chan) {
- if(blend->colormask & (1 << chan)) {
+ if(blend->rt[0].colormask & (1 << chan)) {
LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), chan, 0);
lp_build_name(res[chan], "res.%c", "rgba"[chan]);
res[chan] = lp_build_select(&bld, mask, res[chan], dst[chan]);
@@ -421,15 +421,15 @@ generate_fragment(struct llvmpipe_context *lp,
if(key->blend.logicop_enable) {
debug_printf("blend.logicop_func = %u\n", key->blend.logicop_func);
}
- else if(key->blend.blend_enable) {
- debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rgb_func, TRUE));
- debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_src_factor, TRUE));
- debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_dst_factor, TRUE));
- debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.alpha_func, TRUE));
- debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_src_factor, TRUE));
- debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE));
+ else if(key->blend.rt[0].blend_enable) {
+ debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rt[0].rgb_func, TRUE));
+ debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].rgb_src_factor, TRUE));
+ debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].rgb_dst_factor, TRUE));
+ debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.rt[0].alpha_func, TRUE));
+ debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_src_factor, TRUE));
+ debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_dst_factor, TRUE));
}
- debug_printf("blend.colormask = 0x%x\n", key->blend.colormask);
+ debug_printf("blend.colormask = 0x%x\n", key->blend.rt[0].colormask);
for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
if(key->sampler[i].format) {
debug_printf("sampler[%u] = \n", i);
@@ -780,7 +780,7 @@ make_variant_key(struct llvmpipe_context *lp,
for(chan = 0; chan < 4; ++chan) {
enum util_format_swizzle swizzle = format_desc->swizzle[chan];
if(swizzle > 4)
- key->blend.colormask &= ~(1 << chan);
+ key->blend.rt[0].colormask &= ~(1 << chan);
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c
index 7b65bab43a4..ee72f6ce4fc 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_blend.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c
@@ -103,18 +103,18 @@ write_tsv_row(FILE *fp,
fprintf(fp,
"%s\t%s\t%s\t",
- blend->rgb_func != blend->alpha_func ? "true" : "false",
- blend->rgb_src_factor != blend->alpha_src_factor ? "true" : "false",
- blend->rgb_dst_factor != blend->alpha_dst_factor ? "true" : "false");
+ blend->rt[0].rgb_func != blend->rt[0].alpha_func ? "true" : "false",
+ blend->rt[0].rgb_src_factor != blend->rt[0].alpha_src_factor ? "true" : "false",
+ blend->rt[0].rgb_dst_factor != blend->rt[0].alpha_dst_factor ? "true" : "false");
fprintf(fp,
"%s\t%s\t%s\t%s\t%s\t%s\n",
- debug_dump_blend_func(blend->rgb_func, TRUE),
- debug_dump_blend_factor(blend->rgb_src_factor, TRUE),
- debug_dump_blend_factor(blend->rgb_dst_factor, TRUE),
- debug_dump_blend_func(blend->alpha_func, TRUE),
- debug_dump_blend_factor(blend->alpha_src_factor, TRUE),
- debug_dump_blend_factor(blend->alpha_dst_factor, TRUE));
+ debug_dump_blend_func(blend->rt[0].rgb_func, TRUE),
+ debug_dump_blend_factor(blend->rt[0].rgb_src_factor, TRUE),
+ debug_dump_blend_factor(blend->rt[0].rgb_dst_factor, TRUE),
+ debug_dump_blend_func(blend->rt[0].alpha_func, TRUE),
+ debug_dump_blend_factor(blend->rt[0].alpha_src_factor, TRUE),
+ debug_dump_blend_factor(blend->rt[0].alpha_dst_factor, TRUE));
fflush(fp);
}
@@ -136,12 +136,12 @@ dump_blend_type(FILE *fp,
fprintf(fp,
" %s=%s %s=%s %s=%s %s=%s %s=%s %s=%s",
- "rgb_func", debug_dump_blend_func(blend->rgb_func, TRUE),
- "rgb_src_factor", debug_dump_blend_factor(blend->rgb_src_factor, TRUE),
- "rgb_dst_factor", debug_dump_blend_factor(blend->rgb_dst_factor, TRUE),
- "alpha_func", debug_dump_blend_func(blend->alpha_func, TRUE),
- "alpha_src_factor", debug_dump_blend_factor(blend->alpha_src_factor, TRUE),
- "alpha_dst_factor", debug_dump_blend_factor(blend->alpha_dst_factor, TRUE));
+ "rgb_func", debug_dump_blend_func(blend->rt[0].rgb_func, TRUE),
+ "rgb_src_factor", debug_dump_blend_factor(blend->rt[0].rgb_src_factor, TRUE),
+ "rgb_dst_factor", debug_dump_blend_factor(blend->rt[0].rgb_dst_factor, TRUE),
+ "alpha_func", debug_dump_blend_func(blend->rt[0].alpha_func, TRUE),
+ "alpha_src_factor", debug_dump_blend_factor(blend->rt[0].alpha_src_factor, TRUE),
+ "alpha_dst_factor", debug_dump_blend_factor(blend->rt[0].alpha_dst_factor, TRUE));
fprintf(fp, " ...\n");
fflush(fp);
@@ -400,13 +400,15 @@ compute_blend_ref(const struct pipe_blend_state *blend,
double src_term[4];
double dst_term[4];
- compute_blend_ref_term(blend->rgb_src_factor, blend->alpha_src_factor, src, src, dst, con, src_term);
- compute_blend_ref_term(blend->rgb_dst_factor, blend->alpha_dst_factor, dst, src, dst, con, dst_term);
+ compute_blend_ref_term(blend->rt[0].rgb_src_factor, blend->rt[0].alpha_src_factor,
+ src, src, dst, con, src_term);
+ compute_blend_ref_term(blend->rt[0].rgb_dst_factor, blend->rt[0].alpha_dst_factor,
+ dst, src, dst, con, dst_term);
/*
* Combine RGB terms
*/
- switch (blend->rgb_func) {
+ switch (blend->rt[0].rgb_func) {
case PIPE_BLEND_ADD:
ADD_SAT(res[0], src_term[0], dst_term[0]); /* R */
ADD_SAT(res[1], src_term[1], dst_term[1]); /* G */
@@ -439,7 +441,7 @@ compute_blend_ref(const struct pipe_blend_state *blend,
/*
* Combine A terms
*/
- switch (blend->alpha_func) {
+ switch (blend->rt[0].alpha_func) {
case PIPE_BLEND_ADD:
ADD_SAT(res[3], src_term[3], dst_term[3]); /* A */
break;
@@ -805,14 +807,14 @@ test_all(unsigned verbose, FILE *fp)
continue;
memset(&blend, 0, sizeof blend);
- blend.blend_enable = 1;
- blend.rgb_func = *rgb_func;
- blend.rgb_src_factor = *rgb_src_factor;
- blend.rgb_dst_factor = *rgb_dst_factor;
- blend.alpha_func = *alpha_func;
- blend.alpha_src_factor = *alpha_src_factor;
- blend.alpha_dst_factor = *alpha_dst_factor;
- blend.colormask = PIPE_MASK_RGBA;
+ blend.rt[0].blend_enable = 1;
+ blend.rt[0].rgb_func = *rgb_func;
+ blend.rt[0].rgb_src_factor = *rgb_src_factor;
+ blend.rt[0].rgb_dst_factor = *rgb_dst_factor;
+ blend.rt[0].alpha_func = *alpha_func;
+ blend.rt[0].alpha_src_factor = *alpha_src_factor;
+ blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
+ blend.rt[0].colormask = PIPE_MASK_RGBA;
if(!test_one(verbose, fp, &blend, mode, *type))
success = FALSE;
@@ -864,14 +866,14 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
type = &blend_types[rand() % num_types];
memset(&blend, 0, sizeof blend);
- blend.blend_enable = 1;
- blend.rgb_func = *rgb_func;
- blend.rgb_src_factor = *rgb_src_factor;
- blend.rgb_dst_factor = *rgb_dst_factor;
- blend.alpha_func = *alpha_func;
- blend.alpha_src_factor = *alpha_src_factor;
- blend.alpha_dst_factor = *alpha_dst_factor;
- blend.colormask = PIPE_MASK_RGBA;
+ blend.rt[0].blend_enable = 1;
+ blend.rt[0].rgb_func = *rgb_func;
+ blend.rt[0].rgb_src_factor = *rgb_src_factor;
+ blend.rt[0].rgb_dst_factor = *rgb_dst_factor;
+ blend.rt[0].alpha_func = *alpha_func;
+ blend.rt[0].alpha_src_factor = *alpha_src_factor;
+ blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
+ blend.rt[0].colormask = PIPE_MASK_RGBA;
if(!test_one(verbose, fp, &blend, mode, *type))
success = FALSE;
diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c
index 7c5b6e8229a..4eba7725753 100644
--- a/src/gallium/drivers/nv04/nv04_screen.c
+++ b/src/gallium/drivers/nv04/nv04_screen.c
@@ -45,6 +45,10 @@ nv04_screen_get_param(struct pipe_screen *screen, int param)
case NOUVEAU_CAP_HW_VTXBUF:
case NOUVEAU_CAP_HW_IDXBUF:
return 0;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nv04/nv04_state.c b/src/gallium/drivers/nv04/nv04_state.c
index b67f1e16b1c..1fdb764b532 100644
--- a/src/gallium/drivers/nv04/nv04_state.c
+++ b/src/gallium/drivers/nv04/nv04_state.c
@@ -17,11 +17,11 @@ nv04_blend_state_create(struct pipe_context *pipe,
cb = MALLOC(sizeof(struct nv04_blend_state));
- cb->b_enable = cso->blend_enable ? 1 : 0;
- cb->b_src = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
- (nvgl_blend_func(cso->rgb_src_factor)));
- cb->b_dst = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
- (nvgl_blend_func(cso->rgb_dst_factor)));
+ cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
+ cb->b_src = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
+ (nvgl_blend_func(cso->rt[0].rgb_src_factor)));
+ cb->b_dst = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
+ (nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
return (void *)cb;
diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c
index 69a6dab866a..2dabc4509fb 100644
--- a/src/gallium/drivers/nv10/nv10_screen.c
+++ b/src/gallium/drivers/nv10/nv10_screen.c
@@ -40,6 +40,10 @@ nv10_screen_get_param(struct pipe_screen *screen, int param)
case NOUVEAU_CAP_HW_VTXBUF:
case NOUVEAU_CAP_HW_IDXBUF:
return 0;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c
index ad7def53b12..9aafc604116 100644
--- a/src/gallium/drivers/nv10/nv10_state.c
+++ b/src/gallium/drivers/nv10/nv10_state.c
@@ -17,16 +17,16 @@ nv10_blend_state_create(struct pipe_context *pipe,
cb = MALLOC(sizeof(struct nv10_blend_state));
- cb->b_enable = cso->blend_enable ? 1 : 0;
- cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
- (nvgl_blend_func(cso->rgb_src_factor)));
- cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
- (nvgl_blend_func(cso->rgb_dst_factor)));
-
- cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
- ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
- ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
+ cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
+ cb->b_srcfunc = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
+ (nvgl_blend_func(cso->rt[0].rgb_src_factor)));
+ cb->b_dstfunc = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
+ (nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
+
+ cb->c_mask = (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
cb->d_enable = cso->dither ? 1 : 0;
diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c
index d091335063b..7782cbe3a8e 100644
--- a/src/gallium/drivers/nv20/nv20_screen.c
+++ b/src/gallium/drivers/nv20/nv20_screen.c
@@ -40,6 +40,10 @@ nv20_screen_get_param(struct pipe_screen *screen, int param)
case NOUVEAU_CAP_HW_VTXBUF:
case NOUVEAU_CAP_HW_IDXBUF:
return 0;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c
index 45697a60efd..83335c790a0 100644
--- a/src/gallium/drivers/nv20/nv20_state.c
+++ b/src/gallium/drivers/nv20/nv20_state.c
@@ -17,16 +17,16 @@ nv20_blend_state_create(struct pipe_context *pipe,
cb = MALLOC(sizeof(struct nv20_blend_state));
- cb->b_enable = cso->blend_enable ? 1 : 0;
- cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
- (nvgl_blend_func(cso->rgb_src_factor)));
- cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
- (nvgl_blend_func(cso->rgb_dst_factor)));
-
- cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
- ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
- ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
+ cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
+ cb->b_srcfunc = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
+ (nvgl_blend_func(cso->rt[0].rgb_src_factor)));
+ cb->b_dstfunc = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
+ (nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
+
+ cb->c_mask = (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
cb->d_enable = cso->dither ? 1 : 0;
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 9ed48178dc2..8f8f3ea1a9f 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -67,6 +67,10 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param)
case NOUVEAU_CAP_HW_VTXBUF:
case NOUVEAU_CAP_HW_IDXBUF:
return 1;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index 065c927a10d..1f4c9642705 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -16,27 +16,27 @@ nv30_blend_state_create(struct pipe_context *pipe,
struct nv30_blend_state *bso = CALLOC(1, sizeof(*bso));
struct nouveau_stateobj *so = so_new(5, 8, 0);
- if (cso->blend_enable) {
+ if (cso->rt[0].blend_enable) {
so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 3);
so_data (so, 1);
- so_data (so, (nvgl_blend_func(cso->alpha_src_factor) << 16) |
- nvgl_blend_func(cso->rgb_src_factor));
- so_data (so, nvgl_blend_func(cso->alpha_dst_factor) << 16 |
- nvgl_blend_func(cso->rgb_dst_factor));
+ so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
+ nvgl_blend_func(cso->rt[0].rgb_src_factor));
+ so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
+ nvgl_blend_func(cso->rt[0].rgb_dst_factor));
/* FIXME: Gallium assumes GL_EXT_blend_func_separate.
It is not the case for NV30 */
so_method(so, rankine, NV34TCL_BLEND_EQUATION, 1);
- so_data (so, nvgl_blend_eqn(cso->rgb_func));
+ so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
} else {
so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 1);
so_data (so, 0);
}
so_method(so, rankine, NV34TCL_COLOR_MASK, 1);
- so_data (so, (((cso->colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
- ((cso->colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
- ((cso->colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
+ so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
if (cso->logicop_enable) {
so_method(so, rankine, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index 9e55e5a089c..4eab5daa80c 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -52,6 +52,10 @@ nv40_screen_get_param(struct pipe_screen *pscreen, int param)
if (screen->curie->grclass == NV40TCL)
return 1;
return 0;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index 7d990f7d567..7a63fba18c5 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -18,26 +18,26 @@ nv40_blend_state_create(struct pipe_context *pipe,
struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso));
struct nouveau_stateobj *so = so_new(5, 8, 0);
- if (cso->blend_enable) {
+ if (cso->rt[0].blend_enable) {
so_method(so, curie, NV40TCL_BLEND_ENABLE, 3);
so_data (so, 1);
- so_data (so, (nvgl_blend_func(cso->alpha_src_factor) << 16) |
- nvgl_blend_func(cso->rgb_src_factor));
- so_data (so, nvgl_blend_func(cso->alpha_dst_factor) << 16 |
- nvgl_blend_func(cso->rgb_dst_factor));
+ so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
+ nvgl_blend_func(cso->rt[0].rgb_src_factor));
+ so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
+ nvgl_blend_func(cso->rt[0].rgb_dst_factor));
so_method(so, curie, NV40TCL_BLEND_EQUATION, 1);
- so_data (so, nvgl_blend_eqn(cso->alpha_func) << 16 |
- nvgl_blend_eqn(cso->rgb_func));
+ so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
+ nvgl_blend_eqn(cso->rt[0].rgb_func));
} else {
so_method(so, curie, NV40TCL_BLEND_ENABLE, 1);
so_data (so, 0);
}
so_method(so, curie, NV40TCL_COLOR_MASK, 1);
- so_data (so, (((cso->colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
- ((cso->colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
- ((cso->colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
+ so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
if (cso->logicop_enable) {
so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 2);
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 9d58f3c9651..6af9700c1af 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -135,6 +135,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
return 1;
case NOUVEAU_CAP_HW_IDXBUF:
return 0;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 1;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 6ab33be663d..da8dc933b03 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -31,6 +31,23 @@
#include "nouveau/nouveau_stateobj.h"
+static INLINE uint32_t
+nv50_colormask(unsigned mask)
+{
+ uint32_t cmask = 0;
+
+ if (mask & PIPE_MASK_R)
+ cmask |= 0x0001;
+ if (mask & PIPE_MASK_G)
+ cmask |= 0x0010;
+ if (mask & PIPE_MASK_B)
+ cmask |= 0x0100;
+ if (mask & PIPE_MASK_A)
+ cmask |= 0x1000;
+
+ return cmask;
+}
+
static void *
nv50_blend_state_create(struct pipe_context *pipe,
const struct pipe_blend_state *cso)
@@ -38,28 +55,37 @@ nv50_blend_state_create(struct pipe_context *pipe,
struct nouveau_stateobj *so = so_new(5, 24, 0);
struct nouveau_grobj *tesla = nv50_context(pipe)->screen->tesla;
struct nv50_blend_stateobj *bso = CALLOC_STRUCT(nv50_blend_stateobj);
- unsigned cmask = 0, i;
+ unsigned i, blend_enabled = 0;
/*XXX ignored:
* - dither
*/
- if (cso->blend_enable == 0) {
- so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
+ so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
+ if (cso->independent_blend_enable) {
+ for (i = 0; i < 8; ++i) {
+ so_data(so, cso->rt[i].blend_enable);
+ if (cso->rt[i].blend_enable)
+ blend_enabled = 1;
+ }
+ } else
+ if (cso->rt[0].blend_enable) {
+ blend_enabled = 1;
for (i = 0; i < 8; i++)
- so_data(so, 0);
+ so_data(so, 1);
} else {
- so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
for (i = 0; i < 8; i++)
- so_data(so, 1);
+ so_data(so, 0);
+ }
+ if (blend_enabled) {
so_method(so, tesla, NV50TCL_BLEND_EQUATION_RGB, 5);
- so_data (so, nvgl_blend_eqn(cso->rgb_func));
- so_data (so, 0x4000 | nvgl_blend_func(cso->rgb_src_factor));
- so_data (so, 0x4000 | nvgl_blend_func(cso->rgb_dst_factor));
- so_data (so, nvgl_blend_eqn(cso->alpha_func));
- so_data (so, 0x4000 | nvgl_blend_func(cso->alpha_src_factor));
+ so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
+ so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].rgb_src_factor));
+ so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].rgb_dst_factor));
+ so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func));
+ so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].alpha_src_factor));
so_method(so, tesla, NV50TCL_BLEND_FUNC_DST_ALPHA, 1);
- so_data (so, 0x4000 | nvgl_blend_func(cso->alpha_dst_factor));
+ so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].alpha_dst_factor));
}
if (cso->logicop_enable == 0 ) {
@@ -71,17 +97,15 @@ nv50_blend_state_create(struct pipe_context *pipe,
so_data (so, nvgl_logicop_func(cso->logicop_func));
}
- if (cso->colormask & PIPE_MASK_R)
- cmask |= (1 << 0);
- if (cso->colormask & PIPE_MASK_G)
- cmask |= (1 << 4);
- if (cso->colormask & PIPE_MASK_B)
- cmask |= (1 << 8);
- if (cso->colormask & PIPE_MASK_A)
- cmask |= (1 << 12);
so_method(so, tesla, NV50TCL_COLOR_MASK(0), 8);
- for (i = 0; i < 8; i++)
- so_data(so, cmask);
+ if (cso->independent_blend_enable)
+ for (i = 0; i < 8; ++i)
+ so_data(so, nv50_colormask(cso->rt[i].colormask));
+ else {
+ uint32_t cmask = nv50_colormask(cso->rt[0].colormask);
+ for (i = 0; i < 8; i++)
+ so_data(so, cmask);
+ }
bso->pipe = *cso;
so_ref(so, &bso->so);
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index a4a0e528159..b8fbf03d3a9 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -149,6 +149,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
} else {
return 0;
}
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
default:
debug_printf("r300: Implementation error: Bad param %d\n",
param);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 1b920563a5f..3cdcf94274c 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -163,15 +163,15 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
{
struct r300_blend_state* blend = CALLOC_STRUCT(r300_blend_state);
- if (state->blend_enable)
+ if (state->rt[0].blend_enable)
{
- unsigned eqRGB = state->rgb_func;
- unsigned srcRGB = state->rgb_src_factor;
- unsigned dstRGB = state->rgb_dst_factor;
+ unsigned eqRGB = state->rt[0].rgb_func;
+ unsigned srcRGB = state->rt[0].rgb_src_factor;
+ unsigned dstRGB = state->rt[0].rgb_dst_factor;
- unsigned eqA = state->alpha_func;
- unsigned srcA = state->alpha_src_factor;
- unsigned dstA = state->alpha_dst_factor;
+ unsigned eqA = state->rt[0].alpha_func;
+ unsigned srcA = state->rt[0].alpha_src_factor;
+ unsigned dstA = state->rt[0].alpha_dst_factor;
/* despite the name, ALPHA_BLEND_ENABLE has nothing to do with alpha,
* this is just the crappy D3D naming */
@@ -289,16 +289,16 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
}
/* Color Channel Mask */
- if (state->colormask & PIPE_MASK_R) {
+ if (state->rt[0].colormask & PIPE_MASK_R) {
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_RED_MASK0;
}
- if (state->colormask & PIPE_MASK_G) {
+ if (state->rt[0].colormask & PIPE_MASK_G) {
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0;
}
- if (state->colormask & PIPE_MASK_B) {
+ if (state->rt[0].colormask & PIPE_MASK_B) {
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0;
}
- if (state->colormask & PIPE_MASK_A) {
+ if (state->rt[0].colormask & PIPE_MASK_A) {
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0;
}
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index 3b8c2d5789c..d65307b7f60 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -223,7 +223,8 @@ logicop_quad(struct quad_stage *qs,
static void
blend_quad(struct quad_stage *qs,
float (*quadColor)[4],
- float (*dest)[4])
+ float (*dest)[4],
+ unsigned cbuf)
{
static const float zero[4] = { 0, 0, 0, 0 };
static const float one[4] = { 1, 1, 1, 1 };
@@ -233,7 +234,7 @@ blend_quad(struct quad_stage *qs,
/*
* Compute src/first term RGB
*/
- switch (softpipe->blend->rgb_src_factor) {
+ switch (softpipe->blend->rt[cbuf].rgb_src_factor) {
case PIPE_BLENDFACTOR_ONE:
VEC4_COPY(source[0], quadColor[0]); /* R */
VEC4_COPY(source[1], quadColor[1]); /* G */
@@ -383,7 +384,7 @@ blend_quad(struct quad_stage *qs,
/*
* Compute src/first term A
*/
- switch (softpipe->blend->alpha_src_factor) {
+ switch (softpipe->blend->rt[cbuf].alpha_src_factor) {
case PIPE_BLENDFACTOR_ONE:
VEC4_COPY(source[3], quadColor[3]); /* A */
break;
@@ -452,7 +453,7 @@ blend_quad(struct quad_stage *qs,
/*
* Compute dest/second term RGB
*/
- switch (softpipe->blend->rgb_dst_factor) {
+ switch (softpipe->blend->rt[cbuf].rgb_dst_factor) {
case PIPE_BLENDFACTOR_ONE:
/* dest = dest * 1 NO-OP, leave dest as-is */
break;
@@ -592,7 +593,7 @@ blend_quad(struct quad_stage *qs,
/*
* Compute dest/second term A
*/
- switch (softpipe->blend->alpha_dst_factor) {
+ switch (softpipe->blend->rt[cbuf].alpha_dst_factor) {
case PIPE_BLENDFACTOR_ONE:
/* dest = dest * 1 NO-OP, leave dest as-is */
break;
@@ -655,7 +656,7 @@ blend_quad(struct quad_stage *qs,
/*
* Combine RGB terms
*/
- switch (softpipe->blend->rgb_func) {
+ switch (softpipe->blend->rt[cbuf].rgb_func) {
case PIPE_BLEND_ADD:
VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */
VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */
@@ -688,7 +689,7 @@ blend_quad(struct quad_stage *qs,
/*
* Combine A terms
*/
- switch (softpipe->blend->alpha_func) {
+ switch (softpipe->blend->rt[cbuf].alpha_func) {
case PIPE_BLEND_ADD:
VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
break;
@@ -710,26 +711,24 @@ blend_quad(struct quad_stage *qs,
}
static void
-colormask_quad(struct quad_stage *qs,
+colormask_quad(unsigned colormask,
float (*quadColor)[4],
float (*dest)[4])
{
- struct softpipe_context *softpipe = qs->softpipe;
-
/* R */
- if (!(softpipe->blend->colormask & PIPE_MASK_R))
+ if (!(colormask & PIPE_MASK_R))
COPY_4V(quadColor[0], dest[0]);
/* G */
- if (!(softpipe->blend->colormask & PIPE_MASK_G))
+ if (!(colormask & PIPE_MASK_G))
COPY_4V(quadColor[1], dest[1]);
/* B */
- if (!(softpipe->blend->colormask & PIPE_MASK_B))
+ if (!(colormask & PIPE_MASK_B))
COPY_4V(quadColor[2], dest[2]);
/* A */
- if (!(softpipe->blend->colormask & PIPE_MASK_A))
+ if (!(colormask & PIPE_MASK_A))
COPY_4V(quadColor[3], dest[3]);
}
@@ -772,12 +771,12 @@ blend_fallback(struct quad_stage *qs,
if (blend->logicop_enable) {
logicop_quad( qs, quadColor, dest );
}
- else if (blend->blend_enable) {
- blend_quad( qs, quadColor, dest );
+ else if (blend->rt[cbuf].blend_enable) {
+ blend_quad( qs, quadColor, dest, cbuf );
}
- if (blend->colormask != 0xf)
- colormask_quad( qs, quadColor, dest );
+ if (blend->rt[cbuf].colormask != 0xf)
+ colormask_quad( blend->rt[cbuf].colormask, quadColor, dest);
/* Output color values
*/
@@ -953,23 +952,23 @@ choose_blend_quad(struct quad_stage *qs,
qs->run = blend_noop;
}
else if (!softpipe->blend->logicop_enable &&
- softpipe->blend->colormask == 0xf &&
+ softpipe->blend->rt[0].colormask == 0xf &&
softpipe->framebuffer.nr_cbufs == 1)
{
- if (!blend->blend_enable) {
+ if (!blend->rt[0].blend_enable) {
qs->run = single_output_color;
}
- else if (blend->rgb_src_factor == blend->alpha_src_factor &&
- blend->rgb_dst_factor == blend->alpha_dst_factor &&
- blend->rgb_func == blend->alpha_func)
+ else if (blend->rt[0].rgb_src_factor == blend->rt[0].alpha_src_factor &&
+ blend->rt[0].rgb_dst_factor == blend->rt[0].alpha_dst_factor &&
+ blend->rt[0].rgb_func == blend->rt[0].alpha_func)
{
- if (blend->alpha_func == PIPE_BLEND_ADD) {
- if (blend->rgb_src_factor == PIPE_BLENDFACTOR_ONE &&
- blend->rgb_dst_factor == PIPE_BLENDFACTOR_ONE) {
+ if (blend->rt[0].alpha_func == PIPE_BLEND_ADD) {
+ if (blend->rt[0].rgb_src_factor == PIPE_BLENDFACTOR_ONE &&
+ blend->rt[0].rgb_dst_factor == PIPE_BLENDFACTOR_ONE) {
qs->run = blend_single_add_one_one;
}
- else if (blend->rgb_src_factor == PIPE_BLENDFACTOR_SRC_ALPHA &&
- blend->rgb_dst_factor == PIPE_BLENDFACTOR_INV_SRC_ALPHA)
+ else if (blend->rt[0].rgb_src_factor == PIPE_BLENDFACTOR_SRC_ALPHA &&
+ blend->rt[0].rgb_dst_factor == PIPE_BLENDFACTOR_INV_SRC_ALPHA)
qs->run = blend_single_add_src_alpha_inv_src_alpha;
}
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 69f40dc7b64..b2841f41031 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -95,6 +95,10 @@ softpipe_get_param(struct pipe_screen *screen, int param)
return PIPE_MAX_CONSTANT_BUFFERS;
case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
return 4096 * 4 * sizeof(float);
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ return 1;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 1;
default:
return 0;
}
diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c
index cae2d3efc58..d0723ebe9e0 100644
--- a/src/gallium/drivers/softpipe/sp_video_context.c
+++ b/src/gallium/drivers/softpipe/sp_video_context.c
@@ -185,17 +185,18 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
ctx->rast = ctx->pipe->create_rasterizer_state(ctx->pipe, &rast);
ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rast);
- blend.blend_enable = 0;
- blend.rgb_func = PIPE_BLEND_ADD;
- blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
- blend.rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
- blend.alpha_func = PIPE_BLEND_ADD;
- blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
- blend.alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
+ blend.independent_blend_enable = 0;
+ blend.rt[0].blend_enable = 0;
+ blend.rt[0].rgb_func = PIPE_BLEND_ADD;
+ blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
+ blend.rt[0].alpha_func = PIPE_BLEND_ADD;
+ blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
blend.logicop_enable = 0;
blend.logicop_func = PIPE_LOGICOP_CLEAR;
/* Needed to allow color writes to FB, even if blending disabled */
- blend.colormask = PIPE_MASK_RGBA;
+ blend.rt[0].colormask = PIPE_MASK_RGBA;
blend.dither = 0;
ctx->blend = ctx->pipe->create_blend_state(ctx->pipe, &blend);
ctx->pipe->bind_blend_state(ctx->pipe, ctx->blend);
diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c b/src/gallium/drivers/svga/svga_pipe_blend.c
index 3ad3f97816c..9df5485f462 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -181,15 +181,15 @@ svga_create_blend_state(struct pipe_context *pipe,
}
}
else {
- blend->rt[i].blend_enable = templ->blend_enable;
+ blend->rt[i].blend_enable = templ->rt[0].blend_enable;
- if (templ->blend_enable) {
- blend->rt[i].srcblend = svga_translate_blend_factor(templ->rgb_src_factor);
- blend->rt[i].dstblend = svga_translate_blend_factor(templ->rgb_dst_factor);
- blend->rt[i].blendeq = svga_translate_blend_func(templ->rgb_func);
- blend->rt[i].srcblend_alpha = svga_translate_blend_factor(templ->alpha_src_factor);
- blend->rt[i].dstblend_alpha = svga_translate_blend_factor(templ->alpha_dst_factor);
- blend->rt[i].blendeq_alpha = svga_translate_blend_func(templ->alpha_func);
+ if (templ->rt[0].blend_enable) {
+ blend->rt[i].srcblend = svga_translate_blend_factor(templ->rt[0].rgb_src_factor);
+ blend->rt[i].dstblend = svga_translate_blend_factor(templ->rt[0].rgb_dst_factor);
+ blend->rt[i].blendeq = svga_translate_blend_func(templ->rt[0].rgb_func);
+ blend->rt[i].srcblend_alpha = svga_translate_blend_factor(templ->rt[0].alpha_src_factor);
+ blend->rt[i].dstblend_alpha = svga_translate_blend_factor(templ->rt[0].alpha_dst_factor);
+ blend->rt[i].blendeq_alpha = svga_translate_blend_func(templ->rt[0].alpha_func);
if (blend->rt[i].srcblend_alpha != blend->rt[i].srcblend ||
blend->rt[i].dstblend_alpha != blend->rt[i].dstblend ||
@@ -200,7 +200,7 @@ svga_create_blend_state(struct pipe_context *pipe,
}
}
- blend->rt[i].writemask = templ->colormask;
+ blend->rt[i].writemask = templ->rt[0].colormask;
}
return blend;
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index 32f61f8c944..dbca5de0a52 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -323,9 +323,23 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
trace_dump_struct_end();
}
+static void trace_dump_rt_blend_state(const struct pipe_rt_blend_state *state)
+{
+ trace_dump_member(uint, state, rgb_func);
+ trace_dump_member(uint, state, rgb_src_factor);
+ trace_dump_member(uint, state, rgb_dst_factor);
+
+ trace_dump_member(uint, state, alpha_func);
+ trace_dump_member(uint, state, alpha_src_factor);
+ trace_dump_member(uint, state, alpha_dst_factor);
+
+ trace_dump_member(uint, state, colormask);
+
+}
void trace_dump_blend_state(const struct pipe_blend_state *state)
{
+ unsigned valid_entries = 1;
if (!trace_dumping_enabled_locked())
return;
@@ -336,21 +350,17 @@ void trace_dump_blend_state(const struct pipe_blend_state *state)
trace_dump_struct_begin("pipe_blend_state");
- trace_dump_member(bool, state, blend_enable);
-
- trace_dump_member(uint, state, rgb_func);
- trace_dump_member(uint, state, rgb_src_factor);
- trace_dump_member(uint, state, rgb_dst_factor);
-
- trace_dump_member(uint, state, alpha_func);
- trace_dump_member(uint, state, alpha_src_factor);
- trace_dump_member(uint, state, alpha_dst_factor);
+ trace_dump_member(bool, state, dither);
trace_dump_member(bool, state, logicop_enable);
trace_dump_member(uint, state, logicop_func);
- trace_dump_member(uint, state, colormask);
- trace_dump_member(bool, state, dither);
+ trace_dump_member(bool, state, independent_blend_enable);
+
+ if (state->independent_blend_enable)
+ valid_entries = PIPE_MAX_COLOR_BUFS;
+
+ trace_dump_struct_array(rt_blend_state, state->rt, valid_entries);
trace_dump_struct_end();
}