fix triangle strips
authorZack Rusin <zack@tungstengraphics.com>
Thu, 8 May 2008 16:10:24 +0000 (12:10 -0400)
committerZack Rusin <zack@tungstengraphics.com>
Thu, 8 May 2008 19:26:34 +0000 (15:26 -0400)
src/gallium/auxiliary/draw/draw_pt_varray_tmp.h
src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h

index fb49452d8b6e35816ebe6e68b614ebf587a605c5..d137a758e2701133597c926c43f489d94eaf2069 100644 (file)
@@ -109,19 +109,27 @@ static void FUNC(struct draw_pt_front_end *frontend,
             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;
index ab28859c35ff14fd79db8ceb5d716d2dbd80c6d3..4bf04fa62b6a0154918ffc3968ac1742d6722e76 100644 (file)
@@ -80,19 +80,27 @@ static void FUNC(struct draw_pt_front_end *frontend,
             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;) {
+         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++) {
                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);
-            j += end;
+            if (j + first + i <= count) {
+               varray->fetch_start -= 2;
+               i -= 2;
+            }
          }
       }
       break;