aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl/t_imm_dlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl/t_imm_dlist.c')
-rw-r--r--src/mesa/tnl/t_imm_dlist.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index a9ae72cee07..07dd86b334e 100644
--- a/src/mesa/tnl/t_imm_dlist.c
+++ b/src/mesa/tnl/t_imm_dlist.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_dlist.c,v 1.46 2003/03/01 01:50:26 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.47 2003/03/28 01:39:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -66,7 +66,8 @@ static void execute_compiled_cassette( GLcontext *ctx, void *data );
static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM );
-static void build_normal_lengths( struct immediate *IM )
+static void
+build_normal_lengths( struct immediate *IM )
{
GLuint i;
GLfloat len;
@@ -93,7 +94,9 @@ static void build_normal_lengths( struct immediate *IM )
}
}
-static void fixup_normal_lengths( struct immediate *IM )
+
+static void
+fixup_normal_lengths( struct immediate *IM )
{
GLuint i;
GLfloat len = 1.0F; /* just to silence warnings */
@@ -147,6 +150,9 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
_tnl_fixup_input( ctx, IM );
+ /* Allocate space for this structure in the display list currently
+ * being compiled.
+ */
node = (TNLvertexcassette *)
_mesa_alloc_instruction(ctx,
tnl->opcode_vertex_cassette,
@@ -202,7 +208,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
}
-static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
+static void
+fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -240,7 +247,8 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
IM->LastPrimitive = IM->CopyStart;
}
}
- } else {
+ }
+ else {
GLuint i;
if (IM->BeginState & VERT_ERROR_0)
@@ -249,6 +257,7 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
if (IM->CopyStart == IM->Start &&
IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB))
{
+ /* nothing */
}
else
{
@@ -261,7 +270,7 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
ASSERT(IM->PrimitiveLength[IM->Start] > 0 ||
IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB));
- for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i])
+ for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) {
if (IM->Flag[i] & (VERT_BIT_END | VERT_BIT_END_VB)) {
IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart;
if (IM->Flag[i] & VERT_BIT_END_VB) {
@@ -273,14 +282,17 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
}
break;
}
+ }
}
}
}
+
/* Undo any changes potentially made to the immediate in the range
* IM->Start..IM->Count above.
*/
-static void restore_compiled_primitives( GLcontext *ctx, struct immediate *IM )
+static void
+restore_compiled_primitives( GLcontext *ctx, struct immediate *IM )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
IM->Primitive[IM->Start] = tnl->DlistPrimitive;
@@ -288,7 +300,6 @@ static void restore_compiled_primitives( GLcontext *ctx, struct immediate *IM )
}
-
static void
execute_compiled_cassette( GLcontext *ctx, void *data )
{
@@ -384,6 +395,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
tnl->ReplayHardBeginEnd = 0;
}
+
static void
destroy_compiled_cassette( GLcontext *ctx, void *data )
{
@@ -419,6 +431,7 @@ print_compiled_cassette( GLcontext *ctx, void *data )
_tnl_print_cassette( node->IM );
}
+
void
_tnl_BeginCallList( GLcontext *ctx, GLuint list )
{
@@ -505,7 +518,12 @@ _tnl_dlist_init( GLcontext *ctx )
}
-static void emit_material( struct gl_material *src, GLuint bitmask )
+/**
+ * Call glMaterialfv for the attributes specified by bitmask, using the
+ * material colors in src.
+ */
+static void
+emit_material( const struct gl_material *src, GLuint bitmask )
{
if (bitmask & FRONT_EMISSION_BIT)
glMaterialfv( GL_FRONT, GL_EMISSION, src[0].Emission );
@@ -562,16 +580,14 @@ static void emit_material( struct gl_material *src, GLuint bitmask )
* begin/end), or (for tnl hardware) implement their own display list
* mechanism.
*/
-static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM )
+static void
+loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM )
{
- GLuint i;
- GLuint *flags = IM->Flag;
- GLuint orflag = IM->OrFlag;
- GLuint j;
+ const GLuint *flags = IM->Flag;
+ const GLuint orflag = IM->OrFlag;
void (GLAPIENTRY *vertex)( const GLfloat * );
void (GLAPIENTRY *texcoordfv[MAX_TEXTURE_COORD_UNITS])( GLenum, const GLfloat * );
- GLuint maxtex = 0;
- GLuint p, length, prim = 0;
+ GLuint i, j, p, length, prim = 0, maxtex = 0;
if (orflag & VERT_BITS_OBJ_234)
vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex4fv;