2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
26 * This file implements the glArrayElement() function.
27 * It involves looking at the format/type of all the enabled vertex arrays
28 * and emitting a list of pointers to functions which set the per-vertex
29 * state for the element/index.
34 * Keith Whitwell <keithw@vmware.com>
39 #include "api_arrayelt.h"
40 #include "bufferobj.h"
45 #include "main/dispatch.h"
48 typedef void (GLAPIENTRY
*array_func
)( const void * );
51 const struct gl_array_attributes
*array
;
52 const struct gl_vertex_buffer_binding
*binding
;
56 typedef void (GLAPIENTRY
*attrib_func
)( GLuint indx
, const void *data
);
59 const struct gl_array_attributes
*array
;
60 const struct gl_vertex_buffer_binding
*binding
;
67 AEattrib attribs
[VERT_ATTRIB_MAX
+ 1];
74 static inline AEcontext
*
75 AE_CONTEXT(struct gl_context
*ctx
)
77 return (AEcontext
*) ctx
->aelt_context
;
82 * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
83 * in the range [0, 7]. Luckily these type tokens are sequentially
84 * numbered in gl.h, except for GL_DOUBLE.
89 return t
== GL_DOUBLE
? 7 : t
& 7;
94 * Convert normalized/integer/double to the range [0, 3].
97 vertex_format_to_index(const struct gl_vertex_format
*vformat
)
101 else if (vformat
->Integer
)
103 else if (vformat
->Normalized
)
111 _ae_is_state_dirty(struct gl_context
*ctx
)
113 return AE_CONTEXT(ctx
)->dirty_state
;
121 ** GL_NV_vertex_program
124 /* GL_BYTE attributes */
126 static void GLAPIENTRY
127 VertexAttrib1NbvNV(GLuint index
, const GLbyte
*v
)
129 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0])));
132 static void GLAPIENTRY
133 VertexAttrib1bvNV(GLuint index
, const GLbyte
*v
)
135 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
138 static void GLAPIENTRY
139 VertexAttrib2NbvNV(GLuint index
, const GLbyte
*v
)
141 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]), BYTE_TO_FLOAT(v
[1])));
144 static void GLAPIENTRY
145 VertexAttrib2bvNV(GLuint index
, const GLbyte
*v
)
147 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
150 static void GLAPIENTRY
151 VertexAttrib3NbvNV(GLuint index
, const GLbyte
*v
)
153 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
155 BYTE_TO_FLOAT(v
[2])));
158 static void GLAPIENTRY
159 VertexAttrib3bvNV(GLuint index
, const GLbyte
*v
)
161 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2]));
164 static void GLAPIENTRY
165 VertexAttrib4NbvNV(GLuint index
, const GLbyte
*v
)
167 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
170 BYTE_TO_FLOAT(v
[3])));
173 static void GLAPIENTRY
174 VertexAttrib4bvNV(GLuint index
, const GLbyte
*v
)
176 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2], (GLfloat
)v
[3]));
179 /* GL_UNSIGNED_BYTE attributes */
181 static void GLAPIENTRY
182 VertexAttrib1NubvNV(GLuint index
, const GLubyte
*v
)
184 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0])));
187 static void GLAPIENTRY
188 VertexAttrib1ubvNV(GLuint index
, const GLubyte
*v
)
190 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
193 static void GLAPIENTRY
194 VertexAttrib2NubvNV(GLuint index
, const GLubyte
*v
)
196 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0]),
197 UBYTE_TO_FLOAT(v
[1])));
200 static void GLAPIENTRY
201 VertexAttrib2ubvNV(GLuint index
, const GLubyte
*v
)
203 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
206 static void GLAPIENTRY
207 VertexAttrib3NubvNV(GLuint index
, const GLubyte
*v
)
209 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0]),
210 UBYTE_TO_FLOAT(v
[1]),
211 UBYTE_TO_FLOAT(v
[2])));
213 static void GLAPIENTRY
214 VertexAttrib3ubvNV(GLuint index
, const GLubyte
*v
)
216 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
217 (GLfloat
)v
[1], (GLfloat
)v
[2]));
220 static void GLAPIENTRY
221 VertexAttrib4NubvNV(GLuint index
, const GLubyte
*v
)
223 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0]),
224 UBYTE_TO_FLOAT(v
[1]),
225 UBYTE_TO_FLOAT(v
[2]),
226 UBYTE_TO_FLOAT(v
[3])));
229 static void GLAPIENTRY
230 VertexAttrib4ubvNV(GLuint index
, const GLubyte
*v
)
232 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
233 (GLfloat
)v
[1], (GLfloat
)v
[2],
237 /* GL_SHORT attributes */
239 static void GLAPIENTRY
240 VertexAttrib1NsvNV(GLuint index
, const GLshort
*v
)
242 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0])));
245 static void GLAPIENTRY
246 VertexAttrib1svNV(GLuint index
, const GLshort
*v
)
248 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
251 static void GLAPIENTRY
252 VertexAttrib2NsvNV(GLuint index
, const GLshort
*v
)
254 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0]),
255 SHORT_TO_FLOAT(v
[1])));
258 static void GLAPIENTRY
259 VertexAttrib2svNV(GLuint index
, const GLshort
*v
)
261 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
264 static void GLAPIENTRY
265 VertexAttrib3NsvNV(GLuint index
, const GLshort
*v
)
267 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0]),
268 SHORT_TO_FLOAT(v
[1]),
269 SHORT_TO_FLOAT(v
[2])));
272 static void GLAPIENTRY
273 VertexAttrib3svNV(GLuint index
, const GLshort
*v
)
275 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
279 static void GLAPIENTRY
280 VertexAttrib4NsvNV(GLuint index
, const GLshort
*v
)
282 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0]),
283 SHORT_TO_FLOAT(v
[1]),
284 SHORT_TO_FLOAT(v
[2]),
285 SHORT_TO_FLOAT(v
[3])));
288 static void GLAPIENTRY
289 VertexAttrib4svNV(GLuint index
, const GLshort
*v
)
291 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
292 (GLfloat
)v
[2], (GLfloat
)v
[3]));
295 /* GL_UNSIGNED_SHORT attributes */
297 static void GLAPIENTRY
298 VertexAttrib1NusvNV(GLuint index
, const GLushort
*v
)
300 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0])));
303 static void GLAPIENTRY
304 VertexAttrib1usvNV(GLuint index
, const GLushort
*v
)
306 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
309 static void GLAPIENTRY
310 VertexAttrib2NusvNV(GLuint index
, const GLushort
*v
)
312 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
313 USHORT_TO_FLOAT(v
[1])));
316 static void GLAPIENTRY
317 VertexAttrib2usvNV(GLuint index
, const GLushort
*v
)
319 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
323 static void GLAPIENTRY
324 VertexAttrib3NusvNV(GLuint index
, const GLushort
*v
)
326 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
327 USHORT_TO_FLOAT(v
[1]),
328 USHORT_TO_FLOAT(v
[2])));
331 static void GLAPIENTRY
332 VertexAttrib3usvNV(GLuint index
, const GLushort
*v
)
334 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
338 static void GLAPIENTRY
339 VertexAttrib4NusvNV(GLuint index
, const GLushort
*v
)
341 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
342 USHORT_TO_FLOAT(v
[1]),
343 USHORT_TO_FLOAT(v
[2]),
344 USHORT_TO_FLOAT(v
[3])));
347 static void GLAPIENTRY
348 VertexAttrib4usvNV(GLuint index
, const GLushort
*v
)
350 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
351 (GLfloat
)v
[2], (GLfloat
)v
[3]));
354 /* GL_INT attributes */
356 static void GLAPIENTRY
357 VertexAttrib1NivNV(GLuint index
, const GLint
*v
)
359 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0])));
362 static void GLAPIENTRY
363 VertexAttrib1ivNV(GLuint index
, const GLint
*v
)
365 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
368 static void GLAPIENTRY
369 VertexAttrib2NivNV(GLuint index
, const GLint
*v
)
371 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
372 INT_TO_FLOAT(v
[1])));
375 static void GLAPIENTRY
376 VertexAttrib2ivNV(GLuint index
, const GLint
*v
)
378 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
381 static void GLAPIENTRY
382 VertexAttrib3NivNV(GLuint index
, const GLint
*v
)
384 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
386 INT_TO_FLOAT(v
[2])));
389 static void GLAPIENTRY
390 VertexAttrib3ivNV(GLuint index
, const GLint
*v
)
392 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
396 static void GLAPIENTRY
397 VertexAttrib4NivNV(GLuint index
, const GLint
*v
)
399 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
402 INT_TO_FLOAT(v
[3])));
405 static void GLAPIENTRY
406 VertexAttrib4ivNV(GLuint index
, const GLint
*v
)
408 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
409 (GLfloat
)v
[2], (GLfloat
)v
[3]));
412 /* GL_UNSIGNED_INT attributes */
414 static void GLAPIENTRY
415 VertexAttrib1NuivNV(GLuint index
, const GLuint
*v
)
417 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0])));
420 static void GLAPIENTRY
421 VertexAttrib1uivNV(GLuint index
, const GLuint
*v
)
423 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
426 static void GLAPIENTRY
427 VertexAttrib2NuivNV(GLuint index
, const GLuint
*v
)
429 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
430 UINT_TO_FLOAT(v
[1])));
433 static void GLAPIENTRY
434 VertexAttrib2uivNV(GLuint index
, const GLuint
*v
)
436 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
440 static void GLAPIENTRY
441 VertexAttrib3NuivNV(GLuint index
, const GLuint
*v
)
443 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
445 UINT_TO_FLOAT(v
[2])));
448 static void GLAPIENTRY
449 VertexAttrib3uivNV(GLuint index
, const GLuint
*v
)
451 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
455 static void GLAPIENTRY
456 VertexAttrib4NuivNV(GLuint index
, const GLuint
*v
)
458 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
461 UINT_TO_FLOAT(v
[3])));
464 static void GLAPIENTRY
465 VertexAttrib4uivNV(GLuint index
, const GLuint
*v
)
467 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
468 (GLfloat
)v
[2], (GLfloat
)v
[3]));
471 /* GL_FLOAT attributes */
473 static void GLAPIENTRY
474 VertexAttrib1fvNV(GLuint index
, const GLfloat
*v
)
476 CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index
, v
));
479 static void GLAPIENTRY
480 VertexAttrib2fvNV(GLuint index
, const GLfloat
*v
)
482 CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index
, v
));
485 static void GLAPIENTRY
486 VertexAttrib3fvNV(GLuint index
, const GLfloat
*v
)
488 CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index
, v
));
491 static void GLAPIENTRY
492 VertexAttrib4fvNV(GLuint index
, const GLfloat
*v
)
494 CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index
, v
));
497 /* GL_DOUBLE attributes */
499 static void GLAPIENTRY
500 VertexAttrib1dvNV(GLuint index
, const GLdouble
*v
)
502 CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index
, v
));
505 static void GLAPIENTRY
506 VertexAttrib2dvNV(GLuint index
, const GLdouble
*v
)
508 CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index
, v
));
511 static void GLAPIENTRY
512 VertexAttrib3dvNV(GLuint index
, const GLdouble
*v
)
514 CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index
, v
));
517 static void GLAPIENTRY
518 VertexAttrib4dvNV(GLuint index
, const GLdouble
*v
)
520 CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index
, v
));
525 * Array [size][type] of VertexAttrib functions
527 static attrib_func AttribFuncsNV
[2][4][NUM_TYPES
] = {
532 (attrib_func
) VertexAttrib1bvNV
,
533 (attrib_func
) VertexAttrib1ubvNV
,
534 (attrib_func
) VertexAttrib1svNV
,
535 (attrib_func
) VertexAttrib1usvNV
,
536 (attrib_func
) VertexAttrib1ivNV
,
537 (attrib_func
) VertexAttrib1uivNV
,
538 (attrib_func
) VertexAttrib1fvNV
,
539 (attrib_func
) VertexAttrib1dvNV
543 (attrib_func
) VertexAttrib2bvNV
,
544 (attrib_func
) VertexAttrib2ubvNV
,
545 (attrib_func
) VertexAttrib2svNV
,
546 (attrib_func
) VertexAttrib2usvNV
,
547 (attrib_func
) VertexAttrib2ivNV
,
548 (attrib_func
) VertexAttrib2uivNV
,
549 (attrib_func
) VertexAttrib2fvNV
,
550 (attrib_func
) VertexAttrib2dvNV
554 (attrib_func
) VertexAttrib3bvNV
,
555 (attrib_func
) VertexAttrib3ubvNV
,
556 (attrib_func
) VertexAttrib3svNV
,
557 (attrib_func
) VertexAttrib3usvNV
,
558 (attrib_func
) VertexAttrib3ivNV
,
559 (attrib_func
) VertexAttrib3uivNV
,
560 (attrib_func
) VertexAttrib3fvNV
,
561 (attrib_func
) VertexAttrib3dvNV
565 (attrib_func
) VertexAttrib4bvNV
,
566 (attrib_func
) VertexAttrib4ubvNV
,
567 (attrib_func
) VertexAttrib4svNV
,
568 (attrib_func
) VertexAttrib4usvNV
,
569 (attrib_func
) VertexAttrib4ivNV
,
570 (attrib_func
) VertexAttrib4uivNV
,
571 (attrib_func
) VertexAttrib4fvNV
,
572 (attrib_func
) VertexAttrib4dvNV
576 /* normalized (except for float/double) */
579 (attrib_func
) VertexAttrib1NbvNV
,
580 (attrib_func
) VertexAttrib1NubvNV
,
581 (attrib_func
) VertexAttrib1NsvNV
,
582 (attrib_func
) VertexAttrib1NusvNV
,
583 (attrib_func
) VertexAttrib1NivNV
,
584 (attrib_func
) VertexAttrib1NuivNV
,
585 (attrib_func
) VertexAttrib1fvNV
,
586 (attrib_func
) VertexAttrib1dvNV
590 (attrib_func
) VertexAttrib2NbvNV
,
591 (attrib_func
) VertexAttrib2NubvNV
,
592 (attrib_func
) VertexAttrib2NsvNV
,
593 (attrib_func
) VertexAttrib2NusvNV
,
594 (attrib_func
) VertexAttrib2NivNV
,
595 (attrib_func
) VertexAttrib2NuivNV
,
596 (attrib_func
) VertexAttrib2fvNV
,
597 (attrib_func
) VertexAttrib2dvNV
601 (attrib_func
) VertexAttrib3NbvNV
,
602 (attrib_func
) VertexAttrib3NubvNV
,
603 (attrib_func
) VertexAttrib3NsvNV
,
604 (attrib_func
) VertexAttrib3NusvNV
,
605 (attrib_func
) VertexAttrib3NivNV
,
606 (attrib_func
) VertexAttrib3NuivNV
,
607 (attrib_func
) VertexAttrib3fvNV
,
608 (attrib_func
) VertexAttrib3dvNV
612 (attrib_func
) VertexAttrib4NbvNV
,
613 (attrib_func
) VertexAttrib4NubvNV
,
614 (attrib_func
) VertexAttrib4NsvNV
,
615 (attrib_func
) VertexAttrib4NusvNV
,
616 (attrib_func
) VertexAttrib4NivNV
,
617 (attrib_func
) VertexAttrib4NuivNV
,
618 (attrib_func
) VertexAttrib4fvNV
,
619 (attrib_func
) VertexAttrib4dvNV
626 ** GL_ARB_vertex_program
629 /* GL_BYTE attributes */
631 static void GLAPIENTRY
632 VertexAttrib1NbvARB(GLuint index
, const GLbyte
*v
)
634 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0])));
637 static void GLAPIENTRY
638 VertexAttrib1bvARB(GLuint index
, const GLbyte
*v
)
640 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
643 static void GLAPIENTRY
644 VertexAttrib2NbvARB(GLuint index
, const GLbyte
*v
)
646 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]), BYTE_TO_FLOAT(v
[1])));
649 static void GLAPIENTRY
650 VertexAttrib2bvARB(GLuint index
, const GLbyte
*v
)
652 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
655 static void GLAPIENTRY
656 VertexAttrib3NbvARB(GLuint index
, const GLbyte
*v
)
658 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
660 BYTE_TO_FLOAT(v
[2])));
663 static void GLAPIENTRY
664 VertexAttrib3bvARB(GLuint index
, const GLbyte
*v
)
666 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2]));
669 static void GLAPIENTRY
670 VertexAttrib4NbvARB(GLuint index
, const GLbyte
*v
)
672 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
675 BYTE_TO_FLOAT(v
[3])));
678 static void GLAPIENTRY
679 VertexAttrib4bvARB(GLuint index
, const GLbyte
*v
)
681 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2], (GLfloat
)v
[3]));
684 /* GL_UNSIGNED_BYTE attributes */
686 static void GLAPIENTRY
687 VertexAttrib1NubvARB(GLuint index
, const GLubyte
*v
)
689 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0])));
692 static void GLAPIENTRY
693 VertexAttrib1ubvARB(GLuint index
, const GLubyte
*v
)
695 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
698 static void GLAPIENTRY
699 VertexAttrib2NubvARB(GLuint index
, const GLubyte
*v
)
701 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
,
702 UBYTE_TO_FLOAT(v
[0]),
703 UBYTE_TO_FLOAT(v
[1])));
706 static void GLAPIENTRY
707 VertexAttrib2ubvARB(GLuint index
, const GLubyte
*v
)
709 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
,
710 (GLfloat
)v
[0], (GLfloat
)v
[1]));
713 static void GLAPIENTRY
714 VertexAttrib3NubvARB(GLuint index
, const GLubyte
*v
)
716 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
,
717 UBYTE_TO_FLOAT(v
[0]),
718 UBYTE_TO_FLOAT(v
[1]),
719 UBYTE_TO_FLOAT(v
[2])));
721 static void GLAPIENTRY
722 VertexAttrib3ubvARB(GLuint index
, const GLubyte
*v
)
724 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
,
730 static void GLAPIENTRY
731 VertexAttrib4NubvARB(GLuint index
, const GLubyte
*v
)
733 CALL_VertexAttrib4fARB(GET_DISPATCH(),
735 UBYTE_TO_FLOAT(v
[0]),
736 UBYTE_TO_FLOAT(v
[1]),
737 UBYTE_TO_FLOAT(v
[2]),
738 UBYTE_TO_FLOAT(v
[3])));
741 static void GLAPIENTRY
742 VertexAttrib4ubvARB(GLuint index
, const GLubyte
*v
)
744 CALL_VertexAttrib4fARB(GET_DISPATCH(),
746 (GLfloat
)v
[0], (GLfloat
)v
[1],
747 (GLfloat
)v
[2], (GLfloat
)v
[3]));
750 /* GL_SHORT attributes */
752 static void GLAPIENTRY
753 VertexAttrib1NsvARB(GLuint index
, const GLshort
*v
)
755 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0])));
758 static void GLAPIENTRY
759 VertexAttrib1svARB(GLuint index
, const GLshort
*v
)
761 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
764 static void GLAPIENTRY
765 VertexAttrib2NsvARB(GLuint index
, const GLshort
*v
)
767 CALL_VertexAttrib2fARB(GET_DISPATCH(),
768 (index
, SHORT_TO_FLOAT(v
[0]),
769 SHORT_TO_FLOAT(v
[1])));
772 static void GLAPIENTRY
773 VertexAttrib2svARB(GLuint index
, const GLshort
*v
)
775 CALL_VertexAttrib2fARB(GET_DISPATCH(),
776 (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
779 static void GLAPIENTRY
780 VertexAttrib3NsvARB(GLuint index
, const GLshort
*v
)
782 CALL_VertexAttrib3fARB(GET_DISPATCH(),
784 SHORT_TO_FLOAT(v
[0]),
785 SHORT_TO_FLOAT(v
[1]),
786 SHORT_TO_FLOAT(v
[2])));
789 static void GLAPIENTRY
790 VertexAttrib3svARB(GLuint index
, const GLshort
*v
)
792 CALL_VertexAttrib3fARB(GET_DISPATCH(),
794 (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2]));
797 static void GLAPIENTRY
798 VertexAttrib4NsvARB(GLuint index
, const GLshort
*v
)
800 CALL_VertexAttrib4fARB(GET_DISPATCH(),
802 SHORT_TO_FLOAT(v
[0]),
803 SHORT_TO_FLOAT(v
[1]),
804 SHORT_TO_FLOAT(v
[2]),
805 SHORT_TO_FLOAT(v
[3])));
808 static void GLAPIENTRY
809 VertexAttrib4svARB(GLuint index
, const GLshort
*v
)
811 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
812 (GLfloat
)v
[2], (GLfloat
)v
[3]));
815 /* GL_UNSIGNED_SHORT attributes */
817 static void GLAPIENTRY
818 VertexAttrib1NusvARB(GLuint index
, const GLushort
*v
)
820 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0])));
823 static void GLAPIENTRY
824 VertexAttrib1usvARB(GLuint index
, const GLushort
*v
)
826 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
829 static void GLAPIENTRY
830 VertexAttrib2NusvARB(GLuint index
, const GLushort
*v
)
832 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
833 USHORT_TO_FLOAT(v
[1])));
836 static void GLAPIENTRY
837 VertexAttrib2usvARB(GLuint index
, const GLushort
*v
)
839 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
843 static void GLAPIENTRY
844 VertexAttrib3NusvARB(GLuint index
, const GLushort
*v
)
846 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
847 USHORT_TO_FLOAT(v
[1]),
848 USHORT_TO_FLOAT(v
[2])));
851 static void GLAPIENTRY
852 VertexAttrib3usvARB(GLuint index
, const GLushort
*v
)
854 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
855 (GLfloat
)v
[1], (GLfloat
)v
[2]));
858 static void GLAPIENTRY
859 VertexAttrib4NusvARB(GLuint index
, const GLushort
*v
)
861 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
862 USHORT_TO_FLOAT(v
[1]),
863 USHORT_TO_FLOAT(v
[2]),
864 USHORT_TO_FLOAT(v
[3])));
867 static void GLAPIENTRY
868 VertexAttrib4usvARB(GLuint index
, const GLushort
*v
)
870 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2], (GLfloat
)v
[3]));
873 /* GL_INT attributes */
875 static void GLAPIENTRY
876 VertexAttrib1NivARB(GLuint index
, const GLint
*v
)
878 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0])));
881 static void GLAPIENTRY
882 VertexAttrib1ivARB(GLuint index
, const GLint
*v
)
884 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
887 static void GLAPIENTRY
888 VertexAttrib2NivARB(GLuint index
, const GLint
*v
)
890 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
891 INT_TO_FLOAT(v
[1])));
894 static void GLAPIENTRY
895 VertexAttrib2ivARB(GLuint index
, const GLint
*v
)
897 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
901 static void GLAPIENTRY
902 VertexAttrib3NivARB(GLuint index
, const GLint
*v
)
904 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
906 INT_TO_FLOAT(v
[2])));
909 static void GLAPIENTRY
910 VertexAttrib3ivARB(GLuint index
, const GLint
*v
)
912 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
913 (GLfloat
)v
[1], (GLfloat
)v
[2]));
916 static void GLAPIENTRY
917 VertexAttrib4NivARB(GLuint index
, const GLint
*v
)
919 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
922 INT_TO_FLOAT(v
[3])));
925 static void GLAPIENTRY
926 VertexAttrib4ivARB(GLuint index
, const GLint
*v
)
928 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
929 (GLfloat
)v
[2], (GLfloat
)v
[3]));
932 /* GL_UNSIGNED_INT attributes */
934 static void GLAPIENTRY
935 VertexAttrib1NuivARB(GLuint index
, const GLuint
*v
)
937 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0])));
940 static void GLAPIENTRY
941 VertexAttrib1uivARB(GLuint index
, const GLuint
*v
)
943 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
946 static void GLAPIENTRY
947 VertexAttrib2NuivARB(GLuint index
, const GLuint
*v
)
949 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
950 UINT_TO_FLOAT(v
[1])));
953 static void GLAPIENTRY
954 VertexAttrib2uivARB(GLuint index
, const GLuint
*v
)
956 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
960 static void GLAPIENTRY
961 VertexAttrib3NuivARB(GLuint index
, const GLuint
*v
)
963 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
965 UINT_TO_FLOAT(v
[2])));
968 static void GLAPIENTRY
969 VertexAttrib3uivARB(GLuint index
, const GLuint
*v
)
971 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
972 (GLfloat
)v
[1], (GLfloat
)v
[2]));
975 static void GLAPIENTRY
976 VertexAttrib4NuivARB(GLuint index
, const GLuint
*v
)
978 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
981 UINT_TO_FLOAT(v
[3])));
984 static void GLAPIENTRY
985 VertexAttrib4uivARB(GLuint index
, const GLuint
*v
)
987 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
988 (GLfloat
)v
[2], (GLfloat
)v
[3]));
991 /* GL_FLOAT attributes */
993 static void GLAPIENTRY
994 VertexAttrib1fvARB(GLuint index
, const GLfloat
*v
)
996 CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index
, v
));
999 static void GLAPIENTRY
1000 VertexAttrib2fvARB(GLuint index
, const GLfloat
*v
)
1002 CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index
, v
));
1005 static void GLAPIENTRY
1006 VertexAttrib3fvARB(GLuint index
, const GLfloat
*v
)
1008 CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index
, v
));
1011 static void GLAPIENTRY
1012 VertexAttrib4fvARB(GLuint index
, const GLfloat
*v
)
1014 CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index
, v
));
1017 /* GL_DOUBLE attributes */
1019 static void GLAPIENTRY
1020 VertexAttrib1dvARB(GLuint index
, const GLdouble
*v
)
1022 CALL_VertexAttrib1dv(GET_DISPATCH(), (index
, v
));
1025 static void GLAPIENTRY
1026 VertexAttrib2dvARB(GLuint index
, const GLdouble
*v
)
1028 CALL_VertexAttrib2dv(GET_DISPATCH(), (index
, v
));
1031 static void GLAPIENTRY
1032 VertexAttrib3dvARB(GLuint index
, const GLdouble
*v
)
1034 CALL_VertexAttrib3dv(GET_DISPATCH(), (index
, v
));
1037 static void GLAPIENTRY
1038 VertexAttrib4dvARB(GLuint index
, const GLdouble
*v
)
1040 CALL_VertexAttrib4dv(GET_DISPATCH(), (index
, v
));
1045 * Integer-valued attributes
1047 static void GLAPIENTRY
1048 VertexAttribI1bv(GLuint index
, const GLbyte
*v
)
1050 CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index
, v
[0]));
1053 static void GLAPIENTRY
1054 VertexAttribI2bv(GLuint index
, const GLbyte
*v
)
1056 CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1059 static void GLAPIENTRY
1060 VertexAttribI3bv(GLuint index
, const GLbyte
*v
)
1062 CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1065 static void GLAPIENTRY
1066 VertexAttribI4bv(GLuint index
, const GLbyte
*v
)
1068 CALL_VertexAttribI4bv(GET_DISPATCH(), (index
, v
));
1072 static void GLAPIENTRY
1073 VertexAttribI1ubv(GLuint index
, const GLubyte
*v
)
1075 CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index
, v
[0]));
1078 static void GLAPIENTRY
1079 VertexAttribI2ubv(GLuint index
, const GLubyte
*v
)
1081 CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1084 static void GLAPIENTRY
1085 VertexAttribI3ubv(GLuint index
, const GLubyte
*v
)
1087 CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1090 static void GLAPIENTRY
1091 VertexAttribI4ubv(GLuint index
, const GLubyte
*v
)
1093 CALL_VertexAttribI4ubv(GET_DISPATCH(), (index
, v
));
1098 static void GLAPIENTRY
1099 VertexAttribI1sv(GLuint index
, const GLshort
*v
)
1101 CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index
, v
[0]));
1104 static void GLAPIENTRY
1105 VertexAttribI2sv(GLuint index
, const GLshort
*v
)
1107 CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1110 static void GLAPIENTRY
1111 VertexAttribI3sv(GLuint index
, const GLshort
*v
)
1113 CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1116 static void GLAPIENTRY
1117 VertexAttribI4sv(GLuint index
, const GLshort
*v
)
1119 CALL_VertexAttribI4sv(GET_DISPATCH(), (index
, v
));
1123 static void GLAPIENTRY
1124 VertexAttribI1usv(GLuint index
, const GLushort
*v
)
1126 CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index
, v
[0]));
1129 static void GLAPIENTRY
1130 VertexAttribI2usv(GLuint index
, const GLushort
*v
)
1132 CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1135 static void GLAPIENTRY
1136 VertexAttribI3usv(GLuint index
, const GLushort
*v
)
1138 CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1141 static void GLAPIENTRY
1142 VertexAttribI4usv(GLuint index
, const GLushort
*v
)
1144 CALL_VertexAttribI4usv(GET_DISPATCH(), (index
, v
));
1149 static void GLAPIENTRY
1150 VertexAttribI1iv(GLuint index
, const GLint
*v
)
1152 CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index
, v
[0]));
1155 static void GLAPIENTRY
1156 VertexAttribI2iv(GLuint index
, const GLint
*v
)
1158 CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1161 static void GLAPIENTRY
1162 VertexAttribI3iv(GLuint index
, const GLint
*v
)
1164 CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1167 static void GLAPIENTRY
1168 VertexAttribI4iv(GLuint index
, const GLint
*v
)
1170 CALL_VertexAttribI4ivEXT(GET_DISPATCH(), (index
, v
));
1174 static void GLAPIENTRY
1175 VertexAttribI1uiv(GLuint index
, const GLuint
*v
)
1177 CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index
, v
[0]));
1180 static void GLAPIENTRY
1181 VertexAttribI2uiv(GLuint index
, const GLuint
*v
)
1183 CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1186 static void GLAPIENTRY
1187 VertexAttribI3uiv(GLuint index
, const GLuint
*v
)
1189 CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1192 static void GLAPIENTRY
1193 VertexAttribI4uiv(GLuint index
, const GLuint
*v
)
1195 CALL_VertexAttribI4uivEXT(GET_DISPATCH(), (index
, v
));
1198 /* GL_DOUBLE unconverted attributes */
1200 static void GLAPIENTRY
1201 VertexAttribL1dv(GLuint index
, const GLdouble
*v
)
1203 CALL_VertexAttribL1dv(GET_DISPATCH(), (index
, v
));
1206 static void GLAPIENTRY
1207 VertexAttribL2dv(GLuint index
, const GLdouble
*v
)
1209 CALL_VertexAttribL2dv(GET_DISPATCH(), (index
, v
));
1212 static void GLAPIENTRY
1213 VertexAttribL3dv(GLuint index
, const GLdouble
*v
)
1215 CALL_VertexAttribL3dv(GET_DISPATCH(), (index
, v
));
1218 static void GLAPIENTRY
1219 VertexAttribL4dv(GLuint index
, const GLdouble
*v
)
1221 CALL_VertexAttribL4dv(GET_DISPATCH(), (index
, v
));
1225 * Array [unnormalized/normalized/integer][size][type] of VertexAttrib
1228 static const attrib_func AttribFuncsARB
[4][4][NUM_TYPES
] = {
1230 /* non-normalized */
1233 (attrib_func
) VertexAttrib1bvARB
,
1234 (attrib_func
) VertexAttrib1ubvARB
,
1235 (attrib_func
) VertexAttrib1svARB
,
1236 (attrib_func
) VertexAttrib1usvARB
,
1237 (attrib_func
) VertexAttrib1ivARB
,
1238 (attrib_func
) VertexAttrib1uivARB
,
1239 (attrib_func
) VertexAttrib1fvARB
,
1240 (attrib_func
) VertexAttrib1dvARB
1244 (attrib_func
) VertexAttrib2bvARB
,
1245 (attrib_func
) VertexAttrib2ubvARB
,
1246 (attrib_func
) VertexAttrib2svARB
,
1247 (attrib_func
) VertexAttrib2usvARB
,
1248 (attrib_func
) VertexAttrib2ivARB
,
1249 (attrib_func
) VertexAttrib2uivARB
,
1250 (attrib_func
) VertexAttrib2fvARB
,
1251 (attrib_func
) VertexAttrib2dvARB
1255 (attrib_func
) VertexAttrib3bvARB
,
1256 (attrib_func
) VertexAttrib3ubvARB
,
1257 (attrib_func
) VertexAttrib3svARB
,
1258 (attrib_func
) VertexAttrib3usvARB
,
1259 (attrib_func
) VertexAttrib3ivARB
,
1260 (attrib_func
) VertexAttrib3uivARB
,
1261 (attrib_func
) VertexAttrib3fvARB
,
1262 (attrib_func
) VertexAttrib3dvARB
1266 (attrib_func
) VertexAttrib4bvARB
,
1267 (attrib_func
) VertexAttrib4ubvARB
,
1268 (attrib_func
) VertexAttrib4svARB
,
1269 (attrib_func
) VertexAttrib4usvARB
,
1270 (attrib_func
) VertexAttrib4ivARB
,
1271 (attrib_func
) VertexAttrib4uivARB
,
1272 (attrib_func
) VertexAttrib4fvARB
,
1273 (attrib_func
) VertexAttrib4dvARB
1277 /* normalized (except for float/double) */
1280 (attrib_func
) VertexAttrib1NbvARB
,
1281 (attrib_func
) VertexAttrib1NubvARB
,
1282 (attrib_func
) VertexAttrib1NsvARB
,
1283 (attrib_func
) VertexAttrib1NusvARB
,
1284 (attrib_func
) VertexAttrib1NivARB
,
1285 (attrib_func
) VertexAttrib1NuivARB
,
1286 (attrib_func
) VertexAttrib1fvARB
,
1287 (attrib_func
) VertexAttrib1dvARB
1291 (attrib_func
) VertexAttrib2NbvARB
,
1292 (attrib_func
) VertexAttrib2NubvARB
,
1293 (attrib_func
) VertexAttrib2NsvARB
,
1294 (attrib_func
) VertexAttrib2NusvARB
,
1295 (attrib_func
) VertexAttrib2NivARB
,
1296 (attrib_func
) VertexAttrib2NuivARB
,
1297 (attrib_func
) VertexAttrib2fvARB
,
1298 (attrib_func
) VertexAttrib2dvARB
1302 (attrib_func
) VertexAttrib3NbvARB
,
1303 (attrib_func
) VertexAttrib3NubvARB
,
1304 (attrib_func
) VertexAttrib3NsvARB
,
1305 (attrib_func
) VertexAttrib3NusvARB
,
1306 (attrib_func
) VertexAttrib3NivARB
,
1307 (attrib_func
) VertexAttrib3NuivARB
,
1308 (attrib_func
) VertexAttrib3fvARB
,
1309 (attrib_func
) VertexAttrib3dvARB
1313 (attrib_func
) VertexAttrib4NbvARB
,
1314 (attrib_func
) VertexAttrib4NubvARB
,
1315 (attrib_func
) VertexAttrib4NsvARB
,
1316 (attrib_func
) VertexAttrib4NusvARB
,
1317 (attrib_func
) VertexAttrib4NivARB
,
1318 (attrib_func
) VertexAttrib4NuivARB
,
1319 (attrib_func
) VertexAttrib4fvARB
,
1320 (attrib_func
) VertexAttrib4dvARB
1325 /* integer-valued */
1328 (attrib_func
) VertexAttribI1bv
,
1329 (attrib_func
) VertexAttribI1ubv
,
1330 (attrib_func
) VertexAttribI1sv
,
1331 (attrib_func
) VertexAttribI1usv
,
1332 (attrib_func
) VertexAttribI1iv
,
1333 (attrib_func
) VertexAttribI1uiv
,
1334 NULL
, /* GL_FLOAT */
1335 NULL
/* GL_DOUBLE */
1339 (attrib_func
) VertexAttribI2bv
,
1340 (attrib_func
) VertexAttribI2ubv
,
1341 (attrib_func
) VertexAttribI2sv
,
1342 (attrib_func
) VertexAttribI2usv
,
1343 (attrib_func
) VertexAttribI2iv
,
1344 (attrib_func
) VertexAttribI2uiv
,
1345 NULL
, /* GL_FLOAT */
1346 NULL
/* GL_DOUBLE */
1350 (attrib_func
) VertexAttribI3bv
,
1351 (attrib_func
) VertexAttribI3ubv
,
1352 (attrib_func
) VertexAttribI3sv
,
1353 (attrib_func
) VertexAttribI3usv
,
1354 (attrib_func
) VertexAttribI3iv
,
1355 (attrib_func
) VertexAttribI3uiv
,
1356 NULL
, /* GL_FLOAT */
1357 NULL
/* GL_DOUBLE */
1361 (attrib_func
) VertexAttribI4bv
,
1362 (attrib_func
) VertexAttribI4ubv
,
1363 (attrib_func
) VertexAttribI4sv
,
1364 (attrib_func
) VertexAttribI4usv
,
1365 (attrib_func
) VertexAttribI4iv
,
1366 (attrib_func
) VertexAttribI4uiv
,
1367 NULL
, /* GL_FLOAT */
1368 NULL
/* GL_DOUBLE */
1382 (attrib_func
) VertexAttribL1dv
,
1393 (attrib_func
) VertexAttribL2dv
,
1404 (attrib_func
) VertexAttribL3dv
,
1415 (attrib_func
) VertexAttribL4dv
,
1423 _ae_create_context(struct gl_context
*ctx
)
1425 if (ctx
->aelt_context
)
1428 ctx
->aelt_context
= calloc(1, sizeof(AEcontext
));
1429 if (!ctx
->aelt_context
)
1432 AE_CONTEXT(ctx
)->dirty_state
= true;
1438 _ae_destroy_context(struct gl_context
*ctx
)
1440 if (AE_CONTEXT(ctx
)) {
1441 free(ctx
->aelt_context
);
1442 ctx
->aelt_context
= NULL
;
1448 * Make a list of per-vertex functions to call for each glArrayElement call.
1449 * These functions access the array data (i.e. glVertex, glColor, glNormal,
1451 * Note: this may be called during display list construction.
1454 _ae_update_state(struct gl_context
*ctx
)
1456 AEcontext
*actx
= AE_CONTEXT(ctx
);
1457 AEarray
*aa
= actx
->arrays
; /* non-indexed arrays (ex: glNormal) */
1458 AEattrib
*at
= actx
->attribs
; /* indexed arrays (ex: glMultiTexCoord) */
1460 struct gl_vertex_array_object
*vao
= ctx
->Array
.VAO
;
1462 /* conventional vertex arrays */
1463 for (i
= 1; i
< VERT_ATTRIB_FF_MAX
; i
++) { /* skip zero! */
1464 if (vao
->Enabled
& VERT_BIT_FF(i
)) {
1465 struct gl_array_attributes
*attribArray
=
1466 &vao
->VertexAttrib
[VERT_ATTRIB_FF(i
)];
1467 /* NOTE: we use generic glVertexAttribNV functions here.
1468 * If we ever remove GL_NV_vertex_program this will have to change.
1470 at
->array
= attribArray
;
1471 at
->binding
= &vao
->BufferBinding
[attribArray
->BufferBindingIndex
];
1472 assert(!at
->array
->Format
.Normalized
);
1473 at
->func
= AttribFuncsNV
[at
->array
->Format
.Normalized
]
1474 [at
->array
->Format
.Size
-1]
1475 [TYPE_IDX(at
->array
->Format
.Type
)];
1476 at
->index
= VERT_ATTRIB_FF(i
);
1481 /* generic vertex attribute arrays */
1482 for (i
= 1; i
< VERT_ATTRIB_GENERIC_MAX
; i
++) { /* skip zero! */
1483 if (vao
->Enabled
& VERT_BIT_GENERIC(i
)) {
1484 struct gl_array_attributes
*attribArray
=
1485 &vao
->VertexAttrib
[VERT_ATTRIB_GENERIC(i
)];
1486 at
->array
= attribArray
;
1487 at
->binding
= &vao
->BufferBinding
[attribArray
->BufferBindingIndex
];
1488 /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
1489 * function pointer here (for float arrays) since the pointer may
1490 * change from one execution of _ae_ArrayElement() to
1491 * the next. Doing so caused UT to break.
1493 at
->func
= AttribFuncsARB
[vertex_format_to_index(&at
->array
->Format
)]
1494 [at
->array
->Format
.Size
-1]
1495 [TYPE_IDX(at
->array
->Format
.Type
)];
1502 /* finally, vertex position */
1503 if (vao
->Enabled
& VERT_BIT_GENERIC0
) {
1504 struct gl_array_attributes
*attribArray
=
1505 &vao
->VertexAttrib
[VERT_ATTRIB_GENERIC0
];
1506 /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
1507 * issued as the last (provoking) attribute).
1509 at
->array
= attribArray
;
1510 at
->binding
= &vao
->BufferBinding
[attribArray
->BufferBindingIndex
];
1511 /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
1512 * function pointer here (for float arrays) since the pointer may
1513 * change from one execution of _ae_ArrayElement() to
1514 * the next. Doing so caused UT to break.
1516 at
->func
= AttribFuncsNV
[at
->array
->Format
.Normalized
]
1517 [at
->array
->Format
.Size
-1]
1518 [TYPE_IDX(at
->array
->Format
.Type
)];
1523 else if (vao
->Enabled
& VERT_BIT_POS
) {
1524 struct gl_array_attributes
*attribArray
=
1525 &vao
->VertexAttrib
[VERT_ATTRIB_POS
];
1526 at
->array
= attribArray
;
1527 at
->binding
= &vao
->BufferBinding
[attribArray
->BufferBindingIndex
];
1528 at
->func
= AttribFuncsNV
[at
->array
->Format
.Normalized
]
1529 [at
->array
->Format
.Size
-1]
1530 [TYPE_IDX(at
->array
->Format
.Type
)];
1535 assert(at
- actx
->attribs
<= VERT_ATTRIB_MAX
);
1536 assert(aa
- actx
->arrays
< 32);
1537 at
->func
= NULL
; /* terminate the list */
1538 aa
->offset
= -1; /* terminate the list */
1540 actx
->dirty_state
= false;
1545 _mesa_array_element(struct gl_context
*ctx
,
1546 struct _glapi_table
*disp
, GLint elt
)
1548 const AEcontext
*actx
= AE_CONTEXT(ctx
);
1550 if (actx
->dirty_state
)
1551 _ae_update_state(ctx
);
1553 /* emit generic attribute elements */
1554 for (const AEattrib
*at
= actx
->attribs
; at
->func
; at
++) {
1556 = ADD_POINTERS(at
->binding
->BufferObj
->Mappings
[MAP_INTERNAL
].Pointer
,
1557 _mesa_vertex_attrib_address(at
->array
, at
->binding
))
1558 + elt
* at
->binding
->Stride
;
1559 at
->func(at
->index
, src
);
1562 /* emit conventional arrays elements */
1563 for (const AEarray
*aa
= actx
->arrays
; aa
->offset
!= -1 ; aa
++) {
1565 = ADD_POINTERS(aa
->binding
->BufferObj
->Mappings
[MAP_INTERNAL
].Pointer
,
1566 _mesa_vertex_attrib_address(aa
->array
, aa
->binding
))
1567 + elt
* aa
->binding
->Stride
;
1568 CALL_by_offset(disp
, (array_func
), aa
->offset
, ((const void *) src
));
1574 * Called via glArrayElement() and glDrawArrays().
1575 * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions
1576 * for all enabled vertex arrays (for elt-th element).
1577 * Note: this may be called during display list construction.
1580 _ae_ArrayElement(GLint elt
)
1582 GET_CURRENT_CONTEXT(ctx
);
1583 const struct _glapi_table
* const disp
= GET_DISPATCH();
1584 struct gl_vertex_array_object
*vao
;
1586 /* If PrimitiveRestart is enabled and the index is the RestartIndex
1587 * then we call PrimitiveRestartNV and return.
1589 if (ctx
->Array
.PrimitiveRestart
&& (elt
== ctx
->Array
.RestartIndex
)) {
1590 CALL_PrimitiveRestartNV((struct _glapi_table
*)disp
, ());
1594 vao
= ctx
->Array
.VAO
;
1595 _mesa_vao_map_arrays(ctx
, vao
, GL_MAP_READ_BIT
);
1597 _mesa_array_element(ctx
, (struct _glapi_table
*)disp
, elt
);
1599 _mesa_vao_unmap_arrays(ctx
, vao
);
1604 _ae_invalidate_state(struct gl_context
*ctx
)
1606 AEcontext
*actx
= AE_CONTEXT(ctx
);
1608 /* Only interested in this subset of mesa state. Need to prune
1609 * this down as both tnl/ and the drivers can raise statechanges
1610 * for arcane reasons in the middle of seemingly atomic operations
1611 * like DrawElements, over which we'd like to keep a known set of
1612 * arrays and vbo's mapped.
1614 * Luckily, neither the drivers nor tnl muck with the state that
1617 assert(ctx
->NewState
& _NEW_ARRAY
);
1619 actx
->dirty_state
= true;
1624 _mesa_install_arrayelt_vtxfmt(struct _glapi_table
*disp
,
1625 const GLvertexformat
*vfmt
)
1627 SET_ArrayElement(disp
, vfmt
->ArrayElement
);