-/* $Id: t_context.h,v 1.40 2002/04/09 16:56:52 keithw Exp $ */
+/* $Id: t_context.h,v 1.41 2002/04/19 12:32:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define VERT_BIT_CLIP VERT_BIT_END /* vb only, reuse imm bit*/
+/*
+ * XXXX these are temporary - for backward compatibility w/ DRI drivers
+ */
+#define VERT_OBJ VERT_BIT_POS
+#define VERT_RGBA VERT_BIT_COLOR0
+#define VERT_NORM VERT_BIT_NORMAL
+#define VERT_INDEX VERT_BIT_INDEX
+#define VERT_EDGE VERT_BIT_SEVEN
+#define VERT_SPEC_RGB VERT_BIT_COLOR1
+#define VERT_FOG_COORD VERT_BIT_FOG
+#define VERT_TEX0 VERT_BIT_TEX0
+#define VERT_TEX1 VERT_BIT_TEX1
+#define VERT_TEX2 VERT_BIT_TEX2
+#define VERT_TEX3 VERT_BIT_TEX3
+#define VERT_TEX4 VERT_BIT_TEX4
+#define VERT_TEX5 VERT_BIT_TEX5
+#define VERT_TEX6 VERT_BIT_TEX6
+#define VERT_TEX7 VERT_BIT_TEX7
+#define VERT_EVAL_C1 VERT_BIT_EVAL_C1
+#define VERT_EVAL_C2 VERT_BIT_EVAL_C2
+#define VERT_EVAL_P1 VERT_BIT_EVAL_P1
+#define VERT_EVAL_P2 VERT_BIT_EVAL_P2
+#define VERT_OBJ_3 VERT_BIT_OBJ_3
+#define VERT_OBJ_4 VERT_BIT_OBJ_4
+#define VERT_MATERIAL VERT_BIT_MATERIAL
+#define VERT_ELT VERT_BIT_ELT
+#define VERT_BEGIN VERT_BIT_BEGIN
+#define VERT_END VERT_BIT_END
+#define VERT_END_VB VERT_BIT_END_VB
+#define VERT_POINT_SIZE VERT_BIT_POINT_SIZE
+#define VERT_EYE VERT_BIT_EYE
+#define VERT_CLIP VERT_BIT_CLIP
+
/* Flags for IM->TexCoordSize. Enough flags for 16 units.
*/
*/
struct immediate
{
- struct __GLcontextRec *backref;
GLuint id, ref_count;
/* This must be saved when immediates are shared in display lists.
-/* $Id: t_imm_api.c,v 1.26 2002/04/09 16:56:52 keithw Exp $ */
+/* $Id: t_imm_api.c,v 1.27 2002/04/19 12:32:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* A cassette is full or flushed on a statechange.
*/
-void _tnl_flush_immediate( struct immediate *IM )
+void _tnl_flush_immediate( GLcontext *ctx, struct immediate *IM )
{
- GLcontext *ctx = IM->backref;
+ if (!ctx) {
+ /* We were called by glVertex, glEvalCoord, glArrayElement, etc.
+ * The current context is corresponds to the IM structure.
+ */
+ GET_CURRENT_CONTEXT(context);
+ ctx = context;
+ }
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
fprintf(stderr, "_tnl_flush_immediate IM: %d compiling: %d\n",
if (IM->Flag[IM->Start])
if ((flags & FLUSH_UPDATE_CURRENT) || IM->Count > IM->Start)
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( ctx, IM );
}
if (ctx->NewState)
_mesa_update_state(ctx);
+ /* if only a very few slots left, might as well flush now
+ */
+ if (IM->Count > IMM_MAXDATA-8) {
+ _tnl_flush_immediate( ctx, IM );
+ IM = TNL_CURRENT_IM(ctx);
+ }
+
/* Check for and flush buffered vertices from internal operations.
*/
if (IM->SavedBeginState) {
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( ctx, IM );
IM = TNL_CURRENT_IM(ctx);
IM->BeginState = IM->SavedBeginState;
IM->SavedBeginState = 0;
_mesa_update_state(ctx);
if (IM->Count > IMM_MAXDATA-8) {
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( ctx, IM );
IM = TNL_CURRENT_IM(ctx);
}
/* You can set this flag to get the old 'flush_vb on glEnd()'
* behaviour.
*/
+ /* XXXX tempory change here */
if (1 /*(MESA_DEBUG_FLAGS&DEBUG_ALWAYS_FLUSH)*/ )
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( ctx, IM );
}
void
ASSIGN_4V(dest, x, y, 0, 1); \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#define VERTEX3(IM,x,y,z) \
ASSIGN_4V(dest, x, y, z, 1); \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#define VERTEX4(IM, x,y,z,w) \
IM->Flag[count] |= VERT_BITS_OBJ_234; \
ASSIGN_4V(dest, x, y, z, w); \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#if defined(USE_IEEE)
dest[3].i = IEEE_ONE; \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#else
#define VERTEX2F VERTEX2
dest[3].i = IEEE_ONE; \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#else
#define VERTEX3F VERTEX3
dest[2].i = ((fi_type *)&(z))->i; \
dest[3].i = ((fi_type *)&(w))->i; \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#else
#define VERTEX4F VERTEX4
IM->Flag[count] |= VERT_BIT_EVAL_C1; \
ASSIGN_4V(dest, x, 0, 0, 1); \
if (count == IMM_MAXDATA-1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#define EVALCOORD2(IM, x, y) \
IM->Flag[count] |= VERT_BIT_EVAL_C2; \
ASSIGN_4V(dest, x, y, 0, 1); \
if (count == IMM_MAXDATA-1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#define EVALPOINT1(IM, x) \
IM->Flag[count] |= VERT_BIT_EVAL_P1; \
ASSIGN_4V(dest, x, 0, 0, 1); \
if (count == IMM_MAXDATA-1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
#define EVALPOINT2(IM, x, y) \
IM->Flag[count] |= VERT_BIT_EVAL_P2; \
ASSIGN_4V(dest, x, y, 0, 1); \
if (count == IMM_MAXDATA-1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
static void
IM->FlushElt = IM->ArrayEltFlush; \
IM->Count += IM->ArrayEltIncr; \
if (IM->Count == IMM_MAXDATA) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( NULL, IM ); \
}
if (index == 0) {
IM->Count++;
if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( NULL, IM );
}
}
}
if (index == 0) {
IM->Count++;
if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( NULL, IM );
}
}
}
if (tnl->IsolateMaterials &&
!(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
{
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( ctx, IM );
IM = TNL_CURRENT_IM(ctx);
count = IM->Count;
}
if (tnl->IsolateMaterials &&
!(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
{
- _tnl_flush_immediate( IM );
+ _tnl_flush_immediate( ctx, IM );
}
}