1 /**************************************************************************
3 Copyright 2002 VMware, Inc.
4 Copyright 2011 Dave Airlie (ARB_vertex_type_2_10_10_10_rev support)
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:
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
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.
26 **************************************************************************/
28 #include "util/u_format_r11g11b10f.h"
29 #include "main/varray.h"
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)
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] )
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 )
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] )
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 )
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] )
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 )
79 #define MAT_ATTR( A, N, V ) ATTRF( A, N, (V)[0], (V)[1], (V)[2], (V)[3] )
81 static inline float conv_ui10_to_norm_float(unsigned ui10
)
83 return ui10
/ 1023.0f
;
86 static inline float conv_ui2_to_norm_float(unsigned ui2
)
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 )
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) )
110 struct attr_bits_10
{signed int x
:10;};
111 struct attr_bits_2
{signed int x
:2;};
113 static inline float conv_i10_to_i(int i10
)
115 struct attr_bits_10 val
;
120 static inline float conv_i2_to_i(int i2
)
122 struct attr_bits_2 val
;
127 static inline float conv_i10_to_norm_float(const struct gl_context
*ctx
, int i10
)
129 struct attr_bits_10 val
;
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:
136 * f = (2c + 1)/(2^b - 1). (2.2)
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.
142 * f = max{c/(2^(b-1) - 1), -1.0} (2.3)
144 * Comments below this equation state: "In general, this representation is
145 * used for signed normalized fixed-point texture or floating point values."
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.
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
);
156 /* Equation 2.2 above. */
157 return (2.0F
* (float)val
.x
+ 1.0F
) * (1.0F
/ 1023.0F
);
161 static inline float conv_i2_to_norm_float(const struct gl_context
*ctx
, int i2
)
163 struct attr_bits_2 val
;
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
);
172 /* Equation 2.2 above. */
173 return (2.0F
* (float)val
.x
+ 1.0F
) * (1.0F
/ 3.0F
);
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))
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))
206 #define ATTR_UI(ctx, val, type, normalized, attr, arg) do { \
207 if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
209 ATTRUI10N_##val((attr), (arg)); \
211 ATTRUI10_##val((attr), (arg)); \
213 } else if ((type) == GL_INT_2_10_10_10_REV) { \
215 ATTRI10N_##val(ctx, (attr), (arg)); \
217 ATTRI10_##val((attr), (arg)); \
219 } else if ((type) == GL_UNSIGNED_INT_10F_11F_11F_REV) { \
222 r11g11b10f_to_float3((arg), res); \
223 ATTR##val##FV((attr), res); \
225 ERROR(GL_INVALID_VALUE); \
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)); \
234 ERROR(GL_INVALID_VALUE); \
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] )
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 )
250 static void GLAPIENTRY
251 TAG(Vertex2f
)(GLfloat x
, GLfloat y
)
253 GET_CURRENT_CONTEXT(ctx
);
254 ATTR2F(VBO_ATTRIB_POS
, x
, y
);
257 static void GLAPIENTRY
258 TAG(Vertex2fv
)(const GLfloat
* v
)
260 GET_CURRENT_CONTEXT(ctx
);
261 ATTR2FV(VBO_ATTRIB_POS
, v
);
264 static void GLAPIENTRY
265 TAG(Vertex3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
267 GET_CURRENT_CONTEXT(ctx
);
268 ATTR3F(VBO_ATTRIB_POS
, x
, y
, z
);
271 static void GLAPIENTRY
272 TAG(Vertex3fv
)(const GLfloat
* v
)
274 GET_CURRENT_CONTEXT(ctx
);
275 ATTR3FV(VBO_ATTRIB_POS
, v
);
278 static void GLAPIENTRY
279 TAG(Vertex4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
281 GET_CURRENT_CONTEXT(ctx
);
282 ATTR4F(VBO_ATTRIB_POS
, x
, y
, z
, w
);
285 static void GLAPIENTRY
286 TAG(Vertex4fv
)(const GLfloat
* v
)
288 GET_CURRENT_CONTEXT(ctx
);
289 ATTR4FV(VBO_ATTRIB_POS
, v
);
294 static void GLAPIENTRY
295 TAG(TexCoord1f
)(GLfloat x
)
297 GET_CURRENT_CONTEXT(ctx
);
298 ATTR1F(VBO_ATTRIB_TEX0
, x
);
301 static void GLAPIENTRY
302 TAG(TexCoord1fv
)(const GLfloat
* v
)
304 GET_CURRENT_CONTEXT(ctx
);
305 ATTR1FV(VBO_ATTRIB_TEX0
, v
);
308 static void GLAPIENTRY
309 TAG(TexCoord2f
)(GLfloat x
, GLfloat y
)
311 GET_CURRENT_CONTEXT(ctx
);
312 ATTR2F(VBO_ATTRIB_TEX0
, x
, y
);
315 static void GLAPIENTRY
316 TAG(TexCoord2fv
)(const GLfloat
* v
)
318 GET_CURRENT_CONTEXT(ctx
);
319 ATTR2FV(VBO_ATTRIB_TEX0
, v
);
322 static void GLAPIENTRY
323 TAG(TexCoord3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
325 GET_CURRENT_CONTEXT(ctx
);
326 ATTR3F(VBO_ATTRIB_TEX0
, x
, y
, z
);
329 static void GLAPIENTRY
330 TAG(TexCoord3fv
)(const GLfloat
* v
)
332 GET_CURRENT_CONTEXT(ctx
);
333 ATTR3FV(VBO_ATTRIB_TEX0
, v
);
336 static void GLAPIENTRY
337 TAG(TexCoord4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
339 GET_CURRENT_CONTEXT(ctx
);
340 ATTR4F(VBO_ATTRIB_TEX0
, x
, y
, z
, w
);
343 static void GLAPIENTRY
344 TAG(TexCoord4fv
)(const GLfloat
* v
)
346 GET_CURRENT_CONTEXT(ctx
);
347 ATTR4FV(VBO_ATTRIB_TEX0
, v
);
352 static void GLAPIENTRY
353 TAG(Normal3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
355 GET_CURRENT_CONTEXT(ctx
);
356 ATTR3F(VBO_ATTRIB_NORMAL
, x
, y
, z
);
359 static void GLAPIENTRY
360 TAG(Normal3fv
)(const GLfloat
* v
)
362 GET_CURRENT_CONTEXT(ctx
);
363 ATTR3FV(VBO_ATTRIB_NORMAL
, v
);
368 static void GLAPIENTRY
369 TAG(FogCoordfEXT
)(GLfloat x
)
371 GET_CURRENT_CONTEXT(ctx
);
372 ATTR1F(VBO_ATTRIB_FOG
, x
);
377 static void GLAPIENTRY
378 TAG(FogCoordfvEXT
)(const GLfloat
* v
)
380 GET_CURRENT_CONTEXT(ctx
);
381 ATTR1FV(VBO_ATTRIB_FOG
, v
);
384 static void GLAPIENTRY
385 TAG(Color3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
387 GET_CURRENT_CONTEXT(ctx
);
388 ATTR3F(VBO_ATTRIB_COLOR0
, x
, y
, z
);
391 static void GLAPIENTRY
392 TAG(Color3fv
)(const GLfloat
* v
)
394 GET_CURRENT_CONTEXT(ctx
);
395 ATTR3FV(VBO_ATTRIB_COLOR0
, v
);
398 static void GLAPIENTRY
399 TAG(Color4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
401 GET_CURRENT_CONTEXT(ctx
);
402 ATTR4F(VBO_ATTRIB_COLOR0
, x
, y
, z
, w
);
405 static void GLAPIENTRY
406 TAG(Color4fv
)(const GLfloat
* v
)
408 GET_CURRENT_CONTEXT(ctx
);
409 ATTR4FV(VBO_ATTRIB_COLOR0
, v
);
414 static void GLAPIENTRY
415 TAG(SecondaryColor3fEXT
)(GLfloat x
, GLfloat y
, GLfloat z
)
417 GET_CURRENT_CONTEXT(ctx
);
418 ATTR3F(VBO_ATTRIB_COLOR1
, x
, y
, z
);
421 static void GLAPIENTRY
422 TAG(SecondaryColor3fvEXT
)(const GLfloat
* v
)
424 GET_CURRENT_CONTEXT(ctx
);
425 ATTR3FV(VBO_ATTRIB_COLOR1
, v
);
430 static void GLAPIENTRY
431 TAG(EdgeFlag
)(GLboolean b
)
433 GET_CURRENT_CONTEXT(ctx
);
434 ATTR1F(VBO_ATTRIB_EDGEFLAG
, (GLfloat
) b
);
439 static void GLAPIENTRY
440 TAG(Indexf
)(GLfloat f
)
442 GET_CURRENT_CONTEXT(ctx
);
443 ATTR1F(VBO_ATTRIB_INDEX
, f
);
446 static void GLAPIENTRY
447 TAG(Indexfv
)(const GLfloat
* f
)
449 GET_CURRENT_CONTEXT(ctx
);
450 ATTR1FV(VBO_ATTRIB_INDEX
, f
);
455 static void GLAPIENTRY
456 TAG(MultiTexCoord1f
)(GLenum target
, GLfloat x
)
458 GET_CURRENT_CONTEXT(ctx
);
459 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
463 static void GLAPIENTRY
464 TAG(MultiTexCoord1fv
)(GLenum target
, const GLfloat
* v
)
466 GET_CURRENT_CONTEXT(ctx
);
467 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
471 static void GLAPIENTRY
472 TAG(MultiTexCoord2f
)(GLenum target
, GLfloat x
, GLfloat y
)
474 GET_CURRENT_CONTEXT(ctx
);
475 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
479 static void GLAPIENTRY
480 TAG(MultiTexCoord2fv
)(GLenum target
, const GLfloat
* v
)
482 GET_CURRENT_CONTEXT(ctx
);
483 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
487 static void GLAPIENTRY
488 TAG(MultiTexCoord3f
)(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
490 GET_CURRENT_CONTEXT(ctx
);
491 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
492 ATTR3F(attr
, x
, y
, z
);
495 static void GLAPIENTRY
496 TAG(MultiTexCoord3fv
)(GLenum target
, const GLfloat
* v
)
498 GET_CURRENT_CONTEXT(ctx
);
499 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
503 static void GLAPIENTRY
504 TAG(MultiTexCoord4f
)(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
506 GET_CURRENT_CONTEXT(ctx
);
507 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
508 ATTR4F(attr
, x
, y
, z
, w
);
511 static void GLAPIENTRY
512 TAG(MultiTexCoord4fv
)(GLenum target
, const GLfloat
* v
)
514 GET_CURRENT_CONTEXT(ctx
);
515 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
521 static void GLAPIENTRY
522 TAG(VertexAttrib1fARB
)(GLuint index
, GLfloat x
)
524 GET_CURRENT_CONTEXT(ctx
);
525 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
527 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
528 ATTR1F(VBO_ATTRIB_GENERIC0
+ index
, x
);
530 ERROR(GL_INVALID_VALUE
);
533 static void GLAPIENTRY
534 TAG(VertexAttrib1fvARB
)(GLuint index
, const GLfloat
* v
)
536 GET_CURRENT_CONTEXT(ctx
);
537 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
539 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
540 ATTR1FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
542 ERROR(GL_INVALID_VALUE
);
545 static void GLAPIENTRY
546 TAG(VertexAttrib2fARB
)(GLuint index
, GLfloat x
, GLfloat y
)
548 GET_CURRENT_CONTEXT(ctx
);
549 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
551 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
552 ATTR2F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
554 ERROR(GL_INVALID_VALUE
);
557 static void GLAPIENTRY
558 TAG(VertexAttrib2fvARB
)(GLuint index
, const GLfloat
* v
)
560 GET_CURRENT_CONTEXT(ctx
);
561 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
563 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
564 ATTR2FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
566 ERROR(GL_INVALID_VALUE
);
569 static void GLAPIENTRY
570 TAG(VertexAttrib3fARB
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
572 GET_CURRENT_CONTEXT(ctx
);
573 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
575 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
576 ATTR3F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
578 ERROR(GL_INVALID_VALUE
);
581 static void GLAPIENTRY
582 TAG(VertexAttrib3fvARB
)(GLuint index
, const GLfloat
* v
)
584 GET_CURRENT_CONTEXT(ctx
);
585 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
587 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
588 ATTR3FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
590 ERROR(GL_INVALID_VALUE
);
593 static void GLAPIENTRY
594 TAG(VertexAttrib4fARB
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
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
);
602 ERROR(GL_INVALID_VALUE
);
605 static void GLAPIENTRY
606 TAG(VertexAttrib4fvARB
)(GLuint index
, const GLfloat
* v
)
608 GET_CURRENT_CONTEXT(ctx
);
609 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
611 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
612 ATTR4FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
614 ERROR(GL_INVALID_VALUE
);
619 /* Integer-valued generic attributes.
620 * XXX: the integers just get converted to floats at this time
622 static void GLAPIENTRY
623 TAG(VertexAttribI1i
)(GLuint index
, GLint x
)
625 GET_CURRENT_CONTEXT(ctx
);
626 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
628 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
629 ATTR1I(VBO_ATTRIB_GENERIC0
+ index
, x
);
631 ERROR(GL_INVALID_VALUE
);
634 static void GLAPIENTRY
635 TAG(VertexAttribI2i
)(GLuint index
, GLint x
, GLint y
)
637 GET_CURRENT_CONTEXT(ctx
);
638 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
640 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
641 ATTR2I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
643 ERROR(GL_INVALID_VALUE
);
646 static void GLAPIENTRY
647 TAG(VertexAttribI3i
)(GLuint index
, GLint x
, GLint y
, GLint z
)
649 GET_CURRENT_CONTEXT(ctx
);
650 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
652 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
653 ATTR3I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
655 ERROR(GL_INVALID_VALUE
);
658 static void GLAPIENTRY
659 TAG(VertexAttribI4i
)(GLuint index
, GLint x
, GLint y
, GLint z
, GLint w
)
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
);
667 ERROR(GL_INVALID_VALUE
);
670 static void GLAPIENTRY
671 TAG(VertexAttribI2iv
)(GLuint index
, const GLint
*v
)
673 GET_CURRENT_CONTEXT(ctx
);
674 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
676 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
677 ATTR2IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
679 ERROR(GL_INVALID_VALUE
);
682 static void GLAPIENTRY
683 TAG(VertexAttribI3iv
)(GLuint index
, const GLint
*v
)
685 GET_CURRENT_CONTEXT(ctx
);
686 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
688 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
689 ATTR3IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
691 ERROR(GL_INVALID_VALUE
);
694 static void GLAPIENTRY
695 TAG(VertexAttribI4iv
)(GLuint index
, const GLint
*v
)
697 GET_CURRENT_CONTEXT(ctx
);
698 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
700 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
701 ATTR4IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
703 ERROR(GL_INVALID_VALUE
);
708 /* Unsigned integer-valued generic attributes.
709 * XXX: the integers just get converted to floats at this time
711 static void GLAPIENTRY
712 TAG(VertexAttribI1ui
)(GLuint index
, GLuint x
)
714 GET_CURRENT_CONTEXT(ctx
);
715 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
717 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
718 ATTR1UI(VBO_ATTRIB_GENERIC0
+ index
, x
);
720 ERROR(GL_INVALID_VALUE
);
723 static void GLAPIENTRY
724 TAG(VertexAttribI2ui
)(GLuint index
, GLuint x
, GLuint y
)
726 GET_CURRENT_CONTEXT(ctx
);
727 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
729 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
730 ATTR2UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
732 ERROR(GL_INVALID_VALUE
);
735 static void GLAPIENTRY
736 TAG(VertexAttribI3ui
)(GLuint index
, GLuint x
, GLuint y
, GLuint z
)
738 GET_CURRENT_CONTEXT(ctx
);
739 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
741 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
742 ATTR3UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
744 ERROR(GL_INVALID_VALUE
);
747 static void GLAPIENTRY
748 TAG(VertexAttribI4ui
)(GLuint index
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
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
);
756 ERROR(GL_INVALID_VALUE
);
759 static void GLAPIENTRY
760 TAG(VertexAttribI2uiv
)(GLuint index
, const GLuint
*v
)
762 GET_CURRENT_CONTEXT(ctx
);
763 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
765 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
766 ATTR2UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
768 ERROR(GL_INVALID_VALUE
);
771 static void GLAPIENTRY
772 TAG(VertexAttribI3uiv
)(GLuint index
, const GLuint
*v
)
774 GET_CURRENT_CONTEXT(ctx
);
775 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
777 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
778 ATTR3UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
780 ERROR(GL_INVALID_VALUE
);
783 static void GLAPIENTRY
784 TAG(VertexAttribI4uiv
)(GLuint index
, const GLuint
*v
)
786 GET_CURRENT_CONTEXT(ctx
);
787 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
789 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
790 ATTR4UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
792 ERROR(GL_INVALID_VALUE
);
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)
802 static void GLAPIENTRY
803 TAG(VertexAttrib1fNV
)(GLuint index
, GLfloat x
)
805 GET_CURRENT_CONTEXT(ctx
);
806 if (index
< VBO_ATTRIB_MAX
)
810 static void GLAPIENTRY
811 TAG(VertexAttrib1fvNV
)(GLuint index
, const GLfloat
* v
)
813 GET_CURRENT_CONTEXT(ctx
);
814 if (index
< VBO_ATTRIB_MAX
)
818 static void GLAPIENTRY
819 TAG(VertexAttrib2fNV
)(GLuint index
, GLfloat x
, GLfloat y
)
821 GET_CURRENT_CONTEXT(ctx
);
822 if (index
< VBO_ATTRIB_MAX
)
826 static void GLAPIENTRY
827 TAG(VertexAttrib2fvNV
)(GLuint index
, const GLfloat
* v
)
829 GET_CURRENT_CONTEXT(ctx
);
830 if (index
< VBO_ATTRIB_MAX
)
834 static void GLAPIENTRY
835 TAG(VertexAttrib3fNV
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
837 GET_CURRENT_CONTEXT(ctx
);
838 if (index
< VBO_ATTRIB_MAX
)
839 ATTR3F(index
, x
, y
, z
);
842 static void GLAPIENTRY
843 TAG(VertexAttrib3fvNV
)(GLuint index
,
846 GET_CURRENT_CONTEXT(ctx
);
847 if (index
< VBO_ATTRIB_MAX
)
851 static void GLAPIENTRY
852 TAG(VertexAttrib4fNV
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
854 GET_CURRENT_CONTEXT(ctx
);
855 if (index
< VBO_ATTRIB_MAX
)
856 ATTR4F(index
, x
, y
, z
, w
);
859 static void GLAPIENTRY
860 TAG(VertexAttrib4fvNV
)(GLuint index
, const GLfloat
* v
)
862 GET_CURRENT_CONTEXT(ctx
);
863 if (index
< VBO_ATTRIB_MAX
)
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); \
874 /* Extended version of ERROR_IF_NOT_PACKED_TYPE which also
875 * accepts GL_UNSIGNED_INT_10F_11F_11F_REV.
877 * Only used for VertexAttribP[123]ui[v]; VertexAttribP4* cannot use this type,
878 * and neither can legacy vertex attribs.
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); \
887 static void GLAPIENTRY
888 TAG(VertexP2ui
)(GLenum type
, GLuint value
)
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
);
895 static void GLAPIENTRY
896 TAG(VertexP2uiv
)(GLenum type
, const GLuint
*value
)
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]);
903 static void GLAPIENTRY
904 TAG(VertexP3ui
)(GLenum type
, GLuint value
)
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
);
911 static void GLAPIENTRY
912 TAG(VertexP3uiv
)(GLenum type
, const GLuint
*value
)
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]);
919 static void GLAPIENTRY
920 TAG(VertexP4ui
)(GLenum type
, GLuint value
)
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
);
927 static void GLAPIENTRY
928 TAG(VertexP4uiv
)(GLenum type
, const GLuint
*value
)
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]);
935 static void GLAPIENTRY
936 TAG(TexCoordP1ui
)(GLenum type
, GLuint coords
)
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
);
943 static void GLAPIENTRY
944 TAG(TexCoordP1uiv
)(GLenum type
, const GLuint
*coords
)
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]);
951 static void GLAPIENTRY
952 TAG(TexCoordP2ui
)(GLenum type
, GLuint coords
)
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
);
959 static void GLAPIENTRY
960 TAG(TexCoordP2uiv
)(GLenum type
, const GLuint
*coords
)
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]);
967 static void GLAPIENTRY
968 TAG(TexCoordP3ui
)(GLenum type
, GLuint coords
)
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
);
975 static void GLAPIENTRY
976 TAG(TexCoordP3uiv
)(GLenum type
, const GLuint
*coords
)
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]);
983 static void GLAPIENTRY
984 TAG(TexCoordP4ui
)(GLenum type
, GLuint coords
)
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
);
991 static void GLAPIENTRY
992 TAG(TexCoordP4uiv
)(GLenum type
, const GLuint
*coords
)
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]);
999 static void GLAPIENTRY
1000 TAG(MultiTexCoordP1ui
)(GLenum target
, GLenum type
, GLuint coords
)
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
);
1008 static void GLAPIENTRY
1009 TAG(MultiTexCoordP1uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
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]);
1017 static void GLAPIENTRY
1018 TAG(MultiTexCoordP2ui
)(GLenum target
, GLenum type
, GLuint coords
)
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
);
1026 static void GLAPIENTRY
1027 TAG(MultiTexCoordP2uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
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]);
1035 static void GLAPIENTRY
1036 TAG(MultiTexCoordP3ui
)(GLenum target
, GLenum type
, GLuint coords
)
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
);
1044 static void GLAPIENTRY
1045 TAG(MultiTexCoordP3uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
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]);
1053 static void GLAPIENTRY
1054 TAG(MultiTexCoordP4ui
)(GLenum target
, GLenum type
, GLuint coords
)
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
);
1062 static void GLAPIENTRY
1063 TAG(MultiTexCoordP4uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
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]);
1071 static void GLAPIENTRY
1072 TAG(NormalP3ui
)(GLenum type
, GLuint coords
)
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
);
1079 static void GLAPIENTRY
1080 TAG(NormalP3uiv
)(GLenum type
, const GLuint
*coords
)
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]);
1087 static void GLAPIENTRY
1088 TAG(ColorP3ui
)(GLenum type
, GLuint color
)
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
);
1095 static void GLAPIENTRY
1096 TAG(ColorP3uiv
)(GLenum type
, const GLuint
*color
)
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]);
1103 static void GLAPIENTRY
1104 TAG(ColorP4ui
)(GLenum type
, GLuint color
)
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
);
1111 static void GLAPIENTRY
1112 TAG(ColorP4uiv
)(GLenum type
, const GLuint
*color
)
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]);
1119 static void GLAPIENTRY
1120 TAG(SecondaryColorP3ui
)(GLenum type
, GLuint color
)
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
);
1127 static void GLAPIENTRY
1128 TAG(SecondaryColorP3uiv
)(GLenum type
, const GLuint
*color
)
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]);
1135 static void GLAPIENTRY
1136 TAG(VertexAttribP1ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
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
);
1144 static void GLAPIENTRY
1145 TAG(VertexAttribP2ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
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
);
1153 static void GLAPIENTRY
1154 TAG(VertexAttribP3ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
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
);
1162 static void GLAPIENTRY
1163 TAG(VertexAttribP4ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1166 GET_CURRENT_CONTEXT(ctx
);
1167 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexAttribP4ui");
1168 ATTR_UI_INDEX(ctx
, 4, type
, normalized
, index
, value
);
1171 static void GLAPIENTRY
1172 TAG(VertexAttribP1uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1173 const GLuint
*value
)
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
);
1180 static void GLAPIENTRY
1181 TAG(VertexAttribP2uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1182 const GLuint
*value
)
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
);
1189 static void GLAPIENTRY
1190 TAG(VertexAttribP3uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1191 const GLuint
*value
)
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
);
1198 static void GLAPIENTRY
1199 TAG(VertexAttribP4uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1200 const GLuint
*value
)
1202 GET_CURRENT_CONTEXT(ctx
);
1203 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexAttribP4uiv");
1204 ATTR_UI_INDEX(ctx
, 4, type
, normalized
, index
, *value
);
1209 static void GLAPIENTRY
1210 TAG(VertexAttribL1d
)(GLuint index
, GLdouble x
)
1212 GET_CURRENT_CONTEXT(ctx
);
1213 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1215 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1216 ATTR1D(VBO_ATTRIB_GENERIC0
+ index
, x
);
1218 ERROR(GL_INVALID_VALUE
);
1221 static void GLAPIENTRY
1222 TAG(VertexAttribL1dv
)(GLuint index
, const GLdouble
* v
)
1224 GET_CURRENT_CONTEXT(ctx
);
1225 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1227 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1228 ATTR1DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1230 ERROR(GL_INVALID_VALUE
);
1233 static void GLAPIENTRY
1234 TAG(VertexAttribL2d
)(GLuint index
, GLdouble x
, GLdouble y
)
1236 GET_CURRENT_CONTEXT(ctx
);
1237 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1239 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1240 ATTR2D(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
1242 ERROR(GL_INVALID_VALUE
);
1245 static void GLAPIENTRY
1246 TAG(VertexAttribL2dv
)(GLuint index
, const GLdouble
* v
)
1248 GET_CURRENT_CONTEXT(ctx
);
1249 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1251 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1252 ATTR2DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1254 ERROR(GL_INVALID_VALUE
);
1257 static void GLAPIENTRY
1258 TAG(VertexAttribL3d
)(GLuint index
, GLdouble x
, GLdouble y
, GLdouble z
)
1260 GET_CURRENT_CONTEXT(ctx
);
1261 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1263 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1264 ATTR3D(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
1266 ERROR(GL_INVALID_VALUE
);
1269 static void GLAPIENTRY
1270 TAG(VertexAttribL3dv
)(GLuint index
, const GLdouble
* v
)
1272 GET_CURRENT_CONTEXT(ctx
);
1273 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1275 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1276 ATTR3DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1278 ERROR(GL_INVALID_VALUE
);
1281 static void GLAPIENTRY
1282 TAG(VertexAttribL4d
)(GLuint index
, GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
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
);
1290 ERROR(GL_INVALID_VALUE
);
1293 static void GLAPIENTRY
1294 TAG(VertexAttribL4dv
)(GLuint index
, const GLdouble
* v
)
1296 GET_CURRENT_CONTEXT(ctx
);
1297 if (index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
))
1299 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1300 ATTR4DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1302 ERROR(GL_INVALID_VALUE
);