res4[j] = ~0;
break;
default:
- assert(0);
+ assert(0 && "invalid logicop mode");
}
for (j = 0; j < 4; j++) {
+/**
+ * Do blending for a 2x2 quad for one color buffer.
+ * \param quadColor the incoming quad colors
+ * \param dest the destination/framebuffer quad colors
+ * \param blend_index which set of blending terms to use
+ * \param has_dst_alpha does the dest color buffer have an alpha channel?
+ */
static void
blend_quad(struct quad_stage *qs,
float (*quadColor)[4],
float (*dest)[4],
- unsigned cbuf,
+ unsigned blend_index,
boolean has_dst_alpha)
{
static const float zero[4] = { 0, 0, 0, 0 };
/*
* Compute src/first term RGB
*/
- switch (softpipe->blend->rt[cbuf].rgb_src_factor) {
+ switch (softpipe->blend->rt[blend_index].rgb_src_factor) {
case PIPE_BLENDFACTOR_ONE:
VEC4_COPY(source[0], quadColor[0]); /* R */
VEC4_COPY(source[1], quadColor[1]); /* G */
assert(0); /* to do */
break;
default:
- assert(0);
+ assert(0 && "invalid rgb src factor");
}
/*
* Compute src/first term A
*/
- switch (softpipe->blend->rt[cbuf].alpha_src_factor) {
+ switch (softpipe->blend->rt[blend_index].alpha_src_factor) {
case PIPE_BLENDFACTOR_ONE:
VEC4_COPY(source[3], quadColor[3]); /* A */
break;
}
break;
default:
- assert(0);
+ assert(0 && "invalid alpha src factor");
}
/*
* Compute dest/second term RGB
*/
- switch (softpipe->blend->rt[cbuf].rgb_dst_factor) {
+ switch (softpipe->blend->rt[blend_index].rgb_dst_factor) {
case PIPE_BLENDFACTOR_ONE:
/* dest = dest * 1 NO-OP, leave dest as-is */
break;
assert(0);
break;
default:
- assert(0);
+ assert(0 && "invalid rgb dst factor");
}
/*
* Compute dest/second term A
*/
- switch (softpipe->blend->rt[cbuf].alpha_dst_factor) {
+ switch (softpipe->blend->rt[blend_index].alpha_dst_factor) {
case PIPE_BLENDFACTOR_ONE:
/* dest = dest * 1 NO-OP, leave dest as-is */
break;
}
break;
default:
- assert(0);
+ assert(0 && "invalid alpha dst factor");
}
/*
* Combine RGB terms
*/
- switch (softpipe->blend->rt[cbuf].rgb_func) {
+ switch (softpipe->blend->rt[blend_index].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 */
VEC4_MAX(quadColor[2], source[2], dest[2]); /* B */
break;
default:
- assert(0);
+ assert(0 && "invalid rgb blend func");
}
/*
* Combine A terms
*/
- switch (softpipe->blend->rt[cbuf].alpha_func) {
+ switch (softpipe->blend->rt[blend_index].alpha_func) {
case PIPE_BLEND_ADD:
VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
break;
VEC4_MAX(quadColor[3], source[3], dest[3]); /* A */
break;
default:
- assert(0);
+ assert(0 && "invalid alpha blend func");
}
}
logicop_quad( qs, quadColor, dest );
}
else if (blend->rt[blend_buf].blend_enable) {
- blend_quad( qs, quadColor, dest, cbuf, has_dst_alpha );
+ blend_quad( qs, quadColor, dest, blend_buf, has_dst_alpha );
}
if (blend->rt[blend_buf].colormask != 0xf)