}
+/**
+ * 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,
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)
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,
}
}
- /* 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) {