2 /**************************************************************************
4 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the "Software"),
10 to deal in the Software without restriction, including without limitation
11 on the rights to use, copy, modify, merge, publish, distribute, sub
12 license, and/or sell copies of the Software, and to permit persons to whom
13 the Software is furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice (including the next
16 paragraph) shall be included in all copies or substantial portions of the
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
22 TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
23 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25 USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
31 * Keith Whitwell <keith@tungstengraphics.com>
35 #include "simple_list.h"
38 #include "tnl_vtx_api.h"
40 /* Fallback versions of all the entrypoints for situations where
41 * codegen isn't available. This is slowed significantly by all the
42 * gumph necessary to get to the tnl pointer.
46 /* MultiTexcoord ends up with both of these branches, unfortunately
47 * (it may get its own version of the macro after size-tracking is
50 * Errors (VertexAttribNV when ATTR>15) are handled at a higher level.
52 #define ATTRF( ATTR, N, A, B, C, D ) \
54 GET_CURRENT_CONTEXT( ctx ); \
55 TNLcontext *tnl = TNL_CONTEXT(ctx); \
60 if (N>0) tnl->vbptr[0].f = A; \
61 if (N>1) tnl->vbptr[1].f = B; \
62 if (N>2) tnl->vbptr[2].f = C; \
63 if (N>3) tnl->vbptr[3].f = D; \
65 for (i = N; i < tnl->vertex_size; i++) \
66 *tnl->vbptr[i].i = tnl->vertex[i].i; \
68 tnl->vbptr += tnl->vertex_size; \
70 if (--tnl->counter == 0) \
74 GLfloat *dest = tnl->attrptr[ATTR]; \
75 if (N>0) dest[0] = A; \
76 if (N>1) dest[1] = B; \
77 if (N>2) dest[2] = C; \
78 if (N>3) dest[3] = D; \
82 #define ATTR4F( ATTR, A, B, C, D ) ATTRF( ATTR, 4, A, B, C, D )
83 #define ATTR3F( ATTR, A, B, C, D ) ATTRF( ATTR, 3, A, B, C, 1 )
84 #define ATTR2F( ATTR, A, B, C, D ) ATTRF( ATTR, 2, A, B, 0, 1 )
85 #define ATTR1F( ATTR, A, B, C, D ) ATTRF( ATTR, 1, A, 0, 0, 1 )
87 #define ATTR3UB( ATTR, A, B, C ) \
94 #define ATTR4UB( ATTR, A, B, C, D ) \
104 static void tnl_Vertex2f( GLfloat x
, GLfloat y
)
106 ATTR2F( VERT_ATTRIB_POS
, x
, y
);
109 static void tnl_Vertex2fv( const GLfloat
*v
)
111 ATTR2F( VERT_ATTRIB_POS
, v
[0], v
[1] );
114 static void tnl_Vertex3f( GLfloat x
, GLfloat y
, GLfloat z
)
116 ATTR3F( VERT_ATTRIB_POS
, x
, y
, z
);
119 static void tnl_Vertex3fv( const GLfloat
*v
)
121 ATTR3F( VERT_ATTRIB_POS
, v
[0], v
[1], v
[2] );
124 static void tnl_Vertex4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
126 ATTR4F( VERT_ATTRIB_POS
, x
, y
, z
, w
);
129 static void tnl_Vertex4fv( const GLfloat
*v
)
131 ATTR4F( VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3] );
137 static void tnl_Color3ub( GLubyte r
, GLubyte g
, GLubyte b
)
139 ATTR3UB( VERT_ATTRIB_COLOR0
, r
, g
, b
);
142 static void tnl_Color3ubv( const GLubyte
*v
)
144 ATTR3UB( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2] );
147 static void tnl_Color4ub( GLubyte r
, GLubyte g
, GLubyte b
, GLubyte a
)
149 ATTR4UB( VERT_ATTRIB_COLOR0
, r
, g
, b
, a
);
152 static void tnl_Color4ubv( const GLubyte
*v
)
154 ATTR4UB( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3] );
157 static void tnl_Color3f( GLfloat r
, GLfloat g
, GLfloat b
)
159 ATTR3F( VERT_ATTRIB_COLOR0
, r
, g
, b
);
162 static void tnl_Color3fv( const GLfloat
*v
)
164 ATTR3F( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2] );
167 static void tnl_Color4f( GLfloat r
, GLfloat g
, GLfloat b
, GLfloat a
)
169 ATTR4F( VERT_ATTRIB_COLOR0
, r
, g
, b
, a
);
172 static void tnl_Color4fv( const GLfloat
*v
)
174 ATTR4F( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3] );
180 static void tnl_SecondaryColor3ubEXT( GLubyte r
, GLubyte g
, GLubyte b
)
182 ATTR3UB( VERT_ATTRIB_COLOR1
, r
, g
, b
);
185 static void tnl_SecondaryColor3ubvEXT( const GLubyte
*v
)
187 ATTR3UB( VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2] );
190 static void tnl_SecondaryColor3fEXT( GLfloat r
, GLfloat g
, GLfloat b
)
192 ATTR3F( VERT_ATTRIB_COLOR1
, r
, g
, b
);
195 static void tnl_SecondaryColor3fvEXT( const GLfloat
*v
)
197 ATTR3F( VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2] );
204 static void tnl_FogCoordfEXT( GLfloat f
)
206 ATTR1F( VERT_ATTRIB_FOG
, f
);
209 static void tnl_FogCoordfvEXT( const GLfloat
*v
)
211 ATTR1F( VERT_ATTRIB_FOG
, v
[0] );
218 static void tnl_Normal3f( GLfloat n0
, GLfloat n1
, GLfloat n2
)
220 ATTR3F( VERT_ATTRIB_NORMAL
, n0
, n1
, n2
);
223 static void tnl_Normal3fv( const GLfloat
*v
)
225 ATTR3F( VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2] );
231 static void tnl_TexCoord1f( GLfloat s
)
233 ATTR1F( VERT_ATTRIB_TEX0
, s
);
236 static void tnl_TexCoord1fv( const GLfloat
*v
)
238 ATTR1F( VERT_ATTRIB_TEX0
, v
[0] );
241 static void tnl_TexCoord2f( GLfloat s
, GLfloat t
)
243 ATTR2F( VERT_ATTRIB_TEX0
, s
, t
);
246 static void tnl_TexCoord2fv( const GLfloat
*v
)
248 ATTR2F( VERT_ATTRIB_TEX0
, v
[0], v
[1] );
251 static void tnl_TexCoord3f( GLfloat s
, GLfloat t
, GLfloat r
)
253 ATTR3F( VERT_ATTRIB_TEX0
, s
, t
, r
);
256 static void tnl_TexCoord3fv( const GLfloat
*v
)
258 ATTR3F( VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2] );
261 static void tnl_TexCoord4f( GLfloat s
, GLfloat t
, GLfloat r
, GLfloat q
)
263 ATTR4F( VERT_ATTRIB_TEX0
, s
, t
, r
, q
);
266 static void tnl_TexCoord4fv( const GLfloat
*v
)
268 ATTR4F( VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3] );
274 * These don't alias NV attributes, but still need similar treatment.
275 * Basically these are attributes with numbers greater than 16.
277 static void tnl_EdgeFlag( GLboolean flag
)
279 GLfloat f
= flag
? 1 : 0;
280 ATTR1F( VERT_ATTRIB_EDGEFLAG
, f
);
283 static void tnl_EdgeFlagv( const GLboolean
*flag
)
285 GLfloat f
= flag
[0] ? 1 : 0;
286 ATTR1F( VERT_ATTRIB_EDGEFLAG
, f
);
289 static void tnl_Indexi( GLint idx
)
291 ATTR1F( VERT_ATTRIB_INDEX
, idx
);
294 static void tnl_Indexiv( const GLint
*idx
)
296 ATTR1F( VERT_ATTRIB_INDEX
, idx
);
299 /* Use dispatch switching to build 'ranges' of eval vertices for each
300 * type, avoiding need for flags. (Make
301 * evalcoords/evalpoints/vertices/attr0 mutually exclusive)
303 static void _tnl_EvalCoord1f( GLfloat u
)
305 ATTR1F( VERT_ATTRIB_POS
, u
);
308 static void _tnl_EvalCoord1fv( const GLfloat
*v
)
310 ATTR1F( VERT_ATTRIB_POS
, v
[0] );
313 static void _tnl_EvalCoord2f( GLfloat u
, GLfloat v
)
315 ATTR2F( VERT_ATTRIB_POS
, u
, v
);
318 static void _tnl_EvalCoord2fv( const GLfloat
*v
)
320 ATTR2F( VERT_ATTRIB_POS
, v
[0], v
[1] );
325 /* Second level dispatch table for MultiTexCoord, Material and
328 * Need this because we want to track things like vertex attribute
329 * sizes, presence/otherwise of attribs in recorded vertices, etc, by
330 * manipulating the state of dispatch tables. Need therefore a
331 * dispatch slot for each value of 'index' or 'unit' in VertexAttribNV
332 * and MultiTexCoordARB. Also need a mechnism for keeping this data
333 * consistent with what's coming in via the Vertex/Normal/etc api
334 * above (where aliasing exists with the traditional entrypoints).
335 * Note that MultiTexCoordARB aliases with TexCoord when unit==0.
337 * Need presence tracking for material components, too, but not size
338 * tracking or help with aliasing. Could move material to seperate
339 * dispatch without the "*4" below, or even do the checks every time.
341 struct attr_dispatch_tab
{
342 void (*tab
[32*4])( void );
343 void (*swapped
[32*4])( void );
345 int installed_sizes
[32];
348 #define DISPATCH_ATTR1F( ATTR, N, )
349 tnl
->vb
.attr_dispatch
351 /* Result at the back end after second dispatch -- could further
352 * specialize for attr zero -- maybe just in the codegen version.
354 static void tnl_Attr1f( GLint attr
, GLfloat s
)
359 static void tnl_Attr1fv( GLint attr
, const GLfloat
*v
)
361 ATTR1F( attr
, v
[0] );
364 static void tnl_Attr2f( GLint attr
, GLfloat s
, GLfloat t
)
366 ATTR2F( attr
, s
, t
);
369 static void tnl_Attr2fv( GLint attr
, const GLfloat
*v
)
371 ATTR2F( attr
, v
[0], v
[1] );
374 static void tnl_Attr3f( GLint attr
, GLfloat s
, GLfloat t
, GLfloat r
)
376 ATTR3F( attr
, s
, t
, r
);
379 static void tnl_Attr3fv( GLint attr
, const GLfloat
*v
)
381 ATTR3F( attr
, v
[0], v
[1], v
[2] );
384 static void tnl_Attr4f( GLint attr
, GLfloat s
, GLfloat t
, GLfloat r
, GLfloat q
)
386 ATTR4F( attr
, s
, t
, r
, q
);
389 static void tnl_Attr4fv( GLint attr
, const GLfloat
*v
)
391 ATTR4F( attr
, v
[0], v
[1], v
[2], v
[3] );
395 /* MultiTexcoord: Send through second level dispatch.
397 static void tnl_MultiTexCoord1fARB( GLenum target
, GLfloat s
)
399 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
400 if (attr
< MAX_VERT_ATTRS
)
401 DISPATCH_ATTR1F( attr
, s
);
404 static void tnl_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
406 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
407 if (attr
< MAX_VERT_ATTRS
)
408 DISPATCH_ATTR1F( attr
, v
[0] );
411 static void tnl_MultiTexCoord2fARB( GLenum target
, GLfloat s
, GLfloat t
)
413 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
414 if (attr
< MAX_VERT_ATTRS
)
415 DISPATCH_ATTR2F( attr
, s
, t
);
418 static void tnl_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
420 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
421 if (attr
< MAX_VERT_ATTRS
)
422 DISPATCH_ATTR2F( attr
, v
[0], v
[1] );
425 static void tnl_MultiTexCoord3fARB( GLenum target
, GLfloat s
, GLfloat t
,
428 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
429 if (attr
< MAX_VERT_ATTRS
)
430 DISPATCH_ATTR3F( attr
, s
, t
, r
);
433 static void tnl_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
435 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
436 if (attr
< MAX_VERT_ATTRS
)
437 DISPATCH_ATTR3F( attr
, v
[0], v
[1], v
[2] );
440 static void tnl_MultiTexCoord4fARB( GLenum target
, GLfloat s
, GLfloat t
,
441 GLfloat r
, GLfloat q
)
443 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
444 if (attr
< MAX_VERT_ATTRS
)
445 DISPATCH_ATTR4F( attr
, s
, t
, r
, q
);
448 static void tnl_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
450 GLuint attr
= (target
- GL_TEXTURE0_ARB
) + VERT_ATTRIB_TEX0
;
451 if (attr
< MAX_VERT_ATTRS
)
452 DISPATCH_ATTR4F( attr
, v
[0], v
[1], v
[2], v
[3] );
456 /* NV_vertex_program:
458 * Check for errors & reroute through second dispatch layer to get
459 * size tracking per-attribute.
461 static void tnl_VertexAttrib1fNV( GLuint index
, GLfloat s
)
463 if (index
< MAX_VERT_ATTRS
)
464 DISPATCH_ATTR1F( index
, s
);
469 static void tnl_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
471 if (index
< MAX_VERT_ATTRS
)
472 DISPATCH_ATTR1F( index
, v
[0] );
477 static void tnl_VertexAttrib2fNV( GLuint index
, GLfloat s
, GLfloat t
)
479 if (index
< MAX_VERT_ATTRS
)
480 DISPATCH_ATTR2F( index
, s
, t
);
485 static void tnl_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
487 if (index
< MAX_VERT_ATTRS
)
488 DISPATCH_ATTR2F( index
, v
[0], v
[1] );
493 static void tnl_VertexAttrib3fNV( GLuint index
, GLfloat s
, GLfloat t
,
496 if (index
< MAX_VERT_ATTRS
)
497 DISPATCH_ATTR3F( index
, s
, t
, r
);
502 static void tnl_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
504 if (index
< MAX_VERT_ATTRS
)
505 DISPATCH_ATTR3F( index
, v
[0], v
[1], v
[2] );
510 static void tnl_VertexAttrib4fNV( GLuint index
, GLfloat s
, GLfloat t
,
511 GLfloat r
, GLfloat q
)
513 if (index
< MAX_VERT_ATTRS
)
514 DISPATCH_ATTR4F( index
, s
, t
, r
, q
);
519 static void tnl_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
521 if (index
< MAX_VERT_ATTRS
)
522 DISPATCH_ATTR4F( index
, v
[0], v
[1], v
[2], v
[3] );
535 * These are treated as per-vertex attributes, at indices above where
536 * the NV_vertex_program leaves off. There are a lot of good things
537 * about treating materials this way.
539 * *** Need a dispatch step (like VertexAttribute GLint attr, and MultiTexCoord)
540 * *** to expand vertex size, etc. Use the same second level dispatch
541 * *** (keyed by attr number) as above.
543 #define MAT( ATTR, face, params ) \
545 if (face != GL_BACK) \
546 DISPATCH_ATTRF( ATTR, N, params ); \
547 if (face != GL_FRONT) \
548 DISPATCH_ATTRF( ATTR+7, N, params ); \
552 /* NOTE: Have to remove/dealwith colormaterial crossovers, probably
553 * later on - in the meantime just store everything.
555 static void _tnl_Materialfv( GLenum face
, GLenum pname
,
556 const GLfloat
*params
)
560 MAT( VERT_ATTRIB_FRONT_EMMISSION
, 4, face
, params
);
563 MAT( VERT_ATTRIB_FRONT_AMBIENT
, 4, face
, params
);
566 MAT( VERT_ATTRIB_FRONT_DIFFUSE
, 4, face
, params
);
569 MAT( VERT_ATTRIB_FRONT_SPECULAR
, 4, face
, params
);
572 MAT( VERT_ATTRIB_FRONT_SHININESS
, 1, face
, params
);
574 case GL_COLOR_INDEXES
:
575 MAT( VERT_ATTRIB_FRONT_EMMISSION
, 3, face
, params
);
577 case GL_AMBIENT_AND_DIFFUSE
:
578 MAT( VERT_ATTRIB_FRONT_AMBIENT
, 4, face
, params
);
579 MAT( VERT_ATTRIB_FRONT_DIFFUSE
, 4, face
, params
);
582 _mesa_error( ctx
, GL_INVALID_ENUM
, where
);
592 static struct dynfn
*lookup( struct dynfn
*l
, int key
)
606 struct _tnl_vertex_descriptor
{
611 /* Can't use the loopback template for this:
613 #define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
614 static void choose_##FN ARGS1 \
616 int key = tnl->vertex_format & (MASK|ACTIVE); \
617 struct dynfn *dfn = lookup( &tnl->dfn_cache.FN, key ); \
620 dfn = tnl->codegen.FN( &vb, key ); \
621 else if (MESA_VERBOSE & DEBUG_CODEGEN) \
622 _mesa_debug(NULL, "%s -- cached codegen\n", __FUNCTION__ ); \
625 tnl->context->Exec->FN = (FNTYPE)(dfn->code); \
627 if (MESA_VERBOSE & DEBUG_CODEGEN) \
628 _mesa_debug(NULL, "%s -- generic version\n", __FUNCTION__ ); \
629 tnl->context->Exec->FN = tnl_##FN; \
632 tnl->context->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
633 tnl->context->Exec->FN ARGS2; \
638 CHOOSE(Normal3f
, p3f
, 3, VERT_ATTRIB_NORMAL
,
639 (GLfloat a
,GLfloat b
,GLfloat c
), (a
,b
,c
))
640 CHOOSE(Normal3fv
, pfv
, 3, VERT_ATTRIB_NORMAL
,
641 (const GLfloat
*v
), (v
))
643 CHOOSE(Color4ub
, p4ub
, 4, VERT_ATTRIB_COLOR0
,
644 (GLubyte a
,GLubyte b
, GLubyte c
, GLubyte d
), (a
,b
,c
,d
))
645 CHOOSE(Color4ubv
, pubv
, 4, VERT_ATTRIB_COLOR0
,
646 (const GLubyte
*v
), (v
))
647 CHOOSE(Color3ub
, p3ub
, 3, VERT_ATTRIB_COLOR0
,
648 (GLubyte a
,GLubyte b
, GLubyte c
), (a
,b
,c
))
649 CHOOSE(Color3ubv
, pubv
, 3, VERT_ATTRIB_COLOR0
,
650 (const GLubyte
*v
), (v
))
652 CHOOSE(Color4f
, p4f
, 4, VERT_ATTRIB_COLOR0
,
653 (GLfloat a
,GLfloat b
, GLfloat c
, GLfloat d
), (a
,b
,c
,d
))
654 CHOOSE(Color4fv
, pfv
, 4, VERT_ATTRIB_COLOR0
,
655 (const GLfloat
*v
), (v
))
656 CHOOSE(Color3f
, p3f
, 3, VERT_ATTRIB_COLOR0
,
657 (GLfloat a
,GLfloat b
, GLfloat c
), (a
,b
,c
))
658 CHOOSE(Color3fv
, pfv
, 3, VERT_ATTRIB_COLOR0
,
659 (const GLfloat
*v
), (v
))
662 CHOOSE(SecondaryColor3ubEXT
, p3ub
, VERT_ATTRIB_COLOR1
,
663 (GLubyte a
,GLubyte b
, GLubyte c
), (a
,b
,c
))
664 CHOOSE(SecondaryColor3ubvEXT
, pubv
, VERT_ATTRIB_COLOR1
,
665 (const GLubyte
*v
), (v
))
666 CHOOSE(SecondaryColor3fEXT
, p3f
, VERT_ATTRIB_COLOR1
,
667 (GLfloat a
,GLfloat b
, GLfloat c
), (a
,b
,c
))
668 CHOOSE(SecondaryColor3fvEXT
, pfv
, VERT_ATTRIB_COLOR1
,
669 (const GLfloat
*v
), (v
))
671 CHOOSE(TexCoord2f
, p2f
, VERT_ATTRIB_TEX0
,
672 (GLfloat a
,GLfloat b
), (a
,b
))
673 CHOOSE(TexCoord2fv
, pfv
, VERT_ATTRIB_TEX0
,
674 (const GLfloat
*v
), (v
))
675 CHOOSE(TexCoord1f
, p1f
, VERT_ATTRIB_TEX0
,
677 CHOOSE(TexCoord1fv
, pfv
, VERT_ATTRIB_TEX0
,
678 (const GLfloat
*v
), (v
))
680 CHOOSE(MultiTexCoord2fARB
, pe2f
, VERT_ATTRIB_TEX0
,
681 (GLenum u
,GLfloat a
,GLfloat b
), (u
,a
,b
))
682 CHOOSE(MultiTexCoord2fvARB
, pefv
, MASK_ST_ALL
, ACTIVE_ST_ALL
,
683 (GLenum u
,const GLfloat
*v
), (u
,v
))
684 CHOOSE(MultiTexCoord1fARB
, pe1f
, MASK_ST_ALL
, ACTIVE_ST_ALL
,
685 (GLenum u
,GLfloat a
), (u
,a
))
686 CHOOSE(MultiTexCoord1fvARB
, pefv
, MASK_ST_ALL
, ACTIVE_ST_ALL
,
687 (GLenum u
,const GLfloat
*v
), (u
,v
))
689 CHOOSE(Vertex3f
, p3f
, VERT_ATTRIB_POS
,
690 (GLfloat a
,GLfloat b
,GLfloat c
), (a
,b
,c
))
691 CHOOSE(Vertex3fv
, pfv
, VERT_ATTRIB_POS
,
692 (const GLfloat
*v
), (v
))
693 CHOOSE(Vertex2f
, p2f
, VERT_ATTRIB_POS
,
694 (GLfloat a
,GLfloat b
), (a
,b
))
695 CHOOSE(Vertex2fv
, pfv
, VERT_ATTRIB_POS
,
696 (const GLfloat
*v
), (v
))
702 void _tnl_InitVtxfmtChoosers( GLvertexformat
*vfmt
)
704 vfmt
->Color3f
= choose_Color3f
;
705 vfmt
->Color3fv
= choose_Color3fv
;
706 vfmt
->Color3ub
= choose_Color3ub
;
707 vfmt
->Color3ubv
= choose_Color3ubv
;
708 vfmt
->Color4f
= choose_Color4f
;
709 vfmt
->Color4fv
= choose_Color4fv
;
710 vfmt
->Color4ub
= choose_Color4ub
;
711 vfmt
->Color4ubv
= choose_Color4ubv
;
712 vfmt
->SecondaryColor3fEXT
= choose_SecondaryColor3fEXT
;
713 vfmt
->SecondaryColor3fvEXT
= choose_SecondaryColor3fvEXT
;
714 vfmt
->SecondaryColor3ubEXT
= choose_SecondaryColor3ubEXT
;
715 vfmt
->SecondaryColor3ubvEXT
= choose_SecondaryColor3ubvEXT
;
716 vfmt
->MultiTexCoord1fARB
= dd_MultiTexCoord1fARB
;
717 vfmt
->MultiTexCoord1fvARB
= dd_MultiTexCoord1fvARB
;
718 vfmt
->MultiTexCoord2fARB
= dd_MultiTexCoord2fARB
;
719 vfmt
->MultiTexCoord2fvARB
= dd_MultiTexCoord2fvARB
;
720 vfmt
->MultiTexCoord3fARB
= dd_MultiTexCoord3fARB
;
721 vfmt
->MultiTexCoord3fvARB
= dd_MultiTexCoord3fvARB
;
722 vfmt
->MultiTexCoord4fARB
= dd_MultiTexCoord4fARB
;
723 vfmt
->MultiTexCoord4fvARB
= dd_MultiTexCoord4fvARB
;
724 vfmt
->Normal3f
= choose_Normal3f
;
725 vfmt
->Normal3fv
= choose_Normal3fv
;
726 vfmt
->TexCoord1f
= choose_TexCoord1f
;
727 vfmt
->TexCoord1fv
= choose_TexCoord1fv
;
728 vfmt
->TexCoord2f
= choose_TexCoord2f
;
729 vfmt
->TexCoord2fv
= choose_TexCoord2fv
;
730 vfmt
->TexCoord3f
= choose_TexCoord3f
;
731 vfmt
->TexCoord3fv
= choose_TexCoord3fv
;
732 vfmt
->TexCoord4f
= choose_TexCoord4f
;
733 vfmt
->TexCoord4fv
= choose_TexCoord4fv
;
734 vfmt
->Vertex2f
= choose_Vertex2f
;
735 vfmt
->Vertex2fv
= choose_Vertex2fv
;
736 vfmt
->Vertex3f
= choose_Vertex3f
;
737 vfmt
->Vertex3fv
= choose_Vertex3fv
;
738 vfmt
->Vertex4f
= choose_Vertex4f
;
739 vfmt
->Vertex4fv
= choose_Vertex4fv
;
740 vfmt
->FogCoordfvEXT
= choose_FogCoordfvEXT
;
741 vfmt
->FogCoordfEXT
= choose_FogCoordfEXT
;
742 vfmt
->EdgeFlag
= choose_EdgeFlag
;
743 vfmt
->EdgeFlagv
= choose_EdgeFlagv
;
744 vfmt
->Indexi
= choose_Indexi
;
745 vfmt
->Indexiv
= choose_Indexiv
;
746 vfmt
->EvalCoord1f
= choose_EvalCoord1f
;
747 vfmt
->EvalCoord1fv
= choose_EvalCoord1fv
;
748 vfmt
->EvalCoord2f
= choose_EvalCoord2f
;
749 vfmt
->EvalCoord2fv
= choose_EvalCoord2fv
;
750 vfmt
->Materialfv
= dd_Materialfv
;
754 static struct dynfn
*codegen_noop( struct _vb
*vb
, int key
)
756 (void) vb
; (void) key
;
760 void _tnl_InitCodegen( struct dfn_generators
*gen
)
762 /* Generate an attribute or vertex command.
764 gen
->Attr1f
= codegen_noop
;
765 gen
->Attr1fv
= codegen_noop
;
766 gen
->Attr2f
= codegen_noop
;
767 gen
->Attr2fv
= codegen_noop
;
768 gen
->Attr3f
= codegen_noop
;
769 gen
->Attr3fv
= codegen_noop
;
770 gen
->Attr4f
= codegen_noop
;
771 gen
->Attr4fv
= codegen_noop
;
773 /* Index is never zero for these...
775 gen
->Attr3ub
= codegen_noop
;
776 gen
->Attr3ubv
= codegen_noop
;
777 gen
->Attr4ub
= codegen_noop
;
778 gen
->Attr4ubv
= codegen_noop
;
780 /* As above, but deal with the extra (redundant by now) index
781 * argument to the generated function.
783 gen
->NVAttr1f
= codegen_noop
;
784 gen
->NVAttr1fv
= codegen_noop
;
785 gen
->NVAttr2f
= codegen_noop
;
786 gen
->NVAttr2fv
= codegen_noop
;
787 gen
->NVAttr3f
= codegen_noop
;
788 gen
->NVAttr3fv
= codegen_noop
;
789 gen
->NVAttr4f
= codegen_noop
;
790 gen
->NVAttr4fv
= codegen_noop
;
793 if (!getenv("MESA_NO_CODEGEN")) {
794 #if defined(USE_X86_ASM)
795 _tnl_InitX86Codegen( gen
);
798 #if defined(USE_SSE_ASM)
799 _tnl_InitSSECodegen( gen
);
802 #if defined(USE_3DNOW_ASM)
805 #if defined(USE_SPARC_ASM)