OSDN Git Service

t_dd_dmatmp: Allow flat shaded polygons with tri fans
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 30 Jun 2014 15:55:48 +0000 (18:55 +0300)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 16 Jul 2015 13:48:41 +0000 (21:48 +0800)
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@linux.intel.com>
src/mesa/tnl_dd/t_dd_dmatmp.h

index 5ea2d31..3ed4a98 100644 (file)
@@ -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: