summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2005-06-16 11:41:19 +0000
committerAapo Tahkola <[email protected]>2005-06-16 11:41:19 +0000
commit3c6f17be3274d6a137fb52b0aacba81259bbb188 (patch)
tree15974a56605dd222b1694c47acce8ff2145d868a /src/mesa/drivers
parentaf02907b4cbe212f0d87de25d85118b05303415c (diff)
Use depth tiling.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h6
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c29
2 files changed, 28 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index 3321954ca89..3ea4f4fe8c5 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -1217,6 +1217,12 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT 16
/* gap */
+
+#define R300_RB3D_ZSTENCIL_FORMAT 0x4F10
+# define R300_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
+# define R300_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
+
+/* gap */
#define R300_RB3D_DEPTHOFFSET 0x4F20
#define R300_RB3D_DEPTHPITCH 0x4F24
# define R300_DEPTHPITCH_MASK 0x00001FF8 /* GUESS */
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 1c0ccc19860..fd1b006601d 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -2142,7 +2142,7 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4E10.cmd[3] = 0;
/* Again, r300ClearBuffer uses this */
- if(ctx->Visual.doubleBufferMode){
+ if (ctx->Visual.doubleBufferMode) {
r300->hw.cb.cmd[R300_CB_OFFSET] =
r300->radeon.radeonScreen->backOffset +
r300->radeon.radeonScreen->fbLocation;
@@ -2175,19 +2175,34 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4EA0.cmd[1] = 0x00000000;
r300->hw.unk4EA0.cmd[2] = 0xffffffff;
- r300->hw.unk4F10.cmd[1] = 0x00000002; // depthbuffer format?
- //r300->hw.unk4F10.cmd[2] = 0x00000000;
+ switch (ctx->Visual.depthBits) {
+ case 16:
+ r300->hw.unk4F10.cmd[1] = R300_DEPTH_FORMAT_16BIT_INT_Z;
+ break;
+ case 24:
+ r300->hw.unk4F10.cmd[1] = R300_DEPTH_FORMAT_24BIT_INT_Z;
+ break;
+ default:
+ fprintf(stderr, "Error: Unsupported depth %d... exiting\n",
+ ctx->Visual.depthBits);
+ exit(-1);
+
+ }
r300->hw.unk4F10.cmd[3] = 0x00000003;
r300->hw.unk4F10.cmd[4] = 0x00000000;
- /* experiment a bit */
- //r300->hw.unk4F10.cmd[2] = 0x00000001; // depthbuffer format?
-
r300->hw.zb.cmd[R300_ZB_OFFSET] =
r300->radeon.radeonScreen->depthOffset +
r300->radeon.radeonScreen->fbLocation;
r300->hw.zb.cmd[R300_ZB_PITCH] = r300->radeon.radeonScreen->depthPitch;
-
+ /* Turn off when clearing buffers ? */
+ r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_TILE_ENABLE;
+
+ if (ctx->Visual.depthBits == 24)
+ r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_MICROTILE_ENABLE;
+ else if (ctx->Visual.depthBits == 16)
+ r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_ENDIAN_WORD_SWAP;
+
r300->hw.unk4F28.cmd[1] = 0;
r300->hw.unk4F30.cmd[1] = 0;