abstract fetching elts
authorZack Rusin <zack@tungstengraphics.com>
Thu, 1 May 2008 16:38:51 +0000 (12:38 -0400)
committerZack Rusin <zack@tungstengraphics.com>
Thu, 8 May 2008 19:26:00 +0000 (15:26 -0400)
src/gallium/auxiliary/draw/draw_pt_varray.c
src/gallium/auxiliary/draw/draw_pt_varray_tmp.h

index 355093f945e8d8b92cfce99e2ba350f043132402..b0bd2b983e497c3367f7f710fb0efb273fca58ad 100644 (file)
@@ -43,6 +43,8 @@ struct varray_frontend {
    unsigned draw_count;
    unsigned fetch_count;
 
+   unsigned fetch_start;
+
    struct draw_pt_middle_end *middle;
 
    unsigned input_prim;
@@ -68,15 +70,18 @@ static void varray_flush(struct varray_frontend *varray)
    varray->draw_count = 0;
 }
 
-#if 0
-static void varray_check_flush(struct varray_frontend *varray)
+static INLINE void fetch_init(struct varray_frontend *varray,
+                              unsigned current_count,
+                              unsigned count)
 {
-   if (varray->draw_count + 6 >= DRAW_MAX/* ||
-       varray->fetch_count + 4 >= FETCH_MAX*/) {
-      varray_flush(varray);
+   unsigned idx;
+   const unsigned end = MIN2(FETCH_MAX, count - current_count);
+   for (idx = 0; idx < end; ++idx) {
+      varray->fetch_elts[idx] = varray->fetch_start + idx;
    }
+   varray->fetch_start += idx;
+   varray->fetch_count = idx;
 }
-#endif
 
 static INLINE void add_draw_el(struct varray_frontend *varray,
                                int idx, ushort flags)
index b9a319b2535bacb7748cd518311a27387156fdeb..a3509613f50056c4ac139692eb9b7724a72062ec 100644 (file)
@@ -20,10 +20,8 @@ static void FUNC(struct draw_pt_front_end *frontend,
                 start, count);
 #endif
 
-   for (i = 0; i < count; ++i) {
-      varray->fetch_elts[i] = start + i;
-   }
-   varray->fetch_count = count;
+   varray->fetch_start = start;
+   fetch_init(varray, 0, count);
 
    switch (varray->input_prim) {
    case PIPE_PRIM_POINTS: