From 086ecea179ed572c89aa77c5f465671a5cef87a7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 18:33:07 -0600 Subject: [PATCH] softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw() Because of flat shading, we can't use same code as PIPE_PRIM_TRIANGLE_FAN. This is a follow-on to commit a59575d8fbe8b0ca053cc8366ce7a42bc660158a. --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 56f12b9810d..06725fd09b4 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); } -- 2.30.2