-#define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- int key = tnl->vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn = lookup( &tnl->dfn_cache.FN, key ); \
- \
- if (dfn == 0) \
- dfn = tnl->codegen.FN( &vb, key ); \
- else if (MESA_VERBOSE & DEBUG_CODEGEN) \
- _mesa_debug(NULL, "%s -- cached codegen\n", __FUNCTION__ ); \
- \
- if (dfn) \
- tnl->context->Exec->FN = (FNTYPE)(dfn->code); \
- else { \
- if (MESA_VERBOSE & DEBUG_CODEGEN) \
- _mesa_debug(NULL, "%s -- generic version\n", __FUNCTION__ ); \
- tnl->context->Exec->FN = tnl_##FN; \
- } \
- \
- tnl->context->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- tnl->context->Exec->FN ARGS2; \
-}
-
-
-
-CHOOSE(Normal3f, p3f, 3, VERT_ATTRIB_NORMAL,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Normal3fv, pfv, 3, VERT_ATTRIB_NORMAL,
- (const GLfloat *v), (v))
-
-CHOOSE(Color4ub, p4ub, 4, VERT_ATTRIB_COLOR0,
- (GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
-CHOOSE(Color4ubv, pubv, 4, VERT_ATTRIB_COLOR0,
- (const GLubyte *v), (v))
-CHOOSE(Color3ub, p3ub, 3, VERT_ATTRIB_COLOR0,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE(Color3ubv, pubv, 3, VERT_ATTRIB_COLOR0,
- (const GLubyte *v), (v))
-
-CHOOSE(Color4f, p4f, 4, VERT_ATTRIB_COLOR0,
- (GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
-CHOOSE(Color4fv, pfv, 4, VERT_ATTRIB_COLOR0,
- (const GLfloat *v), (v))
-CHOOSE(Color3f, p3f, 3, VERT_ATTRIB_COLOR0,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE(Color3fv, pfv, 3, VERT_ATTRIB_COLOR0,
- (const GLfloat *v), (v))
-
-
-CHOOSE(SecondaryColor3ubEXT, p3ub, VERT_ATTRIB_COLOR1,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE(SecondaryColor3ubvEXT, pubv, VERT_ATTRIB_COLOR1,
- (const GLubyte *v), (v))
-CHOOSE(SecondaryColor3fEXT, p3f, VERT_ATTRIB_COLOR1,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE(SecondaryColor3fvEXT, pfv, VERT_ATTRIB_COLOR1,
- (const GLfloat *v), (v))
-
-CHOOSE(TexCoord2f, p2f, VERT_ATTRIB_TEX0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(TexCoord2fv, pfv, VERT_ATTRIB_TEX0,
- (const GLfloat *v), (v))
-CHOOSE(TexCoord1f, p1f, VERT_ATTRIB_TEX0,
- (GLfloat a), (a))
-CHOOSE(TexCoord1fv, pfv, VERT_ATTRIB_TEX0,
- (const GLfloat *v), (v))
-
-CHOOSE(MultiTexCoord2fARB, pe2f, VERT_ATTRIB_TEX0,
- (GLenum u,GLfloat a,GLfloat b), (u,a,b))
-CHOOSE(MultiTexCoord2fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,const GLfloat *v), (u,v))
-CHOOSE(MultiTexCoord1fARB, pe1f, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,GLfloat a), (u,a))
-CHOOSE(MultiTexCoord1fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,const GLfloat *v), (u,v))
-
-CHOOSE(Vertex3f, p3f, VERT_ATTRIB_POS,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Vertex3fv, pfv, VERT_ATTRIB_POS,
- (const GLfloat *v), (v))
-CHOOSE(Vertex2f, p2f, VERT_ATTRIB_POS,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(Vertex2fv, pfv, VERT_ATTRIB_POS,
- (const GLfloat *v), (v))
-
-
-
-
-
-void _tnl_InitVtxfmtChoosers( GLvertexformat *vfmt )
-{
- vfmt->Color3f = choose_Color3f;
- vfmt->Color3fv = choose_Color3fv;
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
- vfmt->Color4f = choose_Color4f;
- vfmt->Color4fv = choose_Color4fv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
- vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
- vfmt->MultiTexCoord1fARB = dd_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = dd_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = dd_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = dd_MultiTexCoord2fvARB;
- vfmt->MultiTexCoord3fARB = dd_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = dd_MultiTexCoord3fvARB;
- vfmt->MultiTexCoord4fARB = dd_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = dd_MultiTexCoord4fvARB;
- vfmt->Normal3f = choose_Normal3f;
- vfmt->Normal3fv = choose_Normal3fv;
- vfmt->TexCoord1f = choose_TexCoord1f;
- vfmt->TexCoord1fv = choose_TexCoord1fv;
- vfmt->TexCoord2f = choose_TexCoord2f;
- vfmt->TexCoord2fv = choose_TexCoord2fv;
- vfmt->TexCoord3f = choose_TexCoord3f;
- vfmt->TexCoord3fv = choose_TexCoord3fv;
- vfmt->TexCoord4f = choose_TexCoord4f;
- vfmt->TexCoord4fv = choose_TexCoord4fv;
- vfmt->Vertex2f = choose_Vertex2f;
- vfmt->Vertex2fv = choose_Vertex2fv;
- vfmt->Vertex3f = choose_Vertex3f;
- vfmt->Vertex3fv = choose_Vertex3fv;
- vfmt->Vertex4f = choose_Vertex4f;
- vfmt->Vertex4fv = choose_Vertex4fv;
- vfmt->FogCoordfvEXT = choose_FogCoordfvEXT;
- vfmt->FogCoordfEXT = choose_FogCoordfEXT;
- vfmt->EdgeFlag = choose_EdgeFlag;
- vfmt->EdgeFlagv = choose_EdgeFlagv;
- vfmt->Indexi = choose_Indexi;
- vfmt->Indexiv = choose_Indexiv;
- vfmt->EvalCoord1f = choose_EvalCoord1f;
- vfmt->EvalCoord1fv = choose_EvalCoord1fv;
- vfmt->EvalCoord2f = choose_EvalCoord2f;
- vfmt->EvalCoord2fv = choose_EvalCoord2fv;
- vfmt->Materialfv = dd_Materialfv;
-}
-
-
-static struct dynfn *codegen_noop( struct _vb *vb, int key )
-{
- (void) vb; (void) key;
- return 0;