summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/tnl/t_array_import.c6
-rw-r--r--src/mesa/tnl/t_context.h12
-rw-r--r--src/mesa/tnl/t_imm_alloc.c4
-rw-r--r--src/mesa/tnl/t_imm_dlist.c8
-rw-r--r--src/mesa/tnl/t_imm_elt.c3
-rw-r--r--src/mesa/tnl/t_imm_eval.c144
-rw-r--r--src/mesa/tnl/t_imm_fixup.c115
-rw-r--r--src/mesa/tnl/t_imm_fixup.h22
-rw-r--r--src/mesa/tnl/t_vb_light.c4
-rw-r--r--src/mesa/tnl/t_vb_render.c3
-rw-r--r--src/mesa/tnl/t_vb_texgen.c25
11 files changed, 213 insertions, 133 deletions
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index c930092f347..7bb208cf725 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.12 2001/04/17 17:01:33 brianp Exp $ */
+/* $Id: t_array_import.c,v 1.13 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -99,6 +99,8 @@ static void _tnl_import_color( GLcontext *ctx,
GLboolean is_writeable = 0;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
tmp = _ac_import_color(ctx,
GL_UNSIGNED_BYTE,
stride ? 4*sizeof(GLubyte) : 0,
@@ -317,7 +319,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
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); */
+/* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */
if (ctx->Array.LockCount) {
ASSERT(start == (GLint) ctx->Array.LockFirst);
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index db315e69f76..7e5c0de3635 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.19 2001/04/09 14:47:34 keithw Exp $ */
+/* $Id: t_context.h,v 1.20 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -354,15 +354,7 @@ struct tnl_eval_store {
GLuint EvalMap1Flags;
GLuint EvalMap2Flags;
GLuint EvalNewState;
-
- GLfloat Coord[IMM_SIZE][4];
- GLfloat Obj[IMM_SIZE][4];
- GLfloat TexCoord[IMM_SIZE][4];
- GLfloat Normal[IMM_SIZE][3];
- GLchan Color[IMM_SIZE][4];
- GLuint Index[IMM_SIZE];
- GLuint Flag[IMM_SIZE];
- GLuint Elts[IMM_SIZE];
+ struct immediate *im; /* used for temporary data */
};
diff --git a/src/mesa/tnl/t_imm_alloc.c b/src/mesa/tnl/t_imm_alloc.c
index b624026767c..def3b9cc6cd 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.5 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_alloc.c,v 1.6 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,6 +44,8 @@ struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
if (!IM)
return 0;
+/* memset(IM, 0, sizeof(*IM)); */
+
IM->id = id++;
IM->ref_count = 0;
IM->backref = ctx;
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 02ebbbbaf2f..54f7132e0ea 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.12 2001/04/09 14:47:34 keithw Exp $ */
+/* $Id: t_imm_dlist.c,v 1.13 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -76,7 +76,6 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
TNLvertexcassette *node;
GLuint new_beginstate;
-
_tnl_compute_orflag( IM );
IM->CopyStart = IM->Start;
@@ -105,6 +104,9 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive;
ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST);
+
+/* _tnl_print_cassette( IM ); */
+
node = (TNLvertexcassette *)
_mesa_alloc_instruction(ctx,
@@ -293,6 +295,8 @@ _tnl_EndList( GLcontext *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct immediate *IM = TNL_CURRENT_IM(ctx);
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
ctx->swtnl_im = 0;
IM->ref_count--;
if (IM == tnl->ExecCopySource) {
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index 1ef6a8c2f20..1386ef16f7c 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_elt.c,v 1.6 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_elt.c,v 1.7 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -138,7 +138,6 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES];
GLuint start, GLuint n
#define SRC_START 0
#define DST_START start
-#undef CHECK
#define CHECK if ((flags[i]&match) == VERT_ELT)
#define NEXT_F (void)1
#define NEXT_F2 f = first + elts[i] * stride;
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c
index aa1d2f4810c..21529a42b5a 100644
--- a/src/mesa/tnl/t_imm_eval.c
+++ b/src/mesa/tnl/t_imm_eval.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_eval.c,v 1.6 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_eval.c,v 1.7 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,6 +38,7 @@
#include "t_imm_eval.h"
#include "t_imm_exec.h"
#include "t_imm_fixup.h"
+#include "t_imm_alloc.h"
static void eval_points1( GLfloat outcoord[][4],
@@ -400,7 +401,7 @@ void _tnl_eval_vb( GLcontext *ctx,
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_arrays *tmp = &tnl->imm_inputs;
- struct tnl_eval_store *store = &tnl->eval;
+ struct immediate *store = tnl->eval.im;
GLuint *flags = tnl->vb.Flag;
GLuint count = tnl->vb.Count;
GLuint any_eval1 = orflag & (VERT_EVAL_C1|VERT_EVAL_P1);
@@ -409,6 +410,12 @@ void _tnl_eval_vb( GLcontext *ctx,
GLuint req = 0;
GLuint purge_flags = 0;
+/* if (input->writable) */
+/* store = input; */
+
+ if (!store)
+ store = tnl->eval.im = _tnl_alloc_immediate( ctx );
+
if (tnl->eval.EvalNewState & _NEW_EVAL)
update_eval( ctx );
@@ -427,27 +434,27 @@ void _tnl_eval_vb( GLcontext *ctx,
req |= tnl->pipeline.inputs & tnl->eval.EvalMap2Flags;
- /* Translate points into coords. Use store->Coord to hold the
+ /* Translate points into coords. Use store->Obj to hold the
* new data.
*/
if (any_eval1 && (orflag & VERT_EVAL_P1))
{
- eval_points1( store->Coord, coord, flags,
+ eval_points1( store->Obj, coord, flags,
ctx->Eval.MapGrid1du,
ctx->Eval.MapGrid1u1);
- coord = store->Coord;
+ coord = store->Obj;
}
if (any_eval2 && (orflag & VERT_EVAL_P2))
{
- eval_points2( store->Coord, coord, flags,
+ eval_points2( store->Obj, coord, flags,
ctx->Eval.MapGrid2du,
ctx->Eval.MapGrid2u1,
ctx->Eval.MapGrid2dv,
ctx->Eval.MapGrid2v1 );
- coord = store->Coord;
+ coord = store->Obj;
}
@@ -455,62 +462,99 @@ void _tnl_eval_vb( GLcontext *ctx,
*/
if (req & VERT_INDEX)
{
+ GLuint generated = 0;
+
if (!all_eval)
copy_1ui( store->Index, tmp->Index.data, count );
tmp->Index.data = store->Index;
tmp->Index.start = store->Index;
- if (ctx->Eval.Map1Index && any_eval1)
+ if (ctx->Eval.Map1Index && any_eval1) {
eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ }
- if (ctx->Eval.Map2Index && any_eval2)
+ if (ctx->Eval.Map2Index && any_eval2) {
eval2_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map2Index );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ }
+ /* Propogate values to generate correct vertices when vertex
+ * maps are disabled.
+ */
+ if (purge_flags & generated)
+ _tnl_fixup_1ui( store->Index, flags, 0,
+ VERT_INDEX|
+ VERT_OBJ|
+ generated|
+ (VERT_EVAL_ANY&~purge_flags) );
}
if (req & VERT_RGBA)
{
+ GLuint generated = 0;
+
if (!all_eval)
copy_4chan( store->Color, tmp->Color.data, count );
tmp->Color.data = store->Color;
tmp->Color.start = (GLchan *) store->Color;
- if (ctx->Eval.Map1Color4 && any_eval1)
+ if (ctx->Eval.Map1Color4 && any_eval1) {
eval1_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map1Color4 );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ }
- if (ctx->Eval.Map2Color4 && any_eval2)
+ if (ctx->Eval.Map2Color4 && any_eval2) {
eval2_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map2Color4 );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ }
+
+ /* Propogate values to generate correct vertices when vertex
+ * maps are disabled.
+ */
+ if (purge_flags & generated)
+ _tnl_fixup_4chan( store->Color, flags, 0,
+ VERT_RGBA|
+ VERT_OBJ|
+ generated|
+ (VERT_EVAL_ANY&~purge_flags) );
}
if (req & VERT_TEX(0))
{
+ GLuint generated = 0;
+
if (!all_eval)
- copy_4f( store->TexCoord, tmp->TexCoord[0].data, count );
+ copy_4f( store->TexCoord[0], tmp->TexCoord[0].data, count );
else
tmp->TexCoord[0].size = 0;
- tmp->TexCoord[0].data = store->TexCoord;
- tmp->TexCoord[0].start = (GLfloat *)store->TexCoord;
+ tmp->TexCoord[0].data = store->TexCoord[0];
+ tmp->TexCoord[0].start = (GLfloat *)store->TexCoord[0];
if (any_eval1) {
if (ctx->Eval.Map1TextureCoord4) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 4,
&ctx->EvalMap.Map1Texture4 );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
}
else if (ctx->Eval.Map1TextureCoord3) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 3,
&ctx->EvalMap.Map1Texture3 );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
}
else if (ctx->Eval.Map1TextureCoord2) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 2,
&ctx->EvalMap.Map1Texture2 );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
}
else if (ctx->Eval.Map1TextureCoord1) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 1,
&ctx->EvalMap.Map1Texture1 );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
}
}
@@ -518,38 +562,68 @@ void _tnl_eval_vb( GLcontext *ctx,
if (ctx->Eval.Map2TextureCoord4) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 4,
&ctx->EvalMap.Map2Texture4 );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
}
else if (ctx->Eval.Map2TextureCoord3) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 3,
&ctx->EvalMap.Map2Texture3 );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
}
else if (ctx->Eval.Map2TextureCoord2) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 2,
&ctx->EvalMap.Map2Texture2 );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
}
else if (ctx->Eval.Map2TextureCoord1) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 1,
&ctx->EvalMap.Map2Texture1 );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
}
}
+
+ /* Propogate values to generate correct vertices when vertex
+ * maps are disabled.
+ */
+ if (purge_flags & generated)
+ _tnl_fixup_4f( store->TexCoord[0], flags, 0,
+ VERT_TEX0|
+ VERT_OBJ|
+ generated|
+ (VERT_EVAL_ANY&~purge_flags) );
}
if (req & VERT_NORM)
{
+ GLuint generated = 0;
+
if (!all_eval)
copy_3f( store->Normal, tmp->Normal.data, count );
tmp->Normal.data = store->Normal;
tmp->Normal.start = (GLfloat *)store->Normal;
- if (ctx->Eval.Map1Normal && any_eval1)
+ if (ctx->Eval.Map1Normal && any_eval1) {
eval1_norm( &tmp->Normal, coord, flags,
&ctx->EvalMap.Map1Normal );
+ generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ }
- if (ctx->Eval.Map2Normal && any_eval2)
+ if (ctx->Eval.Map2Normal && any_eval2) {
eval2_norm( &tmp->Normal, coord, flags,
&ctx->EvalMap.Map2Normal );
+ generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ }
+
+ /* Propogate values to generate correct vertices when vertex
+ * maps are disabled.
+ */
+ if (purge_flags & generated)
+ _tnl_fixup_3f( store->Normal, flags, 0,
+ VERT_NORM|
+ VERT_OBJ|
+ generated|
+ (VERT_EVAL_ANY&~purge_flags) );
}
@@ -601,16 +675,42 @@ void _tnl_eval_vb( GLcontext *ctx,
}
+ /* Calculate new IM->Elts, IM->Primitive, IM->PrimitiveLength for
+ * the case where vertex maps are not enabled for some received eval
+ * coordinates.
+ */
+ if (purge_flags) {
+ GLuint vertex = VERT_OBJ|(VERT_EVAL_ANY & ~purge_flags);
+ GLuint last_new_prim = 0;
+ GLuint new_prim_length = 0;
+ GLuint next_old_prim = 0;
+ GLuint i,j;
+ struct vertex_buffer *VB = &tnl->vb;
+
+ for (i = 0, j = 0 ; i < tnl->vb.Count ; i++) {
+ if (flags[i] & vertex) {
+ store->Elt[j++] = i;
+ new_prim_length++;
+ }
+ if (i == next_old_prim) {
+ next_old_prim += VB->PrimitiveLength[i];
+ VB->PrimitiveLength[last_new_prim] = new_prim_length;
+ VB->Primitive[j] = VB->Primitive[i];
+ last_new_prim = j;
+ }
+ }
+
+ VB->Elts = store->Elt;
+
+ _tnl_fixup_purged_eval( ctx, store );
+ }
+
+ /* Produce new flags array:
+ */
{
GLuint i;
copy_1ui( store->Flag, flags, count );
tnl->vb.Flag = store->Flag;
-
- /* This is overkill, but correct as fixup will have copied the
- * values to all vertices in the VB - we may be falsely stating
- * that some repeated values are new, but doing so is fairly
- * harmless.
- */
for (i = 0 ; i < count ; i++)
store->Flag[i] |= req;
}
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index 9fde2a89c1e..bfb1d306427 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.10 2001/04/09 14:47:34 keithw Exp $ */
+/* $Id: t_imm_fixup.c,v 1.11 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -52,9 +52,11 @@
#include "t_pipeline.h"
+static const GLuint increment[GL_POLYGON+2] = { 1,2,1,1,3,1,1,4,2,1,1 };
+static const GLuint intro[GL_POLYGON+2] = { 0,0,2,2,0,2,2,0,2,2,0 };
-static void
-fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match )
+void
+_tnl_fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match )
{
GLuint i = start;
@@ -66,8 +68,8 @@ fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match )
}
}
-static void
-fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match )
+void
+_tnl_fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match )
{
GLuint i = start;
@@ -80,8 +82,8 @@ fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match )
}
-static void
-fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match )
+void
+_tnl_fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match )
{
GLuint i = start;
@@ -95,8 +97,8 @@ fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match )
}
-static void
-fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match )
+void
+_tnl_fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match )
{
GLuint i = start;
@@ -109,8 +111,8 @@ fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match )
flag[i] |= match;
}
-static void
-fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match )
+void
+_tnl_fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match )
{
GLuint i = start;
@@ -124,8 +126,8 @@ fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match )
}
-static void
-fixup_4chan( GLchan data[][4], GLuint flag[], GLuint start, GLuint match )
+void
+_tnl_fixup_4chan( GLchan data[][4], GLuint flag[], GLuint start, GLuint match )
{
GLuint i = start;
@@ -285,7 +287,8 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
if (fixup & VERT_TEX(i)) {
if (orflag & VERT_TEX(i))
- fixup_4f( IM->TexCoord[i], IM->Flag, start, VERT_TEX(i) );
+ _tnl_fixup_4f( IM->TexCoord[i], IM->Flag, start,
+ VERT_TEX(i) );
else
fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_END_VB, start,
IM->TexCoord[i][start]);
@@ -296,7 +299,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_EDGE) {
if (orflag & VERT_EDGE)
- fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGE );
+ _tnl_fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGE );
else
fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_END_VB, start,
IM->EdgeFlag[start] );
@@ -304,7 +307,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_INDEX) {
if (orflag & VERT_INDEX)
- fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX );
+ _tnl_fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX );
else
fixup_first_1ui( IM->Index, IM->Flag, VERT_END_VB, start,
IM->Index[start] );
@@ -312,7 +315,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_RGBA) {
if (orflag & VERT_RGBA)
- fixup_4chan( IM->Color, IM->Flag, start, VERT_RGBA );
+ _tnl_fixup_4chan( IM->Color, IM->Flag, start, VERT_RGBA );
else
fixup_first_4chan( IM->Color, IM->Flag, VERT_END_VB, start,
IM->Color[start] );
@@ -320,7 +323,8 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_SPEC_RGB) {
if (orflag & VERT_SPEC_RGB)
- fixup_4chan( IM->SecondaryColor, IM->Flag, start, VERT_SPEC_RGB );
+ _tnl_fixup_4chan( IM->SecondaryColor, IM->Flag, start,
+ VERT_SPEC_RGB );
else
fixup_first_4chan( IM->SecondaryColor, IM->Flag, VERT_END_VB, start,
IM->SecondaryColor[start] );
@@ -328,7 +332,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_FOG_COORD) {
if (orflag & VERT_FOG_COORD)
- fixup_1f( IM->FogCoord, IM->Flag, start, VERT_FOG_COORD );
+ _tnl_fixup_1f( IM->FogCoord, IM->Flag, start, VERT_FOG_COORD );
else
fixup_first_1f( IM->FogCoord, IM->Flag, VERT_END_VB, start,
IM->FogCoord[start] );
@@ -336,7 +340,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_NORM) {
if (orflag & VERT_NORM)
- fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM );
+ _tnl_fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM );
else
fixup_first_3f( IM->Normal, IM->Flag, VERT_END_VB, start,
IM->Normal[start] );
@@ -742,8 +746,6 @@ static copy_func copy_tab[GL_POLYGON+2] =
void
_tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
{
- static const GLuint increment[GL_POLYGON+2] = { 1,2,1,1,3,1,1,4,2,1,1 };
- static const GLuint intro[GL_POLYGON+2] = { 0,0,2,2,0,2,2,0,2,2,0 };
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint last = IM->LastPrimitive;
@@ -778,62 +780,33 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
}
-/* If we receive evalcoords in an immediate struct for maps which
- * don't have a vertex enabled, need to do an additional fixup, as
- * those rows containing evalcoords must now be ignored. The
- * evalcoords may still generate colors, normals, etc, so have to
- * respect the relative order between calls to EvalCoord and Normal
- * etc.
- *
- * Generate the index list that will be used to render this immediate
- * struct.
- *
- * Finally, generate a new primitives list for rendering the indices.
+/*
*/
-#if 0
-void _tnl_fixup_purged_eval( GLcontext *ctx,
- GLuint fixup, GLuint purge )
+void _tnl_fixup_purged_eval( GLcontext *ctx, struct immediate *IM )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct tnl_eval_store *store = &tnl->eval;
- GLuint *flags = tnl->vb.Flag;
- GLuint i, j, nextprim;
- GLuint fixup_fence = purge|VERT_OBJ;
- GLuint good_index = (VERT_EVAL_ANY & ~purge)|VERT_OBJ;
- GLuint prim_length = 0, lastprim = 0, nextprim = 0;
- if (fixup & VERT_TEX0)
- fixup_4f( store->TexCoord, flags, 0, VERT_TEX0|fixup_fence );
-
- if (fixup & VERT_INDEX)
- fixup_1ui( store->Index, flags, 0, VERT_INDEX|fixup_fence );
-
- if (fixup & VERT_RGBA)
- fixup_4chan( store->Color, flags, 0, VERT_RGBA|fixup_fence );
+ /* Recalculate ExecCopyElts, ExecParity, etc. These don't need the
+ * post-eval values, so using the original immediate is fine, but
+ * copied vertices will need to be re-evaluated.
+ */
+ if (tnl->CurrentPrimitive != GL_POLYGON+1) {
+ GLuint last = IM->LastPrimitive;
+ GLenum prim = IM->Primitive[last];
+ GLuint pincr = increment[prim];
+ GLuint pintro = intro[prim];
+ GLuint ovf, i;
- if (fixup & VERT_NORM)
- fixup_3f( store->Normal, flags, 0, VERT_NORM|fixup_fence );
+ tnl->ExecCopyCount = 0;
+ tnl->ExecParity = IM->PrimitiveLength[last] & 1;
- for (i = 0, j = 0 ; i < tnl->vb.Count ; i++) {
- if (flags[i] & good_index) {
- store->Elts[j++] = i;
- prim_length++;
- }
- if (i == nextprim) {
- VB->PrimitiveLength[lastprim] = prim_length;
- VB->Primitive[j] = VB->Primitive[i];
- nextprim += lastprimlen;
- lastprim = i;
- lastprimlen = VB->PrimitiveLength[i];
- }
- }
+ if (pincr != 1 && (IM->Count - last - pintro))
+ ovf = (IM->Count - last - pintro) % pincr;
- VB->Elts = store->Elts;
+ if (last < IM->Count)
+ copy_tab[prim]( tnl, last, IM->Count, ovf );
- /* What about copying??? No immediate exists with the right
- * vertices in place...
- */
- if (tnl->CurrentPrimitive != GL_POLYGON+1) {
+ for (i = 0 ; i < tnl->ExecCopyCount ; i++)
+ tnl->ExecCopyElts[i] = IM->Elt[tnl->ExecCopyElts[i]];
}
}
-#endif
diff --git a/src/mesa/tnl/t_imm_fixup.h b/src/mesa/tnl/t_imm_fixup.h
index 6cf1e3bfd13..939bba408b2 100644
--- a/src/mesa/tnl/t_imm_fixup.h
+++ b/src/mesa/tnl/t_imm_fixup.h
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_fixup.h,v 1.3 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,23 @@
#include "mtypes.h"
#include "t_context.h"
+extern void _tnl_fixup_4chan( GLchan data[][4], GLuint flag[],
+ GLuint start, GLuint match );
+extern void _tnl_fixup_1ub( GLubyte *data, GLuint flag[],
+ GLuint start, GLuint match );
+
+extern void _tnl_fixup_1f( GLfloat *data, GLuint flag[],
+ GLuint start, GLuint match );
+
+extern void _tnl_fixup_1ui( GLuint *data, GLuint flag[],
+ GLuint start, GLuint match );
+
+extern void _tnl_fixup_3f( float data[][3], GLuint flag[],
+ GLuint start, GLuint match );
+
+extern void _tnl_fixup_4f( GLfloat data[][4], GLuint flag[],
+ GLuint start, GLuint match );
extern void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM );
@@ -42,9 +58,7 @@ extern void _tnl_restore_compiled_cassette( GLcontext *ctx,
struct immediate *IM );
-extern void _tnl_fixup_purged_eval( GLcontext *ctx,
- GLuint fixup, GLuint purge );
-
+extern void _tnl_fixup_purged_eval( GLcontext *ctx, struct immediate *IM );
extern void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *IM );
extern void _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM );
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 4fbe52fe47e..209c32f8aba 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_light.c,v 1.12 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_light.c,v 1.13 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -124,6 +124,8 @@ static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage )
GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr;
GLuint ind;
+/* _tnl_print_vert_flags( __FUNCTION__, stage->changed_inputs ); */
+
/* Make sure we can talk about elements 0..2 in the vector we are
* lighting.
*/
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index 42d00e52da2..a71ed8d4493 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.17 2001/03/29 16:50:33 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.18 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -339,6 +339,7 @@ static GLboolean run_render( GLcontext *ctx,
tnl->Driver.RenderFinish( ctx );
+/* usleep(100000); */
return GL_FALSE; /* finished the pipe */
}
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 11c3b33edde..bdf5c63786d 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texgen.c,v 1.8 2001/03/30 14:44:44 gareth Exp $ */
+/* $Id: t_vb_texgen.c,v 1.9 2001/04/26 14:53:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -94,8 +94,6 @@ static GLuint all_bits[5] = {
-/*
- */
static void build_m3( GLfloat f[][3], GLfloat m[],
const GLvector3f *normal,
const GLvector4f *eye )
@@ -106,11 +104,7 @@ static void build_m3( GLfloat f[][3], GLfloat m[],
const GLfloat *norm = normal->start;
GLuint i;
- /* KW: Had to rearrange this loop to avoid a compiler bug with gcc
- * 2.7.3.1 at -O3 optimization. Using -fno-strength-reduce
- * also fixed the bug - is this generally necessary?
- */
- for (i=0;i<count;i++,STRIDE_F(coord,stride)) {
+ for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(norm,normal->stride)) {
GLfloat u[3], two_nu, fx, fy, fz;
COPY_3V( u, coord );
NORMALIZE_3FV( u );
@@ -122,8 +116,6 @@ static void build_m3( GLfloat f[][3], GLfloat m[],
if (m[i] != 0.0F) {
m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]);
}
-
- STRIDE_F(norm, normal->stride);
}
}
@@ -140,8 +132,7 @@ static void build_m2( GLfloat f[][3], GLfloat m[],
GLfloat *norm = normal->start;
GLuint i;
- for (i=0;i<count;i++,STRIDE_F(coord,stride)) {
-
+ for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(norm,normal->stride)) {
GLfloat u[3], two_nu, fx, fy, fz;
COPY_2V( u, coord );
u[2] = 0;
@@ -154,8 +145,6 @@ static void build_m2( GLfloat f[][3], GLfloat m[],
if (m[i] != 0.0F) {
m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]);
}
-
- STRIDE_F(norm, normal->stride);
}
}
@@ -333,6 +322,10 @@ static void texgen_sphere_map( GLcontext *ctx,
GLfloat (*f)[3] = store->tmp_f;
GLfloat *m = store->tmp_m;
+/* fprintf(stderr, "%s normstride %d eyestride %d\n", */
+/* __FUNCTION__, VB->NormalPtr->stride, */
+/* VB->EyePtr->stride); */
+
(build_m_tab[VB->EyePtr->size])( store->tmp_f,
store->tmp_m,
VB->NormalPtr,
@@ -619,9 +612,7 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage )
/* Need the original input in case it contains a Q coord:
* (sigh)
*/
-/* if ((ctx->Texture.Unit[i]._ReallyEnabled|Q_BIT) & */
-/* ~ctx->Texture.Unit[i].TexGenEnabled) */
- inputs |= VERT_TEX(i);
+ inputs |= VERT_TEX(i);
/* Something for Feedback? */
}