Mesa (master): gallium: still more provoking vertex fixes

Brian Paul brianp at kemper.freedesktop.org
Thu May 6 00:47:46 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed May  5 18:46:05 2010 -0600

gallium: still more provoking vertex fixes

This fixes edge flags for polygons and provoking vertex for
filled quads.

---

 src/gallium/auxiliary/draw/draw_pt_vcache.c     |   14 ++++++++++++--
 src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h |   19 ++++++++++---------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index bfcd709..6a48e61 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -183,8 +183,16 @@ vcache_quad( struct vcache_frontend *vcache,
              unsigned i2,
              unsigned i3 )
 {
-   vcache_triangle( vcache, i0, i1, i3 );
-   vcache_triangle( vcache, i1, i2, i3 );
+   if (vcache->draw->rasterizer->flatshade_first) {
+      /* pass last quad vertex as first triangle vertex */
+      vcache_triangle( vcache, i3, i0, i1 );
+      vcache_triangle( vcache, i3, i1, i2 );
+   }
+   else {
+      /* pass last quad vertex as last triangle vertex */
+      vcache_triangle( vcache, i0, i1, i3 );
+      vcache_triangle( vcache, i1, i2, i3 );
+   }
 }
 
 static INLINE void 
@@ -195,6 +203,7 @@ vcache_ef_quad( struct vcache_frontend *vcache,
                 unsigned i3 )
 {
    if (vcache->draw->rasterizer->flatshade_first) {
+      /* pass last quad vertex as first triangle vertex */
       vcache_triangle_flags( vcache,
                              ( DRAW_PIPE_RESET_STIPPLE |
                                DRAW_PIPE_EDGE_FLAG_0 |
@@ -207,6 +216,7 @@ vcache_ef_quad( struct vcache_frontend *vcache,
                              i3, i1, i2 );
    }
    else {
+      /* pass last quad vertex as last triangle vertex */
       vcache_triangle_flags( vcache,
                              ( DRAW_PIPE_RESET_STIPPLE |
                                DRAW_PIPE_EDGE_FLAG_0 |
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
index f7a63de..dac68ad 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
@@ -142,20 +142,21 @@ static void FUNC( struct draw_pt_front_end *frontend,
          /* These bitflags look a little odd because we submit the
           * vertices as (1,2,0) to satisfy flatshade requirements.  
           */
-         const ushort edge_first  = DRAW_PIPE_EDGE_FLAG_2;
-         const ushort edge_middle = DRAW_PIPE_EDGE_FLAG_0;
-         const ushort edge_last   = DRAW_PIPE_EDGE_FLAG_1;
          ushort edge_next, edge_finish;
 
          if (flatfirst) {
-            flags = DRAW_PIPE_RESET_STIPPLE | edge_middle | edge_last;
-            edge_next = edge_last;
-            edge_finish = edge_first;
+            flags = (DRAW_PIPE_RESET_STIPPLE |
+                     DRAW_PIPE_EDGE_FLAG_1 |
+                     DRAW_PIPE_EDGE_FLAG_2);
+            edge_next = DRAW_PIPE_EDGE_FLAG_2;
+            edge_finish = DRAW_PIPE_EDGE_FLAG_0;
          }
          else {
-            flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle;
-            edge_next = edge_middle;
-            edge_finish = edge_last;
+            flags = (DRAW_PIPE_RESET_STIPPLE |
+                     DRAW_PIPE_EDGE_FLAG_2 |
+                     DRAW_PIPE_EDGE_FLAG_0);
+            edge_next = DRAW_PIPE_EDGE_FLAG_0;
+            edge_finish = DRAW_PIPE_EDGE_FLAG_1;
          }
 
 	 for (i = 0; i+2 < count; i++, flags = edge_next) {




More information about the mesa-commit mailing list