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/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)
44 #define ATTRUI64( A, N, V0, V1, V2, V3 ) \
45 ATTR_UNION(A, N, GL_UNSIGNED_INT64_ARB, uint64_t, V0, V1, V2, V3)
49 #define ATTR1FV( A, V ) ATTRF( A, 1, (V)[0], 0, 0, 1 )
50 #define ATTR2FV( A, V ) ATTRF( A, 2, (V)[0], (V)[1], 0, 1 )
51 #define ATTR3FV( A, V ) ATTRF( A, 3, (V)[0], (V)[1], (V)[2], 1 )
52 #define ATTR4FV( A, V ) ATTRF( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
54 #define ATTR1F( A, X ) ATTRF( A, 1, X, 0, 0, 1 )
55 #define ATTR2F( A, X, Y ) ATTRF( A, 2, X, Y, 0, 1 )
56 #define ATTR3F( A, X, Y, Z ) ATTRF( A, 3, X, Y, Z, 1 )
57 #define ATTR4F( A, X, Y, Z, W ) ATTRF( A, 4, X, Y, Z, W )
61 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
62 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
63 #define ATTR4IV( A, V ) ATTRI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
65 #define ATTR1I( A, X ) ATTRI( A, 1, X, 0, 0, 1 )
66 #define ATTR2I( A, X, Y ) ATTRI( A, 2, X, Y, 0, 1 )
67 #define ATTR3I( A, X, Y, Z ) ATTRI( A, 3, X, Y, Z, 1 )
68 #define ATTR4I( A, X, Y, Z, W ) ATTRI( A, 4, X, Y, Z, W )
72 #define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0], (V)[1], 0, 1 )
73 #define ATTR3UIV( A, V ) ATTRUI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
74 #define ATTR4UIV( A, V ) ATTRUI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
76 #define ATTR1UI( A, X ) ATTRUI( A, 1, X, 0, 0, 1 )
77 #define ATTR2UI( A, X, Y ) ATTRUI( A, 2, X, Y, 0, 1 )
78 #define ATTR3UI( A, X, Y, Z ) ATTRUI( A, 3, X, Y, Z, 1 )
79 #define ATTR4UI( A, X, Y, Z, W ) ATTRUI( A, 4, X, Y, Z, W )
81 #define MAT_ATTR( A, N, V ) ATTRF( A, N, (V)[0], (V)[1], (V)[2], (V)[3] )
83 static inline float conv_ui10_to_norm_float(unsigned ui10
)
85 return ui10
/ 1023.0f
;
88 static inline float conv_ui2_to_norm_float(unsigned ui2
)
93 #define ATTRUI10_1( A, UI ) ATTRF( A, 1, (UI) & 0x3ff, 0, 0, 1 )
94 #define ATTRUI10_2( A, UI ) ATTRF( A, 2, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, 0, 1 )
95 #define ATTRUI10_3( A, UI ) ATTRF( A, 3, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, 1 )
96 #define ATTRUI10_4( A, UI ) ATTRF( A, 4, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, ((UI) >> 30) & 0x3 )
98 #define ATTRUI10N_1( A, UI ) ATTRF( A, 1, conv_ui10_to_norm_float((UI) & 0x3ff), 0, 0, 1 )
99 #define ATTRUI10N_2( A, UI ) ATTRF( A, 2, \
100 conv_ui10_to_norm_float((UI) & 0x3ff), \
101 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), 0, 1 )
102 #define ATTRUI10N_3( A, UI ) ATTRF( A, 3, \
103 conv_ui10_to_norm_float((UI) & 0x3ff), \
104 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
105 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), 1 )
106 #define ATTRUI10N_4( A, UI ) ATTRF( A, 4, \
107 conv_ui10_to_norm_float((UI) & 0x3ff), \
108 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
109 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), \
110 conv_ui2_to_norm_float(((UI) >> 30) & 0x3) )
112 struct attr_bits_10
{signed int x
:10;};
113 struct attr_bits_2
{signed int x
:2;};
115 static inline float conv_i10_to_i(int i10
)
117 struct attr_bits_10 val
;
122 static inline float conv_i2_to_i(int i2
)
124 struct attr_bits_2 val
;
129 static inline float conv_i10_to_norm_float(const struct gl_context
*ctx
, int i10
)
131 struct attr_bits_10 val
;
134 /* Traditionally, OpenGL has had two equations for converting from
135 * normalized fixed-point data to floating-point data. In the OpenGL 3.2
136 * specification, these are equations 2.2 and 2.3, respectively:
138 * f = (2c + 1)/(2^b - 1). (2.2)
140 * Comments below this equation state: "In general, this representation is
141 * used for signed normalized fixed-point parameters in GL commands, such
142 * as vertex attribute values." Which is what we're doing here.
144 * f = max{c/(2^(b-1) - 1), -1.0} (2.3)
146 * Comments below this equation state: "In general, this representation is
147 * used for signed normalized fixed-point texture or floating point values."
149 * OpenGL 4.2+ and ES 3.0 remedy this and state that equation 2.3 (above)
150 * is used in every case. They remove equation 2.2 completely.
152 if (_mesa_is_gles3(ctx
) ||
153 (ctx
->API
== API_OPENGL_CORE
&& ctx
->Version
>= 42)) {
154 /* Equation 2.3 above. */
155 float f
= ((float) val
.x
) / 511.0F
;
156 return MAX2(f
, -1.0f
);
158 /* Equation 2.2 above. */
159 return (2.0F
* (float)val
.x
+ 1.0F
) * (1.0F
/ 1023.0F
);
163 static inline float conv_i2_to_norm_float(const struct gl_context
*ctx
, int i2
)
165 struct attr_bits_2 val
;
168 if (_mesa_is_gles3(ctx
) ||
169 (ctx
->API
== API_OPENGL_CORE
&& ctx
->Version
>= 42)) {
170 /* Equation 2.3 above. */
171 float f
= (float) val
.x
;
172 return MAX2(f
, -1.0f
);
174 /* Equation 2.2 above. */
175 return (2.0F
* (float)val
.x
+ 1.0F
) * (1.0F
/ 3.0F
);
179 #define ATTRI10_1( A, I10 ) ATTRF( A, 1, conv_i10_to_i((I10) & 0x3ff), 0, 0, 1 )
180 #define ATTRI10_2( A, I10 ) ATTRF( A, 2, \
181 conv_i10_to_i((I10) & 0x3ff), \
182 conv_i10_to_i(((I10) >> 10) & 0x3ff), 0, 1 )
183 #define ATTRI10_3( A, I10 ) ATTRF( A, 3, \
184 conv_i10_to_i((I10) & 0x3ff), \
185 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
186 conv_i10_to_i(((I10) >> 20) & 0x3ff), 1 )
187 #define ATTRI10_4( A, I10 ) ATTRF( A, 4, \
188 conv_i10_to_i((I10) & 0x3ff), \
189 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
190 conv_i10_to_i(((I10) >> 20) & 0x3ff), \
191 conv_i2_to_i(((I10) >> 30) & 0x3))
194 #define ATTRI10N_1(ctx, A, I10) ATTRF(A, 1, conv_i10_to_norm_float(ctx, (I10) & 0x3ff), 0, 0, 1 )
195 #define ATTRI10N_2(ctx, A, I10) ATTRF(A, 2, \
196 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
197 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), 0, 1 )
198 #define ATTRI10N_3(ctx, A, I10) ATTRF(A, 3, \
199 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
200 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \
201 conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), 1 )
202 #define ATTRI10N_4(ctx, A, I10) ATTRF(A, 4, \
203 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
204 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \
205 conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), \
206 conv_i2_to_norm_float(ctx, ((I10) >> 30) & 0x3))
208 #define ATTR_UI(ctx, val, type, normalized, attr, arg) do { \
209 if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
211 ATTRUI10N_##val((attr), (arg)); \
213 ATTRUI10_##val((attr), (arg)); \
215 } else if ((type) == GL_INT_2_10_10_10_REV) { \
217 ATTRI10N_##val(ctx, (attr), (arg)); \
219 ATTRI10_##val((attr), (arg)); \
221 } else if ((type) == GL_UNSIGNED_INT_10F_11F_11F_REV) { \
224 r11g11b10f_to_float3((arg), res); \
225 ATTR##val##FV((attr), res); \
227 ERROR(GL_INVALID_VALUE); \
230 #define ATTR_UI_INDEX(ctx, val, type, normalized, index, arg) do { \
231 if ((index) == 0 && _mesa_attr_zero_aliases_vertex(ctx)) { \
232 ATTR_UI(ctx, val, (type), normalized, 0, (arg)); \
233 } else if ((index) < MAX_VERTEX_GENERIC_ATTRIBS) { \
234 ATTR_UI(ctx, val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), (arg)); \
236 ERROR(GL_INVALID_VALUE); \
241 #define ATTR1DV( A, V ) ATTRD( A, 1, (V)[0], 0, 0, 1 )
242 #define ATTR2DV( A, V ) ATTRD( A, 2, (V)[0], (V)[1], 0, 1 )
243 #define ATTR3DV( A, V ) ATTRD( A, 3, (V)[0], (V)[1], (V)[2], 1 )
244 #define ATTR4DV( A, V ) ATTRD( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
246 #define ATTR1D( A, X ) ATTRD( A, 1, X, 0, 0, 1 )
247 #define ATTR2D( A, X, Y ) ATTRD( A, 2, X, Y, 0, 1 )
248 #define ATTR3D( A, X, Y, Z ) ATTRD( A, 3, X, Y, Z, 1 )
249 #define ATTR4D( A, X, Y, Z, W ) ATTRD( A, 4, X, Y, Z, W )
251 #define ATTR1UIV64( A, V ) ATTRUI64( A, 1, (V)[0], 0, 0, 0 )
252 #define ATTR1UI64( A, X ) ATTRUI64( A, 1, X, 0, 0, 0 )
255 static void GLAPIENTRY
256 TAG(Vertex2f
)(GLfloat x
, GLfloat y
)
258 GET_CURRENT_CONTEXT(ctx
);
259 ATTR2F(VBO_ATTRIB_POS
, x
, y
);
262 static void GLAPIENTRY
263 TAG(Vertex2fv
)(const GLfloat
* v
)
265 GET_CURRENT_CONTEXT(ctx
);
266 ATTR2FV(VBO_ATTRIB_POS
, v
);
269 static void GLAPIENTRY
270 TAG(Vertex3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
272 GET_CURRENT_CONTEXT(ctx
);
273 ATTR3F(VBO_ATTRIB_POS
, x
, y
, z
);
276 static void GLAPIENTRY
277 TAG(Vertex3fv
)(const GLfloat
* v
)
279 GET_CURRENT_CONTEXT(ctx
);
280 ATTR3FV(VBO_ATTRIB_POS
, v
);
283 static void GLAPIENTRY
284 TAG(Vertex4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
286 GET_CURRENT_CONTEXT(ctx
);
287 ATTR4F(VBO_ATTRIB_POS
, x
, y
, z
, w
);
290 static void GLAPIENTRY
291 TAG(Vertex4fv
)(const GLfloat
* v
)
293 GET_CURRENT_CONTEXT(ctx
);
294 ATTR4FV(VBO_ATTRIB_POS
, v
);
299 static void GLAPIENTRY
300 TAG(TexCoord1f
)(GLfloat x
)
302 GET_CURRENT_CONTEXT(ctx
);
303 ATTR1F(VBO_ATTRIB_TEX0
, x
);
306 static void GLAPIENTRY
307 TAG(TexCoord1fv
)(const GLfloat
* v
)
309 GET_CURRENT_CONTEXT(ctx
);
310 ATTR1FV(VBO_ATTRIB_TEX0
, v
);
313 static void GLAPIENTRY
314 TAG(TexCoord2f
)(GLfloat x
, GLfloat y
)
316 GET_CURRENT_CONTEXT(ctx
);
317 ATTR2F(VBO_ATTRIB_TEX0
, x
, y
);
320 static void GLAPIENTRY
321 TAG(TexCoord2fv
)(const GLfloat
* v
)
323 GET_CURRENT_CONTEXT(ctx
);
324 ATTR2FV(VBO_ATTRIB_TEX0
, v
);
327 static void GLAPIENTRY
328 TAG(TexCoord3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
330 GET_CURRENT_CONTEXT(ctx
);
331 ATTR3F(VBO_ATTRIB_TEX0
, x
, y
, z
);
334 static void GLAPIENTRY
335 TAG(TexCoord3fv
)(const GLfloat
* v
)
337 GET_CURRENT_CONTEXT(ctx
);
338 ATTR3FV(VBO_ATTRIB_TEX0
, v
);
341 static void GLAPIENTRY
342 TAG(TexCoord4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
344 GET_CURRENT_CONTEXT(ctx
);
345 ATTR4F(VBO_ATTRIB_TEX0
, x
, y
, z
, w
);
348 static void GLAPIENTRY
349 TAG(TexCoord4fv
)(const GLfloat
* v
)
351 GET_CURRENT_CONTEXT(ctx
);
352 ATTR4FV(VBO_ATTRIB_TEX0
, v
);
357 static void GLAPIENTRY
358 TAG(Normal3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
360 GET_CURRENT_CONTEXT(ctx
);
361 ATTR3F(VBO_ATTRIB_NORMAL
, x
, y
, z
);
364 static void GLAPIENTRY
365 TAG(Normal3fv
)(const GLfloat
* v
)
367 GET_CURRENT_CONTEXT(ctx
);
368 ATTR3FV(VBO_ATTRIB_NORMAL
, v
);
373 static void GLAPIENTRY
374 TAG(FogCoordfEXT
)(GLfloat x
)
376 GET_CURRENT_CONTEXT(ctx
);
377 ATTR1F(VBO_ATTRIB_FOG
, x
);
382 static void GLAPIENTRY
383 TAG(FogCoordfvEXT
)(const GLfloat
* v
)
385 GET_CURRENT_CONTEXT(ctx
);
386 ATTR1FV(VBO_ATTRIB_FOG
, v
);
389 static void GLAPIENTRY
390 TAG(Color3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
392 GET_CURRENT_CONTEXT(ctx
);
393 ATTR3F(VBO_ATTRIB_COLOR0
, x
, y
, z
);
396 static void GLAPIENTRY
397 TAG(Color3fv
)(const GLfloat
* v
)
399 GET_CURRENT_CONTEXT(ctx
);
400 ATTR3FV(VBO_ATTRIB_COLOR0
, v
);
403 static void GLAPIENTRY
404 TAG(Color4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
406 GET_CURRENT_CONTEXT(ctx
);
407 ATTR4F(VBO_ATTRIB_COLOR0
, x
, y
, z
, w
);
410 static void GLAPIENTRY
411 TAG(Color4fv
)(const GLfloat
* v
)
413 GET_CURRENT_CONTEXT(ctx
);
414 ATTR4FV(VBO_ATTRIB_COLOR0
, v
);
419 static void GLAPIENTRY
420 TAG(SecondaryColor3fEXT
)(GLfloat x
, GLfloat y
, GLfloat z
)
422 GET_CURRENT_CONTEXT(ctx
);
423 ATTR3F(VBO_ATTRIB_COLOR1
, x
, y
, z
);
426 static void GLAPIENTRY
427 TAG(SecondaryColor3fvEXT
)(const GLfloat
* v
)
429 GET_CURRENT_CONTEXT(ctx
);
430 ATTR3FV(VBO_ATTRIB_COLOR1
, v
);
435 static void GLAPIENTRY
436 TAG(EdgeFlag
)(GLboolean b
)
438 GET_CURRENT_CONTEXT(ctx
);
439 ATTR1F(VBO_ATTRIB_EDGEFLAG
, (GLfloat
) b
);
444 static void GLAPIENTRY
445 TAG(Indexf
)(GLfloat f
)
447 GET_CURRENT_CONTEXT(ctx
);
448 ATTR1F(VBO_ATTRIB_INDEX
, f
);
451 static void GLAPIENTRY
452 TAG(Indexfv
)(const GLfloat
* f
)
454 GET_CURRENT_CONTEXT(ctx
);
455 ATTR1FV(VBO_ATTRIB_INDEX
, f
);
460 static void GLAPIENTRY
461 TAG(MultiTexCoord1f
)(GLenum target
, GLfloat x
)
463 GET_CURRENT_CONTEXT(ctx
);
464 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
468 static void GLAPIENTRY
469 TAG(MultiTexCoord1fv
)(GLenum target
, const GLfloat
* v
)
471 GET_CURRENT_CONTEXT(ctx
);
472 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
476 static void GLAPIENTRY
477 TAG(MultiTexCoord2f
)(GLenum target
, GLfloat x
, GLfloat y
)
479 GET_CURRENT_CONTEXT(ctx
);
480 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
484 static void GLAPIENTRY
485 TAG(MultiTexCoord2fv
)(GLenum target
, const GLfloat
* v
)
487 GET_CURRENT_CONTEXT(ctx
);
488 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
492 static void GLAPIENTRY
493 TAG(MultiTexCoord3f
)(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
495 GET_CURRENT_CONTEXT(ctx
);
496 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
497 ATTR3F(attr
, x
, y
, z
);
500 static void GLAPIENTRY
501 TAG(MultiTexCoord3fv
)(GLenum target
, const GLfloat
* v
)
503 GET_CURRENT_CONTEXT(ctx
);
504 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
508 static void GLAPIENTRY
509 TAG(MultiTexCoord4f
)(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
511 GET_CURRENT_CONTEXT(ctx
);
512 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
513 ATTR4F(attr
, x
, y
, z
, w
);
516 static void GLAPIENTRY
517 TAG(MultiTexCoord4fv
)(GLenum target
, const GLfloat
* v
)
519 GET_CURRENT_CONTEXT(ctx
);
520 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
526 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
529 is_vertex_position(const struct gl_context
*ctx
, GLuint index
)
531 return index
== 0 && _mesa_attr_zero_aliases_vertex(ctx
);
536 static void GLAPIENTRY
537 TAG(VertexAttrib1fARB
)(GLuint index
, GLfloat x
)
539 GET_CURRENT_CONTEXT(ctx
);
540 if (is_vertex_position(ctx
, index
))
542 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
543 ATTR1F(VBO_ATTRIB_GENERIC0
+ index
, x
);
545 ERROR(GL_INVALID_VALUE
);
548 static void GLAPIENTRY
549 TAG(VertexAttrib1fvARB
)(GLuint index
, const GLfloat
* v
)
551 GET_CURRENT_CONTEXT(ctx
);
552 if (is_vertex_position(ctx
, index
))
554 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
555 ATTR1FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
557 ERROR(GL_INVALID_VALUE
);
560 static void GLAPIENTRY
561 TAG(VertexAttrib2fARB
)(GLuint index
, GLfloat x
, GLfloat y
)
563 GET_CURRENT_CONTEXT(ctx
);
564 if (is_vertex_position(ctx
, index
))
566 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
567 ATTR2F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
569 ERROR(GL_INVALID_VALUE
);
572 static void GLAPIENTRY
573 TAG(VertexAttrib2fvARB
)(GLuint index
, const GLfloat
* v
)
575 GET_CURRENT_CONTEXT(ctx
);
576 if (is_vertex_position(ctx
, index
))
578 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
579 ATTR2FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
581 ERROR(GL_INVALID_VALUE
);
584 static void GLAPIENTRY
585 TAG(VertexAttrib3fARB
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
587 GET_CURRENT_CONTEXT(ctx
);
588 if (is_vertex_position(ctx
, index
))
590 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
591 ATTR3F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
593 ERROR(GL_INVALID_VALUE
);
596 static void GLAPIENTRY
597 TAG(VertexAttrib3fvARB
)(GLuint index
, const GLfloat
* v
)
599 GET_CURRENT_CONTEXT(ctx
);
600 if (is_vertex_position(ctx
, index
))
602 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
603 ATTR3FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
605 ERROR(GL_INVALID_VALUE
);
608 static void GLAPIENTRY
609 TAG(VertexAttrib4fARB
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
611 GET_CURRENT_CONTEXT(ctx
);
612 if (is_vertex_position(ctx
, index
))
613 ATTR4F(0, x
, y
, z
, w
);
614 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
615 ATTR4F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
617 ERROR(GL_INVALID_VALUE
);
620 static void GLAPIENTRY
621 TAG(VertexAttrib4fvARB
)(GLuint index
, const GLfloat
* v
)
623 GET_CURRENT_CONTEXT(ctx
);
624 if (is_vertex_position(ctx
, index
))
626 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
627 ATTR4FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
629 ERROR(GL_INVALID_VALUE
);
634 /* Integer-valued generic attributes.
635 * XXX: the integers just get converted to floats at this time
637 static void GLAPIENTRY
638 TAG(VertexAttribI1i
)(GLuint index
, GLint x
)
640 GET_CURRENT_CONTEXT(ctx
);
641 if (is_vertex_position(ctx
, index
))
643 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
644 ATTR1I(VBO_ATTRIB_GENERIC0
+ index
, x
);
646 ERROR(GL_INVALID_VALUE
);
649 static void GLAPIENTRY
650 TAG(VertexAttribI2i
)(GLuint index
, GLint x
, GLint y
)
652 GET_CURRENT_CONTEXT(ctx
);
653 if (is_vertex_position(ctx
, index
))
655 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
656 ATTR2I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
658 ERROR(GL_INVALID_VALUE
);
661 static void GLAPIENTRY
662 TAG(VertexAttribI3i
)(GLuint index
, GLint x
, GLint y
, GLint z
)
664 GET_CURRENT_CONTEXT(ctx
);
665 if (is_vertex_position(ctx
, index
))
667 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
668 ATTR3I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
670 ERROR(GL_INVALID_VALUE
);
673 static void GLAPIENTRY
674 TAG(VertexAttribI4i
)(GLuint index
, GLint x
, GLint y
, GLint z
, GLint w
)
676 GET_CURRENT_CONTEXT(ctx
);
677 if (is_vertex_position(ctx
, index
))
678 ATTR4I(0, x
, y
, z
, w
);
679 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
680 ATTR4I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
682 ERROR(GL_INVALID_VALUE
);
685 static void GLAPIENTRY
686 TAG(VertexAttribI2iv
)(GLuint index
, const GLint
*v
)
688 GET_CURRENT_CONTEXT(ctx
);
689 if (is_vertex_position(ctx
, index
))
691 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
692 ATTR2IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
694 ERROR(GL_INVALID_VALUE
);
697 static void GLAPIENTRY
698 TAG(VertexAttribI3iv
)(GLuint index
, const GLint
*v
)
700 GET_CURRENT_CONTEXT(ctx
);
701 if (is_vertex_position(ctx
, index
))
703 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
704 ATTR3IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
706 ERROR(GL_INVALID_VALUE
);
709 static void GLAPIENTRY
710 TAG(VertexAttribI4iv
)(GLuint index
, const GLint
*v
)
712 GET_CURRENT_CONTEXT(ctx
);
713 if (is_vertex_position(ctx
, index
))
715 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
716 ATTR4IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
718 ERROR(GL_INVALID_VALUE
);
723 /* Unsigned integer-valued generic attributes.
724 * XXX: the integers just get converted to floats at this time
726 static void GLAPIENTRY
727 TAG(VertexAttribI1ui
)(GLuint index
, GLuint x
)
729 GET_CURRENT_CONTEXT(ctx
);
730 if (is_vertex_position(ctx
, index
))
732 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
733 ATTR1UI(VBO_ATTRIB_GENERIC0
+ index
, x
);
735 ERROR(GL_INVALID_VALUE
);
738 static void GLAPIENTRY
739 TAG(VertexAttribI2ui
)(GLuint index
, GLuint x
, GLuint y
)
741 GET_CURRENT_CONTEXT(ctx
);
742 if (is_vertex_position(ctx
, index
))
744 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
745 ATTR2UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
747 ERROR(GL_INVALID_VALUE
);
750 static void GLAPIENTRY
751 TAG(VertexAttribI3ui
)(GLuint index
, GLuint x
, GLuint y
, GLuint z
)
753 GET_CURRENT_CONTEXT(ctx
);
754 if (is_vertex_position(ctx
, index
))
756 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
757 ATTR3UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
759 ERROR(GL_INVALID_VALUE
);
762 static void GLAPIENTRY
763 TAG(VertexAttribI4ui
)(GLuint index
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
765 GET_CURRENT_CONTEXT(ctx
);
766 if (is_vertex_position(ctx
, index
))
767 ATTR4UI(0, x
, y
, z
, w
);
768 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
769 ATTR4UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
771 ERROR(GL_INVALID_VALUE
);
774 static void GLAPIENTRY
775 TAG(VertexAttribI2uiv
)(GLuint index
, const GLuint
*v
)
777 GET_CURRENT_CONTEXT(ctx
);
778 if (is_vertex_position(ctx
, index
))
780 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
781 ATTR2UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
783 ERROR(GL_INVALID_VALUE
);
786 static void GLAPIENTRY
787 TAG(VertexAttribI3uiv
)(GLuint index
, const GLuint
*v
)
789 GET_CURRENT_CONTEXT(ctx
);
790 if (is_vertex_position(ctx
, index
))
792 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
793 ATTR3UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
795 ERROR(GL_INVALID_VALUE
);
798 static void GLAPIENTRY
799 TAG(VertexAttribI4uiv
)(GLuint index
, const GLuint
*v
)
801 GET_CURRENT_CONTEXT(ctx
);
802 if (is_vertex_position(ctx
, index
))
804 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
805 ATTR4UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
807 ERROR(GL_INVALID_VALUE
);
812 /* These entrypoints are no longer used for NV_vertex_program but they are
813 * used by the display list and other code specifically because of their
814 * property of aliasing with the legacy Vertex, TexCoord, Normal, etc
815 * attributes. (See vbo_save_loopback.c)
817 static void GLAPIENTRY
818 TAG(VertexAttrib1fNV
)(GLuint index
, GLfloat x
)
820 GET_CURRENT_CONTEXT(ctx
);
821 if (index
< VBO_ATTRIB_MAX
)
825 static void GLAPIENTRY
826 TAG(VertexAttrib1fvNV
)(GLuint index
, const GLfloat
* v
)
828 GET_CURRENT_CONTEXT(ctx
);
829 if (index
< VBO_ATTRIB_MAX
)
833 static void GLAPIENTRY
834 TAG(VertexAttrib2fNV
)(GLuint index
, GLfloat x
, GLfloat y
)
836 GET_CURRENT_CONTEXT(ctx
);
837 if (index
< VBO_ATTRIB_MAX
)
841 static void GLAPIENTRY
842 TAG(VertexAttrib2fvNV
)(GLuint index
, const GLfloat
* v
)
844 GET_CURRENT_CONTEXT(ctx
);
845 if (index
< VBO_ATTRIB_MAX
)
849 static void GLAPIENTRY
850 TAG(VertexAttrib3fNV
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
852 GET_CURRENT_CONTEXT(ctx
);
853 if (index
< VBO_ATTRIB_MAX
)
854 ATTR3F(index
, x
, y
, z
);
857 static void GLAPIENTRY
858 TAG(VertexAttrib3fvNV
)(GLuint index
,
861 GET_CURRENT_CONTEXT(ctx
);
862 if (index
< VBO_ATTRIB_MAX
)
866 static void GLAPIENTRY
867 TAG(VertexAttrib4fNV
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
869 GET_CURRENT_CONTEXT(ctx
);
870 if (index
< VBO_ATTRIB_MAX
)
871 ATTR4F(index
, x
, y
, z
, w
);
874 static void GLAPIENTRY
875 TAG(VertexAttrib4fvNV
)(GLuint index
, const GLfloat
* v
)
877 GET_CURRENT_CONTEXT(ctx
);
878 if (index
< VBO_ATTRIB_MAX
)
883 #define ERROR_IF_NOT_PACKED_TYPE(ctx, type, func) \
884 if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV) { \
885 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \
889 /* Extended version of ERROR_IF_NOT_PACKED_TYPE which also
890 * accepts GL_UNSIGNED_INT_10F_11F_11F_REV.
892 * Only used for VertexAttribP[123]ui[v]; VertexAttribP4* cannot use this type,
893 * and neither can legacy vertex attribs.
895 #define ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, func) \
896 if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV && \
897 type != GL_UNSIGNED_INT_10F_11F_11F_REV) { \
898 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \
902 static void GLAPIENTRY
903 TAG(VertexP2ui
)(GLenum type
, GLuint value
)
905 GET_CURRENT_CONTEXT(ctx
);
906 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexP2ui");
907 ATTR_UI(ctx
, 2, type
, 0, VBO_ATTRIB_POS
, value
);
910 static void GLAPIENTRY
911 TAG(VertexP2uiv
)(GLenum type
, const GLuint
*value
)
913 GET_CURRENT_CONTEXT(ctx
);
914 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexP2uiv");
915 ATTR_UI(ctx
, 2, type
, 0, VBO_ATTRIB_POS
, value
[0]);
918 static void GLAPIENTRY
919 TAG(VertexP3ui
)(GLenum type
, GLuint value
)
921 GET_CURRENT_CONTEXT(ctx
);
922 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexP3ui");
923 ATTR_UI(ctx
, 3, type
, 0, VBO_ATTRIB_POS
, value
);
926 static void GLAPIENTRY
927 TAG(VertexP3uiv
)(GLenum type
, const GLuint
*value
)
929 GET_CURRENT_CONTEXT(ctx
);
930 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexP3uiv");
931 ATTR_UI(ctx
, 3, type
, 0, VBO_ATTRIB_POS
, value
[0]);
934 static void GLAPIENTRY
935 TAG(VertexP4ui
)(GLenum type
, GLuint value
)
937 GET_CURRENT_CONTEXT(ctx
);
938 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexP4ui");
939 ATTR_UI(ctx
, 4, type
, 0, VBO_ATTRIB_POS
, value
);
942 static void GLAPIENTRY
943 TAG(VertexP4uiv
)(GLenum type
, const GLuint
*value
)
945 GET_CURRENT_CONTEXT(ctx
);
946 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexP4uiv");
947 ATTR_UI(ctx
, 4, type
, 0, VBO_ATTRIB_POS
, value
[0]);
950 static void GLAPIENTRY
951 TAG(TexCoordP1ui
)(GLenum type
, GLuint coords
)
953 GET_CURRENT_CONTEXT(ctx
);
954 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP1ui");
955 ATTR_UI(ctx
, 1, type
, 0, VBO_ATTRIB_TEX0
, coords
);
958 static void GLAPIENTRY
959 TAG(TexCoordP1uiv
)(GLenum type
, const GLuint
*coords
)
961 GET_CURRENT_CONTEXT(ctx
);
962 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP1uiv");
963 ATTR_UI(ctx
, 1, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
966 static void GLAPIENTRY
967 TAG(TexCoordP2ui
)(GLenum type
, GLuint coords
)
969 GET_CURRENT_CONTEXT(ctx
);
970 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP2ui");
971 ATTR_UI(ctx
, 2, type
, 0, VBO_ATTRIB_TEX0
, coords
);
974 static void GLAPIENTRY
975 TAG(TexCoordP2uiv
)(GLenum type
, const GLuint
*coords
)
977 GET_CURRENT_CONTEXT(ctx
);
978 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP2uiv");
979 ATTR_UI(ctx
, 2, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
982 static void GLAPIENTRY
983 TAG(TexCoordP3ui
)(GLenum type
, GLuint coords
)
985 GET_CURRENT_CONTEXT(ctx
);
986 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP3ui");
987 ATTR_UI(ctx
, 3, type
, 0, VBO_ATTRIB_TEX0
, coords
);
990 static void GLAPIENTRY
991 TAG(TexCoordP3uiv
)(GLenum type
, const GLuint
*coords
)
993 GET_CURRENT_CONTEXT(ctx
);
994 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP3uiv");
995 ATTR_UI(ctx
, 3, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
998 static void GLAPIENTRY
999 TAG(TexCoordP4ui
)(GLenum type
, GLuint coords
)
1001 GET_CURRENT_CONTEXT(ctx
);
1002 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP4ui");
1003 ATTR_UI(ctx
, 4, type
, 0, VBO_ATTRIB_TEX0
, coords
);
1006 static void GLAPIENTRY
1007 TAG(TexCoordP4uiv
)(GLenum type
, const GLuint
*coords
)
1009 GET_CURRENT_CONTEXT(ctx
);
1010 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glTexCoordP4uiv");
1011 ATTR_UI(ctx
, 4, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
1014 static void GLAPIENTRY
1015 TAG(MultiTexCoordP1ui
)(GLenum target
, GLenum type
, GLuint coords
)
1017 GET_CURRENT_CONTEXT(ctx
);
1018 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1019 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP1ui");
1020 ATTR_UI(ctx
, 1, type
, 0, attr
, coords
);
1023 static void GLAPIENTRY
1024 TAG(MultiTexCoordP1uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
1026 GET_CURRENT_CONTEXT(ctx
);
1027 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1028 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP1uiv");
1029 ATTR_UI(ctx
, 1, type
, 0, attr
, coords
[0]);
1032 static void GLAPIENTRY
1033 TAG(MultiTexCoordP2ui
)(GLenum target
, GLenum type
, GLuint coords
)
1035 GET_CURRENT_CONTEXT(ctx
);
1036 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1037 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP2ui");
1038 ATTR_UI(ctx
, 2, type
, 0, attr
, coords
);
1041 static void GLAPIENTRY
1042 TAG(MultiTexCoordP2uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
1044 GET_CURRENT_CONTEXT(ctx
);
1045 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1046 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP2uiv");
1047 ATTR_UI(ctx
, 2, type
, 0, attr
, coords
[0]);
1050 static void GLAPIENTRY
1051 TAG(MultiTexCoordP3ui
)(GLenum target
, GLenum type
, GLuint coords
)
1053 GET_CURRENT_CONTEXT(ctx
);
1054 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1055 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP3ui");
1056 ATTR_UI(ctx
, 3, type
, 0, attr
, coords
);
1059 static void GLAPIENTRY
1060 TAG(MultiTexCoordP3uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
1062 GET_CURRENT_CONTEXT(ctx
);
1063 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1064 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP3uiv");
1065 ATTR_UI(ctx
, 3, type
, 0, attr
, coords
[0]);
1068 static void GLAPIENTRY
1069 TAG(MultiTexCoordP4ui
)(GLenum target
, GLenum type
, GLuint coords
)
1071 GET_CURRENT_CONTEXT(ctx
);
1072 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1073 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP4ui");
1074 ATTR_UI(ctx
, 4, type
, 0, attr
, coords
);
1077 static void GLAPIENTRY
1078 TAG(MultiTexCoordP4uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
1080 GET_CURRENT_CONTEXT(ctx
);
1081 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
1082 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glMultiTexCoordP4uiv");
1083 ATTR_UI(ctx
, 4, type
, 0, attr
, coords
[0]);
1086 static void GLAPIENTRY
1087 TAG(NormalP3ui
)(GLenum type
, GLuint coords
)
1089 GET_CURRENT_CONTEXT(ctx
);
1090 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glNormalP3ui");
1091 ATTR_UI(ctx
, 3, type
, 1, VBO_ATTRIB_NORMAL
, coords
);
1094 static void GLAPIENTRY
1095 TAG(NormalP3uiv
)(GLenum type
, const GLuint
*coords
)
1097 GET_CURRENT_CONTEXT(ctx
);
1098 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glNormalP3uiv");
1099 ATTR_UI(ctx
, 3, type
, 1, VBO_ATTRIB_NORMAL
, coords
[0]);
1102 static void GLAPIENTRY
1103 TAG(ColorP3ui
)(GLenum type
, GLuint color
)
1105 GET_CURRENT_CONTEXT(ctx
);
1106 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glColorP3ui");
1107 ATTR_UI(ctx
, 3, type
, 1, VBO_ATTRIB_COLOR0
, color
);
1110 static void GLAPIENTRY
1111 TAG(ColorP3uiv
)(GLenum type
, const GLuint
*color
)
1113 GET_CURRENT_CONTEXT(ctx
);
1114 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glColorP3uiv");
1115 ATTR_UI(ctx
, 3, type
, 1, VBO_ATTRIB_COLOR0
, color
[0]);
1118 static void GLAPIENTRY
1119 TAG(ColorP4ui
)(GLenum type
, GLuint color
)
1121 GET_CURRENT_CONTEXT(ctx
);
1122 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glColorP4ui");
1123 ATTR_UI(ctx
, 4, type
, 1, VBO_ATTRIB_COLOR0
, color
);
1126 static void GLAPIENTRY
1127 TAG(ColorP4uiv
)(GLenum type
, const GLuint
*color
)
1129 GET_CURRENT_CONTEXT(ctx
);
1130 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glColorP4uiv");
1131 ATTR_UI(ctx
, 4, type
, 1, VBO_ATTRIB_COLOR0
, color
[0]);
1134 static void GLAPIENTRY
1135 TAG(SecondaryColorP3ui
)(GLenum type
, GLuint color
)
1137 GET_CURRENT_CONTEXT(ctx
);
1138 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glSecondaryColorP3ui");
1139 ATTR_UI(ctx
, 3, type
, 1, VBO_ATTRIB_COLOR1
, color
);
1142 static void GLAPIENTRY
1143 TAG(SecondaryColorP3uiv
)(GLenum type
, const GLuint
*color
)
1145 GET_CURRENT_CONTEXT(ctx
);
1146 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glSecondaryColorP3uiv");
1147 ATTR_UI(ctx
, 3, type
, 1, VBO_ATTRIB_COLOR1
, color
[0]);
1150 static void GLAPIENTRY
1151 TAG(VertexAttribP1ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1154 GET_CURRENT_CONTEXT(ctx
);
1155 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx
, type
, "glVertexAttribP1ui");
1156 ATTR_UI_INDEX(ctx
, 1, type
, normalized
, index
, value
);
1159 static void GLAPIENTRY
1160 TAG(VertexAttribP2ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1163 GET_CURRENT_CONTEXT(ctx
);
1164 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx
, type
, "glVertexAttribP2ui");
1165 ATTR_UI_INDEX(ctx
, 2, type
, normalized
, index
, value
);
1168 static void GLAPIENTRY
1169 TAG(VertexAttribP3ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1172 GET_CURRENT_CONTEXT(ctx
);
1173 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx
, type
, "glVertexAttribP3ui");
1174 ATTR_UI_INDEX(ctx
, 3, type
, normalized
, index
, value
);
1177 static void GLAPIENTRY
1178 TAG(VertexAttribP4ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1181 GET_CURRENT_CONTEXT(ctx
);
1182 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexAttribP4ui");
1183 ATTR_UI_INDEX(ctx
, 4, type
, normalized
, index
, value
);
1186 static void GLAPIENTRY
1187 TAG(VertexAttribP1uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1188 const GLuint
*value
)
1190 GET_CURRENT_CONTEXT(ctx
);
1191 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx
, type
, "glVertexAttribP1uiv");
1192 ATTR_UI_INDEX(ctx
, 1, type
, normalized
, index
, *value
);
1195 static void GLAPIENTRY
1196 TAG(VertexAttribP2uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1197 const GLuint
*value
)
1199 GET_CURRENT_CONTEXT(ctx
);
1200 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx
, type
, "glVertexAttribP2uiv");
1201 ATTR_UI_INDEX(ctx
, 2, type
, normalized
, index
, *value
);
1204 static void GLAPIENTRY
1205 TAG(VertexAttribP3uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1206 const GLuint
*value
)
1208 GET_CURRENT_CONTEXT(ctx
);
1209 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx
, type
, "glVertexAttribP3uiv");
1210 ATTR_UI_INDEX(ctx
, 3, type
, normalized
, index
, *value
);
1213 static void GLAPIENTRY
1214 TAG(VertexAttribP4uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1215 const GLuint
*value
)
1217 GET_CURRENT_CONTEXT(ctx
);
1218 ERROR_IF_NOT_PACKED_TYPE(ctx
, type
, "glVertexAttribP4uiv");
1219 ATTR_UI_INDEX(ctx
, 4, type
, normalized
, index
, *value
);
1224 static void GLAPIENTRY
1225 TAG(VertexAttribL1d
)(GLuint index
, GLdouble x
)
1227 GET_CURRENT_CONTEXT(ctx
);
1228 if (is_vertex_position(ctx
, index
))
1230 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1231 ATTR1D(VBO_ATTRIB_GENERIC0
+ index
, x
);
1233 ERROR(GL_INVALID_VALUE
);
1236 static void GLAPIENTRY
1237 TAG(VertexAttribL1dv
)(GLuint index
, const GLdouble
* v
)
1239 GET_CURRENT_CONTEXT(ctx
);
1240 if (is_vertex_position(ctx
, index
))
1242 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1243 ATTR1DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1245 ERROR(GL_INVALID_VALUE
);
1248 static void GLAPIENTRY
1249 TAG(VertexAttribL2d
)(GLuint index
, GLdouble x
, GLdouble y
)
1251 GET_CURRENT_CONTEXT(ctx
);
1252 if (is_vertex_position(ctx
, index
))
1254 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1255 ATTR2D(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
1257 ERROR(GL_INVALID_VALUE
);
1260 static void GLAPIENTRY
1261 TAG(VertexAttribL2dv
)(GLuint index
, const GLdouble
* v
)
1263 GET_CURRENT_CONTEXT(ctx
);
1264 if (is_vertex_position(ctx
, index
))
1266 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1267 ATTR2DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1269 ERROR(GL_INVALID_VALUE
);
1272 static void GLAPIENTRY
1273 TAG(VertexAttribL3d
)(GLuint index
, GLdouble x
, GLdouble y
, GLdouble z
)
1275 GET_CURRENT_CONTEXT(ctx
);
1276 if (is_vertex_position(ctx
, index
))
1278 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1279 ATTR3D(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
1281 ERROR(GL_INVALID_VALUE
);
1284 static void GLAPIENTRY
1285 TAG(VertexAttribL3dv
)(GLuint index
, const GLdouble
* v
)
1287 GET_CURRENT_CONTEXT(ctx
);
1288 if (is_vertex_position(ctx
, index
))
1290 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1291 ATTR3DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1293 ERROR(GL_INVALID_VALUE
);
1296 static void GLAPIENTRY
1297 TAG(VertexAttribL4d
)(GLuint index
, GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
1299 GET_CURRENT_CONTEXT(ctx
);
1300 if (is_vertex_position(ctx
, index
))
1301 ATTR4D(0, x
, y
, z
, w
);
1302 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1303 ATTR4D(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
1305 ERROR(GL_INVALID_VALUE
);
1308 static void GLAPIENTRY
1309 TAG(VertexAttribL4dv
)(GLuint index
, const GLdouble
* v
)
1311 GET_CURRENT_CONTEXT(ctx
);
1312 if (is_vertex_position(ctx
, index
))
1314 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1315 ATTR4DV(VBO_ATTRIB_GENERIC0
+ index
, v
);
1317 ERROR(GL_INVALID_VALUE
);
1320 static void GLAPIENTRY
1321 TAG(VertexAttribL1ui64ARB
)(GLuint index
, GLuint64EXT x
)
1323 GET_CURRENT_CONTEXT(ctx
);
1324 if (is_vertex_position(ctx
, index
))
1326 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1327 ATTR1UI64(VBO_ATTRIB_GENERIC0
+ index
, x
);
1329 ERROR(GL_INVALID_VALUE
);
1332 static void GLAPIENTRY
1333 TAG(VertexAttribL1ui64vARB
)(GLuint index
, const GLuint64EXT
*v
)
1335 GET_CURRENT_CONTEXT(ctx
);
1336 if (is_vertex_position(ctx
, index
))
1338 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
1339 ATTR1UIV64(VBO_ATTRIB_GENERIC0
+ index
, v
);
1341 ERROR(GL_INVALID_VALUE
);