Mesa (7.11): i915: Disable the depth test whenever we don' t have a depth buffer.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Jul 20 19:53:27 UTC 2011
Module: Mesa
Branch: 7.11
Commit: ea241750f7d92eeeea494049121acdf200c68189
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea241750f7d92eeeea494049121acdf200c68189
Author: Eric Anholt <eric at anholt.net>
Date: Tue Jul 12 10:48:40 2011 -0700
i915: Disable the depth test whenever we don't have a depth buffer.
We were disabling it once at the moment we changed draw buffers, but
later enabling of depth test could turn it back on. Fixes
fbo-nodepth-test.
Note that ctx->DrawBuffer has to be checked because during context
create we get called while it's still unset. However, we know we'll
get an intel_draw_buffer() after that, so it's safe to make a silly
choice at this point.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30080
(cherry picked from commit fc4fba52cf7e9616c70dd76b4d6bdba6582e157b)
---
src/mesa/drivers/dri/i915/i915_state.c | 7 +++++++
src/mesa/drivers/dri/i915/i915_vtbl.c | 3 +--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index 99212ad..73dda65 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -375,6 +375,9 @@ i915DepthMask(struct gl_context * ctx, GLboolean flag)
DBG("%s flag (%d)\n", __FUNCTION__, flag);
+ if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits)
+ flag = false;
+
dw = i915->state.Ctx[I915_CTXREG_LIS6];
if (flag && ctx->Depth.Test)
dw |= S6_DEPTH_WRITE_ENABLE;
@@ -797,6 +800,10 @@ i915Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
case GL_DEPTH_TEST:
dw = i915->state.Ctx[I915_CTXREG_LIS6];
+
+ if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits)
+ state = false;
+
if (state)
dw |= S6_DEPTH_TEST_ENABLE;
else
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index ea33304..b3b55b2 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -800,8 +800,7 @@ i915_update_draw_buffer(struct intel_context *intel)
/*
* Update depth and stencil test state
*/
- ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
- (ctx->Depth.Test && fb->Visual.depthBits > 0));
+ ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
(ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
More information about the mesa-commit
mailing list