gallium: only enable depth test if a depth bufffer is available
authorBrian Paul <brianp@vmware.com>
Mon, 2 Mar 2009 18:27:32 +0000 (11:27 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 2 Mar 2009 18:51:46 +0000 (11:51 -0700)
src/mesa/state_tracker/st_atom_depth.c

index 4ea62dda18430680af869c980d3ba27c79aa7e2b..0aa128f94793af443677c4342720367b344ea70d 100644 (file)
@@ -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)