summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2006-06-27 01:46:11 +0000
committerAapo Tahkola <[email protected]>2006-06-27 01:46:11 +0000
commit291fd257ebc7915137d0005e696313ce01175f36 (patch)
tree0719a01c8b3d100d8ec8f2a9ebd7d08bd883522b /src/mesa/drivers/dri
parentcaf0176472ea024e70b2401d622947281b316a24 (diff)
Fix stencil clears that have caused problems with redbook/stencil, tests/stencilwrap and ut2k4 adrenaline pills.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c47
1 files changed, 7 insertions, 40 deletions
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<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
-/*
- R300_STATECHANGE(r300, zb);
- r300->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<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
@@ -299,37 +285,18 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
{
uint32_t t1, t2;
- t1 = r300->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<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
-/*
- R300_STATECHANGE(r300, zb);
- r300->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<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |