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