s/Tungsten Graphics/VMware/
[mesa.git] / src / mesa / vbo / vbo_attrib_tmp.h
1 /**************************************************************************
2
3 Copyright 2002 VMware, Inc.
4 Copyright 2011 Dave Airlie (ARB_vertex_type_2_10_10_10_rev support)
5 All Rights Reserved.
6
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the "Software"),
9 to deal in the Software without restriction, including without limitation
10 on the rights to use, copy, modify, merge, publish, distribute, sub
11 license, and/or sell copies of the Software, and to permit persons to whom
12 the Software is furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice (including the next
15 paragraph) shall be included in all copies or substantial portions of the
16 Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **************************************************************************/
27
28 #include "util/u_format_r11g11b10f.h"
29
30 /* float */
31 #define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
32 #define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
33 #define ATTR3FV( A, V ) ATTR( A, 3, GL_FLOAT, (V)[0], (V)[1], (V)[2], 1 )
34 #define ATTR4FV( A, V ) ATTR( A, 4, GL_FLOAT, (V)[0], (V)[1], (V)[2], (V)[3] )
35
36 #define ATTR1F( A, X ) ATTR( A, 1, GL_FLOAT, X, 0, 0, 1 )
37 #define ATTR2F( A, X, Y ) ATTR( A, 2, GL_FLOAT, X, Y, 0, 1 )
38 #define ATTR3F( A, X, Y, Z ) ATTR( A, 3, GL_FLOAT, X, Y, Z, 1 )
39 #define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, GL_FLOAT, X, Y, Z, W )
40
41 /* int */
42 #define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
43 INT_AS_FLT(X), INT_AS_FLT(Y), \
44 INT_AS_FLT(Z), INT_AS_FLT(W) )
45
46 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
47 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
48 #define ATTR4IV( A, V ) ATTRI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
49
50 #define ATTR1I( A, X ) ATTRI( A, 1, X, 0, 0, 1 )
51 #define ATTR2I( A, X, Y ) ATTRI( A, 2, X, Y, 0, 1 )
52 #define ATTR3I( A, X, Y, Z ) ATTRI( A, 3, X, Y, Z, 1 )
53 #define ATTR4I( A, X, Y, Z, W ) ATTRI( A, 4, X, Y, Z, W )
54
55
56 /* uint */
57 #define ATTRUI( A, N, X, Y, Z, W) ATTR( A, N, GL_UNSIGNED_INT, \
58 UINT_AS_FLT(X), UINT_AS_FLT(Y), \
59 UINT_AS_FLT(Z), UINT_AS_FLT(W) )
60
61 #define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0], (V)[1], 0, 1 )
62 #define ATTR3UIV( A, V ) ATTRUI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
63 #define ATTR4UIV( A, V ) ATTRUI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
64
65 #define ATTR1UI( A, X ) ATTRUI( A, 1, X, 0, 0, 1 )
66 #define ATTR2UI( A, X, Y ) ATTRUI( A, 2, X, Y, 0, 1 )
67 #define ATTR3UI( A, X, Y, Z ) ATTRUI( A, 3, X, Y, Z, 1 )
68 #define ATTR4UI( A, X, Y, Z, W ) ATTRUI( A, 4, X, Y, Z, W )
69
70 #define MAT_ATTR( A, N, V ) ATTR( A, N, GL_FLOAT, (V)[0], (V)[1], (V)[2], (V)[3] )
71
72 static inline float conv_ui10_to_norm_float(unsigned ui10)
73 {
74 return ui10 / 1023.0f;
75 }
76
77 static inline float conv_ui2_to_norm_float(unsigned ui2)
78 {
79 return ui2 / 3.0f;
80 }
81
82 #define ATTRUI10_1( A, UI ) ATTR( A, 1, GL_FLOAT, (UI) & 0x3ff, 0, 0, 1 )
83 #define ATTRUI10_2( A, UI ) ATTR( A, 2, GL_FLOAT, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, 0, 1 )
84 #define ATTRUI10_3( A, UI ) ATTR( A, 3, GL_FLOAT, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, 1 )
85 #define ATTRUI10_4( A, UI ) ATTR( A, 4, GL_FLOAT, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, ((UI) >> 30) & 0x3 )
86
87 #define ATTRUI10N_1( A, UI ) ATTR( A, 1, GL_FLOAT, conv_ui10_to_norm_float((UI) & 0x3ff), 0, 0, 1 )
88 #define ATTRUI10N_2( A, UI ) ATTR( A, 2, GL_FLOAT, \
89 conv_ui10_to_norm_float((UI) & 0x3ff), \
90 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), 0, 1 )
91 #define ATTRUI10N_3( A, UI ) ATTR( A, 3, GL_FLOAT, \
92 conv_ui10_to_norm_float((UI) & 0x3ff), \
93 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
94 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), 1 )
95 #define ATTRUI10N_4( A, UI ) ATTR( A, 4, GL_FLOAT, \
96 conv_ui10_to_norm_float((UI) & 0x3ff), \
97 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
98 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), \
99 conv_ui2_to_norm_float(((UI) >> 30) & 0x3) )
100
101 struct attr_bits_10 {signed int x:10;};
102 struct attr_bits_2 {signed int x:2;};
103
104 static inline float conv_i10_to_i(int i10)
105 {
106 struct attr_bits_10 val;
107 val.x = i10;
108 return (float)val.x;
109 }
110
111 static inline float conv_i2_to_i(int i2)
112 {
113 struct attr_bits_2 val;
114 val.x = i2;
115 return (float)val.x;
116 }
117
118 static inline float conv_i10_to_norm_float(const struct gl_context *ctx, int i10)
119 {
120 struct attr_bits_10 val;
121 val.x = i10;
122
123 /* Traditionally, OpenGL has had two equations for converting from
124 * normalized fixed-point data to floating-point data. In the OpenGL 3.2
125 * specification, these are equations 2.2 and 2.3, respectively:
126 *
127 * f = (2c + 1)/(2^b - 1). (2.2)
128 *
129 * Comments below this equation state: "In general, this representation is
130 * used for signed normalized fixed-point parameters in GL commands, such
131 * as vertex attribute values." Which is what we're doing here.
132 *
133 * f = max{c/(2^(b-1) - 1), -1.0} (2.3)
134 *
135 * Comments below this equation state: "In general, this representation is
136 * used for signed normalized fixed-point texture or floating point values."
137 *
138 * OpenGL 4.2+ and ES 3.0 remedy this and state that equation 2.3 (above)
139 * is used in every case. They remove equation 2.2 completely.
140 */
141 if (_mesa_is_gles3(ctx) ||
142 (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
143 /* Equation 2.3 above. */
144 float f = ((float) val.x) / 511.0F;
145 return MAX2(f, -1.0f);
146 } else {
147 /* Equation 2.2 above. */
148 return (2.0F * (float)val.x + 1.0F) * (1.0F / 1023.0F);
149 }
150 }
151
152 static inline float conv_i2_to_norm_float(const struct gl_context *ctx, int i2)
153 {
154 struct attr_bits_2 val;
155 val.x = i2;
156
157 if (_mesa_is_gles3(ctx) ||
158 (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
159 /* Equation 2.3 above. */
160 float f = (float) val.x;
161 return MAX2(f, -1.0f);
162 } else {
163 /* Equation 2.2 above. */
164 return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
165 }
166 }
167
168 #define ATTRI10_1( A, I10 ) ATTR( A, 1, GL_FLOAT, conv_i10_to_i((I10) & 0x3ff), 0, 0, 1 )
169 #define ATTRI10_2( A, I10 ) ATTR( A, 2, GL_FLOAT, \
170 conv_i10_to_i((I10) & 0x3ff), \
171 conv_i10_to_i(((I10) >> 10) & 0x3ff), 0, 1 )
172 #define ATTRI10_3( A, I10 ) ATTR( A, 3, GL_FLOAT, \
173 conv_i10_to_i((I10) & 0x3ff), \
174 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
175 conv_i10_to_i(((I10) >> 20) & 0x3ff), 1 )
176 #define ATTRI10_4( A, I10 ) ATTR( A, 4, GL_FLOAT, \
177 conv_i10_to_i((I10) & 0x3ff), \
178 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
179 conv_i10_to_i(((I10) >> 20) & 0x3ff), \
180 conv_i2_to_i(((I10) >> 30) & 0x3))
181
182
183 #define ATTRI10N_1(ctx, A, I10) ATTR(A, 1, GL_FLOAT, conv_i10_to_norm_float(ctx, (I10) & 0x3ff), 0, 0, 1 )
184 #define ATTRI10N_2(ctx, A, I10) ATTR(A, 2, GL_FLOAT, \
185 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
186 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), 0, 1 )
187 #define ATTRI10N_3(ctx, A, I10) ATTR(A, 3, GL_FLOAT, \
188 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
189 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \
190 conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), 1 )
191 #define ATTRI10N_4(ctx, A, I10) ATTR(A, 4, GL_FLOAT, \
192 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
193 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \
194 conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), \
195 conv_i2_to_norm_float(ctx, ((I10) >> 30) & 0x3))
196
197 #define ATTR_UI(ctx, val, type, normalized, attr, arg) do { \
198 if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
199 if (normalized) { \
200 ATTRUI10N_##val((attr), (arg)); \
201 } else { \
202 ATTRUI10_##val((attr), (arg)); \
203 } \
204 } else if ((type) == GL_INT_2_10_10_10_REV) { \
205 if (normalized) { \
206 ATTRI10N_##val(ctx, (attr), (arg)); \
207 } else { \
208 ATTRI10_##val((attr), (arg)); \
209 } \
210 } else if ((type) == GL_UNSIGNED_INT_10F_11F_11F_REV) { \
211 float res[4]; \
212 r11g11b10f_to_float3((arg), res); \
213 ATTR##val##FV((attr), res); \
214 } else \
215 ERROR(GL_INVALID_VALUE); \
216 } while(0)
217
218 #define ATTR_UI_INDEX(ctx, val, type, normalized, index, arg) do { \
219 if ((index) == 0) { \
220 ATTR_UI(ctx, val, (type), normalized, 0, (arg)); \
221 } else if ((index) < MAX_VERTEX_GENERIC_ATTRIBS) { \
222 ATTR_UI(ctx, val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), (arg)); \
223 } else \
224 ERROR(GL_INVALID_VALUE); \
225 } while(0)
226
227 static void GLAPIENTRY
228 TAG(Vertex2f)(GLfloat x, GLfloat y)
229 {
230 GET_CURRENT_CONTEXT(ctx);
231 ATTR2F(VBO_ATTRIB_POS, x, y);
232 }
233
234 static void GLAPIENTRY
235 TAG(Vertex2fv)(const GLfloat * v)
236 {
237 GET_CURRENT_CONTEXT(ctx);
238 ATTR2FV(VBO_ATTRIB_POS, v);
239 }
240
241 static void GLAPIENTRY
242 TAG(Vertex3f)(GLfloat x, GLfloat y, GLfloat z)
243 {
244 GET_CURRENT_CONTEXT(ctx);
245 ATTR3F(VBO_ATTRIB_POS, x, y, z);
246 }
247
248 static void GLAPIENTRY
249 TAG(Vertex3fv)(const GLfloat * v)
250 {
251 GET_CURRENT_CONTEXT(ctx);
252 ATTR3FV(VBO_ATTRIB_POS, v);
253 }
254
255 static void GLAPIENTRY
256 TAG(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
257 {
258 GET_CURRENT_CONTEXT(ctx);
259 ATTR4F(VBO_ATTRIB_POS, x, y, z, w);
260 }
261
262 static void GLAPIENTRY
263 TAG(Vertex4fv)(const GLfloat * v)
264 {
265 GET_CURRENT_CONTEXT(ctx);
266 ATTR4FV(VBO_ATTRIB_POS, v);
267 }
268
269
270
271 static void GLAPIENTRY
272 TAG(TexCoord1f)(GLfloat x)
273 {
274 GET_CURRENT_CONTEXT(ctx);
275 ATTR1F(VBO_ATTRIB_TEX0, x);
276 }
277
278 static void GLAPIENTRY
279 TAG(TexCoord1fv)(const GLfloat * v)
280 {
281 GET_CURRENT_CONTEXT(ctx);
282 ATTR1FV(VBO_ATTRIB_TEX0, v);
283 }
284
285 static void GLAPIENTRY
286 TAG(TexCoord2f)(GLfloat x, GLfloat y)
287 {
288 GET_CURRENT_CONTEXT(ctx);
289 ATTR2F(VBO_ATTRIB_TEX0, x, y);
290 }
291
292 static void GLAPIENTRY
293 TAG(TexCoord2fv)(const GLfloat * v)
294 {
295 GET_CURRENT_CONTEXT(ctx);
296 ATTR2FV(VBO_ATTRIB_TEX0, v);
297 }
298
299 static void GLAPIENTRY
300 TAG(TexCoord3f)(GLfloat x, GLfloat y, GLfloat z)
301 {
302 GET_CURRENT_CONTEXT(ctx);
303 ATTR3F(VBO_ATTRIB_TEX0, x, y, z);
304 }
305
306 static void GLAPIENTRY
307 TAG(TexCoord3fv)(const GLfloat * v)
308 {
309 GET_CURRENT_CONTEXT(ctx);
310 ATTR3FV(VBO_ATTRIB_TEX0, v);
311 }
312
313 static void GLAPIENTRY
314 TAG(TexCoord4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
315 {
316 GET_CURRENT_CONTEXT(ctx);
317 ATTR4F(VBO_ATTRIB_TEX0, x, y, z, w);
318 }
319
320 static void GLAPIENTRY
321 TAG(TexCoord4fv)(const GLfloat * v)
322 {
323 GET_CURRENT_CONTEXT(ctx);
324 ATTR4FV(VBO_ATTRIB_TEX0, v);
325 }
326
327
328
329 static void GLAPIENTRY
330 TAG(Normal3f)(GLfloat x, GLfloat y, GLfloat z)
331 {
332 GET_CURRENT_CONTEXT(ctx);
333 ATTR3F(VBO_ATTRIB_NORMAL, x, y, z);
334 }
335
336 static void GLAPIENTRY
337 TAG(Normal3fv)(const GLfloat * v)
338 {
339 GET_CURRENT_CONTEXT(ctx);
340 ATTR3FV(VBO_ATTRIB_NORMAL, v);
341 }
342
343
344
345 static void GLAPIENTRY
346 TAG(FogCoordfEXT)(GLfloat x)
347 {
348 GET_CURRENT_CONTEXT(ctx);
349 ATTR1F(VBO_ATTRIB_FOG, x);
350 }
351
352
353
354 static void GLAPIENTRY
355 TAG(FogCoordfvEXT)(const GLfloat * v)
356 {
357 GET_CURRENT_CONTEXT(ctx);
358 ATTR1FV(VBO_ATTRIB_FOG, v);
359 }
360
361 static void GLAPIENTRY
362 TAG(Color3f)(GLfloat x, GLfloat y, GLfloat z)
363 {
364 GET_CURRENT_CONTEXT(ctx);
365 ATTR3F(VBO_ATTRIB_COLOR0, x, y, z);
366 }
367
368 static void GLAPIENTRY
369 TAG(Color3fv)(const GLfloat * v)
370 {
371 GET_CURRENT_CONTEXT(ctx);
372 ATTR3FV(VBO_ATTRIB_COLOR0, v);
373 }
374
375 static void GLAPIENTRY
376 TAG(Color4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
377 {
378 GET_CURRENT_CONTEXT(ctx);
379 ATTR4F(VBO_ATTRIB_COLOR0, x, y, z, w);
380 }
381
382 static void GLAPIENTRY
383 TAG(Color4fv)(const GLfloat * v)
384 {
385 GET_CURRENT_CONTEXT(ctx);
386 ATTR4FV(VBO_ATTRIB_COLOR0, v);
387 }
388
389
390
391 static void GLAPIENTRY
392 TAG(SecondaryColor3fEXT)(GLfloat x, GLfloat y, GLfloat z)
393 {
394 GET_CURRENT_CONTEXT(ctx);
395 ATTR3F(VBO_ATTRIB_COLOR1, x, y, z);
396 }
397
398 static void GLAPIENTRY
399 TAG(SecondaryColor3fvEXT)(const GLfloat * v)
400 {
401 GET_CURRENT_CONTEXT(ctx);
402 ATTR3FV(VBO_ATTRIB_COLOR1, v);
403 }
404
405
406
407 static void GLAPIENTRY
408 TAG(EdgeFlag)(GLboolean b)
409 {
410 GET_CURRENT_CONTEXT(ctx);
411 ATTR1F(VBO_ATTRIB_EDGEFLAG, (GLfloat) b);
412 }
413
414
415
416 static void GLAPIENTRY
417 TAG(Indexf)(GLfloat f)
418 {
419 GET_CURRENT_CONTEXT(ctx);
420 ATTR1F(VBO_ATTRIB_INDEX, f);
421 }
422
423 static void GLAPIENTRY
424 TAG(Indexfv)(const GLfloat * f)
425 {
426 GET_CURRENT_CONTEXT(ctx);
427 ATTR1FV(VBO_ATTRIB_INDEX, f);
428 }
429
430
431
432 static void GLAPIENTRY
433 TAG(MultiTexCoord1f)(GLenum target, GLfloat x)
434 {
435 GET_CURRENT_CONTEXT(ctx);
436 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
437 ATTR1F(attr, x);
438 }
439
440 static void GLAPIENTRY
441 TAG(MultiTexCoord1fv)(GLenum target, const GLfloat * v)
442 {
443 GET_CURRENT_CONTEXT(ctx);
444 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
445 ATTR1FV(attr, v);
446 }
447
448 static void GLAPIENTRY
449 TAG(MultiTexCoord2f)(GLenum target, GLfloat x, GLfloat y)
450 {
451 GET_CURRENT_CONTEXT(ctx);
452 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
453 ATTR2F(attr, x, y);
454 }
455
456 static void GLAPIENTRY
457 TAG(MultiTexCoord2fv)(GLenum target, const GLfloat * v)
458 {
459 GET_CURRENT_CONTEXT(ctx);
460 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
461 ATTR2FV(attr, v);
462 }
463
464 static void GLAPIENTRY
465 TAG(MultiTexCoord3f)(GLenum target, GLfloat x, GLfloat y, GLfloat z)
466 {
467 GET_CURRENT_CONTEXT(ctx);
468 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
469 ATTR3F(attr, x, y, z);
470 }
471
472 static void GLAPIENTRY
473 TAG(MultiTexCoord3fv)(GLenum target, const GLfloat * v)
474 {
475 GET_CURRENT_CONTEXT(ctx);
476 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
477 ATTR3FV(attr, v);
478 }
479
480 static void GLAPIENTRY
481 TAG(MultiTexCoord4f)(GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
482 {
483 GET_CURRENT_CONTEXT(ctx);
484 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
485 ATTR4F(attr, x, y, z, w);
486 }
487
488 static void GLAPIENTRY
489 TAG(MultiTexCoord4fv)(GLenum target, const GLfloat * v)
490 {
491 GET_CURRENT_CONTEXT(ctx);
492 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
493 ATTR4FV(attr, v);
494 }
495
496
497
498 static void GLAPIENTRY
499 TAG(VertexAttrib1fARB)(GLuint index, GLfloat x)
500 {
501 GET_CURRENT_CONTEXT(ctx);
502 if (index == 0)
503 ATTR1F(0, x);
504 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
505 ATTR1F(VBO_ATTRIB_GENERIC0 + index, x);
506 else
507 ERROR(GL_INVALID_VALUE);
508 }
509
510 static void GLAPIENTRY
511 TAG(VertexAttrib1fvARB)(GLuint index, const GLfloat * v)
512 {
513 GET_CURRENT_CONTEXT(ctx);
514 if (index == 0)
515 ATTR1FV(0, v);
516 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
517 ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v);
518 else
519 ERROR(GL_INVALID_VALUE);
520 }
521
522 static void GLAPIENTRY
523 TAG(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y)
524 {
525 GET_CURRENT_CONTEXT(ctx);
526 if (index == 0)
527 ATTR2F(0, x, y);
528 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
529 ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y);
530 else
531 ERROR(GL_INVALID_VALUE);
532 }
533
534 static void GLAPIENTRY
535 TAG(VertexAttrib2fvARB)(GLuint index, const GLfloat * v)
536 {
537 GET_CURRENT_CONTEXT(ctx);
538 if (index == 0)
539 ATTR2FV(0, v);
540 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
541 ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v);
542 else
543 ERROR(GL_INVALID_VALUE);
544 }
545
546 static void GLAPIENTRY
547 TAG(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
548 {
549 GET_CURRENT_CONTEXT(ctx);
550 if (index == 0)
551 ATTR3F(0, x, y, z);
552 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
553 ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z);
554 else
555 ERROR(GL_INVALID_VALUE);
556 }
557
558 static void GLAPIENTRY
559 TAG(VertexAttrib3fvARB)(GLuint index, const GLfloat * v)
560 {
561 GET_CURRENT_CONTEXT(ctx);
562 if (index == 0)
563 ATTR3FV(0, v);
564 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
565 ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v);
566 else
567 ERROR(GL_INVALID_VALUE);
568 }
569
570 static void GLAPIENTRY
571 TAG(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
572 {
573 GET_CURRENT_CONTEXT(ctx);
574 if (index == 0)
575 ATTR4F(0, x, y, z, w);
576 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
577 ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
578 else
579 ERROR(GL_INVALID_VALUE);
580 }
581
582 static void GLAPIENTRY
583 TAG(VertexAttrib4fvARB)(GLuint index, const GLfloat * v)
584 {
585 GET_CURRENT_CONTEXT(ctx);
586 if (index == 0)
587 ATTR4FV(0, v);
588 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
589 ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v);
590 else
591 ERROR(GL_INVALID_VALUE);
592 }
593
594
595
596 /* Integer-valued generic attributes.
597 * XXX: the integers just get converted to floats at this time
598 */
599 static void GLAPIENTRY
600 TAG(VertexAttribI1i)(GLuint index, GLint x)
601 {
602 GET_CURRENT_CONTEXT(ctx);
603 if (index == 0)
604 ATTR1I(0, x);
605 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
606 ATTR1I(VBO_ATTRIB_GENERIC0 + index, x);
607 else
608 ERROR(GL_INVALID_VALUE);
609 }
610
611 static void GLAPIENTRY
612 TAG(VertexAttribI2i)(GLuint index, GLint x, GLint y)
613 {
614 GET_CURRENT_CONTEXT(ctx);
615 if (index == 0)
616 ATTR2I(0, x, y);
617 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
618 ATTR2I(VBO_ATTRIB_GENERIC0 + index, x, y);
619 else
620 ERROR(GL_INVALID_VALUE);
621 }
622
623 static void GLAPIENTRY
624 TAG(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z)
625 {
626 GET_CURRENT_CONTEXT(ctx);
627 if (index == 0)
628 ATTR3I(0, x, y, z);
629 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
630 ATTR3I(VBO_ATTRIB_GENERIC0 + index, x, y, z);
631 else
632 ERROR(GL_INVALID_VALUE);
633 }
634
635 static void GLAPIENTRY
636 TAG(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w)
637 {
638 GET_CURRENT_CONTEXT(ctx);
639 if (index == 0)
640 ATTR4I(0, x, y, z, w);
641 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
642 ATTR4I(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
643 else
644 ERROR(GL_INVALID_VALUE);
645 }
646
647 static void GLAPIENTRY
648 TAG(VertexAttribI2iv)(GLuint index, const GLint *v)
649 {
650 GET_CURRENT_CONTEXT(ctx);
651 if (index == 0)
652 ATTR2IV(0, v);
653 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
654 ATTR2IV(VBO_ATTRIB_GENERIC0 + index, v);
655 else
656 ERROR(GL_INVALID_VALUE);
657 }
658
659 static void GLAPIENTRY
660 TAG(VertexAttribI3iv)(GLuint index, const GLint *v)
661 {
662 GET_CURRENT_CONTEXT(ctx);
663 if (index == 0)
664 ATTR3IV(0, v);
665 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
666 ATTR3IV(VBO_ATTRIB_GENERIC0 + index, v);
667 else
668 ERROR(GL_INVALID_VALUE);
669 }
670
671 static void GLAPIENTRY
672 TAG(VertexAttribI4iv)(GLuint index, const GLint *v)
673 {
674 GET_CURRENT_CONTEXT(ctx);
675 if (index == 0)
676 ATTR4IV(0, v);
677 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
678 ATTR4IV(VBO_ATTRIB_GENERIC0 + index, v);
679 else
680 ERROR(GL_INVALID_VALUE);
681 }
682
683
684
685 /* Unsigned integer-valued generic attributes.
686 * XXX: the integers just get converted to floats at this time
687 */
688 static void GLAPIENTRY
689 TAG(VertexAttribI1ui)(GLuint index, GLuint x)
690 {
691 GET_CURRENT_CONTEXT(ctx);
692 if (index == 0)
693 ATTR1UI(0, x);
694 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
695 ATTR1UI(VBO_ATTRIB_GENERIC0 + index, x);
696 else
697 ERROR(GL_INVALID_VALUE);
698 }
699
700 static void GLAPIENTRY
701 TAG(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y)
702 {
703 GET_CURRENT_CONTEXT(ctx);
704 if (index == 0)
705 ATTR2UI(0, x, y);
706 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
707 ATTR2UI(VBO_ATTRIB_GENERIC0 + index, x, y);
708 else
709 ERROR(GL_INVALID_VALUE);
710 }
711
712 static void GLAPIENTRY
713 TAG(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z)
714 {
715 GET_CURRENT_CONTEXT(ctx);
716 if (index == 0)
717 ATTR3UI(0, x, y, z);
718 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
719 ATTR3UI(VBO_ATTRIB_GENERIC0 + index, x, y, z);
720 else
721 ERROR(GL_INVALID_VALUE);
722 }
723
724 static void GLAPIENTRY
725 TAG(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
726 {
727 GET_CURRENT_CONTEXT(ctx);
728 if (index == 0)
729 ATTR4UI(0, x, y, z, w);
730 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
731 ATTR4UI(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
732 else
733 ERROR(GL_INVALID_VALUE);
734 }
735
736 static void GLAPIENTRY
737 TAG(VertexAttribI2uiv)(GLuint index, const GLuint *v)
738 {
739 GET_CURRENT_CONTEXT(ctx);
740 if (index == 0)
741 ATTR2UIV(0, v);
742 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
743 ATTR2UIV(VBO_ATTRIB_GENERIC0 + index, v);
744 else
745 ERROR(GL_INVALID_VALUE);
746 }
747
748 static void GLAPIENTRY
749 TAG(VertexAttribI3uiv)(GLuint index, const GLuint *v)
750 {
751 GET_CURRENT_CONTEXT(ctx);
752 if (index == 0)
753 ATTR3UIV(0, v);
754 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
755 ATTR3UIV(VBO_ATTRIB_GENERIC0 + index, v);
756 else
757 ERROR(GL_INVALID_VALUE);
758 }
759
760 static void GLAPIENTRY
761 TAG(VertexAttribI4uiv)(GLuint index, const GLuint *v)
762 {
763 GET_CURRENT_CONTEXT(ctx);
764 if (index == 0)
765 ATTR4UIV(0, v);
766 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
767 ATTR4UIV(VBO_ATTRIB_GENERIC0 + index, v);
768 else
769 ERROR(GL_INVALID_VALUE);
770 }
771
772
773
774 /* In addition to supporting NV_vertex_program, these entrypoints are
775 * used by the display list and other code specifically because of
776 * their property of aliasing with other attributes. (See
777 * vbo_save_loopback.c)
778 */
779 static void GLAPIENTRY
780 TAG(VertexAttrib1fNV)(GLuint index, GLfloat x)
781 {
782 GET_CURRENT_CONTEXT(ctx);
783 if (index < VBO_ATTRIB_MAX)
784 ATTR1F(index, x);
785 }
786
787 static void GLAPIENTRY
788 TAG(VertexAttrib1fvNV)(GLuint index, const GLfloat * v)
789 {
790 GET_CURRENT_CONTEXT(ctx);
791 if (index < VBO_ATTRIB_MAX)
792 ATTR1FV(index, v);
793 }
794
795 static void GLAPIENTRY
796 TAG(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y)
797 {
798 GET_CURRENT_CONTEXT(ctx);
799 if (index < VBO_ATTRIB_MAX)
800 ATTR2F(index, x, y);
801 }
802
803 static void GLAPIENTRY
804 TAG(VertexAttrib2fvNV)(GLuint index, const GLfloat * v)
805 {
806 GET_CURRENT_CONTEXT(ctx);
807 if (index < VBO_ATTRIB_MAX)
808 ATTR2FV(index, v);
809 }
810
811 static void GLAPIENTRY
812 TAG(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
813 {
814 GET_CURRENT_CONTEXT(ctx);
815 if (index < VBO_ATTRIB_MAX)
816 ATTR3F(index, x, y, z);
817 }
818
819 static void GLAPIENTRY
820 TAG(VertexAttrib3fvNV)(GLuint index,
821 const GLfloat * v)
822 {
823 GET_CURRENT_CONTEXT(ctx);
824 if (index < VBO_ATTRIB_MAX)
825 ATTR3FV(index, v);
826 }
827
828 static void GLAPIENTRY
829 TAG(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
830 {
831 GET_CURRENT_CONTEXT(ctx);
832 if (index < VBO_ATTRIB_MAX)
833 ATTR4F(index, x, y, z, w);
834 }
835
836 static void GLAPIENTRY
837 TAG(VertexAttrib4fvNV)(GLuint index, const GLfloat * v)
838 {
839 GET_CURRENT_CONTEXT(ctx);
840 if (index < VBO_ATTRIB_MAX)
841 ATTR4FV(index, v);
842 }
843
844
845 #define ERROR_IF_NOT_PACKED_TYPE(ctx, type, func) \
846 if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV) { \
847 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \
848 return; \
849 }
850
851 /* Extended version of ERROR_IF_NOT_PACKED_TYPE which also
852 * accepts GL_UNSIGNED_INT_10F_11F_11F_REV.
853 *
854 * Only used for VertexAttribP[123]ui[v]; VertexAttribP4* cannot use this type,
855 * and neither can legacy vertex attribs.
856 */
857 #define ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, func) \
858 if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV && \
859 type != GL_UNSIGNED_INT_10F_11F_11F_REV) { \
860 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \
861 return; \
862 }
863
864 static void GLAPIENTRY
865 TAG(VertexP2ui)(GLenum type, GLuint value)
866 {
867 GET_CURRENT_CONTEXT(ctx);
868 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP2ui");
869 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_POS, value);
870 }
871
872 static void GLAPIENTRY
873 TAG(VertexP2uiv)(GLenum type, const GLuint *value)
874 {
875 GET_CURRENT_CONTEXT(ctx);
876 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP2uiv");
877 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_POS, value[0]);
878 }
879
880 static void GLAPIENTRY
881 TAG(VertexP3ui)(GLenum type, GLuint value)
882 {
883 GET_CURRENT_CONTEXT(ctx);
884 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP3ui");
885 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_POS, value);
886 }
887
888 static void GLAPIENTRY
889 TAG(VertexP3uiv)(GLenum type, const GLuint *value)
890 {
891 GET_CURRENT_CONTEXT(ctx);
892 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP3uiv");
893 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_POS, value[0]);
894 }
895
896 static void GLAPIENTRY
897 TAG(VertexP4ui)(GLenum type, GLuint value)
898 {
899 GET_CURRENT_CONTEXT(ctx);
900 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP4ui");
901 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_POS, value);
902 }
903
904 static void GLAPIENTRY
905 TAG(VertexP4uiv)(GLenum type, const GLuint *value)
906 {
907 GET_CURRENT_CONTEXT(ctx);
908 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP4uiv");
909 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_POS, value[0]);
910 }
911
912 static void GLAPIENTRY
913 TAG(TexCoordP1ui)(GLenum type, GLuint coords)
914 {
915 GET_CURRENT_CONTEXT(ctx);
916 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP1ui");
917 ATTR_UI(ctx, 1, type, 0, VBO_ATTRIB_TEX0, coords);
918 }
919
920 static void GLAPIENTRY
921 TAG(TexCoordP1uiv)(GLenum type, const GLuint *coords)
922 {
923 GET_CURRENT_CONTEXT(ctx);
924 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP1uiv");
925 ATTR_UI(ctx, 1, type, 0, VBO_ATTRIB_TEX0, coords[0]);
926 }
927
928 static void GLAPIENTRY
929 TAG(TexCoordP2ui)(GLenum type, GLuint coords)
930 {
931 GET_CURRENT_CONTEXT(ctx);
932 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP2ui");
933 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_TEX0, coords);
934 }
935
936 static void GLAPIENTRY
937 TAG(TexCoordP2uiv)(GLenum type, const GLuint *coords)
938 {
939 GET_CURRENT_CONTEXT(ctx);
940 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP2uiv");
941 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_TEX0, coords[0]);
942 }
943
944 static void GLAPIENTRY
945 TAG(TexCoordP3ui)(GLenum type, GLuint coords)
946 {
947 GET_CURRENT_CONTEXT(ctx);
948 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP3ui");
949 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_TEX0, coords);
950 }
951
952 static void GLAPIENTRY
953 TAG(TexCoordP3uiv)(GLenum type, const GLuint *coords)
954 {
955 GET_CURRENT_CONTEXT(ctx);
956 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP3uiv");
957 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_TEX0, coords[0]);
958 }
959
960 static void GLAPIENTRY
961 TAG(TexCoordP4ui)(GLenum type, GLuint coords)
962 {
963 GET_CURRENT_CONTEXT(ctx);
964 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP4ui");
965 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_TEX0, coords);
966 }
967
968 static void GLAPIENTRY
969 TAG(TexCoordP4uiv)(GLenum type, const GLuint *coords)
970 {
971 GET_CURRENT_CONTEXT(ctx);
972 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP4uiv");
973 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_TEX0, coords[0]);
974 }
975
976 static void GLAPIENTRY
977 TAG(MultiTexCoordP1ui)(GLenum target, GLenum type, GLuint coords)
978 {
979 GET_CURRENT_CONTEXT(ctx);
980 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
981 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP1ui");
982 ATTR_UI(ctx, 1, type, 0, attr, coords);
983 }
984
985 static void GLAPIENTRY
986 TAG(MultiTexCoordP1uiv)(GLenum target, GLenum type, const GLuint *coords)
987 {
988 GET_CURRENT_CONTEXT(ctx);
989 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
990 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP1uiv");
991 ATTR_UI(ctx, 1, type, 0, attr, coords[0]);
992 }
993
994 static void GLAPIENTRY
995 TAG(MultiTexCoordP2ui)(GLenum target, GLenum type, GLuint coords)
996 {
997 GET_CURRENT_CONTEXT(ctx);
998 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
999 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP2ui");
1000 ATTR_UI(ctx, 2, type, 0, attr, coords);
1001 }
1002
1003 static void GLAPIENTRY
1004 TAG(MultiTexCoordP2uiv)(GLenum target, GLenum type, const GLuint *coords)
1005 {
1006 GET_CURRENT_CONTEXT(ctx);
1007 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1008 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP2uiv");
1009 ATTR_UI(ctx, 2, type, 0, attr, coords[0]);
1010 }
1011
1012 static void GLAPIENTRY
1013 TAG(MultiTexCoordP3ui)(GLenum target, GLenum type, GLuint coords)
1014 {
1015 GET_CURRENT_CONTEXT(ctx);
1016 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1017 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP3ui");
1018 ATTR_UI(ctx, 3, type, 0, attr, coords);
1019 }
1020
1021 static void GLAPIENTRY
1022 TAG(MultiTexCoordP3uiv)(GLenum target, GLenum type, const GLuint *coords)
1023 {
1024 GET_CURRENT_CONTEXT(ctx);
1025 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1026 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP3uiv");
1027 ATTR_UI(ctx, 3, type, 0, attr, coords[0]);
1028 }
1029
1030 static void GLAPIENTRY
1031 TAG(MultiTexCoordP4ui)(GLenum target, GLenum type, GLuint coords)
1032 {
1033 GET_CURRENT_CONTEXT(ctx);
1034 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1035 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP4ui");
1036 ATTR_UI(ctx, 4, type, 0, attr, coords);
1037 }
1038
1039 static void GLAPIENTRY
1040 TAG(MultiTexCoordP4uiv)(GLenum target, GLenum type, const GLuint *coords)
1041 {
1042 GET_CURRENT_CONTEXT(ctx);
1043 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1044 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP4uiv");
1045 ATTR_UI(ctx, 4, type, 0, attr, coords[0]);
1046 }
1047
1048 static void GLAPIENTRY
1049 TAG(NormalP3ui)(GLenum type, GLuint coords)
1050 {
1051 GET_CURRENT_CONTEXT(ctx);
1052 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glNormalP3ui");
1053 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_NORMAL, coords);
1054 }
1055
1056 static void GLAPIENTRY
1057 TAG(NormalP3uiv)(GLenum type, const GLuint *coords)
1058 {
1059 GET_CURRENT_CONTEXT(ctx);
1060 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glNormalP3uiv");
1061 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_NORMAL, coords[0]);
1062 }
1063
1064 static void GLAPIENTRY
1065 TAG(ColorP3ui)(GLenum type, GLuint color)
1066 {
1067 GET_CURRENT_CONTEXT(ctx);
1068 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP3ui");
1069 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR0, color);
1070 }
1071
1072 static void GLAPIENTRY
1073 TAG(ColorP3uiv)(GLenum type, const GLuint *color)
1074 {
1075 GET_CURRENT_CONTEXT(ctx);
1076 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP3uiv");
1077 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR0, color[0]);
1078 }
1079
1080 static void GLAPIENTRY
1081 TAG(ColorP4ui)(GLenum type, GLuint color)
1082 {
1083 GET_CURRENT_CONTEXT(ctx);
1084 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP4ui");
1085 ATTR_UI(ctx, 4, type, 1, VBO_ATTRIB_COLOR0, color);
1086 }
1087
1088 static void GLAPIENTRY
1089 TAG(ColorP4uiv)(GLenum type, const GLuint *color)
1090 {
1091 GET_CURRENT_CONTEXT(ctx);
1092 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP4uiv");
1093 ATTR_UI(ctx, 4, type, 1, VBO_ATTRIB_COLOR0, color[0]);
1094 }
1095
1096 static void GLAPIENTRY
1097 TAG(SecondaryColorP3ui)(GLenum type, GLuint color)
1098 {
1099 GET_CURRENT_CONTEXT(ctx);
1100 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glSecondaryColorP3ui");
1101 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR1, color);
1102 }
1103
1104 static void GLAPIENTRY
1105 TAG(SecondaryColorP3uiv)(GLenum type, const GLuint *color)
1106 {
1107 GET_CURRENT_CONTEXT(ctx);
1108 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glSecondaryColorP3uiv");
1109 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR1, color[0]);
1110 }
1111
1112 static void GLAPIENTRY
1113 TAG(VertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized,
1114 GLuint value)
1115 {
1116 GET_CURRENT_CONTEXT(ctx);
1117 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1ui");
1118 ATTR_UI_INDEX(ctx, 1, type, normalized, index, value);
1119 }
1120
1121 static void GLAPIENTRY
1122 TAG(VertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized,
1123 GLuint value)
1124 {
1125 GET_CURRENT_CONTEXT(ctx);
1126 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2ui");
1127 ATTR_UI_INDEX(ctx, 2, type, normalized, index, value);
1128 }
1129
1130 static void GLAPIENTRY
1131 TAG(VertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized,
1132 GLuint value)
1133 {
1134 GET_CURRENT_CONTEXT(ctx);
1135 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3ui");
1136 ATTR_UI_INDEX(ctx, 3, type, normalized, index, value);
1137 }
1138
1139 static void GLAPIENTRY
1140 TAG(VertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized,
1141 GLuint value)
1142 {
1143 GET_CURRENT_CONTEXT(ctx);
1144 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP4ui");
1145 ATTR_UI_INDEX(ctx, 4, type, normalized, index, value);
1146 }
1147
1148 static void GLAPIENTRY
1149 TAG(VertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized,
1150 const GLuint *value)
1151 {
1152 GET_CURRENT_CONTEXT(ctx);
1153 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1uiv");
1154 ATTR_UI_INDEX(ctx, 1, type, normalized, index, *value);
1155 }
1156
1157 static void GLAPIENTRY
1158 TAG(VertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized,
1159 const GLuint *value)
1160 {
1161 GET_CURRENT_CONTEXT(ctx);
1162 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2uiv");
1163 ATTR_UI_INDEX(ctx, 2, type, normalized, index, *value);
1164 }
1165
1166 static void GLAPIENTRY
1167 TAG(VertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized,
1168 const GLuint *value)
1169 {
1170 GET_CURRENT_CONTEXT(ctx);
1171 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3uiv");
1172 ATTR_UI_INDEX(ctx, 3, type, normalized, index, *value);
1173 }
1174
1175 static void GLAPIENTRY
1176 TAG(VertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized,
1177 const GLuint *value)
1178 {
1179 GET_CURRENT_CONTEXT(ctx);
1180 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP4uiv");
1181 ATTR_UI_INDEX(ctx, 4, type, normalized, index, *value);
1182 }
1183
1184
1185 #undef ATTR1FV
1186 #undef ATTR2FV
1187 #undef ATTR3FV
1188 #undef ATTR4FV
1189
1190 #undef ATTR1F
1191 #undef ATTR2F
1192 #undef ATTR3F
1193 #undef ATTR4F
1194
1195 #undef ATTR_UI
1196
1197 #undef MAT