diff options
Diffstat (limited to 'src/mesa/tnl/t_vtx_api.c')
-rw-r--r-- | src/mesa/tnl/t_vtx_api.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index 9379d91780c..b766ce2d2ce 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -174,6 +174,8 @@ static void _tnl_copy_to_current( GLcontext *ctx ) } ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; + + ctx->NewState |= _NEW_LIGHT; } @@ -321,13 +323,17 @@ static void _tnl_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) static const GLfloat id[4] = { 0, 0, 0, 1 }; int i; + if (0) + _mesa_printf("%s attr %d sz %d -> %d\n", + __FUNCTION__, attr, tnl->vtx.attrsz[attr], sz); + if (tnl->vtx.attrsz[attr] < sz) { /* New size is larger. Need to flush existing vertices and get * an enlarged vertex format. */ _tnl_wrap_upgrade_vertex( ctx, attr, sz ); } - else if (tnl->vtx.attrsz[attr] > sz) { + else if (sz < tnl->vtx.active_sz[attr]) { /* New size is smaller - just need to fill in some * zeros. Don't need to flush or wrap. */ @@ -335,6 +341,8 @@ static void _tnl_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) tnl->vtx.attrptr[attr][i-1] = id[i-1]; } + tnl->vtx.active_sz[attr] = sz; + /* Does setting NeedFlush belong here? Necessitates resetting * vtxfmt on each flush (otherwise flags won't get reset * afterwards). @@ -398,7 +406,7 @@ static tnl_attrfv_func do_choose( GLuint attr, GLuint sz ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint oldsz = tnl->vtx.attrsz[attr]; + GLuint oldsz = tnl->vtx.active_sz[attr]; assert(attr < _TNL_MAX_ATTR_CODEGEN); @@ -519,6 +527,7 @@ reset_attrfv(TNLcontext *tnl) if (tnl->vtx.attrsz[i]) { GLint j = tnl->vtx.attrsz[i] - 1; tnl->vtx.attrsz[i] = 0; + tnl->vtx.active_sz[i] = 0; if (i < _TNL_MAX_ATTR_CODEGEN) { while (j >= 0) { @@ -550,7 +559,7 @@ reset_attrfv(TNLcontext *tnl) */ #define OTHER_ATTR( A, N, params ) \ do { \ - if (tnl->vtx.attrsz[A] != N) { \ + if (tnl->vtx.active_sz[A] != N) { \ _tnl_fixup_vertex( ctx, A, N ); \ } \ \ @@ -650,7 +659,7 @@ static void GLAPIENTRY _tnl_EvalCoord1f( GLfloat u ) for (i = 0; i < _TNL_NUM_EVAL; i++) { if (tnl->vtx.eval.map1[i].map) - if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map1[i].sz) + if (tnl->vtx.active_sz[i] != tnl->vtx.eval.map1[i].sz) _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map1[i].sz ); } } @@ -678,12 +687,12 @@ static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v ) for (i = 0; i < _TNL_NUM_EVAL; i++) { if (tnl->vtx.eval.map2[i].map) - if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map2[i].sz) + if (tnl->vtx.active_sz[i] != tnl->vtx.eval.map2[i].sz) _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map2[i].sz ); } if (ctx->Eval.AutoNormal) - if (tnl->vtx.attrsz[_TNL_ATTRIB_NORMAL] != 3) + if (tnl->vtx.active_sz[_TNL_ATTRIB_NORMAL] != 3) _tnl_fixup_vertex( ctx, _TNL_ATTRIB_NORMAL, 3 ); } @@ -1005,8 +1014,10 @@ void _tnl_vtx_init( GLcontext *ctx ) _mesa_memcpy( tnl->vtx.tabfv, choose, sizeof(choose) ); - for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) { tnl->vtx.attrsz[i] = 0; + tnl->vtx.active_sz[i] = 0; + } tnl->vtx.vertex_size = 0; tnl->vtx.have_materials = 0; |