Mesa (master): r300g: don' t set other HyperZ states if depth and stencil tests are disabled

Marek Olšák mareko at kemper.freedesktop.org
Sun May 15 01:31:22 UTC 2011


Module: Mesa
Branch: master
Commit: 19f59dd413b52dd7db9dd0cfa2f477e25bd3608e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=19f59dd413b52dd7db9dd0cfa2f477e25bd3608e

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat May 14 05:58:35 2011 +0200

r300g: don't set other HyperZ states if depth and stencil tests are disabled

Such as HiZ.

---

 src/gallium/drivers/r300/r300_hyperz.c |   41 +++++++++++++++++++++-----------
 1 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c
index 544aa1f..bbff83e 100644
--- a/src/gallium/drivers/r300/r300_hyperz.c
+++ b/src/gallium/drivers/r300/r300_hyperz.c
@@ -138,6 +138,7 @@ static void r300_update_hyperz(struct r300_context* r300)
         (struct r300_hyperz_state*)r300->hyperz_state.state;
     struct pipe_framebuffer_state *fb =
         (struct pipe_framebuffer_state*)r300->fb_state.state;
+    struct r300_dsa_state *dsa = r300->dsa_state.state;
     struct r300_resource *zstex =
             fb->zsbuf ? r300_resource(fb->zsbuf->texture) : NULL;
 
@@ -154,19 +155,37 @@ static void r300_update_hyperz(struct r300_context* r300)
     if (!zstex || !r300->hyperz_enabled)
         return;
 
-    /* Zbuffer compression. */
-    if (r300->zmask_in_use && !r300->locked_zbuffer) {
+    /* Set the size of ZMASK tiles. */
+    if (zstex->tex.zcomp8x8[fb->zsbuf->u.tex.level]) {
+        z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8;
+    }
+
+    /* R500-specific features and optimizations. */
+    if (r300->screen->caps.is_r500) {
+        z->zb_bw_cntl |= R500_PEQ_PACKING_ENABLE |
+                         R500_COVERED_PTR_MASKING_ENABLE;
+    }
+
+    /* Setup decompression if needed. No other HyperZ setting is required. */
+    if (r300->zmask_decompress) {
         z->zb_bw_cntl |= R300_FAST_FILL_ENABLE |
-                         /*R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE |*/
                          R300_RD_COMP_ENABLE;
+        return;
+    }
 
-        if (!r300->zmask_decompress) {
-            z->zb_bw_cntl |= R300_WR_COMP_ENABLE;
-        }
+    /* Do not set anything if depth and stencil tests are off. */
+    if (!dsa->dsa.depth.enabled &&
+        !dsa->dsa.stencil[0].enabled &&
+        !dsa->dsa.stencil[1].enabled) {
+        assert(!dsa->dsa.depth.writemask);
+        return;
     }
 
-    if (zstex->tex.zcomp8x8[fb->zsbuf->u.tex.level]) {
-        z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8;
+    /* Zbuffer compression. */
+    if (r300->zmask_in_use && !r300->locked_zbuffer) {
+        z->zb_bw_cntl |= R300_FAST_FILL_ENABLE |
+                         R300_RD_COMP_ENABLE |
+                         R300_WR_COMP_ENABLE;
     }
 
     /* HiZ. */
@@ -193,12 +212,6 @@ static void r300_update_hyperz(struct r300_context* r300)
             }
         }
     }
-
-    /* R500-specific features and optimizations. */
-    if (r300->screen->caps.is_r500) {
-        z->zb_bw_cntl |= R500_PEQ_PACKING_ENABLE |
-                         R500_COVERED_PTR_MASKING_ENABLE;
-    }
 }
 
 /*****************************************************************************/




More information about the mesa-commit mailing list