r300: enable depth test only if depth buffer is available
authorMaciej Cencora <m.cencora@gmail.com>
Wed, 10 Mar 2010 21:28:53 +0000 (22:28 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Wed, 10 Mar 2010 21:33:29 +0000 (22:33 +0100)
Fixes #23532 and piglit/fbo-nodepth-test piglit/fbo-nostencil-test

src/mesa/drivers/dri/r300/r300_state.c

index 874894124195c416ce0faf994622a56c69648a80..e75c88e101b7b51b82cdbb751ff93e38974f4dff 100644 (file)
@@ -590,7 +590,7 @@ static void r300SetDepthState(GLcontext * ctx)
                                            R500_STENCIL_REFMASK_FRONT_BACK);
        r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_Z_FUNC_SHIFT);
 
-       if (ctx->Depth.Test) {
+       if (ctx->Depth.Test && ctx->DrawBuffer->_DepthBuffer) {
                r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_Z_ENABLE;
                if (ctx->Depth.Mask)
                        r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_Z_WRITE_ENABLE;