Mesa (master): llvmpipe: version of block4 which doesn' t need the full step array

Keith Whitwell keithw at kemper.freedesktop.org
Sun Aug 15 16:33:58 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sun Aug 15 16:32:45 2010 +0100

llvmpipe: version of block4 which doesn't need the full step array

No noticable slowdown with isosurf.

---

 src/gallium/drivers/llvmpipe/lp_rast_tri.c     |   30 +++++++++++++++++++----
 src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h |    4 ++-
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
index c1f2680..28a0446 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
@@ -115,19 +115,37 @@ block_full_16(struct lp_rasterizer_task *task,
 
 
 static INLINE unsigned
-build_mask(int c, const int *step)
+build_mask(int c, int dcdx, int dcdy)
 {
    int mask = 0;
-   int i;
 
-   for (i = 0; i < 16; i++) {
-      mask |= ((c + step[i]) >> 31) & (1 << i);
-   }
-   
+   int c0 = c;
+   int c1 = c0 + dcdx;
+   int c2 = c1 + dcdx;
+   int c3 = c2 + dcdx;
+
+   mask |= ((c0 + 0 * dcdy) >> 31) & (1 << 0);
+   mask |= ((c0 + 1 * dcdy) >> 31) & (1 << 2);
+   mask |= ((c0 + 2 * dcdy) >> 31) & (1 << 8);
+   mask |= ((c0 + 3 * dcdy) >> 31) & (1 << 10);
+   mask |= ((c1 + 0 * dcdy) >> 31) & (1 << 1);
+   mask |= ((c1 + 1 * dcdy) >> 31) & (1 << 3);
+   mask |= ((c1 + 2 * dcdy) >> 31) & (1 << 9);
+   mask |= ((c1 + 3 * dcdy) >> 31) & (1 << 11); 
+   mask |= ((c2 + 0 * dcdy) >> 31) & (1 << 4);
+   mask |= ((c2 + 1 * dcdy) >> 31) & (1 << 6);
+   mask |= ((c2 + 2 * dcdy) >> 31) & (1 << 12);
+   mask |= ((c2 + 3 * dcdy) >> 31) & (1 << 14);
+   mask |= ((c3 + 0 * dcdy) >> 31) & (1 << 5);
+   mask |= ((c3 + 1 * dcdy) >> 31) & (1 << 7);
+   mask |= ((c3 + 2 * dcdy) >> 31) & (1 << 13);
+   mask |= ((c3 + 3 * dcdy) >> 31) & (1 << 15);
+  
    return mask;
 }
 
 
+
 #define TAG(x) x##_1
 #define NR_PLANES 1
 #include "lp_rast_tri_tmp.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h
index fcb8e2b..e14886f 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h
@@ -50,7 +50,9 @@ TAG(do_block_4)(struct lp_rasterizer_task *task,
    int j;
 
    for (j = 0; j < NR_PLANES; j++) {
-      mask &= ~build_mask(c[j] - 1, plane[j].step);
+      mask &= ~build_mask(c[j] - 1, 
+			  plane[j].step[1],
+			  plane[j].step[2]);
    }
 
    /* Now pass to the shader:




More information about the mesa-commit mailing list