summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2005-04-23 11:55:18 +0000
committerKeith Whitwell <[email protected]>2005-04-23 11:55:18 +0000
commitdf943a40411d2b71381e5053d7c59e8cd2400fff (patch)
treee10d686768dc55bd5b60cfbac2e79fa5380bc9a3 /src/mesa/tnl
parent0d4af83f252d51f504b7df59a9fab7f83672b9ba (diff)
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.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.h3
-rw-r--r--src/mesa/tnl/t_save_api.c23
-rw-r--r--src/mesa/tnl/t_vtx_api.c25
3 files changed, 30 insertions, 21 deletions
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 905933a0d9b..e8a3c259822 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -282,6 +282,7 @@ struct tnl_vtx {
GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current vertex */
GLfloat *attrptr[_TNL_ATTRIB_MAX]; /* points into vertex */
GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->Current, etc */
+ GLfloat CurrentFloatEdgeFlag;
GLuint counter, initial_counter;
struct tnl_copied_vtx copied;
@@ -379,6 +380,8 @@ struct tnl_save {
GLuint opcode_vertex_list;
struct tnl_copied_vtx copied;
+
+ GLfloat CurrentFloatEdgeFlag;
GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->ListState */
GLubyte *currentsz[_TNL_ATTRIB_MAX];
diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c
index 28bd376fc08..67fee8e29a9 100644
--- a/src/mesa/tnl/t_save_api.c
+++ b/src/mesa/tnl/t_save_api.c
@@ -377,12 +377,16 @@ static void _save_copy_to_current( GLcontext *ctx )
}
}
- /* Edgeflag requires special treatment:
+ /* Edgeflag requires special treatment:
+ *
+ * TODO: change edgeflag to GLfloat in Mesa.
*/
if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) {
ctx->ListState.ActiveEdgeFlag = 1;
+ tnl->save.CurrentFloatEdgeFlag =
+ tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0];
ctx->ListState.CurrentEdgeFlag =
- (tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0] == 1.0);
+ (tnl->save.CurrentFloatEdgeFlag == 1.0);
}
}
@@ -403,9 +407,10 @@ static void _save_copy_from_current( GLcontext *ctx )
/* Edgeflag requires special treatment:
*/
- if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG])
- tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0] =
- (GLfloat)ctx->ListState.CurrentEdgeFlag;
+ if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) {
+ tnl->save.CurrentFloatEdgeFlag = (GLfloat)ctx->ListState.CurrentEdgeFlag;
+ tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0] = tnl->save.CurrentFloatEdgeFlag;
+ }
}
@@ -480,8 +485,9 @@ static void _save_upgrade_vertex( GLcontext *ctx,
if (tnl->save.currentsz[attr][0] == 0) {
assert(oldsz == 0);
tnl->save.dangling_attr_ref = GL_TRUE;
- _mesa_debug(NULL, "_save_upgrade_vertex: dangling reference attr %d\n",
- attr);
+
+/* _mesa_debug(NULL, "_save_upgrade_vertex: dangling reference attr %d\n", */
+/* attr); */
#if 0
/* The current strategy is to punt these degenerate cases
@@ -1653,7 +1659,8 @@ static void _save_current_init( GLcontext *ctx )
tnl->save.currentsz[_TNL_ATTRIB_INDEX] = &ctx->ListState.ActiveIndex;
tnl->save.current[_TNL_ATTRIB_INDEX] = &ctx->ListState.CurrentIndex;
- /* Current edgeflag is handled individually */
+ tnl->save.currentsz[_TNL_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag;
+ tnl->save.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->save.CurrentFloatEdgeFlag;
}
/**
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index fabd99e5d09..b9ad28e67db 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 )