Mesa (master): r300g: if no colorbuffers are set, disable blending and set the color mask to 0

Corbin Simpson csimpson at kemper.freedesktop.org
Tue Dec 15 19:04:50 PST 2009


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Mon Dec 14 05:29:12 2009 +0100

r300g: if no colorbuffers are set, disable blending and set the color mask to 0

This seems to be the only way to disable the first colorbuffer.

---

 src/gallium/drivers/r300/r300_emit.c  |   13 ++++++++++---
 src/gallium/drivers/r300/r300_state.c |    1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 9644efb..55e4f94 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -41,9 +41,16 @@ void r300_emit_blend_state(struct r300_context* r300,
     CS_LOCALS(r300);
     BEGIN_CS(8);
     OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 3);
-    OUT_CS(blend->blend_control);
-    OUT_CS(blend->alpha_blend_control);
-    OUT_CS(blend->color_channel_mask);
+    if (r300->framebuffer_state.nr_cbufs) {
+        OUT_CS(blend->blend_control);
+        OUT_CS(blend->alpha_blend_control);
+        OUT_CS(blend->color_channel_mask);
+    } else {
+        OUT_CS(0);
+        OUT_CS(0);
+        OUT_CS(0);
+        /* XXX also disable fastfill here once it's supported */
+    }
     OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
     OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither);
     END_CS;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 3cfa2e6..91cf972 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -339,6 +339,7 @@ static void
         r300->dirty_state |= R300_NEW_SCISSOR;
     }
     r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
+    r300->dirty_state |= R300_NEW_BLEND;
 }
 
 /* Create fragment shader state. */



More information about the mesa-commit mailing list