Mesa (gallium-0.2): indices: quad fixes

Keith Whitwell keithw at kemper.freedesktop.org
Thu Feb 5 16:05:39 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: 96fb896c3916053c5b3b67c4f51911d718aef2d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96fb896c3916053c5b3b67c4f51911d718aef2d4

Author: Keith Whitwell <keithw at vmware.com>
Date:   Thu Feb  5 16:04:13 2009 +0000

indices: quad fixes

---

 src/gallium/auxiliary/indices/u_indices_gen.c  |  256 ++++++++++++------------
 src/gallium/auxiliary/indices/u_indices_gen.py |    9 +-
 2 files changed, 133 insertions(+), 132 deletions(-)

diff --git a/src/gallium/auxiliary/indices/u_indices_gen.c b/src/gallium/auxiliary/indices/u_indices_gen.c
index 00b9980..01953c3 100644
--- a/src/gallium/auxiliary/indices/u_indices_gen.c
+++ b/src/gallium/auxiliary/indices/u_indices_gen.c
@@ -176,11 +176,11 @@ static void generate_quadstrip_ushort_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)(i+0);
-      (out+j+0)[1] = (ushort)(i+1);
+      (out+j+0)[0] = (ushort)(i+2);
+      (out+j+0)[1] = (ushort)(i+0);
       (out+j+0)[2] = (ushort)(i+3);
-      (out+j+3)[0] = (ushort)(i+1);
-      (out+j+3)[1] = (ushort)(i+2);
+      (out+j+3)[0] = (ushort)(i+0);
+      (out+j+3)[1] = (ushort)(i+1);
       (out+j+3)[2] = (ushort)(i+3);
    }
 }
@@ -309,12 +309,12 @@ static void generate_quadstrip_ushort_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)(i+1);
+      (out+j+0)[0] = (ushort)(i+0);
       (out+j+0)[1] = (ushort)(i+3);
-      (out+j+0)[2] = (ushort)(i+0);
-      (out+j+3)[0] = (ushort)(i+2);
+      (out+j+0)[2] = (ushort)(i+2);
+      (out+j+3)[0] = (ushort)(i+1);
       (out+j+3)[1] = (ushort)(i+3);
-      (out+j+3)[2] = (ushort)(i+1);
+      (out+j+3)[2] = (ushort)(i+0);
    }
 }
 static void generate_polygon_ushort_first2last(
@@ -443,11 +443,11 @@ static void generate_quadstrip_ushort_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (ushort)(i+3);
-      (out+j+0)[1] = (ushort)(i+0);
-      (out+j+0)[2] = (ushort)(i+1);
+      (out+j+0)[1] = (ushort)(i+2);
+      (out+j+0)[2] = (ushort)(i+0);
       (out+j+3)[0] = (ushort)(i+3);
-      (out+j+3)[1] = (ushort)(i+1);
-      (out+j+3)[2] = (ushort)(i+2);
+      (out+j+3)[1] = (ushort)(i+0);
+      (out+j+3)[2] = (ushort)(i+1);
    }
 }
 static void generate_polygon_ushort_last2first(
@@ -575,11 +575,11 @@ static void generate_quadstrip_ushort_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)(i+0);
-      (out+j+0)[1] = (ushort)(i+1);
+      (out+j+0)[0] = (ushort)(i+2);
+      (out+j+0)[1] = (ushort)(i+0);
       (out+j+0)[2] = (ushort)(i+3);
-      (out+j+3)[0] = (ushort)(i+1);
-      (out+j+3)[1] = (ushort)(i+2);
+      (out+j+3)[0] = (ushort)(i+0);
+      (out+j+3)[1] = (ushort)(i+1);
       (out+j+3)[2] = (ushort)(i+3);
    }
 }
@@ -708,11 +708,11 @@ static void generate_quadstrip_uint_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)(i+0);
-      (out+j+0)[1] = (uint)(i+1);
+      (out+j+0)[0] = (uint)(i+2);
+      (out+j+0)[1] = (uint)(i+0);
       (out+j+0)[2] = (uint)(i+3);
-      (out+j+3)[0] = (uint)(i+1);
-      (out+j+3)[1] = (uint)(i+2);
+      (out+j+3)[0] = (uint)(i+0);
+      (out+j+3)[1] = (uint)(i+1);
       (out+j+3)[2] = (uint)(i+3);
    }
 }
@@ -841,12 +841,12 @@ static void generate_quadstrip_uint_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)(i+1);
+      (out+j+0)[0] = (uint)(i+0);
       (out+j+0)[1] = (uint)(i+3);
-      (out+j+0)[2] = (uint)(i+0);
-      (out+j+3)[0] = (uint)(i+2);
+      (out+j+0)[2] = (uint)(i+2);
+      (out+j+3)[0] = (uint)(i+1);
       (out+j+3)[1] = (uint)(i+3);
-      (out+j+3)[2] = (uint)(i+1);
+      (out+j+3)[2] = (uint)(i+0);
    }
 }
 static void generate_polygon_uint_first2last(
@@ -975,11 +975,11 @@ static void generate_quadstrip_uint_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (uint)(i+3);
-      (out+j+0)[1] = (uint)(i+0);
-      (out+j+0)[2] = (uint)(i+1);
+      (out+j+0)[1] = (uint)(i+2);
+      (out+j+0)[2] = (uint)(i+0);
       (out+j+3)[0] = (uint)(i+3);
-      (out+j+3)[1] = (uint)(i+1);
-      (out+j+3)[2] = (uint)(i+2);
+      (out+j+3)[1] = (uint)(i+0);
+      (out+j+3)[2] = (uint)(i+1);
    }
 }
 static void generate_polygon_uint_last2first(
@@ -1107,11 +1107,11 @@ static void generate_quadstrip_uint_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)(i+0);
-      (out+j+0)[1] = (uint)(i+1);
+      (out+j+0)[0] = (uint)(i+2);
+      (out+j+0)[1] = (uint)(i+0);
       (out+j+0)[2] = (uint)(i+3);
-      (out+j+3)[0] = (uint)(i+1);
-      (out+j+3)[1] = (uint)(i+2);
+      (out+j+3)[0] = (uint)(i+0);
+      (out+j+3)[1] = (uint)(i+1);
       (out+j+3)[2] = (uint)(i+3);
    }
 }
@@ -1258,11 +1258,11 @@ static void translate_quadstrip_ubyte2ushort_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+0];
-      (out+j+0)[1] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+2];
+      (out+j+0)[1] = (ushort)in[i+0];
       (out+j+0)[2] = (ushort)in[i+3];
-      (out+j+3)[0] = (ushort)in[i+1];
-      (out+j+3)[1] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+0];
+      (out+j+3)[1] = (ushort)in[i+1];
       (out+j+3)[2] = (ushort)in[i+3];
    }
 }
@@ -1411,12 +1411,12 @@ static void translate_quadstrip_ubyte2ushort_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+0];
       (out+j+0)[1] = (ushort)in[i+3];
-      (out+j+0)[2] = (ushort)in[i+0];
-      (out+j+3)[0] = (ushort)in[i+2];
+      (out+j+0)[2] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+1];
       (out+j+3)[1] = (ushort)in[i+3];
-      (out+j+3)[2] = (ushort)in[i+1];
+      (out+j+3)[2] = (ushort)in[i+0];
    }
 }
 static void translate_polygon_ubyte2ushort_first2last(
@@ -1565,11 +1565,11 @@ static void translate_quadstrip_ubyte2ushort_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (ushort)in[i+3];
-      (out+j+0)[1] = (ushort)in[i+0];
-      (out+j+0)[2] = (ushort)in[i+1];
+      (out+j+0)[1] = (ushort)in[i+2];
+      (out+j+0)[2] = (ushort)in[i+0];
       (out+j+3)[0] = (ushort)in[i+3];
-      (out+j+3)[1] = (ushort)in[i+1];
-      (out+j+3)[2] = (ushort)in[i+2];
+      (out+j+3)[1] = (ushort)in[i+0];
+      (out+j+3)[2] = (ushort)in[i+1];
    }
 }
 static void translate_polygon_ubyte2ushort_last2first(
@@ -1717,11 +1717,11 @@ static void translate_quadstrip_ubyte2ushort_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+0];
-      (out+j+0)[1] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+2];
+      (out+j+0)[1] = (ushort)in[i+0];
       (out+j+0)[2] = (ushort)in[i+3];
-      (out+j+3)[0] = (ushort)in[i+1];
-      (out+j+3)[1] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+0];
+      (out+j+3)[1] = (ushort)in[i+1];
       (out+j+3)[2] = (ushort)in[i+3];
    }
 }
@@ -1870,11 +1870,11 @@ static void translate_quadstrip_ubyte2uint_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+0];
-      (out+j+0)[1] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+2];
+      (out+j+0)[1] = (uint)in[i+0];
       (out+j+0)[2] = (uint)in[i+3];
-      (out+j+3)[0] = (uint)in[i+1];
-      (out+j+3)[1] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+0];
+      (out+j+3)[1] = (uint)in[i+1];
       (out+j+3)[2] = (uint)in[i+3];
    }
 }
@@ -2023,12 +2023,12 @@ static void translate_quadstrip_ubyte2uint_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+0];
       (out+j+0)[1] = (uint)in[i+3];
-      (out+j+0)[2] = (uint)in[i+0];
-      (out+j+3)[0] = (uint)in[i+2];
+      (out+j+0)[2] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+1];
       (out+j+3)[1] = (uint)in[i+3];
-      (out+j+3)[2] = (uint)in[i+1];
+      (out+j+3)[2] = (uint)in[i+0];
    }
 }
 static void translate_polygon_ubyte2uint_first2last(
@@ -2177,11 +2177,11 @@ static void translate_quadstrip_ubyte2uint_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (uint)in[i+3];
-      (out+j+0)[1] = (uint)in[i+0];
-      (out+j+0)[2] = (uint)in[i+1];
+      (out+j+0)[1] = (uint)in[i+2];
+      (out+j+0)[2] = (uint)in[i+0];
       (out+j+3)[0] = (uint)in[i+3];
-      (out+j+3)[1] = (uint)in[i+1];
-      (out+j+3)[2] = (uint)in[i+2];
+      (out+j+3)[1] = (uint)in[i+0];
+      (out+j+3)[2] = (uint)in[i+1];
    }
 }
 static void translate_polygon_ubyte2uint_last2first(
@@ -2329,11 +2329,11 @@ static void translate_quadstrip_ubyte2uint_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+0];
-      (out+j+0)[1] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+2];
+      (out+j+0)[1] = (uint)in[i+0];
       (out+j+0)[2] = (uint)in[i+3];
-      (out+j+3)[0] = (uint)in[i+1];
-      (out+j+3)[1] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+0];
+      (out+j+3)[1] = (uint)in[i+1];
       (out+j+3)[2] = (uint)in[i+3];
    }
 }
@@ -2482,11 +2482,11 @@ static void translate_quadstrip_ushort2ushort_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+0];
-      (out+j+0)[1] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+2];
+      (out+j+0)[1] = (ushort)in[i+0];
       (out+j+0)[2] = (ushort)in[i+3];
-      (out+j+3)[0] = (ushort)in[i+1];
-      (out+j+3)[1] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+0];
+      (out+j+3)[1] = (ushort)in[i+1];
       (out+j+3)[2] = (ushort)in[i+3];
    }
 }
@@ -2635,12 +2635,12 @@ static void translate_quadstrip_ushort2ushort_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+0];
       (out+j+0)[1] = (ushort)in[i+3];
-      (out+j+0)[2] = (ushort)in[i+0];
-      (out+j+3)[0] = (ushort)in[i+2];
+      (out+j+0)[2] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+1];
       (out+j+3)[1] = (ushort)in[i+3];
-      (out+j+3)[2] = (ushort)in[i+1];
+      (out+j+3)[2] = (ushort)in[i+0];
    }
 }
 static void translate_polygon_ushort2ushort_first2last(
@@ -2789,11 +2789,11 @@ static void translate_quadstrip_ushort2ushort_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (ushort)in[i+3];
-      (out+j+0)[1] = (ushort)in[i+0];
-      (out+j+0)[2] = (ushort)in[i+1];
+      (out+j+0)[1] = (ushort)in[i+2];
+      (out+j+0)[2] = (ushort)in[i+0];
       (out+j+3)[0] = (ushort)in[i+3];
-      (out+j+3)[1] = (ushort)in[i+1];
-      (out+j+3)[2] = (ushort)in[i+2];
+      (out+j+3)[1] = (ushort)in[i+0];
+      (out+j+3)[2] = (ushort)in[i+1];
    }
 }
 static void translate_polygon_ushort2ushort_last2first(
@@ -2941,11 +2941,11 @@ static void translate_quadstrip_ushort2ushort_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+0];
-      (out+j+0)[1] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+2];
+      (out+j+0)[1] = (ushort)in[i+0];
       (out+j+0)[2] = (ushort)in[i+3];
-      (out+j+3)[0] = (ushort)in[i+1];
-      (out+j+3)[1] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+0];
+      (out+j+3)[1] = (ushort)in[i+1];
       (out+j+3)[2] = (ushort)in[i+3];
    }
 }
@@ -3094,11 +3094,11 @@ static void translate_quadstrip_ushort2uint_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+0];
-      (out+j+0)[1] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+2];
+      (out+j+0)[1] = (uint)in[i+0];
       (out+j+0)[2] = (uint)in[i+3];
-      (out+j+3)[0] = (uint)in[i+1];
-      (out+j+3)[1] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+0];
+      (out+j+3)[1] = (uint)in[i+1];
       (out+j+3)[2] = (uint)in[i+3];
    }
 }
@@ -3247,12 +3247,12 @@ static void translate_quadstrip_ushort2uint_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+0];
       (out+j+0)[1] = (uint)in[i+3];
-      (out+j+0)[2] = (uint)in[i+0];
-      (out+j+3)[0] = (uint)in[i+2];
+      (out+j+0)[2] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+1];
       (out+j+3)[1] = (uint)in[i+3];
-      (out+j+3)[2] = (uint)in[i+1];
+      (out+j+3)[2] = (uint)in[i+0];
    }
 }
 static void translate_polygon_ushort2uint_first2last(
@@ -3401,11 +3401,11 @@ static void translate_quadstrip_ushort2uint_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (uint)in[i+3];
-      (out+j+0)[1] = (uint)in[i+0];
-      (out+j+0)[2] = (uint)in[i+1];
+      (out+j+0)[1] = (uint)in[i+2];
+      (out+j+0)[2] = (uint)in[i+0];
       (out+j+3)[0] = (uint)in[i+3];
-      (out+j+3)[1] = (uint)in[i+1];
-      (out+j+3)[2] = (uint)in[i+2];
+      (out+j+3)[1] = (uint)in[i+0];
+      (out+j+3)[2] = (uint)in[i+1];
    }
 }
 static void translate_polygon_ushort2uint_last2first(
@@ -3553,11 +3553,11 @@ static void translate_quadstrip_ushort2uint_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+0];
-      (out+j+0)[1] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+2];
+      (out+j+0)[1] = (uint)in[i+0];
       (out+j+0)[2] = (uint)in[i+3];
-      (out+j+3)[0] = (uint)in[i+1];
-      (out+j+3)[1] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+0];
+      (out+j+3)[1] = (uint)in[i+1];
       (out+j+3)[2] = (uint)in[i+3];
    }
 }
@@ -3706,11 +3706,11 @@ static void translate_quadstrip_uint2ushort_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+0];
-      (out+j+0)[1] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+2];
+      (out+j+0)[1] = (ushort)in[i+0];
       (out+j+0)[2] = (ushort)in[i+3];
-      (out+j+3)[0] = (ushort)in[i+1];
-      (out+j+3)[1] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+0];
+      (out+j+3)[1] = (ushort)in[i+1];
       (out+j+3)[2] = (ushort)in[i+3];
    }
 }
@@ -3859,12 +3859,12 @@ static void translate_quadstrip_uint2ushort_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+0];
       (out+j+0)[1] = (ushort)in[i+3];
-      (out+j+0)[2] = (ushort)in[i+0];
-      (out+j+3)[0] = (ushort)in[i+2];
+      (out+j+0)[2] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+1];
       (out+j+3)[1] = (ushort)in[i+3];
-      (out+j+3)[2] = (ushort)in[i+1];
+      (out+j+3)[2] = (ushort)in[i+0];
    }
 }
 static void translate_polygon_uint2ushort_first2last(
@@ -4013,11 +4013,11 @@ static void translate_quadstrip_uint2ushort_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (ushort)in[i+3];
-      (out+j+0)[1] = (ushort)in[i+0];
-      (out+j+0)[2] = (ushort)in[i+1];
+      (out+j+0)[1] = (ushort)in[i+2];
+      (out+j+0)[2] = (ushort)in[i+0];
       (out+j+3)[0] = (ushort)in[i+3];
-      (out+j+3)[1] = (ushort)in[i+1];
-      (out+j+3)[2] = (ushort)in[i+2];
+      (out+j+3)[1] = (ushort)in[i+0];
+      (out+j+3)[2] = (ushort)in[i+1];
    }
 }
 static void translate_polygon_uint2ushort_last2first(
@@ -4165,11 +4165,11 @@ static void translate_quadstrip_uint2ushort_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (ushort)in[i+0];
-      (out+j+0)[1] = (ushort)in[i+1];
+      (out+j+0)[0] = (ushort)in[i+2];
+      (out+j+0)[1] = (ushort)in[i+0];
       (out+j+0)[2] = (ushort)in[i+3];
-      (out+j+3)[0] = (ushort)in[i+1];
-      (out+j+3)[1] = (ushort)in[i+2];
+      (out+j+3)[0] = (ushort)in[i+0];
+      (out+j+3)[1] = (ushort)in[i+1];
       (out+j+3)[2] = (ushort)in[i+3];
    }
 }
@@ -4318,11 +4318,11 @@ static void translate_quadstrip_uint2uint_first2first(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+0];
-      (out+j+0)[1] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+2];
+      (out+j+0)[1] = (uint)in[i+0];
       (out+j+0)[2] = (uint)in[i+3];
-      (out+j+3)[0] = (uint)in[i+1];
-      (out+j+3)[1] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+0];
+      (out+j+3)[1] = (uint)in[i+1];
       (out+j+3)[2] = (uint)in[i+3];
    }
 }
@@ -4471,12 +4471,12 @@ static void translate_quadstrip_uint2uint_first2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+0];
       (out+j+0)[1] = (uint)in[i+3];
-      (out+j+0)[2] = (uint)in[i+0];
-      (out+j+3)[0] = (uint)in[i+2];
+      (out+j+0)[2] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+1];
       (out+j+3)[1] = (uint)in[i+3];
-      (out+j+3)[2] = (uint)in[i+1];
+      (out+j+3)[2] = (uint)in[i+0];
    }
 }
 static void translate_polygon_uint2uint_first2last(
@@ -4625,11 +4625,11 @@ static void translate_quadstrip_uint2uint_last2first(
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
       (out+j+0)[0] = (uint)in[i+3];
-      (out+j+0)[1] = (uint)in[i+0];
-      (out+j+0)[2] = (uint)in[i+1];
+      (out+j+0)[1] = (uint)in[i+2];
+      (out+j+0)[2] = (uint)in[i+0];
       (out+j+3)[0] = (uint)in[i+3];
-      (out+j+3)[1] = (uint)in[i+1];
-      (out+j+3)[2] = (uint)in[i+2];
+      (out+j+3)[1] = (uint)in[i+0];
+      (out+j+3)[2] = (uint)in[i+1];
    }
 }
 static void translate_polygon_uint2uint_last2first(
@@ -4777,11 +4777,11 @@ static void translate_quadstrip_uint2uint_last2last(
   unsigned i, j;
   (void)j;
   for (j = i = 0; j < nr; j+=6, i+=2) { 
-      (out+j+0)[0] = (uint)in[i+0];
-      (out+j+0)[1] = (uint)in[i+1];
+      (out+j+0)[0] = (uint)in[i+2];
+      (out+j+0)[1] = (uint)in[i+0];
       (out+j+0)[2] = (uint)in[i+3];
-      (out+j+3)[0] = (uint)in[i+1];
-      (out+j+3)[1] = (uint)in[i+2];
+      (out+j+3)[0] = (uint)in[i+0];
+      (out+j+3)[1] = (uint)in[i+1];
       (out+j+3)[2] = (uint)in[i+3];
    }
 }
diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py
index 397eea3..40b047b 100644
--- a/src/gallium/auxiliary/indices/u_indices_gen.py
+++ b/src/gallium/auxiliary/indices/u_indices_gen.py
@@ -139,6 +139,9 @@ def do_tri( intype, outtype, ptr, v0, v1, v2, inpv, outpv ):
         else:
             tri( intype, outtype, ptr, v2, v0, v1 )
 
+def do_quad( intype, outtype, ptr, v0, v1, v2, v3, inpv, outpv ):
+    do_tri( intype, outtype, ptr+'+0',  v0, v1, v3, inpv, outpv );
+    do_tri( intype, outtype, ptr+'+3',  v1, v2, v3, inpv, outpv );
 
 def name(intype, outtype, inpv, outpv, prim):
     if intype == GENERATE:
@@ -234,8 +237,7 @@ def polygon(intype, outtype, inpv, outpv):
 def quads(intype, outtype, inpv, outpv):
     preamble(intype, outtype, inpv, outpv, prim='quads')
     print '  for (j = i = 0; j < nr; j+=6, i+=4) { '
-    do_tri( intype, outtype, 'out+j+0',  'i+0', 'i+1', 'i+3', inpv, outpv );
-    do_tri( intype, outtype, 'out+j+3',  'i+1', 'i+2', 'i+3', inpv, outpv );
+    do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv );
     print '   }'
     postamble()
 
@@ -243,8 +245,7 @@ def quads(intype, outtype, inpv, outpv):
 def quadstrip(intype, outtype, inpv, outpv):
     preamble(intype, outtype, inpv, outpv, prim='quadstrip')
     print '  for (j = i = 0; j < nr; j+=6, i+=2) { '
-    do_tri( intype, outtype, 'out+j+0',  'i+0', 'i+1', 'i+3', inpv, outpv );
-    do_tri( intype, outtype, 'out+j+3',  'i+1', 'i+2', 'i+3', inpv, outpv );
+    do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3', inpv, outpv );
     print '   }'
     postamble()
 




More information about the mesa-commit mailing list