From: Aapo Tahkola Date: Tue, 27 Jun 2006 01:46:11 +0000 (+0000) Subject: Fix stencil clears that have caused problems with redbook/stencil, tests/stencilwrap... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=291fd257ebc7915137d0005e696313ce01175f36;p=mesa.git Fix stencil clears that have caused problems with redbook/stencil, tests/stencilwrap and ut2k4 adrenaline pills. --- diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 2a2eef58120..a05a29b7e1b 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -218,32 +218,18 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) r300->hw.vpi.cmd[8] = 0; R300_STATECHANGE(r300, zs); + r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0; + r300->hw.zs.cmd[R300_ZS_CNTL_1] = 0; if (flags & CLEARBUFFER_DEPTH) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE; - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= 0x6; // test and write - r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); + r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_WRITE_ONLY; r300->hw.zs.cmd[R300_ZS_CNTL_1] |= (R300_ZS_ALWAYS<hw.zb.cmd[R300_ZB_OFFSET] = - 1024*4*300 + - r300->radeon.radeonScreen->frontOffset + - r300->radeon.radeonScreen->fbLocation; - r300->hw.zb.cmd[R300_ZB_PITCH] = - r300->radeon.radeonScreen->depthPitch; -*/ } else { - r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE; r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; // disable - r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); } R300_STATECHANGE(r300, zs); if (flags & CLEARBUFFER_STENCIL) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] &= ~R300_RB3D_STENCIL_ENABLE; r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_STENCIL_ENABLE; - r300->hw.zs.cmd[R300_ZS_CNTL_1] &= - ~((R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT)); r300->hw.zs.cmd[R300_ZS_CNTL_1] |= (R300_ZS_ALWAYS<hw.zs.cmd[R300_ZS_CNTL_0]; - t2 = r300->hw.zs.cmd[R300_ZS_CNTL_1]; + t1 = 0x0; + t2 = 0x0; if (flags & CLEARBUFFER_DEPTH) { - t1 &= R300_RB3D_STENCIL_ENABLE; - t1 |= 0x6; // test and write - - t2 &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); - t2 |= (R300_ZS_ALWAYS<hw.zb.cmd[R300_ZB_OFFSET] = - 1024*4*300 + - r300->radeon.radeonScreen->frontOffset + - r300->radeon.radeonScreen->fbLocation; - r300->hw.zb.cmd[R300_ZB_PITCH] = - r300->radeon.radeonScreen->depthPitch; -*/ + t1 |= R300_RB3D_Z_WRITE_ONLY; + t2 |= (R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); } else { - t1 &= R300_RB3D_STENCIL_ENABLE; t1 |= R300_RB3D_Z_DISABLED_1; // disable - - t2 &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); } if (flags & CLEARBUFFER_STENCIL) { - t1 &= ~R300_RB3D_STENCIL_ENABLE; t1 |= R300_RB3D_STENCIL_ENABLE; - - t2 &= - ~((R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT)); t2 |= (R300_ZS_ALWAYS<