summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_array_api.c162
-rw-r--r--src/mesa/tnl/t_array_import.c5
-rw-r--r--src/mesa/tnl/t_context.h7
-rw-r--r--src/mesa/tnl/t_imm_alloc.c8
-rw-r--r--src/mesa/tnl/t_imm_api.c21
-rw-r--r--src/mesa/tnl/t_imm_dlist.c79
-rw-r--r--src/mesa/tnl/t_imm_exec.c59
-rw-r--r--src/mesa/tnl/t_imm_exec.h6
-rw-r--r--src/mesa/tnl/t_imm_fixup.c19
-rw-r--r--src/mesa/tnl/t_pipeline.c7
-rw-r--r--src/mesa/tnl/t_vb_normals.c11
11 files changed, 150 insertions, 234 deletions
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index 0c61dee780e..900467c98d0 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_array_api.c,v 1.5 2001/02/04 00:44:36 keithw Exp $ */
+/* $Id: t_array_api.c,v 1.6 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -90,6 +90,79 @@ static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start,
}
+static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count,
+ const GLuint *indices)
+{
+#if 1
+ /* Optimized code that fakes the effect of calling
+ * _tnl_array_element for each index in the list.
+ */
+ if (_tnl_hard_begin( ctx, mode )) {
+ GLuint i,j;
+ for (j = 0 ; j < count ; ) {
+ struct immediate *IM = TNL_CURRENT_IM(ctx);
+ GLuint start = IM->Start;
+ GLuint nr = MIN2( IMM_MAXDATA - start, count - j ) + start;
+ GLuint sf = IM->Flag[start];
+ IM->FlushElt |= 1;
+
+ for (i = start ; i < nr ; i++) {
+ IM->Elt[i] = (GLuint) *indices++;
+ IM->Flag[i] = VERT_ELT;
+ }
+
+ if (j == 0) IM->Flag[start] |= sf;
+
+ IM->Count = nr;
+ j += nr - start;
+
+ if (j == count)
+ _tnl_end( ctx );
+
+ _tnl_flush_immediate( IM );
+ }
+ }
+#else
+ /* Simple version of the above code.
+ */
+ if (_tnl_hard_begin(ctx, mode)) {
+ GLuint i;
+ for (i = 0 ; i < count ; i++)
+ _tnl_array_element( ctx, indices[i] );
+ _tnl_end( ctx );
+ }
+#endif
+}
+
+
+static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, const GLuint *indices )
+
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ FLUSH_CURRENT( ctx, 0 );
+
+ _tnl_vb_bind_arrays( ctx, start, end );
+
+ tnl->vb.FirstPrimitive = 0;
+ tnl->vb.Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST;
+ tnl->vb.PrimitiveLength[0] = count;
+ tnl->vb.Elts = (GLuint *)indices;
+
+ if (ctx->Array.LockCount)
+ _tnl_run_pipeline( ctx );
+ else {
+ /* Note that arrays may have changed before/after execution.
+ */
+ tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
+ _tnl_run_pipeline( ctx );
+ tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
+ }
+}
+
+
+
void
_tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
@@ -162,81 +235,6 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
}
-
-static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode,
- GLuint start, GLuint end,
- GLsizei count, const GLuint *indices )
-
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- FLUSH_CURRENT( ctx, 0 );
-
- _tnl_vb_bind_arrays( ctx, start, end );
-
- tnl->vb.FirstPrimitive = 0;
- tnl->vb.Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST;
- tnl->vb.PrimitiveLength[0] = count;
- tnl->vb.Elts = (GLuint *)indices;
-
- if (ctx->Array.LockCount)
- _tnl_run_pipeline( ctx );
- else {
- /* Note that arrays may have changed before/after execution.
- */
- tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
- _tnl_run_pipeline( ctx );
- tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
- }
-}
-
-
-
-
-static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count,
- const GLuint *indices)
-{
-#if 1
- /* Optimized code that fakes the effect of calling
- * _tnl_array_element for each index in the list.
- */
- if (_tnl_hard_begin( ctx, mode )) {
- GLuint i,j;
- for (j = 0 ; j < count ; ) {
- struct immediate *IM = TNL_CURRENT_IM(ctx);
- GLuint start = IM->Start;
- GLuint nr = MIN2( IMM_MAXDATA - start, count - j ) + start;
- GLuint sf = IM->Flag[start];
- IM->FlushElt |= 1;
-
- for (i = start ; i < nr ; i++) {
- IM->Elt[i] = (GLuint) *indices++;
- IM->Flag[i] = VERT_ELT;
- }
-
- if (j == 0) IM->Flag[start] |= sf;
-
- IM->Count = nr;
- j += nr - start;
-
- if (j == count)
- _tnl_end( ctx );
-
- _tnl_flush_immediate( IM );
- }
- }
-#else
- /* Simple version of the above code.
- */
- if (_tnl_hard_begin(ctx, mode)) {
- GLuint i;
- for (i = 0 ; i < count ; i++)
- _tnl_array_element( ctx, indices[i] );
- _tnl_end( ctx );
- }
-#endif
-}
-
-
void
_tnl_DrawRangeElements(GLenum mode,
GLuint start, GLuint end,
@@ -276,6 +274,8 @@ _tnl_DrawRangeElements(GLenum mode,
* May be able to get away with just setting LockCount==0,
* though this raises the problems of dependent state. May
* have to call glUnlockArrays() directly?
+ *
+ * Or scan the list and replace bad indices?
*/
gl_problem( ctx,
"DrawRangeElements references "
@@ -283,8 +283,8 @@ _tnl_DrawRangeElements(GLenum mode,
}
}
else if (end + 1 - start < ctx->Const.MaxArrayLockSize) {
- /* The arrays aren't locked but we can still fit them inside a single
- * vertexbuffer.
+ /* The arrays aren't locked but we can still fit them inside a
+ * single vertexbuffer.
*/
_tnl_draw_range_elements( ctx, mode, start, end + 1, count, ui_indices );
} else {
@@ -315,7 +315,6 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT,
count, type, indices );
-#if 1
if (ctx->Array.LockCount) {
_tnl_draw_range_elements( ctx, mode,
ctx->Array.LockFirst,
@@ -333,13 +332,10 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
if (max_elt < ctx->Const.MaxArrayLockSize && /* can we use it? */
max_elt < count) /* do we want to use it? */
- _tnl_draw_range_elements( ctx, mode, 0, max_elt + 1, count, ui_indices );
+ _tnl_draw_range_elements( ctx, mode, 0, max_elt+1, count, ui_indices );
else
_tnl_draw_elements( ctx, mode, count, ui_indices );
}
-#else
- _tnl_draw_elements( ctx, mode, count, ui_indices );
-#endif
}
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index b88391c8522..6aec1b0be6a 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -1,4 +1,4 @@
-/* $Id: t_array_import.c,v 1.7 2001/01/24 00:04:59 brianp Exp $ */
+/* $Id: t_array_import.c,v 1.8 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -316,6 +316,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
GLuint imports;
struct vertex_arrays *tmp = &tnl->array_inputs;
+/* fprintf(stderr, "_tnl_vb_bind_arrays %d..%d // %d..%d\n", */
+/* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */
+
if (ctx->Array.LockCount) {
ASSERT(start == ctx->Array.LockFirst);
ASSERT(count == ctx->Array.LockCount);
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index c15dd130876..a1707673422 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.13 2001/01/29 20:47:39 keithw Exp $ */
+/* $Id: t_context.h,v 1.14 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -192,7 +192,9 @@ struct immediate
*/
struct gl_material (*Material)[2];
GLuint *MaterialMask;
- GLfloat *NormalLengths;
+ GLuint LastMaterial;
+ GLuint MaterialOrMask;
+
GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4];
GLuint Primitive[IMM_SIZE]; /* BEGIN/END */
@@ -258,7 +260,6 @@ typedef struct vertex_buffer
GLubyte ClipOrMask; /* VERT_CLIP (3) */
GLubyte *ClipMask; /* VERT_CLIP (4) */
GLvector3f *NormalPtr; /* VERT_NORM */
- GLfloat *NormalLengthPtr; /* VERT_NORM (optional) */
GLboolean *EdgeFlag; /* VERT_EDGE */
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
GLvector1ui *IndexPtr[2]; /* VERT_INDEX */
diff --git a/src/mesa/tnl/t_imm_alloc.c b/src/mesa/tnl/t_imm_alloc.c
index e6a37f81015..b63d0096a3e 100644
--- a/src/mesa/tnl/t_imm_alloc.c
+++ b/src/mesa/tnl/t_imm_alloc.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_alloc.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
+/* $Id: t_imm_alloc.c,v 1.3 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -47,7 +47,6 @@ struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
IM->id = id++;
IM->ref_count = 0;
IM->backref = ctx;
- IM->NormalLengths = 0;
IM->FlushElt = 0;
IM->LastPrimitive = IMM_MAX_COPIED_VERTS;
IM->Count = IMM_MAX_COPIED_VERTS;
@@ -83,11 +82,6 @@ void _tnl_free_immediate( struct immediate *IM )
static int freed = 0;
GLuint j;
- if (IM->NormalLengths) {
- FREE( IM->NormalLengths );
- IM->NormalLengths = 0;
- }
-
if (IM->Material) {
FREE( IM->Material );
FREE( IM->MaterialMask );
diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c
index 0ba46b9b7c8..5dd287cedcc 100644
--- a/src/mesa/tnl/t_imm_api.c
+++ b/src/mesa/tnl/t_imm_api.c
@@ -1229,17 +1229,24 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
if (bitmask == 0)
return;
- if (!IM->Material) {
- IM->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) *
- IMM_SIZE * 2 );
- IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE );
- }
-
if (!(IM->Flag[count] & VERT_MATERIAL)) {
+ if (!IM->Material) {
+ IM->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) *
+ IMM_SIZE * 2 );
+ IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE );
+ }
+ else if (IM->MaterialOrMask & ~bitmask) {
+ gl_copy_material_pairs( IM->Material[count],
+ IM->Material[IM->LastMaterial],
+ IM->MaterialOrMask & ~bitmask );
+ }
+
IM->Flag[count] |= VERT_MATERIAL;
+ IM->LastMaterial = count;
IM->MaterialMask[count] = 0;
}
-
+
+ IM->MaterialOrMask |= bitmask;
IM->MaterialMask[count] |= bitmask;
mat = IM->Material[count];
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 3cd08ba4c11..c0393cec9ad 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.7 2001/02/13 23:51:34 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.8 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -57,7 +57,8 @@ typedef struct {
GLuint TexSize;
GLuint LastData;
GLuint LastPrimitive;
- GLboolean have_normal_lengths;
+ GLuint LastMaterial;
+ GLuint MaterialOrMask;
} TNLvertexcassette;
static void execute_compiled_cassette( GLcontext *ctx, void *data );
@@ -121,7 +122,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
node->AndFlag = im->AndFlag;
node->LastData = im->LastData;
node->LastPrimitive = im->LastPrimitive;
- node->have_normal_lengths = GL_FALSE;
+ node->LastMaterial = im->LastMaterial;
+ node->MaterialOrMask = im->MaterialOrMask;
if (ctx->ExecuteFlag) {
execute_compiled_cassette( ctx, (void *)node );
@@ -155,34 +157,6 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
}
-
-#if 0
-/* Drivers to turn this on?
- */
-static void calc_normal_lengths( GLfloat *dest,
- CONST GLfloat (*data)[3],
- GLuint *flags,
- GLuint count )
-{
- GLuint i;
- GLint tmpflag = flags[0];
-
- flags[0] |= VERT_NORM;
-
- for (i = 0 ; i < count ; i++ )
- if (flags[i] & VERT_NORM) {
- GLfloat tmp = (GLfloat) LEN_3FV( data[i] );
- dest[i] = 0;
- if (tmp > 0)
- dest[i] = 1.0F / tmp;
- } else
- dest[i] = dest[i-1];
-
- flags[0] = tmpflag;
-}
-#endif
-
-
static void
execute_compiled_cassette( GLcontext *ctx, void *data )
{
@@ -219,7 +193,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
}
if (IM->Count == IM->Start) {
- _tnl_run_empty_cassette( ctx, IM );
+ _tnl_copy_to_current( ctx, IM, IM->OrFlag );
return;
}
@@ -227,40 +201,16 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1)
tnl->ReplayHardBeginEnd = 1;
if (!tnl->ReplayHardBeginEnd) {
- /* XXX is this really an OpenGL error or an implementation problem? */
+ /* This is a user error. Whatever operation (like glRectf)
+ * decomposed to this hard begin/end pair is now being run
+ * inside a begin/end object -- illegally. Reject it and
+ * raise an error.
+ */
gl_error(ctx, GL_INVALID_OPERATION, "hard replay");
return;
}
}
-
- /* Lazy optimization of the cassette. Need to make these switchable
- * or otherwise more useful for t&l cards.
- */
-#if 0
- if (ctx->Transform.Normalize && !node->have_normal_lengths) {
-
- if (!IM->NormalLengths)
- IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * IMM_SIZE);
-
- calc_normal_lengths( IM->NormalLengths + IM->Start,
- (const GLfloat (*)[3])(IM->Normal + IM->Start),
- IM->Flag + IM->Start,
- IM->Count - IM->Start);
-
- node->have_normal_lengths = GL_TRUE;
- }
-#endif
-
-
-#if 0
- if (0 && im->v.Obj.size < 4 && im->Count > 15) {
- im->Bounds = (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat));
- (_tnl_calc_bound_tab[im->v.Obj.size])( im->Bounds, &im->v.Obj );
- }
-#endif
-
-
_tnl_fixup_compiled_cassette( ctx, IM );
_tnl_get_exec_copy_verts( ctx, IM );
_tnl_run_cassette( ctx, IM );
@@ -275,10 +225,6 @@ destroy_compiled_cassette( GLcontext *ctx, void *data )
{
TNLvertexcassette *node = (TNLvertexcassette *)data;
-/* fprintf(stderr, "destroy_compiled_cassette node->IM id %d ref_count: %d\n", */
-/* node->IM->id, */
-/* node->IM->ref_count-1); */
-
if ( --node->IM->ref_count == 0 )
_tnl_free_immediate( node->IM );
}
@@ -301,6 +247,8 @@ print_compiled_cassette( GLcontext *ctx, void *data )
IM->AndFlag = node->AndFlag;
IM->LastData = node->LastData;
IM->LastPrimitive = node->LastPrimitive;
+ IM->LastMaterial = node->LastMaterial;
+ IM->MaterialOrMask = node->MaterialOrMask;
_tnl_print_cassette( node->IM );
}
@@ -359,7 +307,6 @@ _tnl_EndList( GLcontext *ctx )
tnl->ExecCopySource = IM;
IM->ref_count++;
-
SET_IMMEDIATE( ctx, IM );
IM->ref_count++;
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index 215749beb9b..80e5ce54400 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.10 2001/02/06 21:42:49 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.11 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -84,8 +84,8 @@ void _tnl_reset_input( GLcontext *ctx,
-static void copy_to_current( GLcontext *ctx, struct immediate *IM,
- GLuint flag )
+void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
+ GLuint flag )
{
GLuint count = IM->LastData;
@@ -101,8 +101,13 @@ static void copy_to_current( GLcontext *ctx, struct immediate *IM,
if (flag & VERT_EDGE)
ctx->Current.EdgeFlag = IM->EdgeFlag[count];
- if (flag & VERT_RGBA)
+ if (flag & VERT_RGBA) {
COPY_4UBV(ctx->Current.Color, IM->Color[count]);
+ if (ctx->Light.ColorMaterialEnabled) {
+ gl_update_color_material( ctx, ctx->Current.Color );
+ gl_validate_all_lighting_tables( ctx );
+ }
+ }
if (flag & VERT_SPEC_RGB)
COPY_4UBV(ctx->Current.SecondaryColor, IM->SecondaryColor[count]);
@@ -118,6 +123,14 @@ static void copy_to_current( GLcontext *ctx, struct immediate *IM,
}
}
}
+
+ if (flag & VERT_MATERIAL) {
+ gl_update_material( ctx,
+ IM->Material[IM->LastMaterial],
+ IM->MaterialOrMask );
+
+ gl_validate_all_lighting_tables( ctx );
+ }
}
@@ -142,8 +155,8 @@ void _tnl_compute_orflag( struct immediate *IM )
/* It is possible there will be data in the buffer arising from
* calls like 'glNormal', 'glMaterial' that occur after the final
* glVertex, glEval, etc. Additionally, a buffer can consist of
- * only a single glMaterial call, in which case IM->Start ==
- * IM->Count, but the buffer is definitely not empty.
+ * eg. a single glMaterial call, in which case IM->Start ==
+ * IM->Count, but the buffer is definitely not empty.
*/
if (IM->Flag[i] & VERT_DATA) {
IM->LastData++;
@@ -195,7 +208,6 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
/* TexCoordPtr's are zeroed in loop below.
*/
VB->NormalPtr = 0;
- VB->NormalLengthPtr = 0;
VB->FogCoordPtr = 0;
VB->EdgeFlag = 0;
VB->IndexPtr[0] = 0;
@@ -232,8 +244,6 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
tmp->Normal.start = (GLfloat *)(IM->Normal + start);
tmp->Normal.count = count;
VB->NormalPtr = &tmp->Normal;
- if (IM->NormalLengths)
- VB->NormalLengthPtr = IM->NormalLengths + start;
}
if (inputs & VERT_INDEX) {
@@ -317,7 +327,7 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM )
_tnl_run_pipeline( ctx );
tnl->pipeline.run_input_changes |= tnl->pipeline.inputs;
- copy_to_current( ctx, IM, IM->OrFlag );
+ _tnl_copy_to_current( ctx, IM, IM->OrFlag );
}
@@ -347,31 +357,10 @@ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM )
*/
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) {
_tnl_translate_array_elts( ctx, IM, IM->LastData, IM->LastData );
- copy_to_current( ctx, IM, ctx->Array._Enabled );
+ _tnl_copy_to_current( ctx, IM, ctx->Array._Enabled );
}
}
-/* Called for cassettes where CopyStart == Count -- no need to run the
- * pipeline.
- */
-void _tnl_run_empty_cassette( GLcontext *ctx, struct immediate *IM )
-{
- copy_to_current( ctx, IM, IM->OrFlag );
-
- if (IM->OrFlag & (VERT_RGBA|VERT_MATERIAL)) {
- GLuint start = IM->CopyStart;
-
- if (IM->OrFlag & VERT_MATERIAL)
- gl_update_material( ctx, IM->Material[start],
- IM->MaterialMask[start] );
-
- if (IM->OrFlag & VERT_RGBA)
- if (ctx->Light.ColorMaterialEnabled)
- gl_update_color_material( ctx, ctx->Current.Color );
-
- gl_validate_all_lighting_tables( ctx );
- }
-}
/* Called for regular vertex cassettes.
@@ -413,14 +402,11 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
_tnl_compute_orflag( IM );
-/* _tnl_print_cassette( IM ); */
-
/* Mark the last primitive:
*/
IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive;
ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST);
-
if (tnl->pipeline.build_state_changes)
_tnl_validate_pipeline( ctx );
@@ -430,8 +416,7 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
if (IM->OrFlag & VERT_ELT)
_tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->CopyStart );
- _tnl_fixup_input( ctx, IM ); /* shouldn't be needed? (demos/fire) */
- _tnl_run_empty_cassette( ctx, IM );
+ _tnl_copy_to_current( ctx, IM, IM->OrFlag );
}
else if ((IM->OrFlag & VERT_DATA) == VERT_ELT &&
ctx->Array.LockCount &&
diff --git a/src/mesa/tnl/t_imm_exec.h b/src/mesa/tnl/t_imm_exec.h
index 84cf1f0f8af..ab5fa292d71 100644
--- a/src/mesa/tnl/t_imm_exec.h
+++ b/src/mesa/tnl/t_imm_exec.h
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.h,v 1.2 2000/12/27 21:49:40 keithw Exp $ */
+/* $Id: t_imm_exec.h,v 1.3 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -43,7 +43,8 @@ extern void _tnl_flush_immediate( struct immediate *IM );
/* Called from imm_dlist.c and _tnl_flush_immediate:
*/
extern void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM );
-extern void _tnl_run_empty_cassette( GLcontext *ctx, struct immediate *IM );
+extern void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
+ GLuint flag );
/* Initialize some stuff:
*/
@@ -60,4 +61,5 @@ extern void _tnl_compute_orflag( struct immediate *IM );
extern void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM );
+
#endif
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index 54fd6670b1d..5429994b6cc 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.6 2001/02/13 23:51:34 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.7 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -416,20 +416,6 @@ static void copy_vertices( GLcontext *ctx,
next->CopyAndFlag &= prev->Flag[src]; /* redundant for current_im */
}
- /* Only needed when copying to a compiled cassette
- */
- if (next->NormalLengths) {
- for (i = 0 ; i < count ; i++)
- {
- GLuint src = elts[i+offset];
- GLuint dst = next->CopyStart+i;
-
- if (prev->NormalLengths)
- next->NormalLengths[dst] = prev->NormalLengths[src];
- else
- next->NormalLengths[dst] = 1.0/LEN_3FV(prev->Normal[src]);
- }
- }
ASSERT(prev == tnl->ExecCopySource);
@@ -549,9 +535,6 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_NORM) {
fixup_first_3f(IM->Normal, IM->Flag, VERT_NORM, start,
ctx->Current.Normal );
- if (IM->NormalLengths)
- fixup_first_1f(IM->NormalLengths, IM->Flag, VERT_NORM, start,
- 1.0F / (GLfloat) LEN_3FV(ctx->Current.Normal) );
}
}
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index 942b8ba21eb..467074abaa3 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -1,4 +1,4 @@
-/* $Id: t_pipeline.c,v 1.11 2001/01/29 20:47:39 keithw Exp $ */
+/* $Id: t_pipeline.c,v 1.12 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -132,6 +132,8 @@ void _tnl_run_pipeline( GLcontext *ctx )
ASSERT(pipe->build_state_changes == 0);
START_FAST_MATH(__tmp);
+ if (ctx->Driver.PipelineStart)
+ ctx->Driver.PipelineStart( ctx );
/* If something changes in the pipeline, tag all subsequent stages
* using this value for recalculation.
@@ -157,6 +159,9 @@ void _tnl_run_pipeline( GLcontext *ctx )
}
}
}
+
+ if (ctx->Driver.PipelineFinish)
+ ctx->Driver.PipelineFinish( ctx );
END_FAST_MATH(__tmp);
pipe->run_state_changes = 0;
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index e55520cb5c2..8c33d244425 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_normals.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
+/* $Id: t_vb_normals.c,v 1.3 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -61,18 +61,11 @@ static GLboolean run_normal_stage( GLcontext *ctx,
ASSERT(store->NormalTransform);
- if (VB->NormalLengthPtr) {
- GLfloat diff = VB->NormalLengthPtr[0] -
- 1.0/LEN_3FV(VB->NormalPtr->data[0]);
- (void)diff;
- ASSERT((diff*diff) < .01);
- }
-
if (stage->changed_inputs)
(store->NormalTransform[0])(&ctx->ModelView,
ctx->_ModelViewInvScale,
VB->NormalPtr,
- VB->NormalLengthPtr,
+ 0,
0,
&store->normal);