diff options
Diffstat (limited to 'src/mesa/tnl/t_vtx_api.c')
| -rw-r--r-- | src/mesa/tnl/t_vtx_api.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index 56b1e9f..f2e7857 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -312,14 +312,20 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, * codegen. Might be a reasonable place to try & detect attributes * in the vertex which aren't being submitted any more. */ - for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) { + /* Force the generic entrypoints through _tnl_choose_attr() again + * so shrunken attributes get their identity components refilled + * (mirrors the tabfv reset below). + */ + tnl->vtx.active_sz[i] = 0; + if (tnl->vtx.attrsz[i]) { GLuint j = tnl->vtx.attrsz[i] - 1; if (i < _TNL_MAX_ATTR_CODEGEN) tnl->vtx.tabfv[i][j] = choose[i][j]; } - + } } @@ -440,6 +446,22 @@ static tnl_attrfv_func do_choose( GLuint attr, GLuint sz ) +/* Helper for the single-dispatch generic entrypoints + */ +void _tnl_choose_attr( GLcontext *ctx, GLuint attr, GLuint sz ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + assert(attr < _TNL_ATTRIB_MAX); + assert(sz >= 1 && sz <= 4); + + if (tnl->vtx.attrsz[attr] != sz) + _tnl_fixup_vertex( ctx, attr, sz ); + + tnl->vtx.active_sz[attr] = (GLubyte) sz; +} + + #define CHOOSE( ATTR, N ) \ static void choose_##ATTR##_##N( const GLfloat *v ) \ { \ @@ -487,10 +509,12 @@ static void error_attrib( const GLfloat *unused ) static void reset_attrfv( TNLcontext *tnl ) -{ +{ GLuint i; - for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) { + tnl->vtx.active_sz[i] = 0; + if (tnl->vtx.attrsz[i]) { GLint j = tnl->vtx.attrsz[i] - 1; tnl->vtx.attrsz[i] = 0; @@ -502,6 +526,7 @@ static void reset_attrfv( TNLcontext *tnl ) } } } + } tnl->vtx.vertex_size = 0; tnl->vtx.have_materials = 0; |
