Mesa (master): llvmpipe: consolidate several loops in lp_rast_triangle

Keith Whitwell keithw at kemper.freedesktop.org
Sun Aug 15 18:19:52 UTC 2010


Module: Mesa
Branch: master
Commit: 85d9bc236d6a8ff8f12cbc2150f8c3740354f573
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=85d9bc236d6a8ff8f12cbc2150f8c3740354f573

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sun Aug 15 17:40:39 2010 +0100

llvmpipe: consolidate several loops in lp_rast_triangle

---

 src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h |   33 +++++++++++-------------
 1 files 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)




More information about the mesa-commit mailing list