Mesa (master): r600: don't enable depth test if there is no depth buffer

Jerome Glisse glisse at kemper.freedesktop.org
Fri Apr 23 10:13:58 UTC 2010


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

Author: Jerome Glisse <jglisse at redhat.com>
Date:   Fri Apr 23 11:56:06 2010 +0200

r600: don't enable depth test if there is no depth buffer

If there is no depth buffer bound to current context don't
enable depth test. GL states that if depth test is enabled
without depth buffer it's as if depth buffer always pass.

Signed-off-by: Jerome Glisse <jglisse at redhat.com>

---

 src/mesa/drivers/dri/r600/r700_state.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index 12eaebb..0d7cb8e 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -252,12 +252,15 @@ void r700UpdateShaderStates(GLcontext * ctx)
 
 static void r700SetDepthState(GLcontext * ctx)
 {
+	struct radeon_renderbuffer *rrb;
 	context_t *context = R700_CONTEXT(ctx);
 	R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
 
 	R600_STATECHANGE(context, db);
 
-    if (ctx->Depth.Test)
+	rrb = radeon_get_depthbuffer(&context->radeon);
+
+    if (ctx->Depth.Test && rrb && rrb->bo)
     {
         SETbit(r700->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit);
         if (ctx->Depth.Mask)




More information about the mesa-commit mailing list