t_dd_dmatmp: Allow flat shaded polygons with tri fans
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 23 Mar 2015 12:47:18 +0000 (14:47 +0200)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 6 Oct 2015 18:16:19 +0000 (11:16 -0700)
We can allow rendering flat shaded polygons using tri fans if we check
the provoking vertex convention.

v2 (idr): Remove _EXT suffixes from GL_FIRST_VERTEX_CONVENTION.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/tnl_dd/t_dd_dmatmp.h

index 181cf6701dd7601ae54b272a48c494d4a3e4fb41..7d03b026bd5fb00936720c8a5a81aeea7fc51f9c 100644 (file)
@@ -316,7 +316,8 @@ static void TAG(render_poly_verts)(struct gl_context *ctx,
       }
 
       FLUSH();
-   } else if (ctx->Light.ShadeModel == GL_SMOOTH) {
+   } else if (ctx->Light.ShadeModel == GL_SMOOTH ||
+              ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION) {
       TAG(render_tri_fan_verts)( ctx, start, count, flags );
    } else {
       unreachable("Cannot draw primitive; validate_render should have "
@@ -458,7 +459,8 @@ static bool TAG(validate_render)(struct gl_context *ctx,
          ok = true;
          break;
       case GL_POLYGON:
-         ok = (HAVE_POLYGONS) || ctx->Light.ShadeModel == GL_SMOOTH;
+         ok = (HAVE_POLYGONS) || ctx->Light.ShadeModel == GL_SMOOTH ||
+              ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION;
          break;
       case GL_QUAD_STRIP:
          ok = VB->Elts ||