Use depth tiling.
authorAapo Tahkola <aet@rasterburn.org>
Thu, 16 Jun 2005 11:41:19 +0000 (11:41 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Thu, 16 Jun 2005 11:41:19 +0000 (11:41 +0000)
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_state.c

index 3321954ca892698be26bc2ee9ad3494f503b3019..3ea4f4fe8c5bed7acb812b5c7ffc942c87deb678 100644 (file)
@@ -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
index 1c0ccc198601eabccb0d5b9e29601a1b8b777146..fd1b006601d010ff6f7a7e4a12b54e2c2da136d0 100644 (file)
@@ -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;