From df943a40411d2b71381e5053d7c59e8cd2400fff Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 23 Apr 2005 11:55:18 +0000 Subject: Fix the worst problems with dangling edgeflag references in display lists. These mainly arise from edgeflag being the only attribute no longer stored internally as a float and requiring various special case paths to accomodate it. --- src/mesa/tnl/t_vtx_api.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/mesa/tnl/t_vtx_api.c') diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index fabd99e5d0..b9ad28e67d 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -142,7 +142,7 @@ static void _tnl_copy_to_current( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) if (tnl->vtx.attrsz[i]) { /* Note: the tnl->vtx.current[i] pointers points to * the ctx->Current fields. The first 16 or so, anyway. @@ -152,12 +152,12 @@ static void _tnl_copy_to_current( GLcontext *ctx ) tnl->vtx.attrptr[i]); } - /* Edgeflag requires special treatment: + /* Edgeflag requires additional treatment: */ - if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) + if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { ctx->Current.EdgeFlag = - (tnl->vtx.attrptr[_TNL_ATTRIB_EDGEFLAG][0] == 1.0); - + (tnl->vtx.CurrentFloatEdgeFlag == 1.0); + } /* Colormaterial -- this kindof sucks. */ @@ -179,7 +179,12 @@ static void _tnl_copy_from_current( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) + /* Edgeflag requires additional treatment: + */ + tnl->vtx.CurrentFloatEdgeFlag = + (GLfloat)ctx->Current.EdgeFlag; + + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_MAX ; i++) switch (tnl->vtx.attrsz[i]) { case 4: tnl->vtx.attrptr[i][3] = tnl->vtx.current[i][3]; case 3: tnl->vtx.attrptr[i][2] = tnl->vtx.current[i][2]; @@ -188,13 +193,6 @@ static void _tnl_copy_from_current( GLcontext *ctx ) break; } - /* Edgeflag requires special treatment: - */ - if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) - tnl->vtx.attrptr[_TNL_ATTRIB_EDGEFLAG][0] = - (GLfloat)ctx->Current.EdgeFlag; - - ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; } @@ -860,6 +858,7 @@ static void _tnl_current_init( GLcontext *ctx ) ctx->Light.Material.Attrib[i]; tnl->vtx.current[_TNL_ATTRIB_INDEX] = &ctx->Current.Index; + tnl->vtx.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->vtx.CurrentFloatEdgeFlag; } static struct _tnl_dynfn *no_codegen( GLcontext *ctx, int key ) -- cgit v1.2.3