From: Ville Syrjälä <ville.syrj...@linux.intel.com> Split the tri vs. tristrip paths in render_quad_strip_elts apart and add the appropriate smooth vs. flat shading and provoking vertex checks. Add the same checks to validate_render to make sure we don't end up there under the wrong circumstances.
Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com> --- src/mesa/tnl_dd/t_dd_dmatmp.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h index 82493a3..2132c07 100644 --- a/src/mesa/tnl_dd/t_dd_dmatmp.h +++ b/src/mesa/tnl_dd/t_dd_dmatmp.h @@ -906,7 +906,8 @@ static void TAG(render_quad_strip_elts)( struct gl_context *ctx, { if (HAVE_QUAD_STRIPS && 0) { } - else if (HAVE_TRI_STRIPS) { + else if ((HAVE_TRIANGLES || HAVE_TRI_STRIPS) && + ctx->Light.ShadeModel == GL_SMOOTH) { LOCAL_VARS; GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); @@ -925,7 +926,16 @@ static void TAG(render_quad_strip_elts)( struct gl_context *ctx, if (currentsz < 12) currentsz = dmasz; - if (ctx->Light.ShadeModel == GL_FLAT) { + if (HAVE_TRI_STRIPS) { + ELT_INIT( GL_TRIANGLE_STRIP ); + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } else { ELT_INIT( GL_TRIANGLES ); currentsz = currentsz/6*2; @@ -934,8 +944,7 @@ static void TAG(render_quad_strip_elts)( struct gl_context *ctx, for (j = start; j + 3 < count; j += nr - 2 ) { nr = MIN2( currentsz, count - j ); - if (nr >= 4) - { + if (nr >= 4) { GLint i; GLint quads = (nr/2)-1; ELTS_VARS( ALLOC_ELTS( quads*6 ) ); @@ -948,22 +957,12 @@ static void TAG(render_quad_strip_elts)( struct gl_context *ctx, } FLUSH(); - } - - currentsz = dmasz; } - } - else { - ELT_INIT( GL_TRIANGLE_STRIP ); - for (j = start; j + 3 < count; j += nr - 2 ) { - nr = MIN2( currentsz, count - j ); - TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); - FLUSH(); - currentsz = dmasz; - } + currentsz = dmasz; } } + } @@ -1124,8 +1123,10 @@ static GLboolean TAG(validate_render)( struct gl_context *ctx, break; case GL_QUAD_STRIP: if (VB->Elts) { - ok = HAVE_TRI_STRIPS; - } else if (HAVE_QUAD_STRIPS) { + ok = ((HAVE_TRI_STRIPS || HAVE_TRIANGLES) && + ctx->Light.ShadeModel == GL_SMOOTH); + } + else if (HAVE_QUAD_STRIPS) { ok = GL_TRUE; } else { ok = (HAVE_TRI_STRIPS && ctx->Light.ShadeModel == GL_SMOOTH); -- 2.0.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev