diff options
author | Brian Paul <[email protected]> | 2009-05-30 20:07:18 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-05-30 20:07:18 -0600 |
commit | a59575d8fbe8b0ca053cc8366ce7a42bc660158a (patch) | |
tree | 04ad16af09e67341fde569c82b8e028d550c7cf0 /src | |
parent | 1045481dd96dec6e37f4b623b1dbae8af381de75 (diff) |
softpipe: fix incorrect provoking vertex color for PIPE_PRIM_POLYGON
This fixes the incorrect colors seen when rendering flat-shaded polygons.
Note that clipped polygons were correct, but unclipped polygons were wrong.
See the glean/clipFlat test for regression testing.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_prim_vbuf.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index eef6e5806c9..329c92b8da1 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -378,7 +378,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 +385,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 +412,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-0, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, 0, stride)); + } + break; + default: assert(0); } |