[Mesa-dev] [PATCH 03/18] t_dd_dmatmp: Disallow flat shading when rendering quad strips via tri strips

Ian Romanick idr at freedesktop.org
Wed Sep 30 13:57:51 PDT 2015


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

When rendering quad strips via tri strips we can't get the provoking
vertex right, so disallow flat shading.

v2: Major rebase on top of Ian's other t_dd_dmatmp.h work.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index be4b69c..9a6f6c82 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -330,8 +330,7 @@ static void TAG(render_quad_strip_verts)(struct gl_context *ctx,
 {
    GLuint j, nr;
 
-   if (ctx->Light.ShadeModel != GL_FLAT ||
-       !TNL_CONTEXT(ctx)->vb.AttribPtr[_TNL_ATTRIB_COLOR0]->stride) {
+   if (ctx->Light.ShadeModel == GL_SMOOTH) {
       LOCAL_VARS;
       const unsigned dmasz = GET_SUBSEQUENT_VB_MAX_VERTS() & ~1;
       unsigned currentsz;
@@ -460,9 +459,7 @@ static bool TAG(validate_render)(struct gl_context *ctx,
               ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION;
          break;
       case GL_QUAD_STRIP:
-         ok = VB->Elts ||
-              (ctx->Light.ShadeModel != GL_FLAT ||
-               VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride == 0);
+         ok = VB->Elts || ctx->Light.ShadeModel == GL_SMOOTH;
          break;
       case GL_QUADS:
          ok = true; /* flatshading is ok. */
-- 
2.1.0



More information about the mesa-dev mailing list