From c618005dcff0d4011a77cfebd109880eb784d581 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 1 Aug 2001 05:10:42 +0000 Subject: Fix copying problem (light spots) on evaluated surfaces. --- src/mesa/tnl/t_imm_fixup.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src/mesa/tnl/t_imm_fixup.c') diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c index 607235d327..b5f191e3a3 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.23 2001/07/17 21:44:37 keithw Exp $ */ +/* $Id: t_imm_fixup.c,v 1.24 2001/08/01 05:10:42 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -74,8 +74,14 @@ _tnl_fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match ) { GLuint i = start; + for (;;) { if ((flag[++i] & match) == 0) { +/* fprintf(stderr, "_tnl_fixup_3f copy to %p values %f %f %f\n", */ +/* data[i], */ +/* data[i-1][0], */ +/* data[i-1][1], */ +/* data[i-1][2]); */ COPY_3V(data[i], data[i-1]); if (flag[i] & VERT_END_VB) break; } @@ -145,6 +151,8 @@ fixup_first_3f( GLfloat data[][3], GLuint flag[], GLuint match, GLuint i = start-1; match |= VERT_END_VB; +/* fprintf(stderr, "fixup_first_3f\n"); */ + while ((flag[++i]&match) == 0) COPY_3FV(data[i], dflt); } @@ -190,7 +198,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint start = IM->CopyStart; GLuint andflag = IM->CopyAndFlag; - GLuint orflag = IM->CopyOrFlag; + GLuint orflag = IM->CopyOrFlag | IM->Evaluated; GLuint fixup; IM->CopyTexSize = IM->TexSize; @@ -421,23 +429,21 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) next->CopyAndFlag &= VERT_ELT; } else { - /* prev->CopyOrFlag is hacked to include values generated by eval: - */ - GLuint copy = tnl->pipeline.inputs & prev->CopyOrFlag; + GLuint copy = tnl->pipeline.inputs & (prev->CopyOrFlag|prev->Evaluated); GLuint flag; if (is_fan_like[ctx->Driver.CurrentExecPrimitive]) { - next->TexSize |= tnl->ExecCopyTexSize; - next->CopyOrFlag |= (prev->CopyOrFlag & VERT_FIXUP); - next->CopyAndFlag &= (prev->CopyOrFlag & VERT_FIXUP); - flag = (prev->CopyOrFlag & VERT_FIXUP); + flag = ((prev->CopyOrFlag|prev->Evaluated) & VERT_FIXUP); + next->CopyOrFlag |= flag; } else { /* Don't let an early 'glColor', etc. poison the elt path. */ - next->CopyAndFlag &= (prev->OrFlag & VERT_FIXUP); - flag = (prev->OrFlag & VERT_FIXUP); + flag = ((prev->OrFlag|prev->Evaluated) & VERT_FIXUP); } + + next->TexSize |= tnl->ExecCopyTexSize; + next->CopyAndFlag &= flag; /* Copy whole vertices @@ -455,8 +461,15 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) */ COPY_4FV( next->Obj[dst], inputs->Obj.data[isrc] ); - if (copy & VERT_NORM) + if (copy & VERT_NORM) { +/* fprintf(stderr, "copy vert norm %d to %d (%p): %f %f %f\n", */ +/* isrc, dst, */ +/* next->Normal[dst], */ +/* inputs->Normal.data[isrc][0], */ +/* inputs->Normal.data[isrc][1], */ +/* inputs->Normal.data[isrc][2]); */ COPY_3FV( next->Normal[dst], inputs->Normal.data[isrc] ); + } if (copy & VERT_RGBA) COPY_4FV( next->Color[dst], @@ -490,8 +503,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) } next->Flag[dst] = flag; - next->OrFlag |= prev->Flag[src]; /* for non-fanlike prims, - otherwise redundant */ + next->CopyOrFlag |= prev->Flag[src]; } } @@ -514,6 +526,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) GLuint fixup; GLuint start = IM->Start; + IM->Evaluated = 0; IM->CopyOrFlag = IM->OrFlag; IM->CopyAndFlag = IM->AndFlag; IM->CopyTexSize = IM->TexSize | tnl->ExecCopyTexSize; -- cgit v1.2.3