diff options
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 41 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 15 |
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; } } } |