r300g: if no DS buffer is set, disable reading from and writing to it
authorMarek Olšák <maraeo@gmail.com>
Thu, 24 Dec 2009 13:23:57 +0000 (14:23 +0100)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 6 Jan 2010 20:49:15 +0000 (12:49 -0800)
It fixes another "Bad CS" issue.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c

index 30a1000c29413e045a1788e8ac70000279c5c03f..f8bfa714fefe458e02466140d5ec2ea794e61af7 100644 (file)
@@ -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);
 
index affd0b4591067ce605505257e7e11812355f65c3..a145a7f18a5820bc79f1c80e84a92a455dfe7d0c 100644 (file)
@@ -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. */