Mesa (lp-binning): llvmpipe: Reshape the shader input from 8x2 to 4x4.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Oct 19 13:04:32 UTC 2009


Module: Mesa
Branch: lp-binning
Commit: 2f5f357c5b67869e75087fc1f17ed0d666fb134e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f5f357c5b67869e75087fc1f17ed0d666fb134e

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Oct 19 14:02:01 2009 +0100

llvmpipe: Reshape the shader input from 8x2 to 4x4.

Incorrect rendering until the interpolation code generation is updated.

---

 src/gallium/drivers/llvmpipe/lp_rast_tri.c  |   19 ++++++++-----------
 src/gallium/drivers/llvmpipe/lp_tile_soa.h  |    4 ++--
 src/gallium/drivers/llvmpipe/lp_tile_soa.py |    6 ++++--
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
index f9a8be2..c63aa22 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
@@ -34,7 +34,7 @@
 #include "lp_tile_soa.h"
 
 
-#define BLOCKSIZE 8
+#define BLOCKSIZE 4
 
 
 /* Convert 8x8 block into four runs of quads and render each in turn.
@@ -55,11 +55,9 @@ static void block_full( struct lp_rasterizer *rast,
                         const struct lp_rast_triangle *tri,
                         int x, int y )
 {
-   const unsigned masks[4] = {~0, ~0, 0, 0}; /* FIXME: Wasting quads!!! */
-   int iy;
+   const unsigned masks[4] = {~0, ~0, ~0, ~0};
 
-   for (iy = 0; iy < 4; iy += 2)
-      lp_rast_shade_quads(rast, &tri->inputs, x, y + iy, masks);
+   lp_rast_shade_quads(rast, &tri->inputs, x, y, masks);
 }
 #endif
 
@@ -124,30 +122,29 @@ do_block( struct lp_rasterizer *rast,
 
    int ix, iy;
 
+   unsigned masks[2][2] = {{0, 0}, {0, 0}};
+
    for (iy = 0; iy < BLOCKSIZE; iy += 2) {
       int cx1 = c1;
       int cx2 = c2;
       int cx3 = c3;
 
-      unsigned masks[4] = {0, 0, 0, 0};
-
       for (ix = 0; ix < BLOCKSIZE; ix += 2) {
 
-	 masks[ix >> 1] = do_quad(tri, x + ix, y + iy, cx1, cx2, cx3);
+	 masks[iy >> 1][ix >> 1] = do_quad(tri, x + ix, y + iy, cx1, cx2, cx3);
 
 	 cx1 += xstep1;
 	 cx2 += xstep2;
 	 cx3 += xstep3;
       }
 
-      if(masks[0] || masks[1] || masks[2] || masks[3])
-         lp_rast_shade_quads(rast, &tri->inputs, x, y + iy, masks);
-
       c1 += ystep1;
       c2 += ystep2;
       c3 += ystep3;
    }
 
+   if(masks[0][0] || masks[0][1] || masks[1][0] || masks[1][1])
+      lp_rast_shade_quads(rast, &tri->inputs, x, y, &masks[0][0]);
 }
 
 
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.h b/src/gallium/drivers/llvmpipe/lp_tile_soa.h
index 040b018..d72d6d2 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.h
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.h
@@ -46,8 +46,8 @@ struct pipe_transfer;
 #define TILE_SIZE 64
 
 
-#define TILE_VECTOR_HEIGHT 2
-#define TILE_VECTOR_WIDTH 8
+#define TILE_VECTOR_HEIGHT 4
+#define TILE_VECTOR_WIDTH 4
 
 extern const unsigned char
 tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH];
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
index 004c5c9..a603b7f 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
@@ -259,8 +259,10 @@ def main():
     print
     print 'const unsigned char'
     print 'tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH] = {'
-    print '   {  0,  1,  4,  5,  8,  9, 12, 13},'
-    print '   {  2,  3,  6,  7, 10, 11, 14, 15}'
+    print '   {  0,  1,  4,  5},'
+    print '   {  2,  3,  6,  7},'
+    print '   {  8,  9, 12, 13},'
+    print '   { 10, 11, 14, 15}'
     print '};'
     print
 




More information about the mesa-commit mailing list