softpipe: adapt to blend changes
authorRoland Scheidegger <sroland@vmware.com>
Mon, 25 Jan 2010 15:39:16 +0000 (16:39 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 25 Jan 2010 15:39:16 +0000 (16:39 +0100)
src/gallium/drivers/softpipe/sp_quad_blend.c
src/gallium/drivers/softpipe/sp_video_context.c

index d9babe81dad5d165e10a19fafabd412ad654ae86..abca3233149bb54c3ffcc59b85b0fdf6c633fe61 100644 (file)
@@ -234,7 +234,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * Compute src/first term RGB
     */
-   switch (softpipe->blend->rgb_src_factor) {
+   switch (softpipe->blend->rt[0].rgb_src_factor) {
    case PIPE_BLENDFACTOR_ONE:
       VEC4_COPY(source[0], quadColor[0]); /* R */
       VEC4_COPY(source[1], quadColor[1]); /* G */
@@ -384,7 +384,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * Compute src/first term A
     */
-   switch (softpipe->blend->alpha_src_factor) {
+   switch (softpipe->blend->rt[0].alpha_src_factor) {
    case PIPE_BLENDFACTOR_ONE:
       VEC4_COPY(source[3], quadColor[3]); /* A */
       break;
@@ -453,7 +453,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * Compute dest/second term RGB
     */
-   switch (softpipe->blend->rgb_dst_factor) {
+   switch (softpipe->blend->rt[0].rgb_dst_factor) {
    case PIPE_BLENDFACTOR_ONE:
       /* dest = dest * 1   NO-OP, leave dest as-is */
       break;
@@ -593,7 +593,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * Compute dest/second term A
     */
-   switch (softpipe->blend->alpha_dst_factor) {
+   switch (softpipe->blend->rt[0].alpha_dst_factor) {
    case PIPE_BLENDFACTOR_ONE:
       /* dest = dest * 1   NO-OP, leave dest as-is */
       break;
@@ -656,7 +656,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * Combine RGB terms
     */
-   switch (softpipe->blend->rgb_func) {
+   switch (softpipe->blend->rt[0].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 */
@@ -689,7 +689,7 @@ blend_quad(struct quad_stage *qs,
    /*
     * Combine A terms
     */
-   switch (softpipe->blend->alpha_func) {
+   switch (softpipe->blend->rt[0].alpha_func) {
    case PIPE_BLEND_ADD:
       VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
       break;
@@ -718,19 +718,19 @@ colormask_quad(struct quad_stage *qs,
    struct softpipe_context *softpipe = qs->softpipe;
 
    /* R */
-   if (!(softpipe->blend->colormask & PIPE_MASK_R))
+   if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_R))
       COPY_4V(quadColor[0], dest[0]);
 
    /* G */
-   if (!(softpipe->blend->colormask & PIPE_MASK_G))
+   if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_G))
       COPY_4V(quadColor[1], dest[1]);
 
    /* B */
-   if (!(softpipe->blend->colormask & PIPE_MASK_B))
+   if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_B))
       COPY_4V(quadColor[2], dest[2]);
 
    /* A */
-   if (!(softpipe->blend->colormask & PIPE_MASK_A))
+   if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_A))
       COPY_4V(quadColor[3], dest[3]);
 }
 
@@ -773,11 +773,11 @@ blend_fallback(struct quad_stage *qs,
          if (blend->logicop_enable) {
             logicop_quad( qs, quadColor, dest );
          }
-         else if (blend->blend_enable) {
+         else if (blend->rt[0].blend_enable) {
             blend_quad( qs, quadColor, dest );
          }
 
-         if (blend->colormask != 0xf)
+         if (blend->rt[0].colormask != 0xf)
             colormask_quad( qs, quadColor, dest );
    
          /* Output color values
@@ -954,23 +954,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;
 
          }
index cae2d3efc589317c42e5bde7c69e6279a8803b21..d0723ebe9e05b945bd7acf31b7eab12b8a0b3ade 100644 (file)
@@ -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);