From 85d9bc236d6a8ff8f12cbc2150f8c3740354f573 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 15 Aug 2010 17:40:39 +0100 Subject: [PATCH] llvmpipe: consolidate several loops in lp_rast_triangle --- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 33 ++++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 98ebcfa..43f72d8 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -152,31 +152,28 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, struct lp_rast_plane plane[NR_PLANES]; int c[NR_PLANES]; unsigned outmask, inmask, partmask, partial_mask; - unsigned j, nr_planes = 0; + unsigned j = 0; - while (plane_mask) { - int i = ffs(plane_mask) - 1; - plane[nr_planes] = tri->plane[i]; - plane_mask &= ~(1 << i); - nr_planes++; - }; - - assert(nr_planes == NR_PLANES); outmask = 0; /* outside one or more trivial reject planes */ partmask = 0; /* outside one or more trivial accept planes */ - for (j = 0; j < NR_PLANES; j++) { + while (plane_mask) { + int i = ffs(plane_mask) - 1; + plane[j] = tri->plane[i]; + plane_mask &= ~(1 << i); c[j] = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x; - } - for (j = 0; j < NR_PLANES; j++) { - const int dcdx = -plane[j].dcdx * 16; - const int dcdy = plane[j].dcdy * 16; - const int cox = c[j] + plane[j].eo * 16; - const int cio = c[j] + plane[j].ei * 16 - 1; + { + const int dcdx = -plane[j].dcdx * 16; + const int dcdy = plane[j].dcdy * 16; + const int cox = c[j] + plane[j].eo * 16; + const int cio = c[j] + plane[j].ei * 16 - 1; - outmask |= build_mask_linear(cox, dcdx, dcdy); - partmask |= build_mask_linear(cio, dcdx, dcdy); + outmask |= build_mask_linear(cox, dcdx, dcdy); + partmask |= build_mask_linear(cio, dcdx, dcdy); + } + + j++; } if (outmask == 0xffff) -- 2.7.4