From 7b116e13a2aa28a699e30c907c1b1ae5e04cab28 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 20 Oct 2009 03:17:17 +0100 Subject: llvmpipe: pass mask as a linear encoding of the 4x4 block --- src/gallium/drivers/llvmpipe/lp_rast.c | 41 +++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 39fb8cdb6b..6fd6acc0fa 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 -- cgit v1.2.3