diff options
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_clip.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index d0532cb341..df8d82e367 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -157,6 +157,10 @@ static void interp( const struct clip_stage *clip, } +/** + * Emit a post-clip polygon to the next pipeline stage. The polygon + * will be convex and the provoking vertex will always be vertex[0]. + */ static void emit_poly( struct draw_stage *stage, struct vertex_header **inlist, unsigned n, @@ -183,16 +187,16 @@ static void emit_poly( struct draw_stage *stage, header.pad = 0; for (i = 2; i < n; i++, header.flags = edge_middle) { - /* keep in provoking vertex for flatshading */ + /* order the triangle verts to respect the provoking vertex mode */ if (stage->draw->rasterizer->flatshade_first) { - header.v[0] = inlist[0]; + header.v[0] = inlist[0]; /* the provoking vertex */ header.v[1] = inlist[i-1]; header.v[2] = inlist[i]; } else { header.v[0] = inlist[i-1]; header.v[1] = inlist[i]; - header.v[2] = inlist[0]; + header.v[2] = inlist[0]; /* the provoking vertex */ } if (i == n-1) @@ -201,7 +205,8 @@ static void emit_poly( struct draw_stage *stage, if (0) { const struct draw_vertex_shader *vs = stage->draw->vs.vertex_shader; uint j, k; - debug_printf("Clipped tri:\n"); + debug_printf("Clipped tri: (flat-shade-first = %d)\n", + stage->draw->rasterizer->flatshade_first); for (j = 0; j < 3; j++) { for (k = 0; k < vs->info.num_outputs; k++) { debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k, @@ -307,7 +312,7 @@ do_clip_tri( struct draw_stage *stage, } } - /* If flat-shading, copy color to new provoking vertex. + /* If flat-shading, copy provoking vertex color to polygon vertex[0] */ if (clipper->flat) { if (stage->draw->rasterizer->flatshade_first) { |