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