r300g: only check for an empty shader if there are no compile errors
[mesa.git] / src / gallium / drivers / softpipe / sp_quad_blend.c
index 00187febf0c4c839fa0b573197b7adc955430908..6af1b2d0618b4882934621f945665b60cb686cfc 100644 (file)
@@ -208,7 +208,7 @@ logicop_quad(struct quad_stage *qs,
          res4[j] = ~0;
       break;
    default:
-      assert(0);
+      assert(0 && "invalid logicop mode");
    }
 
    for (j = 0; j < 4; j++) {
@@ -221,11 +221,18 @@ logicop_quad(struct quad_stage *qs,
 
 
 
+/**
+ * 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 };
@@ -236,7 +243,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * 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 */
@@ -395,13 +402,13 @@ blend_quad(struct quad_stage *qs,
       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;
@@ -469,14 +476,14 @@ blend_quad(struct quad_stage *qs,
    }
    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;
@@ -625,13 +632,13 @@ blend_quad(struct quad_stage *qs,
       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;
@@ -696,13 +703,13 @@ blend_quad(struct quad_stage *qs,
    }
    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 */
@@ -729,13 +736,13 @@ blend_quad(struct quad_stage *qs,
       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;
@@ -752,7 +759,7 @@ blend_quad(struct quad_stage *qs,
       VEC4_MAX(quadColor[3], source[3], dest[3]); /* A */
       break;
    default:
-      assert(0);
+      assert(0 && "invalid alpha blend func");
    }
 }
 
@@ -822,7 +829,7 @@ blend_fallback(struct quad_stage *qs,
             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)