Mesa (master): r300g: if no DS buffer is set, disable reading from and writing to it

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Jan 6 12:49:33 PST 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Dec 24 14:23:57 2009 +0100

r300g: if no DS buffer is set, disable reading from and writing to it

It fixes another "Bad CS" issue.

---

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

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 30a1000..f8bfa71 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -121,8 +121,15 @@ void r300_emit_dsa_state(struct r300_context* r300,
     }*/
 
     OUT_CS_REG_SEQ(R300_ZB_CNTL, 3);
-    OUT_CS(dsa->z_buffer_control);
-    OUT_CS(dsa->z_stencil_control);
+
+    if (r300->framebuffer_state.zsbuf) {
+        OUT_CS(dsa->z_buffer_control);
+        OUT_CS(dsa->z_stencil_control);
+    } else {
+        OUT_CS(0);
+        OUT_CS(0);
+    }
+
     OUT_CS(dsa->stencil_ref_mask);
     OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top);
 
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index affd0b4..a145a7f 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -522,6 +522,7 @@ static void
     }
     r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
     r300->dirty_state |= R300_NEW_BLEND;
+    r300->dirty_state |= R300_NEW_DSA;
 }
 
 /* Create fragment shader state. */



More information about the mesa-commit mailing list