Mesa (softpipe-opt): softpipe: fix occlusion counting

Keith Whitwell keithw at kemper.freedesktop.org
Tue Sep 22 19:50:52 UTC 2009


Module: Mesa
Branch: softpipe-opt
Commit: b626176f0613852df908b4b0552b9b67d5830b4e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b626176f0613852df908b4b0552b9b67d5830b4e

Author: Keith Whitwell <keithw at vmware.com>
Date:   Tue Sep 22 19:26:08 2009 +0100

softpipe: fix occlusion counting

---

 src/gallium/drivers/softpipe/sp_quad_depth_test.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 9cffea2..ce1bab9 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -631,7 +631,7 @@ alpha_test_quads(struct quad_stage *qs,
    }
 }
 
-static unsigned mask_count[0x8] = 
+static unsigned mask_count[16] = 
 {
    0,                           /* 0x0 */
    1,                           /* 0x1 */
@@ -641,6 +641,14 @@ static unsigned mask_count[0x8] =
    2,                           /* 0x5 */
    2,                           /* 0x6 */
    3,                           /* 0x7 */
+   1,                           /* 0x8 */
+   2,                           /* 0x9 */
+   2,                           /* 0xa */
+   3,                           /* 0xb */
+   2,                           /* 0xc */
+   3,                           /* 0xd */
+   3,                           /* 0xe */
+   4,                           /* 0xf */
 };
 
 
@@ -693,13 +701,17 @@ depth_test_quads_fallback(struct quad_stage *qs,
              qs->softpipe->depth_stencil->depth.writemask)
             write_depth_stencil_values(&data, quads[i]);
 
-         qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask];
          quads[pass++] = quads[i];
       }
 
       nr = pass;
    }
 
+   if (qs->softpipe->active_query_count) {
+      for (i = 0; i < nr; i++) 
+         qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask];
+   }
+
    if (nr)
       qs->next->run(qs->next, quads, nr);
 }
@@ -883,6 +895,8 @@ choose_depth_test(struct quad_stage *qs,
 
    boolean depthwrite = qs->softpipe->depth_stencil->depth.writemask;
 
+   boolean occlusion = qs->softpipe->active_query_count;
+
 
    if (!alpha &&
        !depth &&
@@ -893,6 +907,7 @@ choose_depth_test(struct quad_stage *qs,
             interp_depth && 
             depth && 
             depthwrite && 
+            !occlusion &&
             !stencil) 
    {
       switch (depthfunc) {




More information about the mesa-commit mailing list