summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_vtx_api.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-09-25 09:14:26 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-09-25 09:14:26 +0000
commitcbdd7e1094e55b4c3c8737141845e749e442471f (patch)
treec7e782a2465494150c1a4e6c432da946fc2d0a7b /src/mesa/tnl/t_vtx_api.c
parentf1945796ed5a2d15a8c3694019e6e5e1ab58db3e (diff)
bring in active_sz mechanism from i965 driver. Fixes bug 8410
Diffstat (limited to 'src/mesa/tnl/t_vtx_api.c')
-rw-r--r--src/mesa/tnl/t_vtx_api.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index 9379d91780..cc00dfda30 100644
--- a/src/mesa/tnl/t_vtx_api.c
+++ b/src/mesa/tnl/t_vtx_api.c
@@ -321,13 +321,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 +339,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 +404,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 +525,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 +557,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 +657,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 +685,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 +1012,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;