From 3c6f17be3274d6a137fb52b0aacba81259bbb188 Mon Sep 17 00:00:00 2001 From: Aapo Tahkola Date: Thu, 16 Jun 2005 11:41:19 +0000 Subject: Use depth tiling. --- src/mesa/drivers/dri/r300/r300_reg.h | 6 ++++++ src/mesa/drivers/dri/r300/r300_state.c | 29 ++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'src') 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 @@ -1216,6 +1216,12 @@ I am fairly certain that they are correct unless stated otherwise in comments. # define R300_RB3D_ZS2_STENCIL_MASK_SHIFT 8 # 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 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; -- cgit v1.2.3