Mesa (master): gallium/draw: additional comments in the clipping code

Brian Paul brianp at kemper.freedesktop.org
Fri May 7 23:13:25 UTC 2010


Module: Mesa
Branch: master
Commit: 74fb08018ac740e8189cee5f9aa8e429d50496e4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=74fb08018ac740e8189cee5f9aa8e429d50496e4

Author: Brian Paul <brianp at vmware.com>
Date:   Fri May  7 17:13:16 2010 -0600

gallium/draw: additional comments in the clipping code

---

 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 d0532cb..df8d82e 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) {




More information about the mesa-commit mailing list