Mesa (master): softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw()

Brian Paul brianp at kemper.freedesktop.org
Thu Jun 4 00:35:16 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jun  3 18:33:07 2009 -0600

softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw()

Because of flat shading, we can't use same code as PIPE_PRIM_TRIANGLE_FAN.
This is a follow-on to commit a59575d8fbe8b0ca053cc8366ce7a42bc660158a.

---

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

diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index 56f12b9..06725fd 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -236,7 +236,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
       }
       break;
 
-
    case PIPE_PRIM_TRIANGLES:
       for (i = 2; i < nr; i += 3) {
          setup_tri( setup_ctx,
@@ -256,7 +255,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
       break;
 
    case PIPE_PRIM_TRIANGLE_FAN:
-   case PIPE_PRIM_POLYGON:
       for (i = 2; i < nr; i += 1) {
          setup_tri( setup_ctx,
                     get_vert(vertex_buffer, indices[0], stride),
@@ -264,6 +262,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
                     get_vert(vertex_buffer, indices[i-0], stride));
       }
       break;
+
    case PIPE_PRIM_QUADS:
       for (i = 3; i < nr; i += 4) {
          setup_tri( setup_ctx,
@@ -277,6 +276,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
                     get_vert(vertex_buffer, indices[i-0], stride));
       }
       break;
+
    case PIPE_PRIM_QUAD_STRIP:
       for (i = 3; i < nr; i += 2) {
          setup_tri( setup_ctx,
@@ -290,6 +290,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
                     get_vert(vertex_buffer, indices[i-0], stride));
       }
       break;
+
+   case PIPE_PRIM_POLYGON:
+      for (i = 2; i < nr; i += 1) {
+         setup_tri( setup_ctx,
+                    get_vert(vertex_buffer, indices[0-1], stride),
+                    get_vert(vertex_buffer, indices[i-0], stride),
+                    get_vert(vertex_buffer, indices[0], stride));
+      }
+      break;
+
    default:
       assert(0);
    }




More information about the mesa-commit mailing list