summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-10-20 03:17:17 +0100
committerKeith Whitwell <[email protected]>2009-10-20 03:17:17 +0100
commit7b116e13a2aa28a699e30c907c1b1ae5e04cab28 (patch)
tree320943f867e86141e55f0c058cc3b71970f21fd4 /src
parent7670628061c2a6ce0a1a787556b0e33a38fd3049 (diff)
llvmpipe: pass mask as a linear encoding of the 4x4 block
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c41
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c15
2 files changed, 40 insertions, 16 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 39fb8cdb6ba..6fd6acc0fa4 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -216,16 +216,45 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
struct lp_rast_tile *tile = &rast->tile;
void *color;
void *depth;
- uint32_t ALIGN16_ATTRIB masks[16];
- unsigned ix, iy, i;
+ uint32_t ALIGN16_ATTRIB masks[2][2][2][2];
+ unsigned ix, iy;
/* Sanity checks */
assert(x % TILE_VECTOR_WIDTH == 0);
assert(y % TILE_VECTOR_HEIGHT == 0);
- /* mask */
- for (i = 0; i < 16; ++i)
- masks[i] = mask & (1 << i) ? ~0 : 0;
+ /* mask: the rasterizer wants to treat pixels in 4x4 blocks, but
+ * the pixel shader wants to swizzle them into 4 2x2 quads.
+ *
+ * Additionally, the pixel shader wants masks as full dword ~0,
+ * while the rasterizer wants to pack per-pixel bits tightly.
+ */
+#if 0
+ unsigned qx, qy;
+ for (qy = 0; qy < 2; ++qy)
+ for (qx = 0; qx < 2; ++qx)
+ for (iy = 0; iy < 2; ++iy)
+ for (ix = 0; ix < 2; ++ix)
+ masks[qy][qx][iy][ix] = mask & (1 << (qy*8+iy*4+qx*2+ix)) ? ~0 : 0;
+#else
+ masks[0][0][0][0] = mask & (1 << (0*8+0*4+0*2+0)) ? ~0 : 0;
+ masks[0][0][0][1] = mask & (1 << (0*8+0*4+0*2+1)) ? ~0 : 0;
+ masks[0][0][1][0] = mask & (1 << (0*8+1*4+0*2+0)) ? ~0 : 0;
+ masks[0][0][1][1] = mask & (1 << (0*8+1*4+0*2+1)) ? ~0 : 0;
+ masks[0][1][0][0] = mask & (1 << (0*8+0*4+1*2+0)) ? ~0 : 0;
+ masks[0][1][0][1] = mask & (1 << (0*8+0*4+1*2+1)) ? ~0 : 0;
+ masks[0][1][1][0] = mask & (1 << (0*8+1*4+1*2+0)) ? ~0 : 0;
+ masks[0][1][1][1] = mask & (1 << (0*8+1*4+1*2+1)) ? ~0 : 0;
+
+ masks[1][0][0][0] = mask & (1 << (1*8+0*4+0*2+0)) ? ~0 : 0;
+ masks[1][0][0][1] = mask & (1 << (1*8+0*4+0*2+1)) ? ~0 : 0;
+ masks[1][0][1][0] = mask & (1 << (1*8+1*4+0*2+0)) ? ~0 : 0;
+ masks[1][0][1][1] = mask & (1 << (1*8+1*4+0*2+1)) ? ~0 : 0;
+ masks[1][1][0][0] = mask & (1 << (1*8+0*4+1*2+0)) ? ~0 : 0;
+ masks[1][1][0][1] = mask & (1 << (1*8+0*4+1*2+1)) ? ~0 : 0;
+ masks[1][1][1][0] = mask & (1 << (1*8+1*4+1*2+0)) ? ~0 : 0;
+ masks[1][1][1][1] = mask & (1 << (1*8+1*4+1*2+1)) ? ~0 : 0;
+#endif
ix = x % TILE_SIZE;
iy = y % TILE_SIZE;
@@ -251,7 +280,7 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
inputs->a0,
inputs->dadx,
inputs->dady,
- &masks[0],
+ &masks[0][0][0][0],
color,
depth);
#else
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index a5a0407a57e..cf8643fc631 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -369,18 +369,13 @@ do_triangle_ccw(struct setup_context *setup,
int ystep3 = tri->dx31;
int ix, iy;
- int qx, qy;
int i = 0;
- for (qy = 0; qy < 4; qy += 2) {
- for (qx = 0; qx < 4; qx += 2) {
- for (iy = 0; iy < 2; iy++) {
- for (ix = 0; ix < 2; ix++, i++) {
- tri->step[0][i] = (xstep1 * (qx+ix)) + (ystep1 * (qy+iy));
- tri->step[1][i] = (xstep2 * (qx+ix)) + (ystep2 * (qy+iy));
- tri->step[2][i] = (xstep3 * (qx+ix)) + (ystep3 * (qy+iy));
- }
- }
+ for (iy = 0; iy < 4; iy++) {
+ for (ix = 0; ix < 4; ix++, i++) {
+ tri->step[0][i] = xstep1 * ix + ystep1 * iy;
+ tri->step[1][i] = xstep2 * ix + ystep2 * iy;
+ tri->step[2][i] = xstep3 * ix + ystep3 * iy;
}
}
}