Mesa (master): r300g: Clean up blend masks, change caps.

Corbin Simpson csimpson at kemper.freedesktop.org
Thu Jan 28 21:41:40 UTC 2010


Module: Mesa
Branch: master
Commit: 00873227292df458b28249d7c3736d633e619dab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=00873227292df458b28249d7c3736d633e619dab

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Thu Jan 28 13:39:13 2010 -0800

r300g: Clean up blend masks, change caps.

progs/tests/drawbuffers should work, except I can't test it. GG new
shader parser. GG.

---

 src/gallium/drivers/r300/r300_emit.c   |    9 ++++++++-
 src/gallium/drivers/r300/r300_screen.c |    4 ++++
 src/gallium/drivers/r300/r300_state.c  |   18 ++++++------------
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index f1d3276..9e81356 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -406,7 +406,14 @@ void r300_emit_fb_state(struct r300_context* r300, void* state)
         R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
 
     /* Set the number of colorbuffers. */
-    OUT_CS_REG(R300_RB3D_CCTL, R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs));
+    if (fb->nr_cbufs > 1) {
+        OUT_CS_REG(R300_RB3D_CCTL,
+            R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) |
+            R300_RB3D_CCTL_INDEPENDENT_COLOR_CHANNEL_MASK_ENABLE |
+            R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE);
+    } else {
+        OUT_CS_REG(R300_RB3D_CCTL, 0x0);
+    }
 
     /* Set up colorbuffers. */
     for (i = 0; i < fb->nr_cbufs; i++) {
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index b8fbf03..679a564 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -113,6 +113,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
              * ~ C.
              */
             return 1;
+        case PIPE_CAP_DUAL_SOURCE_BLEND:
+            /* XXX need to figure out how to do it */
+            return 0;
         case PIPE_CAP_ANISOTROPIC_FILTER:
             return 1;
         case PIPE_CAP_POINT_SPRITE:
@@ -150,6 +153,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
                 return 0;
             }
         case PIPE_CAP_INDEP_BLEND_ENABLE:
+            return 1;
         case PIPE_CAP_INDEP_BLEND_FUNC:
             return 0;
         default:
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 3cdcf94..8295799 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -288,18 +288,12 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
                 (state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT;
     }
 
-    /* Color Channel Mask */
-    if (state->rt[0].colormask & PIPE_MASK_R) {
-        blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_RED_MASK0;
-    }
-    if (state->rt[0].colormask & PIPE_MASK_G) {
-        blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0;
-    }
-    if (state->rt[0].colormask & PIPE_MASK_B) {
-        blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0;
-    }
-    if (state->rt[0].colormask & PIPE_MASK_A) {
-        blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0;
+    /* Color channel masks for all MRTs. */
+    blend->color_channel_mask = state->rt[0].colormask;
+    if (state->independent_blend_enable) {
+        blend->color_channel_mask |= (state->rt[1].colormask << 4);
+        blend->color_channel_mask |= (state->rt[2].colormask << 8);
+        blend->color_channel_mask |= (state->rt[3].colormask << 12);
     }
 
     if (state->dither) {




More information about the mesa-commit mailing list