Mesa (master): softpipe: quads never provoke the first vertex

Marek Olšák mareko at kemper.freedesktop.org
Mon Mar 8 19:57:36 PST 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Mar  7 04:56:06 2010 +0100

softpipe: quads never provoke the first vertex

---

 src/gallium/drivers/softpipe/sp_prim_vbuf.c |   80 ++++-----------------------
 1 files changed, 12 insertions(+), 68 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index 98c08ea..6749243 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -264,57 +264,29 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
       break;
 
    case PIPE_PRIM_QUADS:
-      if (softpipe->rasterizer->flatshade_first) {
-         for (i = 3; i < nr; i += 4) {
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, indices[i-2], stride),
-                       get_vert(vertex_buffer, indices[i-1], stride),
-                       get_vert(vertex_buffer, indices[i-3], stride) );
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, indices[i-1], stride),
-                       get_vert(vertex_buffer, indices[i-0], stride),
-                       get_vert(vertex_buffer, indices[i-3], stride) );
-         }
-      }
-      else {
-         for (i = 3; i < nr; i += 4) {
-            sp_setup_tri( setup_ctx,
+      for (i = 3; i < nr; i += 4) {
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, indices[i-3], stride),
                        get_vert(vertex_buffer, indices[i-2], stride),
                        get_vert(vertex_buffer, indices[i-0], stride) );
 
-            sp_setup_tri( setup_ctx,
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, indices[i-2], stride),
                        get_vert(vertex_buffer, indices[i-1], stride),
                        get_vert(vertex_buffer, indices[i-0], stride) );
-         }
       }
       break;
 
    case PIPE_PRIM_QUAD_STRIP:
-      if (softpipe->rasterizer->flatshade_first) {
-         for (i = 3; i < nr; i += 2) {
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, indices[i-0], stride),
-                       get_vert(vertex_buffer, indices[i-1], stride),
-                       get_vert(vertex_buffer, indices[i-3], stride));
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, indices[i-2], stride),
-                       get_vert(vertex_buffer, indices[i-0], stride),
-                       get_vert(vertex_buffer, indices[i-3], stride) );
-         }
-      }
-      else {
-         for (i = 3; i < nr; i += 2) {
-            sp_setup_tri( setup_ctx,
+      for (i = 3; i < nr; i += 2) {
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, indices[i-3], stride),
                        get_vert(vertex_buffer, indices[i-2], stride),
                        get_vert(vertex_buffer, indices[i-0], stride) );
-            sp_setup_tri( setup_ctx,
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, indices[i-1], stride),
                        get_vert(vertex_buffer, indices[i-3], stride),
                        get_vert(vertex_buffer, indices[i-0], stride) );
-         }
       }
       break;
 
@@ -448,56 +420,28 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
       break;
 
    case PIPE_PRIM_QUADS:
-      if (softpipe->rasterizer->flatshade_first) {
-         for (i = 3; i < nr; i += 4) {
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, i-2, stride),
-                       get_vert(vertex_buffer, i-1, stride),
-                       get_vert(vertex_buffer, i-3, stride) );
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, i-1, stride),
-                       get_vert(vertex_buffer, i-0, stride),
-                       get_vert(vertex_buffer, i-3, stride) );
-         }
-      }
-      else {
-         for (i = 3; i < nr; i += 4) {
-            sp_setup_tri( setup_ctx,
+      for (i = 3; i < nr; i += 4) {
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, i-3, stride),
                        get_vert(vertex_buffer, i-2, stride),
                        get_vert(vertex_buffer, i-0, stride) );
-            sp_setup_tri( setup_ctx,
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, i-2, stride),
                        get_vert(vertex_buffer, i-1, stride),
                        get_vert(vertex_buffer, i-0, stride) );
-         }
       }
       break;
 
    case PIPE_PRIM_QUAD_STRIP:
-      if (softpipe->rasterizer->flatshade_first) {
-         for (i = 3; i < nr; i += 2) {
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, i-0, stride),
-                       get_vert(vertex_buffer, i-1, stride),
-                       get_vert(vertex_buffer, i-3, stride) );
-            sp_setup_tri( setup_ctx,
-                       get_vert(vertex_buffer, i-2, stride),
-                       get_vert(vertex_buffer, i-0, stride),
-                       get_vert(vertex_buffer, i-3, stride) );
-         }
-      }
-      else {
-         for (i = 3; i < nr; i += 2) {
-            sp_setup_tri( setup_ctx,
+      for (i = 3; i < nr; i += 2) {
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, i-3, stride),
                        get_vert(vertex_buffer, i-2, stride),
                        get_vert(vertex_buffer, i-0, stride) );
-            sp_setup_tri( setup_ctx,
+         sp_setup_tri( setup_ctx,
                        get_vert(vertex_buffer, i-1, stride),
                        get_vert(vertex_buffer, i-3, stride),
                        get_vert(vertex_buffer, i-0, stride) );
-         }
       }
       break;
 



More information about the mesa-commit mailing list