Merge branch '7.8'
[mesa.git] / src / gallium / auxiliary / draw / draw_pt_varray_tmp.h
index a9f844a35717ed7714d8425991f1ed7f279b3701..7c722457c3cad1e25333e546335af339a8ec6985 100644 (file)
@@ -10,12 +10,13 @@ static void FUNC(struct draw_pt_front_end *frontend,
 
    boolean flatfirst = (draw->rasterizer->flatshade &&
                         draw->rasterizer->flatshade_first);
-   unsigned i, j, flags;
+   unsigned i, j;
+   ushort flags;
    unsigned first, incr;
 
    varray->fetch_start = start;
 
-   split_prim_inplace(varray->input_prim, &first, &incr);
+   draw_pt_split_prim(varray->input_prim, &first, &incr);
 
 #if 0
    debug_printf("%s (%d) %d/%d\n", __FUNCTION__,
@@ -28,9 +29,10 @@ static void FUNC(struct draw_pt_front_end *frontend,
       for (j = 0; j + first <= count; j += i) {
          unsigned end = MIN2(FETCH_MAX, count - j);
          end -= (end % incr);
-         for (i = 0; i < count; i ++) {
+         for (i = 0; i < end; i++) {
             POINT(varray, i + 0);
          }
+         i = end;
          fetch_init(varray, end);
          varray_flush(varray);
       }
@@ -44,6 +46,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
             LINE(varray, DRAW_PIPE_RESET_STIPPLE,
                  i + 0, i + 1);
          }
+         i = end;
          fetch_init(varray, end);
          varray_flush(varray);
       }
@@ -60,6 +63,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
                LINE(varray, flags, i - 1, i);
             }
             LINE(varray, flags, i - 1, 0);
+            i = end;
             fetch_init(varray, end);
             varray_flush(varray);
          }
@@ -74,6 +78,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
          for (i = 1; i < end; i++, flags = 0) {
             LINE(varray, flags, i - 1, i);
          }
+         i = end;
          fetch_init(varray, end);
          varray_flush(varray);
       }
@@ -87,9 +92,9 @@ static void FUNC(struct draw_pt_front_end *frontend,
             TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
                      i + 0, i + 1, i + 2);
          }
-         varray->fetch_count = end;
-         varray_flush_linear(varray);
-         varray->fetch_start += end;
+         i = end;
+         fetch_init(varray, end);
+         varray_flush(varray);
       }
       break;
 
@@ -102,20 +107,30 @@ static void FUNC(struct draw_pt_front_end *frontend,
                TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
                         i + 0, i + 1 + (i&1), i + 2 - (i&1));
             }
+            i = end;
             fetch_init(varray, end);
             varray_flush(varray);
+            if (j + first + i <= count) {
+               varray->fetch_start -= 2;
+               i -= 2;
+            }
          }
       }
       else {
          for (j = 0; j + first <= count; j += i) {
             unsigned end = MIN2(FETCH_MAX, count - j);
-            end -= (end % incr);
-            for (i = 0; i+2 < end; i++) {
+            end -= (end  % incr);
+            for (i = 0; i + 2 < end; i++) {
                TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
                         i + 0 + (i&1), i + 1 - (i&1), i + 2);
             }
+            i = end;
             fetch_init(varray, end);
             varray_flush(varray);
+            if (j + first + i <= count) {
+               varray->fetch_start -= 2;
+               i -= 2;
+            }
          }
       }
       break;
@@ -130,6 +145,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
                for (i = 0; i+2 < end; i++) {
                   TRIANGLE(varray, flags, i + 1, i + 2, 0);
                }
+               i = end;
                fetch_init(varray, end);
                varray_flush(varray);
             }
@@ -142,6 +158,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
                for (i = 0; i+2 < end; i++) {
                   TRIANGLE(varray, flags, 0, i + 1, i + 2);
                }
+               i = end;
                fetch_init(varray, end);
                varray_flush(varray);
             }
@@ -156,6 +173,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
          for (i = 0; i+3 < end; i += 4) {
             QUAD(varray, i + 0, i + 1, i + 2, i + 3);
          }
+         i = end;
          fetch_init(varray, end);
          varray_flush(varray);
       }
@@ -168,8 +186,13 @@ static void FUNC(struct draw_pt_front_end *frontend,
          for (i = 0; i+3 < end; i += 2) {
             QUAD(varray, i + 2, i + 0, i + 1, i + 3);
          }
+         i = end;
          fetch_init(varray, end);
          varray_flush(varray);
+         if (j + first + i <= count) {
+            varray->fetch_start -= 2;
+            i -= 2;
+         }
       }
       break;
 
@@ -178,9 +201,9 @@ static void FUNC(struct draw_pt_front_end *frontend,
       /* These bitflags look a little odd because we submit the
        * vertices as (1,2,0) to satisfy flatshade requirements.
        */
-      const unsigned edge_first  = DRAW_PIPE_EDGE_FLAG_2;
-      const unsigned edge_middle = DRAW_PIPE_EDGE_FLAG_0;
-      const unsigned edge_last   = DRAW_PIPE_EDGE_FLAG_1;
+      const ushort edge_first  = DRAW_PIPE_EDGE_FLAG_2;
+      const ushort edge_middle = DRAW_PIPE_EDGE_FLAG_0;
+      const ushort edge_last   = DRAW_PIPE_EDGE_FLAG_1;
 
       flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle;
       for (j = 0; j + first <= count; j += i) {
@@ -193,6 +216,7 @@ static void FUNC(struct draw_pt_front_end *frontend,
 
             TRIANGLE(varray, flags, i + 1, i + 2, 0);
          }
+         i = end;
          fetch_init(varray, end);
          varray_flush(varray);
       }