summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_varray.c
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-05-01 23:54:39 -0400
committerZack Rusin <zack@tungstengraphics.com>2008-05-08 15:26:03 -0400
commit90a46ed277cc887d49c8d8c627174c3bd693ecf7 (patch)
tree718e00dda806d1d44abc0fe388d2b63eb62f0719 /src/gallium/auxiliary/draw/draw_pt_varray.c
parent2abc1b3641e435e0b68490fa6b0a7ffa7c030c76 (diff)
split larger primitives in the simple varray pt
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_varray.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_varray.c62
1 files changed, 59 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_varray.c b/src/gallium/auxiliary/draw/draw_pt_varray.c
index b0bd2b983e..c9843bded0 100644
--- a/src/gallium/auxiliary/draw/draw_pt_varray.c
+++ b/src/gallium/auxiliary/draw/draw_pt_varray.c
@@ -58,6 +58,11 @@ static void varray_flush(struct varray_frontend *varray)
debug_printf("FLUSH fc = %d, dc = %d\n",
varray->fetch_count,
varray->draw_count);
+ debug_printf("\telt0 = %d, eltx = %d, draw0 = %d, drawx = %d\n",
+ varray->fetch_elts[0],
+ varray->fetch_elts[varray->fetch_count-1],
+ varray->draw_elts[0],
+ varray->draw_elts[varray->draw_count-1]);
#endif
varray->middle->run(varray->middle,
varray->fetch_elts,
@@ -71,18 +76,69 @@ static void varray_flush(struct varray_frontend *varray)
}
static INLINE void fetch_init(struct varray_frontend *varray,
- unsigned current_count,
unsigned count)
{
unsigned idx;
- const unsigned end = MIN2(FETCH_MAX, count - current_count);
- for (idx = 0; idx < end; ++idx) {
+#if 0
+ debug_printf("FETCH INIT c = %d, fs = %d\n",
+ count,
+ varray->fetch_start);
+#endif
+ for (idx = 0; idx < count; ++idx) {
varray->fetch_elts[idx] = varray->fetch_start + idx;
}
varray->fetch_start += idx;
varray->fetch_count = idx;
}
+
+static boolean split_prim_inplace(unsigned prim, unsigned *first, unsigned *incr)
+{
+ switch (prim) {
+ case PIPE_PRIM_POINTS:
+ *first = 1;
+ *incr = 1;
+ return TRUE;
+ case PIPE_PRIM_LINES:
+ *first = 2;
+ *incr = 2;
+ return TRUE;
+ case PIPE_PRIM_LINE_STRIP:
+ *first = 2;
+ *incr = 1;
+ return TRUE;
+ case PIPE_PRIM_TRIANGLES:
+ *first = 3;
+ *incr = 3;
+ return TRUE;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ *first = 3;
+ *incr = 1;
+ return TRUE;
+ case PIPE_PRIM_TRIANGLE_FAN:
+ *first = 3;
+ *incr = 1;
+ return TRUE;
+ case PIPE_PRIM_QUADS:
+ *first = 4;
+ *incr = 4;
+ return TRUE;
+ case PIPE_PRIM_QUAD_STRIP:
+ *first = 4;
+ *incr = 2;
+ return TRUE;
+ case PIPE_PRIM_POLYGON:
+ *first = 3;
+ *incr = 1;
+ return TRUE;
+ default:
+ *first = 0;
+ *incr = 1; /* set to one so that count % incr works */
+ return FALSE;
+ }
+}
+
+
static INLINE void add_draw_el(struct varray_frontend *varray,
int idx, ushort flags)
{