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

Ville Syrjälä ville.syrjala at linux.intel.com
Thu May 21 10:24:34 PDT 2015


On Fri, May 15, 2015 at 12:07:54PM -0700, Ian Romanick wrote:
> On 03/23/2015 05:47 AM, ville.syrjala at linux.intel.com wrote:
> > 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.
> 
> This sounds reasonable since it matches the DX behavior.  Is there a
> piglit test that would hit this?

Dunno. And in fact we won't hit it with i915 sine we HAVE_POLYGONS.
Failed to realize that before I cooked up the patch :)

> 
> > 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:
> > 

-- 
Ville Syrjälä
Intel OTC


More information about the mesa-dev mailing list