From 4c0641454b952f2c240de8c83511703f98e1f72f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 15 Aug 2010 17:24:54 +0100 Subject: llvmpipe: eliminate last usage of step array in rast_tmp.h For 16 and 64 pixel levels, calculate a mask which is linear in x and y (ie not in the swizzle layout). When iterating over full and partial masks, figure out position by manipulating the bit number set in the mask, rather than relying on postion arrays. Similarly, calculate the lower-level c values from dcdx, dcdy and the position rather than relying on the step array. --- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 44 ++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/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 905f3df213..98ebcfa870 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -84,8 +84,8 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, const int cox = c[j] + plane[j].eo * 4; const int cio = c[j] + plane[j].ei * 4 - 1; - outmask |= build_mask(cox, dcdx, dcdy); - partmask |= build_mask(cio, dcdx, dcdy); + outmask |= build_mask_linear(cox, dcdx, dcdy); + partmask |= build_mask_linear(cio, dcdx, dcdy); } if (outmask == 0xffff) @@ -106,15 +106,19 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, */ while (partial_mask) { int i = ffs(partial_mask) - 1; - int px = x + pos_table4[i][0]; - int py = y + pos_table4[i][1]; + int ix = (i & 3) * 4; + int iy = (i >> 2) * 4; + int px = x + ix; + int py = y + iy; int cx[NR_PLANES]; - for (j = 0; j < NR_PLANES; j++) - cx[j] = c[j] + plane[j].step[i] * 4; - partial_mask &= ~(1 << i); + for (j = 0; j < NR_PLANES; j++) + cx[j] = (c[j] + - plane[j].dcdx * ix + + plane[j].dcdy * iy); + TAG(do_block_4)(task, tri, plane, px, py, cx); } @@ -122,8 +126,10 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, */ while (inmask) { int i = ffs(inmask) - 1; - int px = x + pos_table4[i][0]; - int py = y + pos_table4[i][1]; + int ix = (i & 3) * 4; + int iy = (i >> 2) * 4; + int px = x + ix; + int py = y + iy; inmask &= ~(1 << i); @@ -169,8 +175,8 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, const int cox = c[j] + plane[j].eo * 16; const int cio = c[j] + plane[j].ei * 16 - 1; - outmask |= build_mask(cox, dcdx, dcdy); - partmask |= build_mask(cio, dcdx, dcdy); + outmask |= build_mask_linear(cox, dcdx, dcdy); + partmask |= build_mask_linear(cio, dcdx, dcdy); } if (outmask == 0xffff) @@ -191,12 +197,16 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, */ while (partial_mask) { int i = ffs(partial_mask) - 1; - int px = x + pos_table16[i][0]; - int py = y + pos_table16[i][1]; + int ix = (i & 3) * 16; + int iy = (i >> 2) * 16; + int px = x + ix; + int py = y + iy; int cx[NR_PLANES]; for (j = 0; j < NR_PLANES; j++) - cx[j] = c[j] + plane[j].step[i] * 16; + cx[j] = (c[j] + - plane[j].dcdx * ix + + plane[j].dcdy * iy); partial_mask &= ~(1 << i); @@ -208,8 +218,10 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, */ while (inmask) { int i = ffs(inmask) - 1; - int px = x + pos_table16[i][0]; - int py = y + pos_table16[i][1]; + int ix = (i & 3) * 16; + int iy = (i >> 2) * 16; + int px = x + ix; + int py = y + iy; inmask &= ~(1 << i); -- cgit v1.2.3