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

Author: Brian Paul <[email protected]>
Date:   Fri Oct 16 16:14:46 2015 -0600

svga: try to avoid index generation for some primitive types

The svga device doesn't directly support quads, quad strips or polygons
so we have to convert those types to indexed triangle lists.  But we
can sometimes avoid that if we're drawing flat/constant-colored prims
and we don't have to worry about provoking vertex.

Reviewed-by: Charmaine Lee <[email protected]>
Reviewed-by: José Fonseca <[email protected]>

---

 src/gallium/drivers/svga/svga_draw_arrays.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c 
b/src/gallium/drivers/svga/svga_draw_arrays.c
index e4d7764..caf4b17 100644
--- a/src/gallium/drivers/svga/svga_draw_arrays.c
+++ b/src/gallium/drivers/svga/svga_draw_arrays.c
@@ -218,6 +218,20 @@ svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl,
        * the hardware wants.
        */
       api_pv = hwtnl->hw_pv;
+
+      if (hwtnl->api_fillmode == PIPE_POLYGON_MODE_FILL) {
+         /* Do some simple primitive conversions to avoid index buffer
+          * generation below.  Note that polygons and quads are not directly
+          * supported by the svga device.  Also note, we can only do this
+          * for flat/constant-colored rendering because of provoking vertex.
+          */
+         if (prim == PIPE_PRIM_POLYGON) {
+            prim = PIPE_PRIM_TRIANGLE_FAN;
+         }
+         else if (prim == PIPE_PRIM_QUADS && count == 4) {
+            prim = PIPE_PRIM_TRIANGLE_FAN;
+         }
+      }
    }
 
    if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL &&

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to