-/* $Id: t_imm_exec.c,v 1.28 2001/08/01 05:10:42 keithw Exp $ */
+/* $Id: t_imm_exec.c,v 1.29 2001/08/02 22:39:51 keithw Exp $ */
/*
* Mesa 3-D graphics library
void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
- GLuint flag )
+ GLuint flag, GLuint count )
{
- GLuint count = IM->LastData;
-
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
_tnl_print_vert_flags("copy to current", flag);
IM->Flag[IM->LastData+1] |= VERT_END_VB;
IM->CopyAndFlag = IM->AndFlag = andflag;
- IM->CopyOrFlag = IM->OrFlag = orflag;
+ IM->OrFlag = orflag;
+ IM->CopyOrFlag = orflag;
IM->Evaluated = 0;
}
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
_tnl_vb_bind_immediate( ctx, IM );
- if (IM->CopyOrFlag & VERT_EVAL_ANY)
+ if (IM->OrFlag & VERT_EVAL_ANY)
_tnl_eval_immediate( ctx, IM );
/* Invalidate all stored data before and after run:
tnl->Driver.RunPipeline( ctx );
tnl->pipeline.run_input_changes |= tnl->pipeline.inputs;
- _tnl_copy_to_current( ctx, IM, IM->OrFlag );
+ _tnl_copy_to_current( ctx, IM, IM->OrFlag, IM->LastData );
}
*/
static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM )
{
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
if (IM->FlushElt) {
/* Orflag is computed twice, but only reach this code if app is
* using a mixture of glArrayElement() and glVertex() while
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
_tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount );
/* Take only elements and primitive information from the immediate:
*/
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) {
_tnl_translate_array_elts( ctx, IM, IM->LastData, IM->LastData );
- _tnl_copy_to_current( ctx, IM, ctx->Array._Enabled );
+ _tnl_copy_to_current( ctx, IM, ctx->Array._Enabled, IM->LastData );
}
}
if (IM->FlushElt)
_tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->CopyStart );
- _tnl_copy_to_current( ctx, IM, IM->OrFlag );
+ _tnl_copy_to_current( ctx, IM, IM->OrFlag, IM->LastData );
}
-/* $Id: t_imm_fixup.c,v 1.24 2001/08/01 05:10:42 keithw Exp $ */
+/* $Id: t_imm_fixup.c,v 1.25 2001/08/02 22:39:51 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "t_imm_debug.h"
#include "t_imm_elt.h"
#include "t_imm_fixup.h"
+#include "t_imm_exec.h"
#include "t_pipeline.h"
GLuint i = start-1;
match |= VERT_END_VB;
-/* fprintf(stderr, "fixup_first_3f\n"); */
+/* fprintf(stderr, "fixup_first_3f default: %f %f %f start: %d\n", */
+/* dflt[0], dflt[1], dflt[2], start); */
while ((flag[++i]&match) == 0)
COPY_3FV(data[i], dflt);
data[i] = dflt;
}
+static void copy_from_current( GLcontext *ctx, struct immediate *IM,
+ GLuint start, GLuint copy )
+{
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ _tnl_print_vert_flags("copy from current", copy);
+
+ if (copy & VERT_NORM) {
+ COPY_3V( IM->Normal[start], ctx->Current.Normal );
+ }
+
+ if (copy & VERT_RGBA) {
+ COPY_4FV( IM->Color[start], ctx->Current.Color);
+ }
+
+ if (copy & VERT_SPEC_RGB)
+ COPY_4FV( IM->SecondaryColor[start], ctx->Current.SecondaryColor);
+
+ if (copy & VERT_FOG_COORD)
+ IM->FogCoord[start] = ctx->Current.FogCoord;
+
+ if (copy & VERT_INDEX)
+ IM->Index[start] = ctx->Current.Index;
+
+ if (copy & VERT_EDGE)
+ IM->EdgeFlag[start] = ctx->Current.EdgeFlag;
+
+ if (copy & VERT_TEX_ANY) {
+ GLuint i;
+ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
+ if (copy & VERT_TEX(i))
+ COPY_4FV( IM->TexCoord[i][start], ctx->Current.Texcoord[i] );
+ }
+ }
+}
+
void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
{
/* Equivalent to a lazy copy-from-current when setting up the
* immediate.
*/
- if (ctx->ExecuteFlag && copy) {
-
- if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- _tnl_print_vert_flags("copy from current", copy);
-
- if (copy & VERT_NORM) {
- COPY_3V( IM->Normal[start], ctx->Current.Normal );
- }
-
- if (copy & VERT_RGBA) {
- COPY_4FV( IM->Color[start], ctx->Current.Color);
- }
-
- if (copy & VERT_SPEC_RGB)
- COPY_4FV( IM->SecondaryColor[start], ctx->Current.SecondaryColor);
-
- if (copy & VERT_FOG_COORD)
- IM->FogCoord[start] = ctx->Current.FogCoord;
-
- if (copy & VERT_INDEX)
- IM->Index[start] = ctx->Current.Index;
-
- if (copy & VERT_EDGE)
- IM->EdgeFlag[start] = ctx->Current.EdgeFlag;
-
- if (copy & VERT_TEX_ANY) {
- GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (copy & VERT_TEX(i))
- COPY_4FV( IM->TexCoord[i][start], ctx->Current.Texcoord[i] );
- }
- }
- }
+ if (ctx->ExecuteFlag && copy)
+ copy_from_current( ctx, IM, start, copy );
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
_tnl_print_vert_flags("fixup", fixup);
next->Elt[dst] = prev->Elt[src];
next->Flag[dst] = VERT_ELT;
}
+/* fprintf(stderr, "ADDING VERT_ELT!\n"); */
next->CopyOrFlag |= VERT_ELT;
next->CopyAndFlag &= VERT_ELT;
}
next->CopyAndFlag &= flag;
+/* _tnl_print_vert_flags("copy vertex components", copy); */
+/* _tnl_print_vert_flags("prev copyorflag", prev->CopyOrFlag); */
+/* _tnl_print_vert_flags("flag", flag); */
+
/* Copy whole vertices
*/
for (i = 0 ; i < count ; i++)
}
next->Flag[dst] = flag;
- next->CopyOrFlag |= prev->Flag[src];
+ next->CopyOrFlag |= prev->Flag[src] & (VERT_FIXUP|
+ VERT_MATERIAL|
+ VERT_OBJ);
}
}
}
+
/* Revive a compiled immediate struct - propogate new 'Current'
* values. Often this is redundant because the current values were
* known and fixed up at compile time (or in the first execution of
GLuint fixup;
GLuint start = IM->Start;
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
IM->Evaluated = 0;
IM->CopyOrFlag = IM->OrFlag;
IM->CopyAndFlag = IM->AndFlag;
* display list. Need to translate them away:
*/
if (IM->CopyOrFlag & VERT_ELT) {
+ GLuint copy = tnl->pipeline.inputs & ~ctx->Array._Enabled;
+ GLuint i;
+
ASSERT(IM->CopyStart < IM->Start);
+
_tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->Start );
+
+ for (i = IM->CopyStart ; i < IM->Start ; i++)
+ copy_from_current( ctx, IM, i, copy );
+
+ _tnl_copy_to_current( ctx, IM, ctx->Array._Enabled, IM->Start );
}
fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_FIXUP;
+/* _tnl_print_vert_flags("fixup compiled", fixup); */
+
if (fixup) {
if (fixup & VERT_TEX_ANY) {
GLuint i;
fixup_first_3f(IM->Normal, IM->Flag, VERT_NORM, start,
ctx->Current.Normal );
}
+
+ IM->CopyOrFlag |= fixup;
}
+
/* Materials:
*/