Mesa (master): gallium: only enable depth test if a depth bufffer is available

Brian Paul brianp at kemper.freedesktop.org
Mon Mar 2 18:52:10 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Mar  2 11:27:32 2009 -0700

gallium: only enable depth test if a depth bufffer is available

---

 src/mesa/state_tracker/st_atom_depth.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 4ea62dd..0aa128f 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -98,9 +98,11 @@ update_depth_stencil_alpha(struct st_context *st)
 
    memset(dsa, 0, sizeof(*dsa));
 
-   dsa->depth.enabled = ctx->Depth.Test;
-   dsa->depth.writemask = ctx->Depth.Mask;
-   dsa->depth.func = st_compare_func_to_pipe(ctx->Depth.Func);
+   if (ctx->Depth.Test && ctx->DrawBuffer->Visual.depthBits > 0) {
+      dsa->depth.enabled = 1;
+      dsa->depth.writemask = ctx->Depth.Mask;
+      dsa->depth.func = st_compare_func_to_pipe(ctx->Depth.Func);
+   }
 
    if (ctx->Query.CurrentOcclusionObject &&
        ctx->Query.CurrentOcclusionObject->Active)




More information about the mesa-commit mailing list