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"
42 #include "util/imports.h"
45 #include "main/dispatch.h"
48 typedef void (GLAPIENTRY
*attrib_func
)( GLuint indx
, const void *data
);
51 * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
52 * in the range [0, 7]. Luckily these type tokens are sequentially
53 * numbered in gl.h, except for GL_DOUBLE.
58 return t
== GL_DOUBLE
? 7 : t
& 7;
63 * Convert normalized/integer/double to the range [0, 3].
66 vertex_format_to_index(const struct gl_vertex_format
*vformat
)
70 else if (vformat
->Integer
)
72 else if (vformat
->Normalized
)
83 ** GL_NV_vertex_program
86 /* GL_BYTE attributes */
88 static void GLAPIENTRY
89 VertexAttrib1NbvNV(GLuint index
, const GLbyte
*v
)
91 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0])));
94 static void GLAPIENTRY
95 VertexAttrib1bvNV(GLuint index
, const GLbyte
*v
)
97 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
100 static void GLAPIENTRY
101 VertexAttrib2NbvNV(GLuint index
, const GLbyte
*v
)
103 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]), BYTE_TO_FLOAT(v
[1])));
106 static void GLAPIENTRY
107 VertexAttrib2bvNV(GLuint index
, const GLbyte
*v
)
109 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
112 static void GLAPIENTRY
113 VertexAttrib3NbvNV(GLuint index
, const GLbyte
*v
)
115 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
117 BYTE_TO_FLOAT(v
[2])));
120 static void GLAPIENTRY
121 VertexAttrib3bvNV(GLuint index
, const GLbyte
*v
)
123 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2]));
126 static void GLAPIENTRY
127 VertexAttrib4NbvNV(GLuint index
, const GLbyte
*v
)
129 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
132 BYTE_TO_FLOAT(v
[3])));
135 static void GLAPIENTRY
136 VertexAttrib4bvNV(GLuint index
, const GLbyte
*v
)
138 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2], (GLfloat
)v
[3]));
141 /* GL_UNSIGNED_BYTE attributes */
143 static void GLAPIENTRY
144 VertexAttrib1NubvNV(GLuint index
, const GLubyte
*v
)
146 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0])));
149 static void GLAPIENTRY
150 VertexAttrib1ubvNV(GLuint index
, const GLubyte
*v
)
152 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
155 static void GLAPIENTRY
156 VertexAttrib2NubvNV(GLuint index
, const GLubyte
*v
)
158 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0]),
159 UBYTE_TO_FLOAT(v
[1])));
162 static void GLAPIENTRY
163 VertexAttrib2ubvNV(GLuint index
, const GLubyte
*v
)
165 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
168 static void GLAPIENTRY
169 VertexAttrib3NubvNV(GLuint index
, const GLubyte
*v
)
171 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0]),
172 UBYTE_TO_FLOAT(v
[1]),
173 UBYTE_TO_FLOAT(v
[2])));
175 static void GLAPIENTRY
176 VertexAttrib3ubvNV(GLuint index
, const GLubyte
*v
)
178 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
179 (GLfloat
)v
[1], (GLfloat
)v
[2]));
182 static void GLAPIENTRY
183 VertexAttrib4NubvNV(GLuint index
, const GLubyte
*v
)
185 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0]),
186 UBYTE_TO_FLOAT(v
[1]),
187 UBYTE_TO_FLOAT(v
[2]),
188 UBYTE_TO_FLOAT(v
[3])));
191 static void GLAPIENTRY
192 VertexAttrib4ubvNV(GLuint index
, const GLubyte
*v
)
194 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
195 (GLfloat
)v
[1], (GLfloat
)v
[2],
199 /* GL_SHORT attributes */
201 static void GLAPIENTRY
202 VertexAttrib1NsvNV(GLuint index
, const GLshort
*v
)
204 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0])));
207 static void GLAPIENTRY
208 VertexAttrib1svNV(GLuint index
, const GLshort
*v
)
210 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
213 static void GLAPIENTRY
214 VertexAttrib2NsvNV(GLuint index
, const GLshort
*v
)
216 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0]),
217 SHORT_TO_FLOAT(v
[1])));
220 static void GLAPIENTRY
221 VertexAttrib2svNV(GLuint index
, const GLshort
*v
)
223 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
226 static void GLAPIENTRY
227 VertexAttrib3NsvNV(GLuint index
, const GLshort
*v
)
229 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0]),
230 SHORT_TO_FLOAT(v
[1]),
231 SHORT_TO_FLOAT(v
[2])));
234 static void GLAPIENTRY
235 VertexAttrib3svNV(GLuint index
, const GLshort
*v
)
237 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
241 static void GLAPIENTRY
242 VertexAttrib4NsvNV(GLuint index
, const GLshort
*v
)
244 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0]),
245 SHORT_TO_FLOAT(v
[1]),
246 SHORT_TO_FLOAT(v
[2]),
247 SHORT_TO_FLOAT(v
[3])));
250 static void GLAPIENTRY
251 VertexAttrib4svNV(GLuint index
, const GLshort
*v
)
253 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
254 (GLfloat
)v
[2], (GLfloat
)v
[3]));
257 /* GL_UNSIGNED_SHORT attributes */
259 static void GLAPIENTRY
260 VertexAttrib1NusvNV(GLuint index
, const GLushort
*v
)
262 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0])));
265 static void GLAPIENTRY
266 VertexAttrib1usvNV(GLuint index
, const GLushort
*v
)
268 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
271 static void GLAPIENTRY
272 VertexAttrib2NusvNV(GLuint index
, const GLushort
*v
)
274 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
275 USHORT_TO_FLOAT(v
[1])));
278 static void GLAPIENTRY
279 VertexAttrib2usvNV(GLuint index
, const GLushort
*v
)
281 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
285 static void GLAPIENTRY
286 VertexAttrib3NusvNV(GLuint index
, const GLushort
*v
)
288 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
289 USHORT_TO_FLOAT(v
[1]),
290 USHORT_TO_FLOAT(v
[2])));
293 static void GLAPIENTRY
294 VertexAttrib3usvNV(GLuint index
, const GLushort
*v
)
296 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
300 static void GLAPIENTRY
301 VertexAttrib4NusvNV(GLuint index
, const GLushort
*v
)
303 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
304 USHORT_TO_FLOAT(v
[1]),
305 USHORT_TO_FLOAT(v
[2]),
306 USHORT_TO_FLOAT(v
[3])));
309 static void GLAPIENTRY
310 VertexAttrib4usvNV(GLuint index
, const GLushort
*v
)
312 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
313 (GLfloat
)v
[2], (GLfloat
)v
[3]));
316 /* GL_INT attributes */
318 static void GLAPIENTRY
319 VertexAttrib1NivNV(GLuint index
, const GLint
*v
)
321 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0])));
324 static void GLAPIENTRY
325 VertexAttrib1ivNV(GLuint index
, const GLint
*v
)
327 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
330 static void GLAPIENTRY
331 VertexAttrib2NivNV(GLuint index
, const GLint
*v
)
333 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
334 INT_TO_FLOAT(v
[1])));
337 static void GLAPIENTRY
338 VertexAttrib2ivNV(GLuint index
, const GLint
*v
)
340 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
343 static void GLAPIENTRY
344 VertexAttrib3NivNV(GLuint index
, const GLint
*v
)
346 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
348 INT_TO_FLOAT(v
[2])));
351 static void GLAPIENTRY
352 VertexAttrib3ivNV(GLuint index
, const GLint
*v
)
354 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
358 static void GLAPIENTRY
359 VertexAttrib4NivNV(GLuint index
, const GLint
*v
)
361 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
364 INT_TO_FLOAT(v
[3])));
367 static void GLAPIENTRY
368 VertexAttrib4ivNV(GLuint index
, const GLint
*v
)
370 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
371 (GLfloat
)v
[2], (GLfloat
)v
[3]));
374 /* GL_UNSIGNED_INT attributes */
376 static void GLAPIENTRY
377 VertexAttrib1NuivNV(GLuint index
, const GLuint
*v
)
379 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0])));
382 static void GLAPIENTRY
383 VertexAttrib1uivNV(GLuint index
, const GLuint
*v
)
385 CALL_VertexAttrib1fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
388 static void GLAPIENTRY
389 VertexAttrib2NuivNV(GLuint index
, const GLuint
*v
)
391 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
392 UINT_TO_FLOAT(v
[1])));
395 static void GLAPIENTRY
396 VertexAttrib2uivNV(GLuint index
, const GLuint
*v
)
398 CALL_VertexAttrib2fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
402 static void GLAPIENTRY
403 VertexAttrib3NuivNV(GLuint index
, const GLuint
*v
)
405 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
407 UINT_TO_FLOAT(v
[2])));
410 static void GLAPIENTRY
411 VertexAttrib3uivNV(GLuint index
, const GLuint
*v
)
413 CALL_VertexAttrib3fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
417 static void GLAPIENTRY
418 VertexAttrib4NuivNV(GLuint index
, const GLuint
*v
)
420 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
423 UINT_TO_FLOAT(v
[3])));
426 static void GLAPIENTRY
427 VertexAttrib4uivNV(GLuint index
, const GLuint
*v
)
429 CALL_VertexAttrib4fNV(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
430 (GLfloat
)v
[2], (GLfloat
)v
[3]));
433 /* GL_FLOAT attributes */
435 static void GLAPIENTRY
436 VertexAttrib1fvNV(GLuint index
, const GLfloat
*v
)
438 CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index
, v
));
441 static void GLAPIENTRY
442 VertexAttrib2fvNV(GLuint index
, const GLfloat
*v
)
444 CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index
, v
));
447 static void GLAPIENTRY
448 VertexAttrib3fvNV(GLuint index
, const GLfloat
*v
)
450 CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index
, v
));
453 static void GLAPIENTRY
454 VertexAttrib4fvNV(GLuint index
, const GLfloat
*v
)
456 CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index
, v
));
459 /* GL_DOUBLE attributes */
461 static void GLAPIENTRY
462 VertexAttrib1dvNV(GLuint index
, const GLdouble
*v
)
464 CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index
, v
));
467 static void GLAPIENTRY
468 VertexAttrib2dvNV(GLuint index
, const GLdouble
*v
)
470 CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index
, v
));
473 static void GLAPIENTRY
474 VertexAttrib3dvNV(GLuint index
, const GLdouble
*v
)
476 CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index
, v
));
479 static void GLAPIENTRY
480 VertexAttrib4dvNV(GLuint index
, const GLdouble
*v
)
482 CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index
, v
));
487 * Array [size][type] of VertexAttrib functions
489 static const attrib_func AttribFuncsNV
[2][4][NUM_TYPES
] = {
494 (attrib_func
) VertexAttrib1bvNV
,
495 (attrib_func
) VertexAttrib1ubvNV
,
496 (attrib_func
) VertexAttrib1svNV
,
497 (attrib_func
) VertexAttrib1usvNV
,
498 (attrib_func
) VertexAttrib1ivNV
,
499 (attrib_func
) VertexAttrib1uivNV
,
500 (attrib_func
) VertexAttrib1fvNV
,
501 (attrib_func
) VertexAttrib1dvNV
505 (attrib_func
) VertexAttrib2bvNV
,
506 (attrib_func
) VertexAttrib2ubvNV
,
507 (attrib_func
) VertexAttrib2svNV
,
508 (attrib_func
) VertexAttrib2usvNV
,
509 (attrib_func
) VertexAttrib2ivNV
,
510 (attrib_func
) VertexAttrib2uivNV
,
511 (attrib_func
) VertexAttrib2fvNV
,
512 (attrib_func
) VertexAttrib2dvNV
516 (attrib_func
) VertexAttrib3bvNV
,
517 (attrib_func
) VertexAttrib3ubvNV
,
518 (attrib_func
) VertexAttrib3svNV
,
519 (attrib_func
) VertexAttrib3usvNV
,
520 (attrib_func
) VertexAttrib3ivNV
,
521 (attrib_func
) VertexAttrib3uivNV
,
522 (attrib_func
) VertexAttrib3fvNV
,
523 (attrib_func
) VertexAttrib3dvNV
527 (attrib_func
) VertexAttrib4bvNV
,
528 (attrib_func
) VertexAttrib4ubvNV
,
529 (attrib_func
) VertexAttrib4svNV
,
530 (attrib_func
) VertexAttrib4usvNV
,
531 (attrib_func
) VertexAttrib4ivNV
,
532 (attrib_func
) VertexAttrib4uivNV
,
533 (attrib_func
) VertexAttrib4fvNV
,
534 (attrib_func
) VertexAttrib4dvNV
538 /* normalized (except for float/double) */
541 (attrib_func
) VertexAttrib1NbvNV
,
542 (attrib_func
) VertexAttrib1NubvNV
,
543 (attrib_func
) VertexAttrib1NsvNV
,
544 (attrib_func
) VertexAttrib1NusvNV
,
545 (attrib_func
) VertexAttrib1NivNV
,
546 (attrib_func
) VertexAttrib1NuivNV
,
547 (attrib_func
) VertexAttrib1fvNV
,
548 (attrib_func
) VertexAttrib1dvNV
552 (attrib_func
) VertexAttrib2NbvNV
,
553 (attrib_func
) VertexAttrib2NubvNV
,
554 (attrib_func
) VertexAttrib2NsvNV
,
555 (attrib_func
) VertexAttrib2NusvNV
,
556 (attrib_func
) VertexAttrib2NivNV
,
557 (attrib_func
) VertexAttrib2NuivNV
,
558 (attrib_func
) VertexAttrib2fvNV
,
559 (attrib_func
) VertexAttrib2dvNV
563 (attrib_func
) VertexAttrib3NbvNV
,
564 (attrib_func
) VertexAttrib3NubvNV
,
565 (attrib_func
) VertexAttrib3NsvNV
,
566 (attrib_func
) VertexAttrib3NusvNV
,
567 (attrib_func
) VertexAttrib3NivNV
,
568 (attrib_func
) VertexAttrib3NuivNV
,
569 (attrib_func
) VertexAttrib3fvNV
,
570 (attrib_func
) VertexAttrib3dvNV
574 (attrib_func
) VertexAttrib4NbvNV
,
575 (attrib_func
) VertexAttrib4NubvNV
,
576 (attrib_func
) VertexAttrib4NsvNV
,
577 (attrib_func
) VertexAttrib4NusvNV
,
578 (attrib_func
) VertexAttrib4NivNV
,
579 (attrib_func
) VertexAttrib4NuivNV
,
580 (attrib_func
) VertexAttrib4fvNV
,
581 (attrib_func
) VertexAttrib4dvNV
588 ** GL_ARB_vertex_program
591 /* GL_BYTE attributes */
593 static void GLAPIENTRY
594 VertexAttrib1NbvARB(GLuint index
, const GLbyte
*v
)
596 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0])));
599 static void GLAPIENTRY
600 VertexAttrib1bvARB(GLuint index
, const GLbyte
*v
)
602 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
605 static void GLAPIENTRY
606 VertexAttrib2NbvARB(GLuint index
, const GLbyte
*v
)
608 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]), BYTE_TO_FLOAT(v
[1])));
611 static void GLAPIENTRY
612 VertexAttrib2bvARB(GLuint index
, const GLbyte
*v
)
614 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
617 static void GLAPIENTRY
618 VertexAttrib3NbvARB(GLuint index
, const GLbyte
*v
)
620 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
622 BYTE_TO_FLOAT(v
[2])));
625 static void GLAPIENTRY
626 VertexAttrib3bvARB(GLuint index
, const GLbyte
*v
)
628 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2]));
631 static void GLAPIENTRY
632 VertexAttrib4NbvARB(GLuint index
, const GLbyte
*v
)
634 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, BYTE_TO_FLOAT(v
[0]),
637 BYTE_TO_FLOAT(v
[3])));
640 static void GLAPIENTRY
641 VertexAttrib4bvARB(GLuint index
, const GLbyte
*v
)
643 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2], (GLfloat
)v
[3]));
646 /* GL_UNSIGNED_BYTE attributes */
648 static void GLAPIENTRY
649 VertexAttrib1NubvARB(GLuint index
, const GLubyte
*v
)
651 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, UBYTE_TO_FLOAT(v
[0])));
654 static void GLAPIENTRY
655 VertexAttrib1ubvARB(GLuint index
, const GLubyte
*v
)
657 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
660 static void GLAPIENTRY
661 VertexAttrib2NubvARB(GLuint index
, const GLubyte
*v
)
663 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
,
664 UBYTE_TO_FLOAT(v
[0]),
665 UBYTE_TO_FLOAT(v
[1])));
668 static void GLAPIENTRY
669 VertexAttrib2ubvARB(GLuint index
, const GLubyte
*v
)
671 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
,
672 (GLfloat
)v
[0], (GLfloat
)v
[1]));
675 static void GLAPIENTRY
676 VertexAttrib3NubvARB(GLuint index
, const GLubyte
*v
)
678 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
,
679 UBYTE_TO_FLOAT(v
[0]),
680 UBYTE_TO_FLOAT(v
[1]),
681 UBYTE_TO_FLOAT(v
[2])));
683 static void GLAPIENTRY
684 VertexAttrib3ubvARB(GLuint index
, const GLubyte
*v
)
686 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
,
692 static void GLAPIENTRY
693 VertexAttrib4NubvARB(GLuint index
, const GLubyte
*v
)
695 CALL_VertexAttrib4fARB(GET_DISPATCH(),
697 UBYTE_TO_FLOAT(v
[0]),
698 UBYTE_TO_FLOAT(v
[1]),
699 UBYTE_TO_FLOAT(v
[2]),
700 UBYTE_TO_FLOAT(v
[3])));
703 static void GLAPIENTRY
704 VertexAttrib4ubvARB(GLuint index
, const GLubyte
*v
)
706 CALL_VertexAttrib4fARB(GET_DISPATCH(),
708 (GLfloat
)v
[0], (GLfloat
)v
[1],
709 (GLfloat
)v
[2], (GLfloat
)v
[3]));
712 /* GL_SHORT attributes */
714 static void GLAPIENTRY
715 VertexAttrib1NsvARB(GLuint index
, const GLshort
*v
)
717 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, SHORT_TO_FLOAT(v
[0])));
720 static void GLAPIENTRY
721 VertexAttrib1svARB(GLuint index
, const GLshort
*v
)
723 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
726 static void GLAPIENTRY
727 VertexAttrib2NsvARB(GLuint index
, const GLshort
*v
)
729 CALL_VertexAttrib2fARB(GET_DISPATCH(),
730 (index
, SHORT_TO_FLOAT(v
[0]),
731 SHORT_TO_FLOAT(v
[1])));
734 static void GLAPIENTRY
735 VertexAttrib2svARB(GLuint index
, const GLshort
*v
)
737 CALL_VertexAttrib2fARB(GET_DISPATCH(),
738 (index
, (GLfloat
)v
[0], (GLfloat
)v
[1]));
741 static void GLAPIENTRY
742 VertexAttrib3NsvARB(GLuint index
, const GLshort
*v
)
744 CALL_VertexAttrib3fARB(GET_DISPATCH(),
746 SHORT_TO_FLOAT(v
[0]),
747 SHORT_TO_FLOAT(v
[1]),
748 SHORT_TO_FLOAT(v
[2])));
751 static void GLAPIENTRY
752 VertexAttrib3svARB(GLuint index
, const GLshort
*v
)
754 CALL_VertexAttrib3fARB(GET_DISPATCH(),
756 (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2]));
759 static void GLAPIENTRY
760 VertexAttrib4NsvARB(GLuint index
, const GLshort
*v
)
762 CALL_VertexAttrib4fARB(GET_DISPATCH(),
764 SHORT_TO_FLOAT(v
[0]),
765 SHORT_TO_FLOAT(v
[1]),
766 SHORT_TO_FLOAT(v
[2]),
767 SHORT_TO_FLOAT(v
[3])));
770 static void GLAPIENTRY
771 VertexAttrib4svARB(GLuint index
, const GLshort
*v
)
773 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
774 (GLfloat
)v
[2], (GLfloat
)v
[3]));
777 /* GL_UNSIGNED_SHORT attributes */
779 static void GLAPIENTRY
780 VertexAttrib1NusvARB(GLuint index
, const GLushort
*v
)
782 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0])));
785 static void GLAPIENTRY
786 VertexAttrib1usvARB(GLuint index
, const GLushort
*v
)
788 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
791 static void GLAPIENTRY
792 VertexAttrib2NusvARB(GLuint index
, const GLushort
*v
)
794 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
795 USHORT_TO_FLOAT(v
[1])));
798 static void GLAPIENTRY
799 VertexAttrib2usvARB(GLuint index
, const GLushort
*v
)
801 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
805 static void GLAPIENTRY
806 VertexAttrib3NusvARB(GLuint index
, const GLushort
*v
)
808 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
809 USHORT_TO_FLOAT(v
[1]),
810 USHORT_TO_FLOAT(v
[2])));
813 static void GLAPIENTRY
814 VertexAttrib3usvARB(GLuint index
, const GLushort
*v
)
816 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
817 (GLfloat
)v
[1], (GLfloat
)v
[2]));
820 static void GLAPIENTRY
821 VertexAttrib4NusvARB(GLuint index
, const GLushort
*v
)
823 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, USHORT_TO_FLOAT(v
[0]),
824 USHORT_TO_FLOAT(v
[1]),
825 USHORT_TO_FLOAT(v
[2]),
826 USHORT_TO_FLOAT(v
[3])));
829 static void GLAPIENTRY
830 VertexAttrib4usvARB(GLuint index
, const GLushort
*v
)
832 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1], (GLfloat
)v
[2], (GLfloat
)v
[3]));
835 /* GL_INT attributes */
837 static void GLAPIENTRY
838 VertexAttrib1NivARB(GLuint index
, const GLint
*v
)
840 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0])));
843 static void GLAPIENTRY
844 VertexAttrib1ivARB(GLuint index
, const GLint
*v
)
846 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
849 static void GLAPIENTRY
850 VertexAttrib2NivARB(GLuint index
, const GLint
*v
)
852 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
853 INT_TO_FLOAT(v
[1])));
856 static void GLAPIENTRY
857 VertexAttrib2ivARB(GLuint index
, const GLint
*v
)
859 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
863 static void GLAPIENTRY
864 VertexAttrib3NivARB(GLuint index
, const GLint
*v
)
866 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
868 INT_TO_FLOAT(v
[2])));
871 static void GLAPIENTRY
872 VertexAttrib3ivARB(GLuint index
, const GLint
*v
)
874 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
875 (GLfloat
)v
[1], (GLfloat
)v
[2]));
878 static void GLAPIENTRY
879 VertexAttrib4NivARB(GLuint index
, const GLint
*v
)
881 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, INT_TO_FLOAT(v
[0]),
884 INT_TO_FLOAT(v
[3])));
887 static void GLAPIENTRY
888 VertexAttrib4ivARB(GLuint index
, const GLint
*v
)
890 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
891 (GLfloat
)v
[2], (GLfloat
)v
[3]));
894 /* GL_UNSIGNED_INT attributes */
896 static void GLAPIENTRY
897 VertexAttrib1NuivARB(GLuint index
, const GLuint
*v
)
899 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0])));
902 static void GLAPIENTRY
903 VertexAttrib1uivARB(GLuint index
, const GLuint
*v
)
905 CALL_VertexAttrib1fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0]));
908 static void GLAPIENTRY
909 VertexAttrib2NuivARB(GLuint index
, const GLuint
*v
)
911 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
912 UINT_TO_FLOAT(v
[1])));
915 static void GLAPIENTRY
916 VertexAttrib2uivARB(GLuint index
, const GLuint
*v
)
918 CALL_VertexAttrib2fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
922 static void GLAPIENTRY
923 VertexAttrib3NuivARB(GLuint index
, const GLuint
*v
)
925 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
927 UINT_TO_FLOAT(v
[2])));
930 static void GLAPIENTRY
931 VertexAttrib3uivARB(GLuint index
, const GLuint
*v
)
933 CALL_VertexAttrib3fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0],
934 (GLfloat
)v
[1], (GLfloat
)v
[2]));
937 static void GLAPIENTRY
938 VertexAttrib4NuivARB(GLuint index
, const GLuint
*v
)
940 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, UINT_TO_FLOAT(v
[0]),
943 UINT_TO_FLOAT(v
[3])));
946 static void GLAPIENTRY
947 VertexAttrib4uivARB(GLuint index
, const GLuint
*v
)
949 CALL_VertexAttrib4fARB(GET_DISPATCH(), (index
, (GLfloat
)v
[0], (GLfloat
)v
[1],
950 (GLfloat
)v
[2], (GLfloat
)v
[3]));
953 /* GL_FLOAT attributes */
955 static void GLAPIENTRY
956 VertexAttrib1fvARB(GLuint index
, const GLfloat
*v
)
958 CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index
, v
));
961 static void GLAPIENTRY
962 VertexAttrib2fvARB(GLuint index
, const GLfloat
*v
)
964 CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index
, v
));
967 static void GLAPIENTRY
968 VertexAttrib3fvARB(GLuint index
, const GLfloat
*v
)
970 CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index
, v
));
973 static void GLAPIENTRY
974 VertexAttrib4fvARB(GLuint index
, const GLfloat
*v
)
976 CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index
, v
));
979 /* GL_DOUBLE attributes */
981 static void GLAPIENTRY
982 VertexAttrib1dvARB(GLuint index
, const GLdouble
*v
)
984 CALL_VertexAttrib1dv(GET_DISPATCH(), (index
, v
));
987 static void GLAPIENTRY
988 VertexAttrib2dvARB(GLuint index
, const GLdouble
*v
)
990 CALL_VertexAttrib2dv(GET_DISPATCH(), (index
, v
));
993 static void GLAPIENTRY
994 VertexAttrib3dvARB(GLuint index
, const GLdouble
*v
)
996 CALL_VertexAttrib3dv(GET_DISPATCH(), (index
, v
));
999 static void GLAPIENTRY
1000 VertexAttrib4dvARB(GLuint index
, const GLdouble
*v
)
1002 CALL_VertexAttrib4dv(GET_DISPATCH(), (index
, v
));
1007 * Integer-valued attributes
1009 static void GLAPIENTRY
1010 VertexAttribI1bv(GLuint index
, const GLbyte
*v
)
1012 CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index
, v
[0]));
1015 static void GLAPIENTRY
1016 VertexAttribI2bv(GLuint index
, const GLbyte
*v
)
1018 CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1021 static void GLAPIENTRY
1022 VertexAttribI3bv(GLuint index
, const GLbyte
*v
)
1024 CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1027 static void GLAPIENTRY
1028 VertexAttribI4bv(GLuint index
, const GLbyte
*v
)
1030 CALL_VertexAttribI4bv(GET_DISPATCH(), (index
, v
));
1034 static void GLAPIENTRY
1035 VertexAttribI1ubv(GLuint index
, const GLubyte
*v
)
1037 CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index
, v
[0]));
1040 static void GLAPIENTRY
1041 VertexAttribI2ubv(GLuint index
, const GLubyte
*v
)
1043 CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1046 static void GLAPIENTRY
1047 VertexAttribI3ubv(GLuint index
, const GLubyte
*v
)
1049 CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1052 static void GLAPIENTRY
1053 VertexAttribI4ubv(GLuint index
, const GLubyte
*v
)
1055 CALL_VertexAttribI4ubv(GET_DISPATCH(), (index
, v
));
1060 static void GLAPIENTRY
1061 VertexAttribI1sv(GLuint index
, const GLshort
*v
)
1063 CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index
, v
[0]));
1066 static void GLAPIENTRY
1067 VertexAttribI2sv(GLuint index
, const GLshort
*v
)
1069 CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1072 static void GLAPIENTRY
1073 VertexAttribI3sv(GLuint index
, const GLshort
*v
)
1075 CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1078 static void GLAPIENTRY
1079 VertexAttribI4sv(GLuint index
, const GLshort
*v
)
1081 CALL_VertexAttribI4sv(GET_DISPATCH(), (index
, v
));
1085 static void GLAPIENTRY
1086 VertexAttribI1usv(GLuint index
, const GLushort
*v
)
1088 CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index
, v
[0]));
1091 static void GLAPIENTRY
1092 VertexAttribI2usv(GLuint index
, const GLushort
*v
)
1094 CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1097 static void GLAPIENTRY
1098 VertexAttribI3usv(GLuint index
, const GLushort
*v
)
1100 CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1103 static void GLAPIENTRY
1104 VertexAttribI4usv(GLuint index
, const GLushort
*v
)
1106 CALL_VertexAttribI4usv(GET_DISPATCH(), (index
, v
));
1111 static void GLAPIENTRY
1112 VertexAttribI1iv(GLuint index
, const GLint
*v
)
1114 CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index
, v
[0]));
1117 static void GLAPIENTRY
1118 VertexAttribI2iv(GLuint index
, const GLint
*v
)
1120 CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1123 static void GLAPIENTRY
1124 VertexAttribI3iv(GLuint index
, const GLint
*v
)
1126 CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1129 static void GLAPIENTRY
1130 VertexAttribI4iv(GLuint index
, const GLint
*v
)
1132 CALL_VertexAttribI4ivEXT(GET_DISPATCH(), (index
, v
));
1136 static void GLAPIENTRY
1137 VertexAttribI1uiv(GLuint index
, const GLuint
*v
)
1139 CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index
, v
[0]));
1142 static void GLAPIENTRY
1143 VertexAttribI2uiv(GLuint index
, const GLuint
*v
)
1145 CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1]));
1148 static void GLAPIENTRY
1149 VertexAttribI3uiv(GLuint index
, const GLuint
*v
)
1151 CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index
, v
[0], v
[1], v
[2]));
1154 static void GLAPIENTRY
1155 VertexAttribI4uiv(GLuint index
, const GLuint
*v
)
1157 CALL_VertexAttribI4uivEXT(GET_DISPATCH(), (index
, v
));
1160 /* GL_DOUBLE unconverted attributes */
1162 static void GLAPIENTRY
1163 VertexAttribL1dv(GLuint index
, const GLdouble
*v
)
1165 CALL_VertexAttribL1dv(GET_DISPATCH(), (index
, v
));
1168 static void GLAPIENTRY
1169 VertexAttribL2dv(GLuint index
, const GLdouble
*v
)
1171 CALL_VertexAttribL2dv(GET_DISPATCH(), (index
, v
));
1174 static void GLAPIENTRY
1175 VertexAttribL3dv(GLuint index
, const GLdouble
*v
)
1177 CALL_VertexAttribL3dv(GET_DISPATCH(), (index
, v
));
1180 static void GLAPIENTRY
1181 VertexAttribL4dv(GLuint index
, const GLdouble
*v
)
1183 CALL_VertexAttribL4dv(GET_DISPATCH(), (index
, v
));
1187 * Array [unnormalized/normalized/integer][size][type] of VertexAttrib
1190 static const attrib_func AttribFuncsARB
[4][4][NUM_TYPES
] = {
1192 /* non-normalized */
1195 (attrib_func
) VertexAttrib1bvARB
,
1196 (attrib_func
) VertexAttrib1ubvARB
,
1197 (attrib_func
) VertexAttrib1svARB
,
1198 (attrib_func
) VertexAttrib1usvARB
,
1199 (attrib_func
) VertexAttrib1ivARB
,
1200 (attrib_func
) VertexAttrib1uivARB
,
1201 (attrib_func
) VertexAttrib1fvARB
,
1202 (attrib_func
) VertexAttrib1dvARB
1206 (attrib_func
) VertexAttrib2bvARB
,
1207 (attrib_func
) VertexAttrib2ubvARB
,
1208 (attrib_func
) VertexAttrib2svARB
,
1209 (attrib_func
) VertexAttrib2usvARB
,
1210 (attrib_func
) VertexAttrib2ivARB
,
1211 (attrib_func
) VertexAttrib2uivARB
,
1212 (attrib_func
) VertexAttrib2fvARB
,
1213 (attrib_func
) VertexAttrib2dvARB
1217 (attrib_func
) VertexAttrib3bvARB
,
1218 (attrib_func
) VertexAttrib3ubvARB
,
1219 (attrib_func
) VertexAttrib3svARB
,
1220 (attrib_func
) VertexAttrib3usvARB
,
1221 (attrib_func
) VertexAttrib3ivARB
,
1222 (attrib_func
) VertexAttrib3uivARB
,
1223 (attrib_func
) VertexAttrib3fvARB
,
1224 (attrib_func
) VertexAttrib3dvARB
1228 (attrib_func
) VertexAttrib4bvARB
,
1229 (attrib_func
) VertexAttrib4ubvARB
,
1230 (attrib_func
) VertexAttrib4svARB
,
1231 (attrib_func
) VertexAttrib4usvARB
,
1232 (attrib_func
) VertexAttrib4ivARB
,
1233 (attrib_func
) VertexAttrib4uivARB
,
1234 (attrib_func
) VertexAttrib4fvARB
,
1235 (attrib_func
) VertexAttrib4dvARB
1239 /* normalized (except for float/double) */
1242 (attrib_func
) VertexAttrib1NbvARB
,
1243 (attrib_func
) VertexAttrib1NubvARB
,
1244 (attrib_func
) VertexAttrib1NsvARB
,
1245 (attrib_func
) VertexAttrib1NusvARB
,
1246 (attrib_func
) VertexAttrib1NivARB
,
1247 (attrib_func
) VertexAttrib1NuivARB
,
1248 (attrib_func
) VertexAttrib1fvARB
,
1249 (attrib_func
) VertexAttrib1dvARB
1253 (attrib_func
) VertexAttrib2NbvARB
,
1254 (attrib_func
) VertexAttrib2NubvARB
,
1255 (attrib_func
) VertexAttrib2NsvARB
,
1256 (attrib_func
) VertexAttrib2NusvARB
,
1257 (attrib_func
) VertexAttrib2NivARB
,
1258 (attrib_func
) VertexAttrib2NuivARB
,
1259 (attrib_func
) VertexAttrib2fvARB
,
1260 (attrib_func
) VertexAttrib2dvARB
1264 (attrib_func
) VertexAttrib3NbvARB
,
1265 (attrib_func
) VertexAttrib3NubvARB
,
1266 (attrib_func
) VertexAttrib3NsvARB
,
1267 (attrib_func
) VertexAttrib3NusvARB
,
1268 (attrib_func
) VertexAttrib3NivARB
,
1269 (attrib_func
) VertexAttrib3NuivARB
,
1270 (attrib_func
) VertexAttrib3fvARB
,
1271 (attrib_func
) VertexAttrib3dvARB
1275 (attrib_func
) VertexAttrib4NbvARB
,
1276 (attrib_func
) VertexAttrib4NubvARB
,
1277 (attrib_func
) VertexAttrib4NsvARB
,
1278 (attrib_func
) VertexAttrib4NusvARB
,
1279 (attrib_func
) VertexAttrib4NivARB
,
1280 (attrib_func
) VertexAttrib4NuivARB
,
1281 (attrib_func
) VertexAttrib4fvARB
,
1282 (attrib_func
) VertexAttrib4dvARB
1287 /* integer-valued */
1290 (attrib_func
) VertexAttribI1bv
,
1291 (attrib_func
) VertexAttribI1ubv
,
1292 (attrib_func
) VertexAttribI1sv
,
1293 (attrib_func
) VertexAttribI1usv
,
1294 (attrib_func
) VertexAttribI1iv
,
1295 (attrib_func
) VertexAttribI1uiv
,
1296 NULL
, /* GL_FLOAT */
1297 NULL
/* GL_DOUBLE */
1301 (attrib_func
) VertexAttribI2bv
,
1302 (attrib_func
) VertexAttribI2ubv
,
1303 (attrib_func
) VertexAttribI2sv
,
1304 (attrib_func
) VertexAttribI2usv
,
1305 (attrib_func
) VertexAttribI2iv
,
1306 (attrib_func
) VertexAttribI2uiv
,
1307 NULL
, /* GL_FLOAT */
1308 NULL
/* GL_DOUBLE */
1312 (attrib_func
) VertexAttribI3bv
,
1313 (attrib_func
) VertexAttribI3ubv
,
1314 (attrib_func
) VertexAttribI3sv
,
1315 (attrib_func
) VertexAttribI3usv
,
1316 (attrib_func
) VertexAttribI3iv
,
1317 (attrib_func
) VertexAttribI3uiv
,
1318 NULL
, /* GL_FLOAT */
1319 NULL
/* GL_DOUBLE */
1323 (attrib_func
) VertexAttribI4bv
,
1324 (attrib_func
) VertexAttribI4ubv
,
1325 (attrib_func
) VertexAttribI4sv
,
1326 (attrib_func
) VertexAttribI4usv
,
1327 (attrib_func
) VertexAttribI4iv
,
1328 (attrib_func
) VertexAttribI4uiv
,
1329 NULL
, /* GL_FLOAT */
1330 NULL
/* GL_DOUBLE */
1344 (attrib_func
) VertexAttribL1dv
,
1355 (attrib_func
) VertexAttribL2dv
,
1366 (attrib_func
) VertexAttribL3dv
,
1377 (attrib_func
) VertexAttribL4dv
,
1385 * Return VertexAttrib*NV function pointer matching the provided vertex format.
1387 static inline attrib_func
1388 func_nv(const struct gl_vertex_format
*vformat
)
1390 return AttribFuncsNV
[vformat
->Normalized
][vformat
->Size
-1]
1391 [TYPE_IDX(vformat
->Type
)];
1396 * Return VertexAttrib*ARB function pointer matching the provided vertex format.
1398 static inline attrib_func
1399 func_arb(const struct gl_vertex_format
*vformat
)
1401 return AttribFuncsARB
[vertex_format_to_index(vformat
)][vformat
->Size
-1]
1402 [TYPE_IDX(vformat
->Type
)];
1407 * Return the address of the array attribute array at elt in the
1408 * vertex array object vao.
1410 static inline const void *
1411 attrib_src(const struct gl_vertex_array_object
*vao
,
1412 const struct gl_array_attributes
*array
, GLint elt
)
1414 const struct gl_vertex_buffer_binding
*binding
=
1415 &vao
->BufferBinding
[array
->BufferBindingIndex
];
1417 = ADD_POINTERS(binding
->BufferObj
->Mappings
[MAP_INTERNAL
].Pointer
,
1418 _mesa_vertex_attrib_address(array
, binding
))
1419 + elt
* binding
->Stride
;
1425 _mesa_array_element(struct gl_context
*ctx
, GLint elt
)
1427 const struct gl_vertex_array_object
*vao
= ctx
->Array
.VAO
;
1430 /* emit conventional arrays elements */
1431 mask
= (VERT_BIT_FF_ALL
& ~VERT_BIT_POS
) & vao
->Enabled
;
1433 const gl_vert_attrib attrib
= u_bit_scan(&mask
);
1434 const struct gl_array_attributes
*array
= &vao
->VertexAttrib
[attrib
];
1435 const void *src
= attrib_src(vao
, array
, elt
);
1436 func_nv(&array
->Format
)(attrib
, src
);
1439 /* emit generic attribute elements */
1440 mask
= (VERT_BIT_GENERIC_ALL
& ~VERT_BIT_GENERIC0
) & vao
->Enabled
;
1442 const gl_vert_attrib attrib
= u_bit_scan(&mask
);
1443 const struct gl_array_attributes
*array
= &vao
->VertexAttrib
[attrib
];
1444 const void *src
= attrib_src(vao
, array
, elt
);
1445 func_arb(&array
->Format
)(attrib
- VERT_ATTRIB_GENERIC0
, src
);
1448 /* finally, vertex position */
1449 if (vao
->Enabled
& VERT_BIT_GENERIC0
) {
1450 const gl_vert_attrib attrib
= VERT_ATTRIB_GENERIC0
;
1451 const struct gl_array_attributes
*array
= &vao
->VertexAttrib
[attrib
];
1452 const void *src
= attrib_src(vao
, array
, elt
);
1453 func_arb(&array
->Format
)(0, src
);
1454 } else if (vao
->Enabled
& VERT_BIT_POS
) {
1455 const gl_vert_attrib attrib
= VERT_ATTRIB_POS
;
1456 const struct gl_array_attributes
*array
= &vao
->VertexAttrib
[attrib
];
1457 const void *src
= attrib_src(vao
, array
, elt
);
1458 func_nv(&array
->Format
)(0, src
);
1464 * Called via glArrayElement() and glDrawArrays().
1465 * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions
1466 * for all enabled vertex arrays (for elt-th element).
1467 * Note: this may be called during display list construction.
1470 _ae_ArrayElement(GLint elt
)
1472 GET_CURRENT_CONTEXT(ctx
);
1473 struct gl_vertex_array_object
*vao
;
1475 /* If PrimitiveRestart is enabled and the index is the RestartIndex
1476 * then we call PrimitiveRestartNV and return.
1478 if (ctx
->Array
.PrimitiveRestart
&& (elt
== ctx
->Array
.RestartIndex
)) {
1479 CALL_PrimitiveRestartNV(GET_DISPATCH(), ());
1483 vao
= ctx
->Array
.VAO
;
1484 _mesa_vao_map_arrays(ctx
, vao
, GL_MAP_READ_BIT
);
1486 _mesa_array_element(ctx
, elt
);
1488 _mesa_vao_unmap_arrays(ctx
, vao
);
1493 _mesa_install_arrayelt_vtxfmt(struct _glapi_table
*disp
,
1494 const GLvertexformat
*vfmt
)
1496 SET_ArrayElement(disp
, vfmt
->ArrayElement
);