summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-05-07 17:13:16 -0600
committerBrian Paul <[email protected]>2010-05-07 17:13:16 -0600
commit74fb08018ac740e8189cee5f9aa8e429d50496e4 (patch)
tree8903afa2dd903f87b7e06b627ce4b7f0bcae755d /src/gallium
parent3965bc5d22deef6ada838a3ba991d6347201a28a (diff)
gallium/draw: additional comments in the clipping code
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c15
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 d0532cb341e..df8d82e367d 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) {