summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-03-16 10:33:59 -0600
committerBrian <[email protected]>2008-03-16 10:33:59 -0600
commit49a687882a659bd03fd09ca7a7d592818914597a (patch)
treeedd7ed2ec263fecccae17cee7dedd5478281a449
parentcb98f71d42e4c714dfb0c3e29d28d8418a1ee86b (diff)
gallium: finish remaining prim types for sp_vbuf_draw_arrays()
Not totally tested, but easily fixed if glitches are found.
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index db0913cb2bc..e7d0cb2b870 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -207,6 +207,27 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
(struct vertex_header *) ((char *) vertex_buffer + (I) * vertex_size)
switch (cvbr->prim) {
+ case PIPE_PRIM_POINTS:
+ for (i = 0; i < nr; i++) {
+ prim.v[0] = VERTEX(i);
+ setup->point( setup, &prim );
+ }
+ break;
+ case PIPE_PRIM_LINES:
+ assert(nr % 2 == 0);
+ for (i = 0; i < nr; i += 2) {
+ prim.v[0] = VERTEX(i);
+ prim.v[1] = VERTEX(i + 1);
+ setup->line( setup, &prim );
+ }
+ break;
+ case PIPE_PRIM_LINE_STRIP:
+ for (i = 1; i < nr; i++) {
+ prim.v[0] = VERTEX(i - 1);
+ prim.v[1] = VERTEX(i);
+ setup->line( setup, &prim );
+ }
+ break;
case PIPE_PRIM_TRIANGLES:
assert(nr % 3 == 0);
for (i = 0; i < nr; i += 3) {
@@ -217,6 +238,58 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
setup->tri( setup, &prim );
}
break;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ assert(nr >= 3);
+ for (i = 2; i < nr; i++) {
+ prim.v[0] = VERTEX(i - 2);
+ prim.v[1] = VERTEX(i - 1);
+ prim.v[2] = VERTEX(i);
+ calc_det(&prim);
+ setup->tri( setup, &prim );
+ }
+ break;
+ case PIPE_PRIM_TRIANGLE_FAN:
+ assert(nr >= 3);
+ for (i = 2; i < nr; i++) {
+ prim.v[0] = VERTEX(0);
+ prim.v[1] = VERTEX(i - 1);
+ prim.v[2] = VERTEX(i);
+ calc_det(&prim);
+ setup->tri( setup, &prim );
+ }
+ break;
+ case PIPE_PRIM_QUADS:
+ assert(nr % 4 == 0);
+ for (i = 0; i < nr; i += 4) {
+ prim.v[0] = VERTEX(i + 0);
+ prim.v[1] = VERTEX(i + 1);
+ prim.v[2] = VERTEX(i + 2);
+ calc_det(&prim);
+ setup->tri( setup, &prim );
+
+ prim.v[0] = VERTEX(i + 0);
+ prim.v[1] = VERTEX(i + 2);
+ prim.v[2] = VERTEX(i + 3);
+ calc_det(&prim);
+ setup->tri( setup, &prim );
+ }
+ break;
+ case PIPE_PRIM_QUAD_STRIP:
+ assert(nr >= 4);
+ for (i = 2; i < nr; i += 2) {
+ prim.v[0] = VERTEX(i - 2);
+ prim.v[1] = VERTEX(i);
+ prim.v[2] = VERTEX(i + 1);
+ calc_det(&prim);
+ setup->tri( setup, &prim );
+
+ prim.v[0] = VERTEX(i - 2);
+ prim.v[1] = VERTEX(i + 1);
+ prim.v[2] = VERTEX(i - 1);
+ calc_det(&prim);
+ setup->tri( setup, &prim );
+ }
+ break;
case PIPE_PRIM_POLYGON:
/* draw as tri fan */
for (i = 2; i < nr; i++) {