1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
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.
23 */
24
25 /**
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.
30 */
31
32
33 /* Author:
34 * Keith Whitwell <keithw@vmware.com>
35 */
36
37 #include "glheader.h"
38 #include "arrayobj.h"
39 #include "api_arrayelt.h"
40 #include "bufferobj.h"
41 #include "context.h"
42
43 #include "macros.h"
44 #include "mtypes.h"
45 #include "main/dispatch.h"
46 #include "varray.h"
47 #include "api_exec_decl.h"
48
49 typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data );
50
51 /*
52 * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
53 * in the range [0, 7]. Luckily these type tokens are sequentially
54 * numbered in gl.h, except for GL_DOUBLE.
55 */
56 static inline int
TYPE_IDX(GLenum t)57 TYPE_IDX(GLenum t)
58 {
59 return t == GL_DOUBLE ? 7 : t & 7;
60 }
61
62
63 /*
64 * Convert normalized/integer/double to the range [0, 3].
65 */
66 static inline int
vertex_format_to_index(const struct gl_vertex_format * vformat)67 vertex_format_to_index(const struct gl_vertex_format *vformat)
68 {
69 if (vformat->Doubles)
70 return 3;
71 else if (vformat->Integer)
72 return 2;
73 else if (vformat->Normalized)
74 return 1;
75 else
76 return 0;
77 }
78
79
80 #define NUM_TYPES 8
81
82 static struct _glapi_table *
get_dispatch(void)83 get_dispatch(void)
84 {
85 GET_CURRENT_CONTEXT(ctx);
86 return ctx->CurrentServerDispatch;
87 }
88
89
90 /**
91 ** GL_NV_vertex_program
92 **/
93
94 /* GL_BYTE attributes */
95
96 static void GLAPIENTRY
VertexAttrib1NbvNV(GLuint index,const GLbyte * v)97 VertexAttrib1NbvNV(GLuint index, const GLbyte *v)
98 {
99 CALL_VertexAttrib1fNV(get_dispatch(), (index, BYTE_TO_FLOAT(v[0])));
100 }
101
102 static void GLAPIENTRY
VertexAttrib1bvNV(GLuint index,const GLbyte * v)103 VertexAttrib1bvNV(GLuint index, const GLbyte *v)
104 {
105 CALL_VertexAttrib1fNV(get_dispatch(), (index, (GLfloat)v[0]));
106 }
107
108 static void GLAPIENTRY
VertexAttrib2NbvNV(GLuint index,const GLbyte * v)109 VertexAttrib2NbvNV(GLuint index, const GLbyte *v)
110 {
111 CALL_VertexAttrib2fNV(get_dispatch(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
112 }
113
114 static void GLAPIENTRY
VertexAttrib2bvNV(GLuint index,const GLbyte * v)115 VertexAttrib2bvNV(GLuint index, const GLbyte *v)
116 {
117 CALL_VertexAttrib2fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1]));
118 }
119
120 static void GLAPIENTRY
VertexAttrib3NbvNV(GLuint index,const GLbyte * v)121 VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
122 {
123 CALL_VertexAttrib3fNV(get_dispatch(), (index, BYTE_TO_FLOAT(v[0]),
124 BYTE_TO_FLOAT(v[1]),
125 BYTE_TO_FLOAT(v[2])));
126 }
127
128 static void GLAPIENTRY
VertexAttrib3bvNV(GLuint index,const GLbyte * v)129 VertexAttrib3bvNV(GLuint index, const GLbyte *v)
130 {
131 CALL_VertexAttrib3fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
132 }
133
134 static void GLAPIENTRY
VertexAttrib4NbvNV(GLuint index,const GLbyte * v)135 VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
136 {
137 CALL_VertexAttrib4fNV(get_dispatch(), (index, BYTE_TO_FLOAT(v[0]),
138 BYTE_TO_FLOAT(v[1]),
139 BYTE_TO_FLOAT(v[2]),
140 BYTE_TO_FLOAT(v[3])));
141 }
142
143 static void GLAPIENTRY
VertexAttrib4bvNV(GLuint index,const GLbyte * v)144 VertexAttrib4bvNV(GLuint index, const GLbyte *v)
145 {
146 CALL_VertexAttrib4fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
147 }
148
149 /* GL_UNSIGNED_BYTE attributes */
150
151 static void GLAPIENTRY
VertexAttrib1NubvNV(GLuint index,const GLubyte * v)152 VertexAttrib1NubvNV(GLuint index, const GLubyte *v)
153 {
154 CALL_VertexAttrib1fNV(get_dispatch(), (index, UBYTE_TO_FLOAT(v[0])));
155 }
156
157 static void GLAPIENTRY
VertexAttrib1ubvNV(GLuint index,const GLubyte * v)158 VertexAttrib1ubvNV(GLuint index, const GLubyte *v)
159 {
160 CALL_VertexAttrib1fNV(get_dispatch(), (index, (GLfloat)v[0]));
161 }
162
163 static void GLAPIENTRY
VertexAttrib2NubvNV(GLuint index,const GLubyte * v)164 VertexAttrib2NubvNV(GLuint index, const GLubyte *v)
165 {
166 CALL_VertexAttrib2fNV(get_dispatch(), (index, UBYTE_TO_FLOAT(v[0]),
167 UBYTE_TO_FLOAT(v[1])));
168 }
169
170 static void GLAPIENTRY
VertexAttrib2ubvNV(GLuint index,const GLubyte * v)171 VertexAttrib2ubvNV(GLuint index, const GLubyte *v)
172 {
173 CALL_VertexAttrib2fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1]));
174 }
175
176 static void GLAPIENTRY
VertexAttrib3NubvNV(GLuint index,const GLubyte * v)177 VertexAttrib3NubvNV(GLuint index, const GLubyte *v)
178 {
179 CALL_VertexAttrib3fNV(get_dispatch(), (index, UBYTE_TO_FLOAT(v[0]),
180 UBYTE_TO_FLOAT(v[1]),
181 UBYTE_TO_FLOAT(v[2])));
182 }
183 static void GLAPIENTRY
VertexAttrib3ubvNV(GLuint index,const GLubyte * v)184 VertexAttrib3ubvNV(GLuint index, const GLubyte *v)
185 {
186 CALL_VertexAttrib3fNV(get_dispatch(), (index, (GLfloat)v[0],
187 (GLfloat)v[1], (GLfloat)v[2]));
188 }
189
190 static void GLAPIENTRY
VertexAttrib4NubvNV(GLuint index,const GLubyte * v)191 VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
192 {
193 CALL_VertexAttrib4fNV(get_dispatch(), (index, UBYTE_TO_FLOAT(v[0]),
194 UBYTE_TO_FLOAT(v[1]),
195 UBYTE_TO_FLOAT(v[2]),
196 UBYTE_TO_FLOAT(v[3])));
197 }
198
199 static void GLAPIENTRY
VertexAttrib4ubvNV(GLuint index,const GLubyte * v)200 VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
201 {
202 CALL_VertexAttrib4fNV(get_dispatch(), (index, (GLfloat)v[0],
203 (GLfloat)v[1], (GLfloat)v[2],
204 (GLfloat)v[3]));
205 }
206
207 /* GL_SHORT attributes */
208
209 static void GLAPIENTRY
VertexAttrib1NsvNV(GLuint index,const GLshort * v)210 VertexAttrib1NsvNV(GLuint index, const GLshort *v)
211 {
212 CALL_VertexAttrib1fNV(get_dispatch(), (index, SHORT_TO_FLOAT(v[0])));
213 }
214
215 static void GLAPIENTRY
VertexAttrib1svNV(GLuint index,const GLshort * v)216 VertexAttrib1svNV(GLuint index, const GLshort *v)
217 {
218 CALL_VertexAttrib1fNV(get_dispatch(), (index, (GLfloat)v[0]));
219 }
220
221 static void GLAPIENTRY
VertexAttrib2NsvNV(GLuint index,const GLshort * v)222 VertexAttrib2NsvNV(GLuint index, const GLshort *v)
223 {
224 CALL_VertexAttrib2fNV(get_dispatch(), (index, SHORT_TO_FLOAT(v[0]),
225 SHORT_TO_FLOAT(v[1])));
226 }
227
228 static void GLAPIENTRY
VertexAttrib2svNV(GLuint index,const GLshort * v)229 VertexAttrib2svNV(GLuint index, const GLshort *v)
230 {
231 CALL_VertexAttrib2fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1]));
232 }
233
234 static void GLAPIENTRY
VertexAttrib3NsvNV(GLuint index,const GLshort * v)235 VertexAttrib3NsvNV(GLuint index, const GLshort *v)
236 {
237 CALL_VertexAttrib3fNV(get_dispatch(), (index, SHORT_TO_FLOAT(v[0]),
238 SHORT_TO_FLOAT(v[1]),
239 SHORT_TO_FLOAT(v[2])));
240 }
241
242 static void GLAPIENTRY
VertexAttrib3svNV(GLuint index,const GLshort * v)243 VertexAttrib3svNV(GLuint index, const GLshort *v)
244 {
245 CALL_VertexAttrib3fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
246 (GLfloat)v[2]));
247 }
248
249 static void GLAPIENTRY
VertexAttrib4NsvNV(GLuint index,const GLshort * v)250 VertexAttrib4NsvNV(GLuint index, const GLshort *v)
251 {
252 CALL_VertexAttrib4fNV(get_dispatch(), (index, SHORT_TO_FLOAT(v[0]),
253 SHORT_TO_FLOAT(v[1]),
254 SHORT_TO_FLOAT(v[2]),
255 SHORT_TO_FLOAT(v[3])));
256 }
257
258 static void GLAPIENTRY
VertexAttrib4svNV(GLuint index,const GLshort * v)259 VertexAttrib4svNV(GLuint index, const GLshort *v)
260 {
261 CALL_VertexAttrib4fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
262 (GLfloat)v[2], (GLfloat)v[3]));
263 }
264
265 /* GL_UNSIGNED_SHORT attributes */
266
267 static void GLAPIENTRY
VertexAttrib1NusvNV(GLuint index,const GLushort * v)268 VertexAttrib1NusvNV(GLuint index, const GLushort *v)
269 {
270 CALL_VertexAttrib1fNV(get_dispatch(), (index, USHORT_TO_FLOAT(v[0])));
271 }
272
273 static void GLAPIENTRY
VertexAttrib1usvNV(GLuint index,const GLushort * v)274 VertexAttrib1usvNV(GLuint index, const GLushort *v)
275 {
276 CALL_VertexAttrib1fNV(get_dispatch(), (index, (GLfloat)v[0]));
277 }
278
279 static void GLAPIENTRY
VertexAttrib2NusvNV(GLuint index,const GLushort * v)280 VertexAttrib2NusvNV(GLuint index, const GLushort *v)
281 {
282 CALL_VertexAttrib2fNV(get_dispatch(), (index, USHORT_TO_FLOAT(v[0]),
283 USHORT_TO_FLOAT(v[1])));
284 }
285
286 static void GLAPIENTRY
VertexAttrib2usvNV(GLuint index,const GLushort * v)287 VertexAttrib2usvNV(GLuint index, const GLushort *v)
288 {
289 CALL_VertexAttrib2fNV(get_dispatch(), (index, (GLfloat)v[0],
290 (GLfloat)v[1]));
291 }
292
293 static void GLAPIENTRY
VertexAttrib3NusvNV(GLuint index,const GLushort * v)294 VertexAttrib3NusvNV(GLuint index, const GLushort *v)
295 {
296 CALL_VertexAttrib3fNV(get_dispatch(), (index, USHORT_TO_FLOAT(v[0]),
297 USHORT_TO_FLOAT(v[1]),
298 USHORT_TO_FLOAT(v[2])));
299 }
300
301 static void GLAPIENTRY
VertexAttrib3usvNV(GLuint index,const GLushort * v)302 VertexAttrib3usvNV(GLuint index, const GLushort *v)
303 {
304 CALL_VertexAttrib3fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
305 (GLfloat)v[2]));
306 }
307
308 static void GLAPIENTRY
VertexAttrib4NusvNV(GLuint index,const GLushort * v)309 VertexAttrib4NusvNV(GLuint index, const GLushort *v)
310 {
311 CALL_VertexAttrib4fNV(get_dispatch(), (index, USHORT_TO_FLOAT(v[0]),
312 USHORT_TO_FLOAT(v[1]),
313 USHORT_TO_FLOAT(v[2]),
314 USHORT_TO_FLOAT(v[3])));
315 }
316
317 static void GLAPIENTRY
VertexAttrib4usvNV(GLuint index,const GLushort * v)318 VertexAttrib4usvNV(GLuint index, const GLushort *v)
319 {
320 CALL_VertexAttrib4fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
321 (GLfloat)v[2], (GLfloat)v[3]));
322 }
323
324 /* GL_INT attributes */
325
326 static void GLAPIENTRY
VertexAttrib1NivNV(GLuint index,const GLint * v)327 VertexAttrib1NivNV(GLuint index, const GLint *v)
328 {
329 CALL_VertexAttrib1fNV(get_dispatch(), (index, INT_TO_FLOAT(v[0])));
330 }
331
332 static void GLAPIENTRY
VertexAttrib1ivNV(GLuint index,const GLint * v)333 VertexAttrib1ivNV(GLuint index, const GLint *v)
334 {
335 CALL_VertexAttrib1fNV(get_dispatch(), (index, (GLfloat)v[0]));
336 }
337
338 static void GLAPIENTRY
VertexAttrib2NivNV(GLuint index,const GLint * v)339 VertexAttrib2NivNV(GLuint index, const GLint *v)
340 {
341 CALL_VertexAttrib2fNV(get_dispatch(), (index, INT_TO_FLOAT(v[0]),
342 INT_TO_FLOAT(v[1])));
343 }
344
345 static void GLAPIENTRY
VertexAttrib2ivNV(GLuint index,const GLint * v)346 VertexAttrib2ivNV(GLuint index, const GLint *v)
347 {
348 CALL_VertexAttrib2fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1]));
349 }
350
351 static void GLAPIENTRY
VertexAttrib3NivNV(GLuint index,const GLint * v)352 VertexAttrib3NivNV(GLuint index, const GLint *v)
353 {
354 CALL_VertexAttrib3fNV(get_dispatch(), (index, INT_TO_FLOAT(v[0]),
355 INT_TO_FLOAT(v[1]),
356 INT_TO_FLOAT(v[2])));
357 }
358
359 static void GLAPIENTRY
VertexAttrib3ivNV(GLuint index,const GLint * v)360 VertexAttrib3ivNV(GLuint index, const GLint *v)
361 {
362 CALL_VertexAttrib3fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
363 (GLfloat)v[2]));
364 }
365
366 static void GLAPIENTRY
VertexAttrib4NivNV(GLuint index,const GLint * v)367 VertexAttrib4NivNV(GLuint index, const GLint *v)
368 {
369 CALL_VertexAttrib4fNV(get_dispatch(), (index, INT_TO_FLOAT(v[0]),
370 INT_TO_FLOAT(v[1]),
371 INT_TO_FLOAT(v[2]),
372 INT_TO_FLOAT(v[3])));
373 }
374
375 static void GLAPIENTRY
VertexAttrib4ivNV(GLuint index,const GLint * v)376 VertexAttrib4ivNV(GLuint index, const GLint *v)
377 {
378 CALL_VertexAttrib4fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
379 (GLfloat)v[2], (GLfloat)v[3]));
380 }
381
382 /* GL_UNSIGNED_INT attributes */
383
384 static void GLAPIENTRY
VertexAttrib1NuivNV(GLuint index,const GLuint * v)385 VertexAttrib1NuivNV(GLuint index, const GLuint *v)
386 {
387 CALL_VertexAttrib1fNV(get_dispatch(), (index, UINT_TO_FLOAT(v[0])));
388 }
389
390 static void GLAPIENTRY
VertexAttrib1uivNV(GLuint index,const GLuint * v)391 VertexAttrib1uivNV(GLuint index, const GLuint *v)
392 {
393 CALL_VertexAttrib1fNV(get_dispatch(), (index, (GLfloat)v[0]));
394 }
395
396 static void GLAPIENTRY
VertexAttrib2NuivNV(GLuint index,const GLuint * v)397 VertexAttrib2NuivNV(GLuint index, const GLuint *v)
398 {
399 CALL_VertexAttrib2fNV(get_dispatch(), (index, UINT_TO_FLOAT(v[0]),
400 UINT_TO_FLOAT(v[1])));
401 }
402
403 static void GLAPIENTRY
VertexAttrib2uivNV(GLuint index,const GLuint * v)404 VertexAttrib2uivNV(GLuint index, const GLuint *v)
405 {
406 CALL_VertexAttrib2fNV(get_dispatch(), (index, (GLfloat)v[0],
407 (GLfloat)v[1]));
408 }
409
410 static void GLAPIENTRY
VertexAttrib3NuivNV(GLuint index,const GLuint * v)411 VertexAttrib3NuivNV(GLuint index, const GLuint *v)
412 {
413 CALL_VertexAttrib3fNV(get_dispatch(), (index, UINT_TO_FLOAT(v[0]),
414 UINT_TO_FLOAT(v[1]),
415 UINT_TO_FLOAT(v[2])));
416 }
417
418 static void GLAPIENTRY
VertexAttrib3uivNV(GLuint index,const GLuint * v)419 VertexAttrib3uivNV(GLuint index, const GLuint *v)
420 {
421 CALL_VertexAttrib3fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
422 (GLfloat)v[2]));
423 }
424
425 static void GLAPIENTRY
VertexAttrib4NuivNV(GLuint index,const GLuint * v)426 VertexAttrib4NuivNV(GLuint index, const GLuint *v)
427 {
428 CALL_VertexAttrib4fNV(get_dispatch(), (index, UINT_TO_FLOAT(v[0]),
429 UINT_TO_FLOAT(v[1]),
430 UINT_TO_FLOAT(v[2]),
431 UINT_TO_FLOAT(v[3])));
432 }
433
434 static void GLAPIENTRY
VertexAttrib4uivNV(GLuint index,const GLuint * v)435 VertexAttrib4uivNV(GLuint index, const GLuint *v)
436 {
437 CALL_VertexAttrib4fNV(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
438 (GLfloat)v[2], (GLfloat)v[3]));
439 }
440
441 /* GL_FLOAT attributes */
442
443 static void GLAPIENTRY
VertexAttrib1fvNV(GLuint index,const GLfloat * v)444 VertexAttrib1fvNV(GLuint index, const GLfloat *v)
445 {
446 CALL_VertexAttrib1fvNV(get_dispatch(), (index, v));
447 }
448
449 static void GLAPIENTRY
VertexAttrib2fvNV(GLuint index,const GLfloat * v)450 VertexAttrib2fvNV(GLuint index, const GLfloat *v)
451 {
452 CALL_VertexAttrib2fvNV(get_dispatch(), (index, v));
453 }
454
455 static void GLAPIENTRY
VertexAttrib3fvNV(GLuint index,const GLfloat * v)456 VertexAttrib3fvNV(GLuint index, const GLfloat *v)
457 {
458 CALL_VertexAttrib3fvNV(get_dispatch(), (index, v));
459 }
460
461 static void GLAPIENTRY
VertexAttrib4fvNV(GLuint index,const GLfloat * v)462 VertexAttrib4fvNV(GLuint index, const GLfloat *v)
463 {
464 CALL_VertexAttrib4fvNV(get_dispatch(), (index, v));
465 }
466
467 /* GL_DOUBLE attributes */
468
469 static void GLAPIENTRY
VertexAttrib1dvNV(GLuint index,const GLdouble * v)470 VertexAttrib1dvNV(GLuint index, const GLdouble *v)
471 {
472 CALL_VertexAttrib1dvNV(get_dispatch(), (index, v));
473 }
474
475 static void GLAPIENTRY
VertexAttrib2dvNV(GLuint index,const GLdouble * v)476 VertexAttrib2dvNV(GLuint index, const GLdouble *v)
477 {
478 CALL_VertexAttrib2dvNV(get_dispatch(), (index, v));
479 }
480
481 static void GLAPIENTRY
VertexAttrib3dvNV(GLuint index,const GLdouble * v)482 VertexAttrib3dvNV(GLuint index, const GLdouble *v)
483 {
484 CALL_VertexAttrib3dvNV(get_dispatch(), (index, v));
485 }
486
487 static void GLAPIENTRY
VertexAttrib4dvNV(GLuint index,const GLdouble * v)488 VertexAttrib4dvNV(GLuint index, const GLdouble *v)
489 {
490 CALL_VertexAttrib4dvNV(get_dispatch(), (index, v));
491 }
492
493
494 /*
495 * Array [size][type] of VertexAttrib functions
496 */
497 static const attrib_func AttribFuncsNV[2][4][NUM_TYPES] = {
498 {
499 /* non-normalized */
500 {
501 /* size 1 */
502 (attrib_func) VertexAttrib1bvNV,
503 (attrib_func) VertexAttrib1ubvNV,
504 (attrib_func) VertexAttrib1svNV,
505 (attrib_func) VertexAttrib1usvNV,
506 (attrib_func) VertexAttrib1ivNV,
507 (attrib_func) VertexAttrib1uivNV,
508 (attrib_func) VertexAttrib1fvNV,
509 (attrib_func) VertexAttrib1dvNV
510 },
511 {
512 /* size 2 */
513 (attrib_func) VertexAttrib2bvNV,
514 (attrib_func) VertexAttrib2ubvNV,
515 (attrib_func) VertexAttrib2svNV,
516 (attrib_func) VertexAttrib2usvNV,
517 (attrib_func) VertexAttrib2ivNV,
518 (attrib_func) VertexAttrib2uivNV,
519 (attrib_func) VertexAttrib2fvNV,
520 (attrib_func) VertexAttrib2dvNV
521 },
522 {
523 /* size 3 */
524 (attrib_func) VertexAttrib3bvNV,
525 (attrib_func) VertexAttrib3ubvNV,
526 (attrib_func) VertexAttrib3svNV,
527 (attrib_func) VertexAttrib3usvNV,
528 (attrib_func) VertexAttrib3ivNV,
529 (attrib_func) VertexAttrib3uivNV,
530 (attrib_func) VertexAttrib3fvNV,
531 (attrib_func) VertexAttrib3dvNV
532 },
533 {
534 /* size 4 */
535 (attrib_func) VertexAttrib4bvNV,
536 (attrib_func) VertexAttrib4ubvNV,
537 (attrib_func) VertexAttrib4svNV,
538 (attrib_func) VertexAttrib4usvNV,
539 (attrib_func) VertexAttrib4ivNV,
540 (attrib_func) VertexAttrib4uivNV,
541 (attrib_func) VertexAttrib4fvNV,
542 (attrib_func) VertexAttrib4dvNV
543 }
544 },
545 {
546 /* normalized (except for float/double) */
547 {
548 /* size 1 */
549 (attrib_func) VertexAttrib1NbvNV,
550 (attrib_func) VertexAttrib1NubvNV,
551 (attrib_func) VertexAttrib1NsvNV,
552 (attrib_func) VertexAttrib1NusvNV,
553 (attrib_func) VertexAttrib1NivNV,
554 (attrib_func) VertexAttrib1NuivNV,
555 (attrib_func) VertexAttrib1fvNV,
556 (attrib_func) VertexAttrib1dvNV
557 },
558 {
559 /* size 2 */
560 (attrib_func) VertexAttrib2NbvNV,
561 (attrib_func) VertexAttrib2NubvNV,
562 (attrib_func) VertexAttrib2NsvNV,
563 (attrib_func) VertexAttrib2NusvNV,
564 (attrib_func) VertexAttrib2NivNV,
565 (attrib_func) VertexAttrib2NuivNV,
566 (attrib_func) VertexAttrib2fvNV,
567 (attrib_func) VertexAttrib2dvNV
568 },
569 {
570 /* size 3 */
571 (attrib_func) VertexAttrib3NbvNV,
572 (attrib_func) VertexAttrib3NubvNV,
573 (attrib_func) VertexAttrib3NsvNV,
574 (attrib_func) VertexAttrib3NusvNV,
575 (attrib_func) VertexAttrib3NivNV,
576 (attrib_func) VertexAttrib3NuivNV,
577 (attrib_func) VertexAttrib3fvNV,
578 (attrib_func) VertexAttrib3dvNV
579 },
580 {
581 /* size 4 */
582 (attrib_func) VertexAttrib4NbvNV,
583 (attrib_func) VertexAttrib4NubvNV,
584 (attrib_func) VertexAttrib4NsvNV,
585 (attrib_func) VertexAttrib4NusvNV,
586 (attrib_func) VertexAttrib4NivNV,
587 (attrib_func) VertexAttrib4NuivNV,
588 (attrib_func) VertexAttrib4fvNV,
589 (attrib_func) VertexAttrib4dvNV
590 }
591 }
592 };
593
594
595 /**
596 ** GL_ARB_vertex_program
597 **/
598
599 /* GL_BYTE attributes */
600
601 static void GLAPIENTRY
VertexAttrib1NbvARB(GLuint index,const GLbyte * v)602 VertexAttrib1NbvARB(GLuint index, const GLbyte *v)
603 {
604 CALL_VertexAttrib1fARB(get_dispatch(), (index, BYTE_TO_FLOAT(v[0])));
605 }
606
607 static void GLAPIENTRY
VertexAttrib1bvARB(GLuint index,const GLbyte * v)608 VertexAttrib1bvARB(GLuint index, const GLbyte *v)
609 {
610 CALL_VertexAttrib1fARB(get_dispatch(), (index, (GLfloat)v[0]));
611 }
612
613 static void GLAPIENTRY
VertexAttrib2NbvARB(GLuint index,const GLbyte * v)614 VertexAttrib2NbvARB(GLuint index, const GLbyte *v)
615 {
616 CALL_VertexAttrib2fARB(get_dispatch(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
617 }
618
619 static void GLAPIENTRY
VertexAttrib2bvARB(GLuint index,const GLbyte * v)620 VertexAttrib2bvARB(GLuint index, const GLbyte *v)
621 {
622 CALL_VertexAttrib2fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1]));
623 }
624
625 static void GLAPIENTRY
VertexAttrib3NbvARB(GLuint index,const GLbyte * v)626 VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
627 {
628 CALL_VertexAttrib3fARB(get_dispatch(), (index, BYTE_TO_FLOAT(v[0]),
629 BYTE_TO_FLOAT(v[1]),
630 BYTE_TO_FLOAT(v[2])));
631 }
632
633 static void GLAPIENTRY
VertexAttrib3bvARB(GLuint index,const GLbyte * v)634 VertexAttrib3bvARB(GLuint index, const GLbyte *v)
635 {
636 CALL_VertexAttrib3fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
637 }
638
639 static void GLAPIENTRY
VertexAttrib4NbvARB(GLuint index,const GLbyte * v)640 VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
641 {
642 CALL_VertexAttrib4fARB(get_dispatch(), (index, BYTE_TO_FLOAT(v[0]),
643 BYTE_TO_FLOAT(v[1]),
644 BYTE_TO_FLOAT(v[2]),
645 BYTE_TO_FLOAT(v[3])));
646 }
647
648 static void GLAPIENTRY
VertexAttrib4bvARB(GLuint index,const GLbyte * v)649 VertexAttrib4bvARB(GLuint index, const GLbyte *v)
650 {
651 CALL_VertexAttrib4fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
652 }
653
654 /* GL_UNSIGNED_BYTE attributes */
655
656 static void GLAPIENTRY
VertexAttrib1NubvARB(GLuint index,const GLubyte * v)657 VertexAttrib1NubvARB(GLuint index, const GLubyte *v)
658 {
659 CALL_VertexAttrib1fARB(get_dispatch(), (index, UBYTE_TO_FLOAT(v[0])));
660 }
661
662 static void GLAPIENTRY
VertexAttrib1ubvARB(GLuint index,const GLubyte * v)663 VertexAttrib1ubvARB(GLuint index, const GLubyte *v)
664 {
665 CALL_VertexAttrib1fARB(get_dispatch(), (index, (GLfloat)v[0]));
666 }
667
668 static void GLAPIENTRY
VertexAttrib2NubvARB(GLuint index,const GLubyte * v)669 VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
670 {
671 CALL_VertexAttrib2fARB(get_dispatch(), (index,
672 UBYTE_TO_FLOAT(v[0]),
673 UBYTE_TO_FLOAT(v[1])));
674 }
675
676 static void GLAPIENTRY
VertexAttrib2ubvARB(GLuint index,const GLubyte * v)677 VertexAttrib2ubvARB(GLuint index, const GLubyte *v)
678 {
679 CALL_VertexAttrib2fARB(get_dispatch(), (index,
680 (GLfloat)v[0], (GLfloat)v[1]));
681 }
682
683 static void GLAPIENTRY
VertexAttrib3NubvARB(GLuint index,const GLubyte * v)684 VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
685 {
686 CALL_VertexAttrib3fARB(get_dispatch(), (index,
687 UBYTE_TO_FLOAT(v[0]),
688 UBYTE_TO_FLOAT(v[1]),
689 UBYTE_TO_FLOAT(v[2])));
690 }
691 static void GLAPIENTRY
VertexAttrib3ubvARB(GLuint index,const GLubyte * v)692 VertexAttrib3ubvARB(GLuint index, const GLubyte *v)
693 {
694 CALL_VertexAttrib3fARB(get_dispatch(), (index,
695 (GLfloat)v[0],
696 (GLfloat)v[1],
697 (GLfloat)v[2]));
698 }
699
700 static void GLAPIENTRY
VertexAttrib4NubvARB(GLuint index,const GLubyte * v)701 VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
702 {
703 CALL_VertexAttrib4fARB(get_dispatch(),
704 (index,
705 UBYTE_TO_FLOAT(v[0]),
706 UBYTE_TO_FLOAT(v[1]),
707 UBYTE_TO_FLOAT(v[2]),
708 UBYTE_TO_FLOAT(v[3])));
709 }
710
711 static void GLAPIENTRY
VertexAttrib4ubvARB(GLuint index,const GLubyte * v)712 VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
713 {
714 CALL_VertexAttrib4fARB(get_dispatch(),
715 (index,
716 (GLfloat)v[0], (GLfloat)v[1],
717 (GLfloat)v[2], (GLfloat)v[3]));
718 }
719
720 /* GL_SHORT attributes */
721
722 static void GLAPIENTRY
VertexAttrib1NsvARB(GLuint index,const GLshort * v)723 VertexAttrib1NsvARB(GLuint index, const GLshort *v)
724 {
725 CALL_VertexAttrib1fARB(get_dispatch(), (index, SHORT_TO_FLOAT(v[0])));
726 }
727
728 static void GLAPIENTRY
VertexAttrib1svARB(GLuint index,const GLshort * v)729 VertexAttrib1svARB(GLuint index, const GLshort *v)
730 {
731 CALL_VertexAttrib1fARB(get_dispatch(), (index, (GLfloat)v[0]));
732 }
733
734 static void GLAPIENTRY
VertexAttrib2NsvARB(GLuint index,const GLshort * v)735 VertexAttrib2NsvARB(GLuint index, const GLshort *v)
736 {
737 CALL_VertexAttrib2fARB(get_dispatch(),
738 (index, SHORT_TO_FLOAT(v[0]),
739 SHORT_TO_FLOAT(v[1])));
740 }
741
742 static void GLAPIENTRY
VertexAttrib2svARB(GLuint index,const GLshort * v)743 VertexAttrib2svARB(GLuint index, const GLshort *v)
744 {
745 CALL_VertexAttrib2fARB(get_dispatch(),
746 (index, (GLfloat)v[0], (GLfloat)v[1]));
747 }
748
749 static void GLAPIENTRY
VertexAttrib3NsvARB(GLuint index,const GLshort * v)750 VertexAttrib3NsvARB(GLuint index, const GLshort *v)
751 {
752 CALL_VertexAttrib3fARB(get_dispatch(),
753 (index,
754 SHORT_TO_FLOAT(v[0]),
755 SHORT_TO_FLOAT(v[1]),
756 SHORT_TO_FLOAT(v[2])));
757 }
758
759 static void GLAPIENTRY
VertexAttrib3svARB(GLuint index,const GLshort * v)760 VertexAttrib3svARB(GLuint index, const GLshort *v)
761 {
762 CALL_VertexAttrib3fARB(get_dispatch(),
763 (index,
764 (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
765 }
766
767 static void GLAPIENTRY
VertexAttrib4NsvARB(GLuint index,const GLshort * v)768 VertexAttrib4NsvARB(GLuint index, const GLshort *v)
769 {
770 CALL_VertexAttrib4fARB(get_dispatch(),
771 (index,
772 SHORT_TO_FLOAT(v[0]),
773 SHORT_TO_FLOAT(v[1]),
774 SHORT_TO_FLOAT(v[2]),
775 SHORT_TO_FLOAT(v[3])));
776 }
777
778 static void GLAPIENTRY
VertexAttrib4svARB(GLuint index,const GLshort * v)779 VertexAttrib4svARB(GLuint index, const GLshort *v)
780 {
781 CALL_VertexAttrib4fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
782 (GLfloat)v[2], (GLfloat)v[3]));
783 }
784
785 /* GL_UNSIGNED_SHORT attributes */
786
787 static void GLAPIENTRY
VertexAttrib1NusvARB(GLuint index,const GLushort * v)788 VertexAttrib1NusvARB(GLuint index, const GLushort *v)
789 {
790 CALL_VertexAttrib1fARB(get_dispatch(), (index, USHORT_TO_FLOAT(v[0])));
791 }
792
793 static void GLAPIENTRY
VertexAttrib1usvARB(GLuint index,const GLushort * v)794 VertexAttrib1usvARB(GLuint index, const GLushort *v)
795 {
796 CALL_VertexAttrib1fARB(get_dispatch(), (index, (GLfloat)v[0]));
797 }
798
799 static void GLAPIENTRY
VertexAttrib2NusvARB(GLuint index,const GLushort * v)800 VertexAttrib2NusvARB(GLuint index, const GLushort *v)
801 {
802 CALL_VertexAttrib2fARB(get_dispatch(), (index, USHORT_TO_FLOAT(v[0]),
803 USHORT_TO_FLOAT(v[1])));
804 }
805
806 static void GLAPIENTRY
VertexAttrib2usvARB(GLuint index,const GLushort * v)807 VertexAttrib2usvARB(GLuint index, const GLushort *v)
808 {
809 CALL_VertexAttrib2fARB(get_dispatch(), (index, (GLfloat)v[0],
810 (GLfloat)v[1]));
811 }
812
813 static void GLAPIENTRY
VertexAttrib3NusvARB(GLuint index,const GLushort * v)814 VertexAttrib3NusvARB(GLuint index, const GLushort *v)
815 {
816 CALL_VertexAttrib3fARB(get_dispatch(), (index, USHORT_TO_FLOAT(v[0]),
817 USHORT_TO_FLOAT(v[1]),
818 USHORT_TO_FLOAT(v[2])));
819 }
820
821 static void GLAPIENTRY
VertexAttrib3usvARB(GLuint index,const GLushort * v)822 VertexAttrib3usvARB(GLuint index, const GLushort *v)
823 {
824 CALL_VertexAttrib3fARB(get_dispatch(), (index, (GLfloat)v[0],
825 (GLfloat)v[1], (GLfloat)v[2]));
826 }
827
828 static void GLAPIENTRY
VertexAttrib4NusvARB(GLuint index,const GLushort * v)829 VertexAttrib4NusvARB(GLuint index, const GLushort *v)
830 {
831 CALL_VertexAttrib4fARB(get_dispatch(), (index, USHORT_TO_FLOAT(v[0]),
832 USHORT_TO_FLOAT(v[1]),
833 USHORT_TO_FLOAT(v[2]),
834 USHORT_TO_FLOAT(v[3])));
835 }
836
837 static void GLAPIENTRY
VertexAttrib4usvARB(GLuint index,const GLushort * v)838 VertexAttrib4usvARB(GLuint index, const GLushort *v)
839 {
840 CALL_VertexAttrib4fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
841 }
842
843 /* GL_INT attributes */
844
845 static void GLAPIENTRY
VertexAttrib1NivARB(GLuint index,const GLint * v)846 VertexAttrib1NivARB(GLuint index, const GLint *v)
847 {
848 CALL_VertexAttrib1fARB(get_dispatch(), (index, INT_TO_FLOAT(v[0])));
849 }
850
851 static void GLAPIENTRY
VertexAttrib1ivARB(GLuint index,const GLint * v)852 VertexAttrib1ivARB(GLuint index, const GLint *v)
853 {
854 CALL_VertexAttrib1fARB(get_dispatch(), (index, (GLfloat)v[0]));
855 }
856
857 static void GLAPIENTRY
VertexAttrib2NivARB(GLuint index,const GLint * v)858 VertexAttrib2NivARB(GLuint index, const GLint *v)
859 {
860 CALL_VertexAttrib2fARB(get_dispatch(), (index, INT_TO_FLOAT(v[0]),
861 INT_TO_FLOAT(v[1])));
862 }
863
864 static void GLAPIENTRY
VertexAttrib2ivARB(GLuint index,const GLint * v)865 VertexAttrib2ivARB(GLuint index, const GLint *v)
866 {
867 CALL_VertexAttrib2fARB(get_dispatch(), (index, (GLfloat)v[0],
868 (GLfloat)v[1]));
869 }
870
871 static void GLAPIENTRY
VertexAttrib3NivARB(GLuint index,const GLint * v)872 VertexAttrib3NivARB(GLuint index, const GLint *v)
873 {
874 CALL_VertexAttrib3fARB(get_dispatch(), (index, INT_TO_FLOAT(v[0]),
875 INT_TO_FLOAT(v[1]),
876 INT_TO_FLOAT(v[2])));
877 }
878
879 static void GLAPIENTRY
VertexAttrib3ivARB(GLuint index,const GLint * v)880 VertexAttrib3ivARB(GLuint index, const GLint *v)
881 {
882 CALL_VertexAttrib3fARB(get_dispatch(), (index, (GLfloat)v[0],
883 (GLfloat)v[1], (GLfloat)v[2]));
884 }
885
886 static void GLAPIENTRY
VertexAttrib4NivARB(GLuint index,const GLint * v)887 VertexAttrib4NivARB(GLuint index, const GLint *v)
888 {
889 CALL_VertexAttrib4fARB(get_dispatch(), (index, INT_TO_FLOAT(v[0]),
890 INT_TO_FLOAT(v[1]),
891 INT_TO_FLOAT(v[2]),
892 INT_TO_FLOAT(v[3])));
893 }
894
895 static void GLAPIENTRY
VertexAttrib4ivARB(GLuint index,const GLint * v)896 VertexAttrib4ivARB(GLuint index, const GLint *v)
897 {
898 CALL_VertexAttrib4fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
899 (GLfloat)v[2], (GLfloat)v[3]));
900 }
901
902 /* GL_UNSIGNED_INT attributes */
903
904 static void GLAPIENTRY
VertexAttrib1NuivARB(GLuint index,const GLuint * v)905 VertexAttrib1NuivARB(GLuint index, const GLuint *v)
906 {
907 CALL_VertexAttrib1fARB(get_dispatch(), (index, UINT_TO_FLOAT(v[0])));
908 }
909
910 static void GLAPIENTRY
VertexAttrib1uivARB(GLuint index,const GLuint * v)911 VertexAttrib1uivARB(GLuint index, const GLuint *v)
912 {
913 CALL_VertexAttrib1fARB(get_dispatch(), (index, (GLfloat)v[0]));
914 }
915
916 static void GLAPIENTRY
VertexAttrib2NuivARB(GLuint index,const GLuint * v)917 VertexAttrib2NuivARB(GLuint index, const GLuint *v)
918 {
919 CALL_VertexAttrib2fARB(get_dispatch(), (index, UINT_TO_FLOAT(v[0]),
920 UINT_TO_FLOAT(v[1])));
921 }
922
923 static void GLAPIENTRY
VertexAttrib2uivARB(GLuint index,const GLuint * v)924 VertexAttrib2uivARB(GLuint index, const GLuint *v)
925 {
926 CALL_VertexAttrib2fARB(get_dispatch(), (index, (GLfloat)v[0],
927 (GLfloat)v[1]));
928 }
929
930 static void GLAPIENTRY
VertexAttrib3NuivARB(GLuint index,const GLuint * v)931 VertexAttrib3NuivARB(GLuint index, const GLuint *v)
932 {
933 CALL_VertexAttrib3fARB(get_dispatch(), (index, UINT_TO_FLOAT(v[0]),
934 UINT_TO_FLOAT(v[1]),
935 UINT_TO_FLOAT(v[2])));
936 }
937
938 static void GLAPIENTRY
VertexAttrib3uivARB(GLuint index,const GLuint * v)939 VertexAttrib3uivARB(GLuint index, const GLuint *v)
940 {
941 CALL_VertexAttrib3fARB(get_dispatch(), (index, (GLfloat)v[0],
942 (GLfloat)v[1], (GLfloat)v[2]));
943 }
944
945 static void GLAPIENTRY
VertexAttrib4NuivARB(GLuint index,const GLuint * v)946 VertexAttrib4NuivARB(GLuint index, const GLuint *v)
947 {
948 CALL_VertexAttrib4fARB(get_dispatch(), (index, UINT_TO_FLOAT(v[0]),
949 UINT_TO_FLOAT(v[1]),
950 UINT_TO_FLOAT(v[2]),
951 UINT_TO_FLOAT(v[3])));
952 }
953
954 static void GLAPIENTRY
VertexAttrib4uivARB(GLuint index,const GLuint * v)955 VertexAttrib4uivARB(GLuint index, const GLuint *v)
956 {
957 CALL_VertexAttrib4fARB(get_dispatch(), (index, (GLfloat)v[0], (GLfloat)v[1],
958 (GLfloat)v[2], (GLfloat)v[3]));
959 }
960
961 /* GL_FLOAT attributes */
962
963 static void GLAPIENTRY
VertexAttrib1fvARB(GLuint index,const GLfloat * v)964 VertexAttrib1fvARB(GLuint index, const GLfloat *v)
965 {
966 CALL_VertexAttrib1fvARB(get_dispatch(), (index, v));
967 }
968
969 static void GLAPIENTRY
VertexAttrib2fvARB(GLuint index,const GLfloat * v)970 VertexAttrib2fvARB(GLuint index, const GLfloat *v)
971 {
972 CALL_VertexAttrib2fvARB(get_dispatch(), (index, v));
973 }
974
975 static void GLAPIENTRY
VertexAttrib3fvARB(GLuint index,const GLfloat * v)976 VertexAttrib3fvARB(GLuint index, const GLfloat *v)
977 {
978 CALL_VertexAttrib3fvARB(get_dispatch(), (index, v));
979 }
980
981 static void GLAPIENTRY
VertexAttrib4fvARB(GLuint index,const GLfloat * v)982 VertexAttrib4fvARB(GLuint index, const GLfloat *v)
983 {
984 CALL_VertexAttrib4fvARB(get_dispatch(), (index, v));
985 }
986
987 /* GL_DOUBLE attributes */
988
989 static void GLAPIENTRY
VertexAttrib1dvARB(GLuint index,const GLdouble * v)990 VertexAttrib1dvARB(GLuint index, const GLdouble *v)
991 {
992 CALL_VertexAttrib1dv(get_dispatch(), (index, v));
993 }
994
995 static void GLAPIENTRY
VertexAttrib2dvARB(GLuint index,const GLdouble * v)996 VertexAttrib2dvARB(GLuint index, const GLdouble *v)
997 {
998 CALL_VertexAttrib2dv(get_dispatch(), (index, v));
999 }
1000
1001 static void GLAPIENTRY
VertexAttrib3dvARB(GLuint index,const GLdouble * v)1002 VertexAttrib3dvARB(GLuint index, const GLdouble *v)
1003 {
1004 CALL_VertexAttrib3dv(get_dispatch(), (index, v));
1005 }
1006
1007 static void GLAPIENTRY
VertexAttrib4dvARB(GLuint index,const GLdouble * v)1008 VertexAttrib4dvARB(GLuint index, const GLdouble *v)
1009 {
1010 CALL_VertexAttrib4dv(get_dispatch(), (index, v));
1011 }
1012
1013
1014 /**
1015 * Integer-valued attributes
1016 */
1017 static void GLAPIENTRY
VertexAttribI1bv(GLuint index,const GLbyte * v)1018 VertexAttribI1bv(GLuint index, const GLbyte *v)
1019 {
1020 CALL_VertexAttribI1iEXT(get_dispatch(), (index, v[0]));
1021 }
1022
1023 static void GLAPIENTRY
VertexAttribI2bv(GLuint index,const GLbyte * v)1024 VertexAttribI2bv(GLuint index, const GLbyte *v)
1025 {
1026 CALL_VertexAttribI2iEXT(get_dispatch(), (index, v[0], v[1]));
1027 }
1028
1029 static void GLAPIENTRY
VertexAttribI3bv(GLuint index,const GLbyte * v)1030 VertexAttribI3bv(GLuint index, const GLbyte *v)
1031 {
1032 CALL_VertexAttribI3iEXT(get_dispatch(), (index, v[0], v[1], v[2]));
1033 }
1034
1035 static void GLAPIENTRY
VertexAttribI4bv(GLuint index,const GLbyte * v)1036 VertexAttribI4bv(GLuint index, const GLbyte *v)
1037 {
1038 CALL_VertexAttribI4bv(get_dispatch(), (index, v));
1039 }
1040
1041
1042 static void GLAPIENTRY
VertexAttribI1ubv(GLuint index,const GLubyte * v)1043 VertexAttribI1ubv(GLuint index, const GLubyte *v)
1044 {
1045 CALL_VertexAttribI1uiEXT(get_dispatch(), (index, v[0]));
1046 }
1047
1048 static void GLAPIENTRY
VertexAttribI2ubv(GLuint index,const GLubyte * v)1049 VertexAttribI2ubv(GLuint index, const GLubyte *v)
1050 {
1051 CALL_VertexAttribI2uiEXT(get_dispatch(), (index, v[0], v[1]));
1052 }
1053
1054 static void GLAPIENTRY
VertexAttribI3ubv(GLuint index,const GLubyte * v)1055 VertexAttribI3ubv(GLuint index, const GLubyte *v)
1056 {
1057 CALL_VertexAttribI3uiEXT(get_dispatch(), (index, v[0], v[1], v[2]));
1058 }
1059
1060 static void GLAPIENTRY
VertexAttribI4ubv(GLuint index,const GLubyte * v)1061 VertexAttribI4ubv(GLuint index, const GLubyte *v)
1062 {
1063 CALL_VertexAttribI4ubv(get_dispatch(), (index, v));
1064 }
1065
1066
1067
1068 static void GLAPIENTRY
VertexAttribI1sv(GLuint index,const GLshort * v)1069 VertexAttribI1sv(GLuint index, const GLshort *v)
1070 {
1071 CALL_VertexAttribI1iEXT(get_dispatch(), (index, v[0]));
1072 }
1073
1074 static void GLAPIENTRY
VertexAttribI2sv(GLuint index,const GLshort * v)1075 VertexAttribI2sv(GLuint index, const GLshort *v)
1076 {
1077 CALL_VertexAttribI2iEXT(get_dispatch(), (index, v[0], v[1]));
1078 }
1079
1080 static void GLAPIENTRY
VertexAttribI3sv(GLuint index,const GLshort * v)1081 VertexAttribI3sv(GLuint index, const GLshort *v)
1082 {
1083 CALL_VertexAttribI3iEXT(get_dispatch(), (index, v[0], v[1], v[2]));
1084 }
1085
1086 static void GLAPIENTRY
VertexAttribI4sv(GLuint index,const GLshort * v)1087 VertexAttribI4sv(GLuint index, const GLshort *v)
1088 {
1089 CALL_VertexAttribI4sv(get_dispatch(), (index, v));
1090 }
1091
1092
1093 static void GLAPIENTRY
VertexAttribI1usv(GLuint index,const GLushort * v)1094 VertexAttribI1usv(GLuint index, const GLushort *v)
1095 {
1096 CALL_VertexAttribI1uiEXT(get_dispatch(), (index, v[0]));
1097 }
1098
1099 static void GLAPIENTRY
VertexAttribI2usv(GLuint index,const GLushort * v)1100 VertexAttribI2usv(GLuint index, const GLushort *v)
1101 {
1102 CALL_VertexAttribI2uiEXT(get_dispatch(), (index, v[0], v[1]));
1103 }
1104
1105 static void GLAPIENTRY
VertexAttribI3usv(GLuint index,const GLushort * v)1106 VertexAttribI3usv(GLuint index, const GLushort *v)
1107 {
1108 CALL_VertexAttribI3uiEXT(get_dispatch(), (index, v[0], v[1], v[2]));
1109 }
1110
1111 static void GLAPIENTRY
VertexAttribI4usv(GLuint index,const GLushort * v)1112 VertexAttribI4usv(GLuint index, const GLushort *v)
1113 {
1114 CALL_VertexAttribI4usv(get_dispatch(), (index, v));
1115 }
1116
1117
1118
1119 static void GLAPIENTRY
VertexAttribI1iv(GLuint index,const GLint * v)1120 VertexAttribI1iv(GLuint index, const GLint *v)
1121 {
1122 CALL_VertexAttribI1iEXT(get_dispatch(), (index, v[0]));
1123 }
1124
1125 static void GLAPIENTRY
VertexAttribI2iv(GLuint index,const GLint * v)1126 VertexAttribI2iv(GLuint index, const GLint *v)
1127 {
1128 CALL_VertexAttribI2iEXT(get_dispatch(), (index, v[0], v[1]));
1129 }
1130
1131 static void GLAPIENTRY
VertexAttribI3iv(GLuint index,const GLint * v)1132 VertexAttribI3iv(GLuint index, const GLint *v)
1133 {
1134 CALL_VertexAttribI3iEXT(get_dispatch(), (index, v[0], v[1], v[2]));
1135 }
1136
1137 static void GLAPIENTRY
VertexAttribI4iv(GLuint index,const GLint * v)1138 VertexAttribI4iv(GLuint index, const GLint *v)
1139 {
1140 CALL_VertexAttribI4ivEXT(get_dispatch(), (index, v));
1141 }
1142
1143
1144 static void GLAPIENTRY
VertexAttribI1uiv(GLuint index,const GLuint * v)1145 VertexAttribI1uiv(GLuint index, const GLuint *v)
1146 {
1147 CALL_VertexAttribI1uiEXT(get_dispatch(), (index, v[0]));
1148 }
1149
1150 static void GLAPIENTRY
VertexAttribI2uiv(GLuint index,const GLuint * v)1151 VertexAttribI2uiv(GLuint index, const GLuint *v)
1152 {
1153 CALL_VertexAttribI2uiEXT(get_dispatch(), (index, v[0], v[1]));
1154 }
1155
1156 static void GLAPIENTRY
VertexAttribI3uiv(GLuint index,const GLuint * v)1157 VertexAttribI3uiv(GLuint index, const GLuint *v)
1158 {
1159 CALL_VertexAttribI3uiEXT(get_dispatch(), (index, v[0], v[1], v[2]));
1160 }
1161
1162 static void GLAPIENTRY
VertexAttribI4uiv(GLuint index,const GLuint * v)1163 VertexAttribI4uiv(GLuint index, const GLuint *v)
1164 {
1165 CALL_VertexAttribI4uivEXT(get_dispatch(), (index, v));
1166 }
1167
1168 /* GL_DOUBLE unconverted attributes */
1169
1170 static void GLAPIENTRY
VertexAttribL1dv(GLuint index,const GLdouble * v)1171 VertexAttribL1dv(GLuint index, const GLdouble *v)
1172 {
1173 CALL_VertexAttribL1dv(get_dispatch(), (index, v));
1174 }
1175
1176 static void GLAPIENTRY
VertexAttribL2dv(GLuint index,const GLdouble * v)1177 VertexAttribL2dv(GLuint index, const GLdouble *v)
1178 {
1179 CALL_VertexAttribL2dv(get_dispatch(), (index, v));
1180 }
1181
1182 static void GLAPIENTRY
VertexAttribL3dv(GLuint index,const GLdouble * v)1183 VertexAttribL3dv(GLuint index, const GLdouble *v)
1184 {
1185 CALL_VertexAttribL3dv(get_dispatch(), (index, v));
1186 }
1187
1188 static void GLAPIENTRY
VertexAttribL4dv(GLuint index,const GLdouble * v)1189 VertexAttribL4dv(GLuint index, const GLdouble *v)
1190 {
1191 CALL_VertexAttribL4dv(get_dispatch(), (index, v));
1192 }
1193
1194 /*
1195 * Array [unnormalized/normalized/integer][size][type] of VertexAttrib
1196 * functions
1197 */
1198 static const attrib_func AttribFuncsARB[4][4][NUM_TYPES] = {
1199 {
1200 /* non-normalized */
1201 {
1202 /* size 1 */
1203 (attrib_func) VertexAttrib1bvARB,
1204 (attrib_func) VertexAttrib1ubvARB,
1205 (attrib_func) VertexAttrib1svARB,
1206 (attrib_func) VertexAttrib1usvARB,
1207 (attrib_func) VertexAttrib1ivARB,
1208 (attrib_func) VertexAttrib1uivARB,
1209 (attrib_func) VertexAttrib1fvARB,
1210 (attrib_func) VertexAttrib1dvARB
1211 },
1212 {
1213 /* size 2 */
1214 (attrib_func) VertexAttrib2bvARB,
1215 (attrib_func) VertexAttrib2ubvARB,
1216 (attrib_func) VertexAttrib2svARB,
1217 (attrib_func) VertexAttrib2usvARB,
1218 (attrib_func) VertexAttrib2ivARB,
1219 (attrib_func) VertexAttrib2uivARB,
1220 (attrib_func) VertexAttrib2fvARB,
1221 (attrib_func) VertexAttrib2dvARB
1222 },
1223 {
1224 /* size 3 */
1225 (attrib_func) VertexAttrib3bvARB,
1226 (attrib_func) VertexAttrib3ubvARB,
1227 (attrib_func) VertexAttrib3svARB,
1228 (attrib_func) VertexAttrib3usvARB,
1229 (attrib_func) VertexAttrib3ivARB,
1230 (attrib_func) VertexAttrib3uivARB,
1231 (attrib_func) VertexAttrib3fvARB,
1232 (attrib_func) VertexAttrib3dvARB
1233 },
1234 {
1235 /* size 4 */
1236 (attrib_func) VertexAttrib4bvARB,
1237 (attrib_func) VertexAttrib4ubvARB,
1238 (attrib_func) VertexAttrib4svARB,
1239 (attrib_func) VertexAttrib4usvARB,
1240 (attrib_func) VertexAttrib4ivARB,
1241 (attrib_func) VertexAttrib4uivARB,
1242 (attrib_func) VertexAttrib4fvARB,
1243 (attrib_func) VertexAttrib4dvARB
1244 }
1245 },
1246 {
1247 /* normalized (except for float/double) */
1248 {
1249 /* size 1 */
1250 (attrib_func) VertexAttrib1NbvARB,
1251 (attrib_func) VertexAttrib1NubvARB,
1252 (attrib_func) VertexAttrib1NsvARB,
1253 (attrib_func) VertexAttrib1NusvARB,
1254 (attrib_func) VertexAttrib1NivARB,
1255 (attrib_func) VertexAttrib1NuivARB,
1256 (attrib_func) VertexAttrib1fvARB,
1257 (attrib_func) VertexAttrib1dvARB
1258 },
1259 {
1260 /* size 2 */
1261 (attrib_func) VertexAttrib2NbvARB,
1262 (attrib_func) VertexAttrib2NubvARB,
1263 (attrib_func) VertexAttrib2NsvARB,
1264 (attrib_func) VertexAttrib2NusvARB,
1265 (attrib_func) VertexAttrib2NivARB,
1266 (attrib_func) VertexAttrib2NuivARB,
1267 (attrib_func) VertexAttrib2fvARB,
1268 (attrib_func) VertexAttrib2dvARB
1269 },
1270 {
1271 /* size 3 */
1272 (attrib_func) VertexAttrib3NbvARB,
1273 (attrib_func) VertexAttrib3NubvARB,
1274 (attrib_func) VertexAttrib3NsvARB,
1275 (attrib_func) VertexAttrib3NusvARB,
1276 (attrib_func) VertexAttrib3NivARB,
1277 (attrib_func) VertexAttrib3NuivARB,
1278 (attrib_func) VertexAttrib3fvARB,
1279 (attrib_func) VertexAttrib3dvARB
1280 },
1281 {
1282 /* size 4 */
1283 (attrib_func) VertexAttrib4NbvARB,
1284 (attrib_func) VertexAttrib4NubvARB,
1285 (attrib_func) VertexAttrib4NsvARB,
1286 (attrib_func) VertexAttrib4NusvARB,
1287 (attrib_func) VertexAttrib4NivARB,
1288 (attrib_func) VertexAttrib4NuivARB,
1289 (attrib_func) VertexAttrib4fvARB,
1290 (attrib_func) VertexAttrib4dvARB
1291 }
1292 },
1293
1294 {
1295 /* integer-valued */
1296 {
1297 /* size 1 */
1298 (attrib_func) VertexAttribI1bv,
1299 (attrib_func) VertexAttribI1ubv,
1300 (attrib_func) VertexAttribI1sv,
1301 (attrib_func) VertexAttribI1usv,
1302 (attrib_func) VertexAttribI1iv,
1303 (attrib_func) VertexAttribI1uiv,
1304 NULL, /* GL_FLOAT */
1305 NULL /* GL_DOUBLE */
1306 },
1307 {
1308 /* size 2 */
1309 (attrib_func) VertexAttribI2bv,
1310 (attrib_func) VertexAttribI2ubv,
1311 (attrib_func) VertexAttribI2sv,
1312 (attrib_func) VertexAttribI2usv,
1313 (attrib_func) VertexAttribI2iv,
1314 (attrib_func) VertexAttribI2uiv,
1315 NULL, /* GL_FLOAT */
1316 NULL /* GL_DOUBLE */
1317 },
1318 {
1319 /* size 3 */
1320 (attrib_func) VertexAttribI3bv,
1321 (attrib_func) VertexAttribI3ubv,
1322 (attrib_func) VertexAttribI3sv,
1323 (attrib_func) VertexAttribI3usv,
1324 (attrib_func) VertexAttribI3iv,
1325 (attrib_func) VertexAttribI3uiv,
1326 NULL, /* GL_FLOAT */
1327 NULL /* GL_DOUBLE */
1328 },
1329 {
1330 /* size 4 */
1331 (attrib_func) VertexAttribI4bv,
1332 (attrib_func) VertexAttribI4ubv,
1333 (attrib_func) VertexAttribI4sv,
1334 (attrib_func) VertexAttribI4usv,
1335 (attrib_func) VertexAttribI4iv,
1336 (attrib_func) VertexAttribI4uiv,
1337 NULL, /* GL_FLOAT */
1338 NULL /* GL_DOUBLE */
1339 }
1340 },
1341 {
1342 /* double-valued */
1343 {
1344 /* size 1 */
1345 NULL,
1346 NULL,
1347 NULL,
1348 NULL,
1349 NULL,
1350 NULL,
1351 NULL,
1352 (attrib_func) VertexAttribL1dv,
1353 },
1354 {
1355 /* size 2 */
1356 NULL,
1357 NULL,
1358 NULL,
1359 NULL,
1360 NULL,
1361 NULL,
1362 NULL,
1363 (attrib_func) VertexAttribL2dv,
1364 },
1365 {
1366 /* size 3 */
1367 NULL,
1368 NULL,
1369 NULL,
1370 NULL,
1371 NULL,
1372 NULL,
1373 NULL,
1374 (attrib_func) VertexAttribL3dv,
1375 },
1376 {
1377 /* size 4 */
1378 NULL,
1379 NULL,
1380 NULL,
1381 NULL,
1382 NULL,
1383 NULL,
1384 NULL,
1385 (attrib_func) VertexAttribL4dv,
1386 }
1387 }
1388
1389 };
1390
1391
1392 /*
1393 * Return VertexAttrib*NV function pointer matching the provided vertex format.
1394 */
1395 static inline attrib_func
func_nv(const struct gl_vertex_format * vformat)1396 func_nv(const struct gl_vertex_format *vformat)
1397 {
1398 return AttribFuncsNV[vformat->Normalized][vformat->Size-1]
1399 [TYPE_IDX(vformat->Type)];
1400 }
1401
1402
1403 /*
1404 * Return VertexAttrib*ARB function pointer matching the provided vertex format.
1405 */
1406 static inline attrib_func
func_arb(const struct gl_vertex_format * vformat)1407 func_arb(const struct gl_vertex_format *vformat)
1408 {
1409 return AttribFuncsARB[vertex_format_to_index(vformat)][vformat->Size-1]
1410 [TYPE_IDX(vformat->Type)];
1411 }
1412
1413
1414 /*
1415 * Return the address of the array attribute array at elt in the
1416 * vertex array object vao.
1417 */
1418 static inline const void *
attrib_src(const struct gl_vertex_array_object * vao,const struct gl_array_attributes * array,GLint elt)1419 attrib_src(const struct gl_vertex_array_object *vao,
1420 const struct gl_array_attributes *array, GLint elt)
1421 {
1422 const struct gl_vertex_buffer_binding *binding =
1423 &vao->BufferBinding[array->BufferBindingIndex];
1424 const GLubyte *src = _mesa_vertex_attrib_address(array, binding);
1425
1426 if (binding->BufferObj) {
1427 src = ADD_POINTERS(binding->BufferObj->Mappings[MAP_INTERNAL].Pointer,
1428 src);
1429 }
1430
1431 return src + elt * binding->Stride;
1432 }
1433
1434
1435 void
_mesa_array_element(struct gl_context * ctx,GLint elt)1436 _mesa_array_element(struct gl_context *ctx, GLint elt)
1437 {
1438 const struct gl_vertex_array_object *vao = ctx->Array.VAO;
1439 GLbitfield mask;
1440
1441 /* emit conventional arrays elements */
1442 mask = (VERT_BIT_FF_ALL & ~VERT_BIT_POS) & vao->Enabled;
1443 while (mask) {
1444 const gl_vert_attrib attrib = u_bit_scan(&mask);
1445 const struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
1446 const void *src = attrib_src(vao, array, elt);
1447 func_nv(&array->Format)(attrib, src);
1448 }
1449
1450 /* emit generic attribute elements */
1451 mask = (VERT_BIT_GENERIC_ALL & ~VERT_BIT_GENERIC0) & vao->Enabled;
1452 while (mask) {
1453 const gl_vert_attrib attrib = u_bit_scan(&mask);
1454 const struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
1455 const void *src = attrib_src(vao, array, elt);
1456 func_arb(&array->Format)(attrib - VERT_ATTRIB_GENERIC0, src);
1457 }
1458
1459 /* finally, vertex position */
1460 if (vao->Enabled & VERT_BIT_GENERIC0) {
1461 const gl_vert_attrib attrib = VERT_ATTRIB_GENERIC0;
1462 const struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
1463 const void *src = attrib_src(vao, array, elt);
1464 func_arb(&array->Format)(0, src);
1465 } else if (vao->Enabled & VERT_BIT_POS) {
1466 const gl_vert_attrib attrib = VERT_ATTRIB_POS;
1467 const struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
1468 const void *src = attrib_src(vao, array, elt);
1469 func_nv(&array->Format)(0, src);
1470 }
1471 }
1472
1473
1474 /**
1475 * Called via glArrayElement() and glDrawArrays().
1476 * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions
1477 * for all enabled vertex arrays (for elt-th element).
1478 * Note: this may be called during display list construction.
1479 */
1480 void GLAPIENTRY
_mesa_ArrayElement(GLint elt)1481 _mesa_ArrayElement(GLint elt)
1482 {
1483 GET_CURRENT_CONTEXT(ctx);
1484 struct gl_vertex_array_object *vao;
1485
1486 /* If PrimitiveRestart is enabled and the index is the RestartIndex
1487 * then we call PrimitiveRestartNV and return.
1488 */
1489 if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) {
1490 CALL_PrimitiveRestartNV(ctx->CurrentServerDispatch, ());
1491 return;
1492 }
1493
1494 vao = ctx->Array.VAO;
1495 _mesa_vao_map_arrays(ctx, vao, GL_MAP_READ_BIT);
1496
1497 _mesa_array_element(ctx, elt);
1498
1499 _mesa_vao_unmap_arrays(ctx, vao);
1500 }
1501