2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * Keith Whitwell <keith@tungstengraphics.com>
30 #include "api_arrayelt.h"
37 typedef void (GLAPIENTRY
*array_func
)( const void * );
40 const struct gl_client_array
*array
;
44 typedef void (GLAPIENTRY
*attrib_func
)( GLuint indx
, const void *data
);
47 const struct gl_client_array
*array
;
54 AEattrib attribs
[VERT_ATTRIB_MAX
+ 1];
58 #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context)
61 * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
62 * in the range [0, 7]. Luckily these type tokens are sequentially
65 #define TYPE_IDX(t) ((t) & 0xf)
68 static void (GLAPIENTRY
*colorfuncs
[2][8])( const void * ) = {
69 { (array_func
)glColor3bv
,
70 (array_func
)glColor3ubv
,
71 (array_func
)glColor3sv
,
72 (array_func
)glColor3usv
,
73 (array_func
)glColor3iv
,
74 (array_func
)glColor3uiv
,
75 (array_func
)glColor3fv
,
76 (array_func
)glColor3dv
},
78 { (array_func
)glColor4bv
,
79 (array_func
)glColor4ubv
,
80 (array_func
)glColor4sv
,
81 (array_func
)glColor4usv
,
82 (array_func
)glColor4iv
,
83 (array_func
)glColor4uiv
,
84 (array_func
)glColor4fv
,
85 (array_func
)glColor4dv
}
88 static void (GLAPIENTRY
*vertexfuncs
[3][8])( const void * ) = {
91 (array_func
)glVertex2sv
,
93 (array_func
)glVertex2iv
,
95 (array_func
)glVertex2fv
,
96 (array_func
)glVertex2dv
},
100 (array_func
)glVertex3sv
,
102 (array_func
)glVertex3iv
,
104 (array_func
)glVertex3fv
,
105 (array_func
)glVertex3dv
},
109 (array_func
)glVertex4sv
,
111 (array_func
)glVertex4iv
,
113 (array_func
)glVertex4fv
,
114 (array_func
)glVertex4dv
}
117 static void (GLAPIENTRY
*indexfuncs
[8])( const void * ) = {
119 (array_func
)glIndexubv
,
120 (array_func
)glIndexsv
,
122 (array_func
)glIndexiv
,
124 (array_func
)glIndexfv
,
125 (array_func
)glIndexdv
128 static void (GLAPIENTRY
*normalfuncs
[8])( const void * ) = {
129 (array_func
)glNormal3bv
,
131 (array_func
)glNormal3sv
,
133 (array_func
)glNormal3iv
,
135 (array_func
)glNormal3fv
,
136 (array_func
)glNormal3dv
,
140 /* Wrapper functions in case glSecondaryColor*EXT doesn't exist */
141 static void SecondaryColor3bvEXT(const GLbyte
*c
)
143 _glapi_Dispatch
->SecondaryColor3bvEXT(c
);
146 static void SecondaryColor3ubvEXT(const GLubyte
*c
)
148 _glapi_Dispatch
->SecondaryColor3ubvEXT(c
);
151 static void SecondaryColor3svEXT(const GLshort
*c
)
153 _glapi_Dispatch
->SecondaryColor3svEXT(c
);
156 static void SecondaryColor3usvEXT(const GLushort
*c
)
158 _glapi_Dispatch
->SecondaryColor3usvEXT(c
);
161 static void SecondaryColor3ivEXT(const GLint
*c
)
163 _glapi_Dispatch
->SecondaryColor3ivEXT(c
);
166 static void SecondaryColor3uivEXT(const GLuint
*c
)
168 _glapi_Dispatch
->SecondaryColor3uivEXT(c
);
171 static void SecondaryColor3fvEXT(const GLfloat
*c
)
173 _glapi_Dispatch
->SecondaryColor3fvEXT(c
);
176 static void SecondaryColor3dvEXT(const GLdouble
*c
)
178 _glapi_Dispatch
->SecondaryColor3dvEXT(c
);
181 static void (GLAPIENTRY
*secondarycolorfuncs
[8])( const void * ) = {
182 (array_func
) SecondaryColor3bvEXT
,
183 (array_func
) SecondaryColor3ubvEXT
,
184 (array_func
) SecondaryColor3svEXT
,
185 (array_func
) SecondaryColor3usvEXT
,
186 (array_func
) SecondaryColor3ivEXT
,
187 (array_func
) SecondaryColor3uivEXT
,
188 (array_func
) SecondaryColor3fvEXT
,
189 (array_func
) SecondaryColor3dvEXT
,
193 /* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */
194 static void FogCoordfvEXT(const GLfloat
*f
)
196 _glapi_Dispatch
->FogCoordfvEXT(f
);
199 static void FogCoorddvEXT(const GLdouble
*f
)
201 _glapi_Dispatch
->FogCoorddvEXT(f
);
204 static void (GLAPIENTRY
*fogcoordfuncs
[8])( const void * ) = {
211 (array_func
) FogCoordfvEXT
,
212 (array_func
) FogCoorddvEXT
216 /**********************************************************************/
218 /* GL_BYTE attributes */
220 static void VertexAttrib1Nbv(GLuint index
, const GLbyte
*v
)
222 _glapi_Dispatch
->VertexAttrib1fNV(index
, BYTE_TO_FLOAT(v
[0]));
225 static void VertexAttrib1bv(GLuint index
, const GLbyte
*v
)
227 _glapi_Dispatch
->VertexAttrib1fNV(index
, v
[0]);
230 static void VertexAttrib2Nbv(GLuint index
, const GLbyte
*v
)
232 _glapi_Dispatch
->VertexAttrib2fNV(index
, BYTE_TO_FLOAT(v
[0]),
233 BYTE_TO_FLOAT(v
[1]));
236 static void VertexAttrib2bv(GLuint index
, const GLbyte
*v
)
238 _glapi_Dispatch
->VertexAttrib2fNV(index
, v
[0], v
[1]);
241 static void VertexAttrib3Nbv(GLuint index
, const GLbyte
*v
)
243 _glapi_Dispatch
->VertexAttrib3fNV(index
, BYTE_TO_FLOAT(v
[0]),
245 BYTE_TO_FLOAT(v
[2]));
248 static void VertexAttrib3bv(GLuint index
, const GLbyte
*v
)
250 _glapi_Dispatch
->VertexAttrib3fNV(index
, v
[0], v
[1], v
[2]);
253 static void VertexAttrib4Nbv(GLuint index
, const GLbyte
*v
)
255 _glapi_Dispatch
->VertexAttrib4fNV(index
, BYTE_TO_FLOAT(v
[0]),
258 BYTE_TO_FLOAT(v
[3]));
261 static void VertexAttrib4bv(GLuint index
, const GLbyte
*v
)
263 _glapi_Dispatch
->VertexAttrib4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
266 /* GL_UNSIGNED_BYTE attributes */
268 static void VertexAttrib1Nubv(GLuint index
, const GLubyte
*v
)
270 _glapi_Dispatch
->VertexAttrib1fNV(index
, UBYTE_TO_FLOAT(v
[0]));
273 static void VertexAttrib1ubv(GLuint index
, const GLubyte
*v
)
275 _glapi_Dispatch
->VertexAttrib1fNV(index
, v
[0]);
278 static void VertexAttrib2Nubv(GLuint index
, const GLubyte
*v
)
280 _glapi_Dispatch
->VertexAttrib2fNV(index
, UBYTE_TO_FLOAT(v
[0]),
281 UBYTE_TO_FLOAT(v
[1]));
284 static void VertexAttrib2ubv(GLuint index
, const GLubyte
*v
)
286 _glapi_Dispatch
->VertexAttrib2fNV(index
, v
[0], v
[1]);
289 static void VertexAttrib3Nubv(GLuint index
, const GLubyte
*v
)
291 _glapi_Dispatch
->VertexAttrib3fNV(index
, UBYTE_TO_FLOAT(v
[0]),
292 UBYTE_TO_FLOAT(v
[1]),
293 UBYTE_TO_FLOAT(v
[2]));
295 static void VertexAttrib3ubv(GLuint index
, const GLubyte
*v
)
297 _glapi_Dispatch
->VertexAttrib3fNV(index
, v
[0], v
[1], v
[2]);
300 static void VertexAttrib4Nubv(GLuint index
, const GLubyte
*v
)
302 _glapi_Dispatch
->VertexAttrib4fNV(index
, UBYTE_TO_FLOAT(v
[0]),
303 UBYTE_TO_FLOAT(v
[1]),
304 UBYTE_TO_FLOAT(v
[2]),
305 UBYTE_TO_FLOAT(v
[3]));
308 static void VertexAttrib4ubv(GLuint index
, const GLubyte
*v
)
310 _glapi_Dispatch
->VertexAttrib4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
313 /* GL_SHORT attributes */
315 static void VertexAttrib1Nsv(GLuint index
, const GLshort
*v
)
317 _glapi_Dispatch
->VertexAttrib1fNV(index
, SHORT_TO_FLOAT(v
[0]));
320 static void VertexAttrib1sv(GLuint index
, const GLshort
*v
)
322 _glapi_Dispatch
->VertexAttrib1fNV(index
, v
[0]);
325 static void VertexAttrib2Nsv(GLuint index
, const GLshort
*v
)
327 _glapi_Dispatch
->VertexAttrib2fNV(index
, SHORT_TO_FLOAT(v
[0]),
328 SHORT_TO_FLOAT(v
[1]));
331 static void VertexAttrib2sv(GLuint index
, const GLshort
*v
)
333 _glapi_Dispatch
->VertexAttrib2fNV(index
, v
[0], v
[1]);
336 static void VertexAttrib3Nsv(GLuint index
, const GLshort
*v
)
338 _glapi_Dispatch
->VertexAttrib3fNV(index
, SHORT_TO_FLOAT(v
[0]),
339 SHORT_TO_FLOAT(v
[1]),
340 SHORT_TO_FLOAT(v
[2]));
343 static void VertexAttrib3sv(GLuint index
, const GLshort
*v
)
345 _glapi_Dispatch
->VertexAttrib3fNV(index
, v
[0], v
[1], v
[2]);
348 static void VertexAttrib4Nsv(GLuint index
, const GLshort
*v
)
350 _glapi_Dispatch
->VertexAttrib4fNV(index
, SHORT_TO_FLOAT(v
[0]),
351 SHORT_TO_FLOAT(v
[1]),
352 SHORT_TO_FLOAT(v
[2]),
353 SHORT_TO_FLOAT(v
[3]));
356 static void VertexAttrib4sv(GLuint index
, const GLshort
*v
)
358 _glapi_Dispatch
->VertexAttrib4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
361 /* GL_UNSIGNED_SHORT attributes */
363 static void VertexAttrib1Nusv(GLuint index
, const GLushort
*v
)
365 _glapi_Dispatch
->VertexAttrib1fNV(index
, USHORT_TO_FLOAT(v
[0]));
368 static void VertexAttrib1usv(GLuint index
, const GLushort
*v
)
370 _glapi_Dispatch
->VertexAttrib1fNV(index
, v
[0]);
373 static void VertexAttrib2Nusv(GLuint index
, const GLushort
*v
)
375 _glapi_Dispatch
->VertexAttrib2fNV(index
, USHORT_TO_FLOAT(v
[0]),
376 USHORT_TO_FLOAT(v
[1]));
379 static void VertexAttrib2usv(GLuint index
, const GLushort
*v
)
381 _glapi_Dispatch
->VertexAttrib2fNV(index
, v
[0], v
[1]);
384 static void VertexAttrib3Nusv(GLuint index
, const GLushort
*v
)
386 _glapi_Dispatch
->VertexAttrib3fNV(index
, USHORT_TO_FLOAT(v
[0]),
387 USHORT_TO_FLOAT(v
[1]),
388 USHORT_TO_FLOAT(v
[2]));
391 static void VertexAttrib3usv(GLuint index
, const GLushort
*v
)
393 _glapi_Dispatch
->VertexAttrib3fNV(index
, v
[0], v
[1], v
[2]);
396 static void VertexAttrib4Nusv(GLuint index
, const GLushort
*v
)
398 _glapi_Dispatch
->VertexAttrib4fNV(index
, USHORT_TO_FLOAT(v
[0]),
399 USHORT_TO_FLOAT(v
[1]),
400 USHORT_TO_FLOAT(v
[2]),
401 USHORT_TO_FLOAT(v
[3]));
404 static void VertexAttrib4usv(GLuint index
, const GLushort
*v
)
406 _glapi_Dispatch
->VertexAttrib4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
409 /* GL_INT attributes */
411 static void VertexAttrib1Niv(GLuint index
, const GLint
*v
)
413 _glapi_Dispatch
->VertexAttrib1fNV(index
, INT_TO_FLOAT(v
[0]));
416 static void VertexAttrib1iv(GLuint index
, const GLint
*v
)
418 _glapi_Dispatch
->VertexAttrib1fNV(index
, v
[0]);
421 static void VertexAttrib2Niv(GLuint index
, const GLint
*v
)
423 _glapi_Dispatch
->VertexAttrib2fNV(index
, INT_TO_FLOAT(v
[0]),
427 static void VertexAttrib2iv(GLuint index
, const GLint
*v
)
429 _glapi_Dispatch
->VertexAttrib2fNV(index
, v
[0], v
[1]);
432 static void VertexAttrib3Niv(GLuint index
, const GLint
*v
)
434 _glapi_Dispatch
->VertexAttrib3fNV(index
, INT_TO_FLOAT(v
[0]),
439 static void VertexAttrib3iv(GLuint index
, const GLint
*v
)
441 _glapi_Dispatch
->VertexAttrib3fNV(index
, v
[0], v
[1], v
[2]);
444 static void VertexAttrib4Niv(GLuint index
, const GLint
*v
)
446 _glapi_Dispatch
->VertexAttrib4fNV(index
, INT_TO_FLOAT(v
[0]),
452 static void VertexAttrib4iv(GLuint index
, const GLint
*v
)
454 _glapi_Dispatch
->VertexAttrib4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
457 /* GL_UNSIGNED_INT attributes */
459 static void VertexAttrib1Nuiv(GLuint index
, const GLuint
*v
)
461 _glapi_Dispatch
->VertexAttrib1fNV(index
, UINT_TO_FLOAT(v
[0]));
464 static void VertexAttrib1uiv(GLuint index
, const GLuint
*v
)
466 _glapi_Dispatch
->VertexAttrib1fNV(index
, v
[0]);
469 static void VertexAttrib2Nuiv(GLuint index
, const GLuint
*v
)
471 _glapi_Dispatch
->VertexAttrib2fNV(index
, UINT_TO_FLOAT(v
[0]),
472 UINT_TO_FLOAT(v
[1]));
475 static void VertexAttrib2uiv(GLuint index
, const GLuint
*v
)
477 _glapi_Dispatch
->VertexAttrib2fNV(index
, v
[0], v
[1]);
480 static void VertexAttrib3Nuiv(GLuint index
, const GLuint
*v
)
482 _glapi_Dispatch
->VertexAttrib3fNV(index
, UINT_TO_FLOAT(v
[0]),
484 UINT_TO_FLOAT(v
[2]));
487 static void VertexAttrib3uiv(GLuint index
, const GLuint
*v
)
489 _glapi_Dispatch
->VertexAttrib3fNV(index
, v
[0], v
[1], v
[2]);
492 static void VertexAttrib4Nuiv(GLuint index
, const GLuint
*v
)
494 _glapi_Dispatch
->VertexAttrib4fNV(index
, UINT_TO_FLOAT(v
[0]),
497 UINT_TO_FLOAT(v
[3]));
500 static void VertexAttrib4uiv(GLuint index
, const GLuint
*v
)
502 _glapi_Dispatch
->VertexAttrib4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
505 /* GL_FLOAT attributes */
507 static void VertexAttrib1fv(GLuint index
, const GLfloat
*v
)
509 _glapi_Dispatch
->VertexAttrib1fvNV(index
, v
);
512 static void VertexAttrib2fv(GLuint index
, const GLfloat
*v
)
514 _glapi_Dispatch
->VertexAttrib2fvNV(index
, v
);
517 static void VertexAttrib3fv(GLuint index
, const GLfloat
*v
)
519 _glapi_Dispatch
->VertexAttrib3fvNV(index
, v
);
522 static void VertexAttrib4fv(GLuint index
, const GLfloat
*v
)
524 _glapi_Dispatch
->VertexAttrib4fvNV(index
, v
);
527 /* GL_DOUBLE attributes */
529 static void VertexAttrib1dv(GLuint index
, const GLdouble
*v
)
531 _glapi_Dispatch
->VertexAttrib1dvNV(index
, v
);
534 static void VertexAttrib2dv(GLuint index
, const GLdouble
*v
)
536 _glapi_Dispatch
->VertexAttrib2dvNV(index
, v
);
539 static void VertexAttrib3dv(GLuint index
, const GLdouble
*v
)
541 _glapi_Dispatch
->VertexAttrib3dvNV(index
, v
);
544 static void VertexAttrib4dv(GLuint index
, const GLdouble
*v
)
546 _glapi_Dispatch
->VertexAttrib4dvNV(index
, v
);
551 * Array [size][type] of VertexAttrib functions
553 static void (GLAPIENTRY
*attribfuncs
[2][4][8])( GLuint
, const void * ) = {
558 (attrib_func
) VertexAttrib1bv
,
559 (attrib_func
) VertexAttrib1ubv
,
560 (attrib_func
) VertexAttrib1sv
,
561 (attrib_func
) VertexAttrib1usv
,
562 (attrib_func
) VertexAttrib1iv
,
563 (attrib_func
) VertexAttrib1uiv
,
564 (attrib_func
) VertexAttrib1fv
,
565 (attrib_func
) VertexAttrib1dv
569 (attrib_func
) VertexAttrib2bv
,
570 (attrib_func
) VertexAttrib2ubv
,
571 (attrib_func
) VertexAttrib2sv
,
572 (attrib_func
) VertexAttrib2usv
,
573 (attrib_func
) VertexAttrib2iv
,
574 (attrib_func
) VertexAttrib2uiv
,
575 (attrib_func
) VertexAttrib2fv
,
576 (attrib_func
) VertexAttrib2dv
580 (attrib_func
) VertexAttrib3bv
,
581 (attrib_func
) VertexAttrib3ubv
,
582 (attrib_func
) VertexAttrib3sv
,
583 (attrib_func
) VertexAttrib3usv
,
584 (attrib_func
) VertexAttrib3iv
,
585 (attrib_func
) VertexAttrib3uiv
,
586 (attrib_func
) VertexAttrib3fv
,
587 (attrib_func
) VertexAttrib3dv
591 (attrib_func
) VertexAttrib4bv
,
592 (attrib_func
) VertexAttrib4ubv
,
593 (attrib_func
) VertexAttrib4sv
,
594 (attrib_func
) VertexAttrib4usv
,
595 (attrib_func
) VertexAttrib4iv
,
596 (attrib_func
) VertexAttrib4uiv
,
597 (attrib_func
) VertexAttrib4fv
,
598 (attrib_func
) VertexAttrib4dv
602 /* normalized (except for float/double) */
605 (attrib_func
) VertexAttrib1Nbv
,
606 (attrib_func
) VertexAttrib1Nubv
,
607 (attrib_func
) VertexAttrib1Nsv
,
608 (attrib_func
) VertexAttrib1Nusv
,
609 (attrib_func
) VertexAttrib1Niv
,
610 (attrib_func
) VertexAttrib1Nuiv
,
611 (attrib_func
) VertexAttrib1fv
,
612 (attrib_func
) VertexAttrib1dv
616 (attrib_func
) VertexAttrib2Nbv
,
617 (attrib_func
) VertexAttrib2Nubv
,
618 (attrib_func
) VertexAttrib2Nsv
,
619 (attrib_func
) VertexAttrib2Nusv
,
620 (attrib_func
) VertexAttrib2Niv
,
621 (attrib_func
) VertexAttrib2Nuiv
,
622 (attrib_func
) VertexAttrib2fv
,
623 (attrib_func
) VertexAttrib2dv
627 (attrib_func
) VertexAttrib3Nbv
,
628 (attrib_func
) VertexAttrib3Nubv
,
629 (attrib_func
) VertexAttrib3Nsv
,
630 (attrib_func
) VertexAttrib3Nusv
,
631 (attrib_func
) VertexAttrib3Niv
,
632 (attrib_func
) VertexAttrib3Nuiv
,
633 (attrib_func
) VertexAttrib3fv
,
634 (attrib_func
) VertexAttrib3dv
638 (attrib_func
) VertexAttrib4Nbv
,
639 (attrib_func
) VertexAttrib4Nubv
,
640 (attrib_func
) VertexAttrib4Nsv
,
641 (attrib_func
) VertexAttrib4Nusv
,
642 (attrib_func
) VertexAttrib4Niv
,
643 (attrib_func
) VertexAttrib4Nuiv
,
644 (attrib_func
) VertexAttrib4fv
,
645 (attrib_func
) VertexAttrib4dv
650 /**********************************************************************/
653 GLboolean
_ae_create_context( GLcontext
*ctx
)
655 if (ctx
->aelt_context
)
658 ctx
->aelt_context
= MALLOC( sizeof(AEcontext
) );
659 if (!ctx
->aelt_context
)
662 AE_CONTEXT(ctx
)->NewState
= ~0;
667 void _ae_destroy_context( GLcontext
*ctx
)
669 if ( AE_CONTEXT( ctx
) ) {
670 FREE( ctx
->aelt_context
);
671 ctx
->aelt_context
= 0;
677 * Make a list of per-vertex functions to call for each glArrayElement call.
678 * These functions access the array data (i.e. glVertex, glColor, glNormal, etc);
680 static void _ae_update_state( GLcontext
*ctx
)
682 AEcontext
*actx
= AE_CONTEXT(ctx
);
683 AEarray
*aa
= actx
->arrays
;
684 AEattrib
*at
= actx
->attribs
;
687 /* yuck, no generic array to correspond to color index or edge flag */
688 if (ctx
->Array
.Index
.Enabled
) {
689 aa
->array
= &ctx
->Array
.Index
;
690 aa
->func
= indexfuncs
[TYPE_IDX(aa
->array
->Type
)];
693 if (ctx
->Array
.EdgeFlag
.Enabled
) {
694 aa
->array
= &ctx
->Array
.EdgeFlag
;
695 aa
->func
= (array_func
) glEdgeFlagv
;
699 /* all other arrays handled here */
700 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++) {
701 /* Note: we count down to zero so glVertex (attrib 0) is last!!! */
702 const GLuint index
= VERT_ATTRIB_MAX
- i
- 1;
703 struct gl_client_array
*attribArray
= NULL
;
705 /* Generic arrays take priority over conventional arrays if vertex program
708 if (ctx
->VertexProgram
.Enabled
709 && ctx
->Array
.VertexAttrib
[index
].Enabled
) {
711 /* Special case: use glVertex() for vertex position so
712 * that it's always executed last.
714 aa
->array
= &ctx
->Array
.VertexAttrib
[0];
715 aa
->func
= vertexfuncs
[aa
->array
->Size
-2][TYPE_IDX(aa
->array
->Type
)];
719 attribArray
= &ctx
->Array
.VertexAttrib
[index
];
724 case VERT_ATTRIB_POS
:
725 if (ctx
->Array
.Vertex
.Enabled
) {
726 aa
->array
= &ctx
->Array
.Vertex
;
727 aa
->func
= vertexfuncs
[aa
->array
->Size
-2][TYPE_IDX(aa
->array
->Type
)];
731 case VERT_ATTRIB_NORMAL
:
732 if (ctx
->Array
.Normal
.Enabled
) {
733 aa
->array
= &ctx
->Array
.Normal
;
734 aa
->func
= normalfuncs
[TYPE_IDX(aa
->array
->Type
)];
738 case VERT_ATTRIB_COLOR0
:
739 if (ctx
->Array
.Color
.Enabled
) {
740 aa
->array
= &ctx
->Array
.Color
;
741 aa
->func
= colorfuncs
[aa
->array
->Size
-3][TYPE_IDX(aa
->array
->Type
)];
745 case VERT_ATTRIB_COLOR1
:
746 if (ctx
->Array
.SecondaryColor
.Enabled
) {
747 aa
->array
= &ctx
->Array
.SecondaryColor
;
748 aa
->func
= secondarycolorfuncs
[TYPE_IDX(aa
->array
->Type
)];
752 case VERT_ATTRIB_FOG
:
753 if (ctx
->Array
.FogCoord
.Enabled
) {
754 aa
->array
= &ctx
->Array
.FogCoord
;
755 aa
->func
= fogcoordfuncs
[TYPE_IDX(aa
->array
->Type
)];
759 case VERT_ATTRIB_TEX0
:
760 case VERT_ATTRIB_TEX1
:
761 case VERT_ATTRIB_TEX2
:
762 case VERT_ATTRIB_TEX3
:
763 case VERT_ATTRIB_TEX4
:
764 case VERT_ATTRIB_TEX5
:
765 case VERT_ATTRIB_TEX6
:
766 case VERT_ATTRIB_TEX7
:
767 /* use generic vertex attribs for texcoords */
768 if (ctx
->Array
.TexCoord
[index
- VERT_ATTRIB_TEX0
].Enabled
) {
769 attribArray
= &ctx
->Array
.TexCoord
[index
- VERT_ATTRIB_TEX0
];
776 /* Save glVertexAttrib call (may be for glMultiTexCoord) */
778 at
->array
= attribArray
;
779 if (attribArray
->Type
== GL_FLOAT
) {
780 switch (attribArray
->Size
) {
782 at
->func
= (attrib_func
) _glapi_Dispatch
->VertexAttrib1fvNV
;
785 at
->func
= (attrib_func
) _glapi_Dispatch
->VertexAttrib2fvNV
;
788 at
->func
= (attrib_func
) _glapi_Dispatch
->VertexAttrib3fvNV
;
791 at
->func
= (attrib_func
) _glapi_Dispatch
->VertexAttrib4fvNV
;
797 at
->func
= attribfuncs
[at
->array
->Normalized
][at
->array
->Size
-1][TYPE_IDX(at
->array
->Type
)];
804 ASSERT(at
- actx
->attribs
<= VERT_ATTRIB_MAX
);
805 ASSERT(aa
- actx
->arrays
< 32);
806 at
->func
= NULL
; /* terminate the list */
807 aa
->func
= NULL
; /* terminate the list */
813 void GLAPIENTRY
_ae_loopback_array_elt( GLint elt
)
815 GET_CURRENT_CONTEXT(ctx
);
816 const AEcontext
*actx
= AE_CONTEXT(ctx
);
821 _ae_update_state( ctx
);
823 /* generic attributes */
824 for (at
= actx
->attribs
; at
->func
; at
++) {
825 const GLubyte
*src
= at
->array
->BufferObj
->Data
826 + (GLuint
) at
->array
->Ptr
827 + elt
* at
->array
->StrideB
;
828 at
->func( at
->index
, src
);
831 /* conventional arrays */
832 for (aa
= actx
->arrays
; aa
->func
; aa
++) {
833 const GLubyte
*src
= aa
->array
->BufferObj
->Data
834 + (GLuint
) aa
->array
->Ptr
835 + elt
* aa
->array
->StrideB
;
842 void _ae_invalidate_state( GLcontext
*ctx
, GLuint new_state
)
844 AE_CONTEXT(ctx
)->NewState
|= new_state
;