-/* $Id: t_imm_api.c,v 1.19 2001/12/04 23:43:31 brianp Exp $ */
+/* $Id: t_imm_api.c,v 1.20 2001/12/14 02:51:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "t_imm_dlist.h"
+extern void _tnl_vprog_vtxfmt_init( GLcontext *ctx );
+
+
/* A cassette is full or flushed on a statechange.
*/
void _tnl_flush_immediate( struct immediate *IM )
if (ctx->NewState)
_mesa_update_state(ctx);
+ /* Either install the normal vertex functions or the vertex program funcs */
+ if (ctx->VertexProgram.Enabled)
+ _tnl_vprog_vtxfmt_init(ctx);
+ else
+ _tnl_imm_vtxfmt_init(ctx);
+ _mesa_init_exec_vtxfmt(ctx);
+
/* if only a very few slots left, might as well flush now
*/
if (IM->Count > IMM_MAXDATA-8) {
ctx->Driver.CurrentSavePrimitive = mode;
}
-static void
+
+void
_tnl_Begin( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
/* You can set this flag to get the old 'flush_vb on glEnd()'
* behaviour.
*/
- if (1/*(MESA_DEBUG_FLAGS&DEBUG_ALWAYS_FLUSH)*/)
+ if (1 /*(MESA_DEBUG_FLAGS&DEBUG_ALWAYS_FLUSH)*/ )
_tnl_flush_immediate( IM );
}
-static void
+void
_tnl_End(void)
{
GET_CURRENT_CONTEXT(ctx);
#define COLOR( IM, r, g, b, a ) \
{ \
GLuint count = IM->Count; \
- IM->Flag[count] |= VERT_RGBA; \
+ IM->Flag[count] |= VERT_COLOR0_BIT; \
IM->Color[count][0] = r; \
IM->Color[count][1] = g; \
IM->Color[count][2] = b; \
#define SECONDARY_COLOR( IM, r, g, b ) \
{ \
GLuint count = IM->Count; \
- IM->Flag[count] |= VERT_SPEC_RGB; \
+ IM->Flag[count] |= VERT_COLOR1_BIT; \
IM->SecondaryColor[count][0] = r; \
IM->SecondaryColor[count][1] = g; \
IM->SecondaryColor[count][2] = b; \
GET_IMMEDIATE;
count = IM->Count;
IM->EdgeFlag[count] = flag;
- IM->Flag[count] |= VERT_EDGE;
+ IM->Flag[count] |= VERT_EDGEFLAG_BIT;
}
GET_IMMEDIATE;
count = IM->Count;
IM->EdgeFlag[count] = *flag;
- IM->Flag[count] |= VERT_EDGE;
+ IM->Flag[count] |= VERT_EDGEFLAG_BIT;
}
GET_IMMEDIATE;
count = IM->Count;
IM->FogCoord[count] = f;
- IM->Flag[count] |= VERT_FOG_COORD;
+ IM->Flag[count] |= VERT_FOG_BIT;
}
static void
GET_IMMEDIATE;
count = IM->Count;
IM->FogCoord[count] = v[0];
- IM->Flag[count] |= VERT_FOG_COORD;
+ IM->Flag[count] |= VERT_FOG_BIT;
}
GET_IMMEDIATE;
count = IM->Count;
IM->Index[count] = c;
- IM->Flag[count] |= VERT_INDEX;
+ IM->Flag[count] |= VERT_INDEX_BIT;
}
GET_IMMEDIATE;
count = IM->Count;
IM->Index[count] = *c;
- IM->Flag[count] |= VERT_INDEX;
+ IM->Flag[count] |= VERT_INDEX_BIT;
}
GLfloat *normal; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_NORM; \
+ IM->Flag[count] |= VERT_NORMAL_BIT; \
normal = IM->Normal[count]; \
ASSIGN_3V(normal, x,y,z); \
}
fi_type *normal; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_NORM; \
+ IM->Flag[count] |= VERT_NORMAL_BIT; \
normal = (fi_type *)IM->Normal[count]; \
normal[0].i = ((fi_type *)&(x))->i; \
normal[1].i = ((fi_type *)&(y))->i; \
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0; \
+ IM->Flag[count] |= VERT_TEX0_BIT; \
tc = IM->TexCoord0[count]; \
ASSIGN_4V(tc,s,0,0,1); \
}
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0; \
+ IM->Flag[count] |= VERT_TEX0_BIT; \
tc = IM->TexCoord0[count]; \
ASSIGN_4V(tc, s,t,0,1); \
}
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0; \
+ IM->Flag[count] |= VERT_TEX0_BIT; \
IM->TexSize |= TEX_0_SIZE_3; \
tc = IM->TexCoord0[count]; \
ASSIGN_4V(tc, s,t,u,1); \
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0; \
+ IM->Flag[count] |= VERT_TEX0_BIT; \
IM->TexSize |= TEX_0_SIZE_4; \
tc = IM->TexCoord0[count]; \
ASSIGN_4V(tc, s,t,u,v); \
fi_type *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0; \
+ IM->Flag[count] |= VERT_TEX0_BIT; \
tc = (fi_type *)IM->TexCoord0[count]; \
tc[0].i = ((fi_type *)&(s))->i; \
tc[1].i = ((fi_type *)&(t))->i; \
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ; \
+ IM->Flag[count] |= VERT_OBJ_BIT; \
ASSIGN_4V(dest, x, y, 0, 1); \
/* ASSERT(IM->Flag[IM->Count]==0); */\
if (count == IMM_MAXDATA - 1) \
{ \
GLuint count = IM->Count++; \
fi_type *dest = (fi_type *)IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ; \
+ IM->Flag[count] |= VERT_OBJ_BIT; \
dest[0].i = ((fi_type *)&(x))->i; \
dest[1].i = ((fi_type *)&(y))->i; \
dest[2].i = 0; \
+/*
+ * NV_vertex_program
+ */
+
+static void
+_tnl_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ /* no-op? */
+ printf("%s(%d, %f, %f, %f, %f)\n", __FUNCTION__, index, x, y, z, w);
+ (void) index;
+ (void) x;
+ (void) y;
+ (void) z;
+ (void) w;
+}
+
+static void
+_tnl_VertexAttrib4fvNV(GLuint index, const GLfloat *v)
+{
+ /* no-op? */
+ (void) index;
+ (void) v;
+}
+
/* Execute a glRectf() function. _tnl_hard_begin() ensures the check
{
GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt);
+ printf("%s()\n", __FUNCTION__);
+
/* All begin/end operations are handled by this vertex format:
*/
vfmt->ArrayElement = _tnl_ArrayElement;
vfmt->Vertex3fv = _tnl_Vertex3fv;
vfmt->Vertex4f = _tnl_Vertex4f;
vfmt->Vertex4fv = _tnl_Vertex4fv;
+ vfmt->VertexAttrib4fNV = _tnl_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = _tnl_VertexAttrib4fvNV;
/* Outside begin/end functions (from t_varray.c, t_eval.c, ...):
*/