summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_prim_vbuf.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-06-12 12:09:34 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-06-12 12:09:34 -0400
commit1036ef2bf468611d37b5df06fc4424f2002e3837 (patch)
treef0859a6d903c2570a0a00c918da88139f8f7d065 /src/gallium/drivers/softpipe/sp_prim_vbuf.c
parent917f8bc1a85e61311cef6478127b387df70fba14 (diff)
parent1cd0afffc9edbcac690f8ab436aecfced26b0aba (diff)
Merge master and fix conflicts
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_prim_vbuf.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index eef6e5806c..06725fd09b 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -236,7 +236,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
}
break;
-
case PIPE_PRIM_TRIANGLES:
for (i = 2; i < nr; i += 3) {
setup_tri( setup_ctx,
@@ -256,7 +255,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
break;
case PIPE_PRIM_TRIANGLE_FAN:
- case PIPE_PRIM_POLYGON:
for (i = 2; i < nr; i += 1) {
setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[0], stride),
@@ -264,6 +262,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
get_vert(vertex_buffer, indices[i-0], stride));
}
break;
+
case PIPE_PRIM_QUADS:
for (i = 3; i < nr; i += 4) {
setup_tri( setup_ctx,
@@ -277,6 +276,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
get_vert(vertex_buffer, indices[i-0], stride));
}
break;
+
case PIPE_PRIM_QUAD_STRIP:
for (i = 3; i < nr; i += 2) {
setup_tri( setup_ctx,
@@ -290,6 +290,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
get_vert(vertex_buffer, indices[i-0], stride));
}
break;
+
+ case PIPE_PRIM_POLYGON:
+ for (i = 2; i < nr; i += 1) {
+ setup_tri( setup_ctx,
+ get_vert(vertex_buffer, indices[0-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride),
+ get_vert(vertex_buffer, indices[0], stride));
+ }
+ break;
+
default:
assert(0);
}
@@ -378,7 +388,6 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
break;
case PIPE_PRIM_TRIANGLE_FAN:
- case PIPE_PRIM_POLYGON:
for (i = 2; i < nr; i += 1) {
setup_tri( setup_ctx,
get_vert(vertex_buffer, 0, stride),
@@ -386,6 +395,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
get_vert(vertex_buffer, i-0, stride));
}
break;
+
case PIPE_PRIM_QUADS:
for (i = 3; i < nr; i += 4) {
setup_tri( setup_ctx,
@@ -412,6 +422,20 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
get_vert(vertex_buffer, i-0, stride));
}
break;
+
+ case PIPE_PRIM_POLYGON:
+ /* Almost same as tri fan but the _first_ vertex specifies the flat
+ * shading color. Note that the first polygon vertex is passed as
+ * the last triangle vertex here.
+ */
+ for (i = 2; i < nr; i += 1) {
+ setup_tri( setup_ctx,
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride),
+ get_vert(vertex_buffer, 0, stride));
+ }
+ break;
+
default:
assert(0);
}