[Mesa-dev] [PATCH 02/20] t_dd_dmatmp: Allow flat shaded polygons with tri fans

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Mon Mar 23 05:47:18 PDT 2015


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

We can allow rendering flat shaded polygons using tri fans if we check
the provoking vertex convention.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 5ea2d31..3ed4a98 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -406,7 +406,9 @@ static void TAG(render_poly_verts)( struct gl_context *ctx,
 
       FLUSH();
    }
-   else if (HAVE_TRI_FANS && ctx->Light.ShadeModel == GL_SMOOTH) {
+   else if (HAVE_TRI_FANS &&
+	    (ctx->Light.ShadeModel == GL_SMOOTH ||
+	     ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT)) {
       TAG(render_tri_fan_verts)( ctx, start, count, flags );
    } else {
       fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__);
@@ -885,7 +887,9 @@ static void TAG(render_poly_elts)( struct gl_context *ctx,
 	 FLUSH();
 	 currentsz = dmasz;
       }
-   } else if (HAVE_TRI_FANS && ctx->Light.ShadeModel == GL_SMOOTH) {
+   } else if (HAVE_TRI_FANS &&
+	      (ctx->Light.ShadeModel == GL_SMOOTH ||
+	       ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT)) {
       TAG(render_tri_fan_verts)( ctx, start, count, flags );
    } else {
       fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__);
@@ -1109,7 +1113,9 @@ static GLboolean TAG(validate_render)( struct gl_context *ctx,
 	    ok = GL_TRUE;
 	 }
 	 else {
-	    ok = (HAVE_TRI_FANS && ctx->Light.ShadeModel == GL_SMOOTH);
+	    ok = (HAVE_TRI_FANS &&
+		  (ctx->Light.ShadeModel == GL_SMOOTH ||
+		   ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT));
          }
 	 break;
       case GL_QUAD_STRIP:
-- 
2.0.5



More information about the mesa-dev mailing list