From: Brian Paul Date: Mon, 2 Mar 2009 18:27:32 +0000 (-0700) Subject: gallium: only enable depth test if a depth bufffer is available X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1a083d4b8c86e0ba335ab162f60b6f2b8391c31;p=mesa.git gallium: only enable depth test if a depth bufffer is available --- diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 4ea62dda184..0aa128f9479 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)