1 /**************************************************************************
3 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
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 TUNGSTEN GRAPHICS 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 **************************************************************************/
29 #define ATTR1FV( A, V ) ATTR( A, 1, (V)[0], 0, 0, 1 )
30 #define ATTR2FV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 )
31 #define ATTR3FV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 )
32 #define ATTR4FV( A, V ) ATTR( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
34 #define ATTR1F( A, X ) ATTR( A, 1, X, 0, 0, 1 )
35 #define ATTR2F( A, X, Y ) ATTR( A, 2, X, Y, 0, 1 )
36 #define ATTR3F( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 )
37 #define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W )
40 #define ATTR2IV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 )
41 #define ATTR3IV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 )
42 #define ATTR4IV( A, V ) ATTR( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
44 #define ATTR1I( A, X ) ATTR( A, 1, X, 0, 0, 1 )
45 #define ATTR2I( A, X, Y ) ATTR( A, 2, X, Y, 0, 1 )
46 #define ATTR3I( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 )
47 #define ATTR4I( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W )
51 #define ATTR2UIV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 )
52 #define ATTR3UIV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 )
53 #define ATTR4UIV( A, V ) ATTR( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
55 #define ATTR1UI( A, X ) ATTR( A, 1, X, 0, 0, 1 )
56 #define ATTR2UI( A, X, Y ) ATTR( A, 2, X, Y, 0, 1 )
57 #define ATTR3UI( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 )
58 #define ATTR4UI( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W )
60 #define MAT_ATTR( A, N, V ) ATTR( A, N, (V)[0], (V)[1], (V)[2], (V)[3] )
62 static inline float conv_ui10_to_norm_float(unsigned ui10
)
64 return (float)(ui10
) / 1023.0;
67 static inline float conv_ui2_to_norm_float(unsigned ui2
)
69 return (float)(ui2
) / 3.0;
72 #define ATTRUI10_1( A, UI ) ATTR( A, 1, (UI) & 0x3ff, 0, 0, 1 )
73 #define ATTRUI10_2( A, UI ) ATTR( A, 2, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, 0, 1 )
74 #define ATTRUI10_3( A, UI ) ATTR( A, 3, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, 1 )
75 #define ATTRUI10_4( A, UI ) ATTR( A, 4, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, ((UI) >> 30) & 0x3 )
77 #define ATTRUI10N_1( A, UI ) ATTR( A, 1, conv_ui10_to_norm_float((UI) & 0x3ff), 0, 0, 1 )
78 #define ATTRUI10N_2( A, UI ) ATTR( A, 2, \
79 conv_ui10_to_norm_float((UI) & 0x3ff), \
80 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), 0, 1 )
81 #define ATTRUI10N_3( A, UI ) ATTR( A, 3, \
82 conv_ui10_to_norm_float((UI) & 0x3ff), \
83 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
84 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), 1 )
85 #define ATTRUI10N_4( A, UI ) ATTR( A, 4, \
86 conv_ui10_to_norm_float((UI) & 0x3ff), \
87 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
88 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), \
89 conv_ui2_to_norm_float(((UI) >> 30) & 0x3) )
91 struct attr_bits_10
{signed int x
:10;};
92 struct attr_bits_2
{signed int x
:2;};
94 static inline float conv_i10_to_i(int i10
)
96 struct attr_bits_10 val
;
101 static inline float conv_i2_to_i(int i2
)
103 struct attr_bits_2 val
;
108 static inline float conv_i10_to_norm_float(int i10
)
110 struct attr_bits_10 val
;
112 return (2.0F
* (float)val
.x
+ 1.0F
) * (1.0F
/ 511.0F
);
115 static inline float conv_i2_to_norm_float(int i2
)
117 struct attr_bits_2 val
;
122 #define ATTRI10_1( A, I10 ) ATTR( A, 1, conv_i10_to_i((I10) & 0x3ff), 0, 0, 1 )
123 #define ATTRI10_2( A, I10 ) ATTR( A, 2, \
124 conv_i10_to_i((I10) & 0x3ff), \
125 conv_i10_to_i(((I10) >> 10) & 0x3ff), 0, 1 )
126 #define ATTRI10_3( A, I10 ) ATTR( A, 3, \
127 conv_i10_to_i((I10) & 0x3ff), \
128 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
129 conv_i10_to_i(((I10) >> 20) & 0x3ff), 1 )
130 #define ATTRI10_4( A, I10 ) ATTR( A, 4, \
131 conv_i10_to_i((I10) & 0x3ff), \
132 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
133 conv_i10_to_i(((I10) >> 20) & 0x3ff), \
134 conv_i2_to_i(((I10) >> 30) & 0x3))
137 #define ATTRI10N_1( A, I10 ) ATTR( A, 1, conv_i10_to_norm_float((I10) & 0x3ff), 0, 0, 1 )
138 #define ATTRI10N_2( A, I10 ) ATTR( A, 2, \
139 conv_i10_to_norm_float((I10) & 0x3ff), \
140 conv_i10_to_norm_float(((I10) >> 10) & 0x3ff), 0, 1 )
141 #define ATTRI10N_3( A, I10 ) ATTR( A, 3, \
142 conv_i10_to_norm_float((I10) & 0x3ff), \
143 conv_i10_to_norm_float(((I10) >> 10) & 0x3ff), \
144 conv_i10_to_norm_float(((I10) >> 20) & 0x3ff), 1 )
145 #define ATTRI10N_4( A, I10 ) ATTR( A, 4, \
146 conv_i10_to_norm_float((I10) & 0x3ff), \
147 conv_i10_to_norm_float(((I10) >> 10) & 0x3ff), \
148 conv_i10_to_norm_float(((I10) >> 20) & 0x3ff), \
149 conv_i2_to_norm_float(((I10) >> 30) & 0x3))
151 #define ATTR_UI(val, type, normalized, attr, arg) do { \
152 if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
154 ATTRUI10N_##val((attr), (arg)); \
156 ATTRUI10_##val((attr), (arg)); \
158 } else if ((type) == GL_INT_2_10_10_10_REV) { \
160 ATTRI10N_##val((attr), (arg)); \
162 ATTRI10_##val((attr), (arg)); \
165 ERROR(GL_INVALID_VALUE); \
168 #define ATTR_UI_INDEX(val, type, normalized, index, arg) do { \
169 if ((index) == 0) { \
170 ATTR_UI(val, (type), normalized, 0, (arg)); \
171 } else if ((index) < MAX_VERTEX_GENERIC_ATTRIBS) { \
172 ATTR_UI(val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), (arg)); \
174 ERROR(GL_INVALID_VALUE); \
177 static void GLAPIENTRY
178 TAG(Vertex2f
)(GLfloat x
, GLfloat y
)
180 GET_CURRENT_CONTEXT(ctx
);
181 ATTR2F(VBO_ATTRIB_POS
, x
, y
);
184 static void GLAPIENTRY
185 TAG(Vertex2fv
)(const GLfloat
* v
)
187 GET_CURRENT_CONTEXT(ctx
);
188 ATTR2FV(VBO_ATTRIB_POS
, v
);
191 static void GLAPIENTRY
192 TAG(Vertex3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
194 GET_CURRENT_CONTEXT(ctx
);
195 ATTR3F(VBO_ATTRIB_POS
, x
, y
, z
);
198 static void GLAPIENTRY
199 TAG(Vertex3fv
)(const GLfloat
* v
)
201 GET_CURRENT_CONTEXT(ctx
);
202 ATTR3FV(VBO_ATTRIB_POS
, v
);
205 static void GLAPIENTRY
206 TAG(Vertex4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
208 GET_CURRENT_CONTEXT(ctx
);
209 ATTR4F(VBO_ATTRIB_POS
, x
, y
, z
, w
);
212 static void GLAPIENTRY
213 TAG(Vertex4fv
)(const GLfloat
* v
)
215 GET_CURRENT_CONTEXT(ctx
);
216 ATTR4FV(VBO_ATTRIB_POS
, v
);
221 static void GLAPIENTRY
222 TAG(TexCoord1f
)(GLfloat x
)
224 GET_CURRENT_CONTEXT(ctx
);
225 ATTR1F(VBO_ATTRIB_TEX0
, x
);
228 static void GLAPIENTRY
229 TAG(TexCoord1fv
)(const GLfloat
* v
)
231 GET_CURRENT_CONTEXT(ctx
);
232 ATTR1FV(VBO_ATTRIB_TEX0
, v
);
235 static void GLAPIENTRY
236 TAG(TexCoord2f
)(GLfloat x
, GLfloat y
)
238 GET_CURRENT_CONTEXT(ctx
);
239 ATTR2F(VBO_ATTRIB_TEX0
, x
, y
);
242 static void GLAPIENTRY
243 TAG(TexCoord2fv
)(const GLfloat
* v
)
245 GET_CURRENT_CONTEXT(ctx
);
246 ATTR2FV(VBO_ATTRIB_TEX0
, v
);
249 static void GLAPIENTRY
250 TAG(TexCoord3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
252 GET_CURRENT_CONTEXT(ctx
);
253 ATTR3F(VBO_ATTRIB_TEX0
, x
, y
, z
);
256 static void GLAPIENTRY
257 TAG(TexCoord3fv
)(const GLfloat
* v
)
259 GET_CURRENT_CONTEXT(ctx
);
260 ATTR3FV(VBO_ATTRIB_TEX0
, v
);
263 static void GLAPIENTRY
264 TAG(TexCoord4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
266 GET_CURRENT_CONTEXT(ctx
);
267 ATTR4F(VBO_ATTRIB_TEX0
, x
, y
, z
, w
);
270 static void GLAPIENTRY
271 TAG(TexCoord4fv
)(const GLfloat
* v
)
273 GET_CURRENT_CONTEXT(ctx
);
274 ATTR4FV(VBO_ATTRIB_TEX0
, v
);
279 static void GLAPIENTRY
280 TAG(Normal3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
282 GET_CURRENT_CONTEXT(ctx
);
283 ATTR3F(VBO_ATTRIB_NORMAL
, x
, y
, z
);
286 static void GLAPIENTRY
287 TAG(Normal3fv
)(const GLfloat
* v
)
289 GET_CURRENT_CONTEXT(ctx
);
290 ATTR3FV(VBO_ATTRIB_NORMAL
, v
);
295 static void GLAPIENTRY
296 TAG(FogCoordfEXT
)(GLfloat x
)
298 GET_CURRENT_CONTEXT(ctx
);
299 ATTR1F(VBO_ATTRIB_FOG
, x
);
304 static void GLAPIENTRY
305 TAG(FogCoordfvEXT
)(const GLfloat
* v
)
307 GET_CURRENT_CONTEXT(ctx
);
308 ATTR1FV(VBO_ATTRIB_FOG
, v
);
311 static void GLAPIENTRY
312 TAG(Color3f
)(GLfloat x
, GLfloat y
, GLfloat z
)
314 GET_CURRENT_CONTEXT(ctx
);
315 ATTR3F(VBO_ATTRIB_COLOR0
, x
, y
, z
);
318 static void GLAPIENTRY
319 TAG(Color3fv
)(const GLfloat
* v
)
321 GET_CURRENT_CONTEXT(ctx
);
322 ATTR3FV(VBO_ATTRIB_COLOR0
, v
);
325 static void GLAPIENTRY
326 TAG(Color4f
)(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
328 GET_CURRENT_CONTEXT(ctx
);
329 ATTR4F(VBO_ATTRIB_COLOR0
, x
, y
, z
, w
);
332 static void GLAPIENTRY
333 TAG(Color4fv
)(const GLfloat
* v
)
335 GET_CURRENT_CONTEXT(ctx
);
336 ATTR4FV(VBO_ATTRIB_COLOR0
, v
);
341 static void GLAPIENTRY
342 TAG(SecondaryColor3fEXT
)(GLfloat x
, GLfloat y
, GLfloat z
)
344 GET_CURRENT_CONTEXT(ctx
);
345 ATTR3F(VBO_ATTRIB_COLOR1
, x
, y
, z
);
348 static void GLAPIENTRY
349 TAG(SecondaryColor3fvEXT
)(const GLfloat
* v
)
351 GET_CURRENT_CONTEXT(ctx
);
352 ATTR3FV(VBO_ATTRIB_COLOR1
, v
);
357 static void GLAPIENTRY
358 TAG(EdgeFlag
)(GLboolean b
)
360 GET_CURRENT_CONTEXT(ctx
);
361 ATTR1F(VBO_ATTRIB_EDGEFLAG
, (GLfloat
) b
);
366 static void GLAPIENTRY
367 TAG(Indexf
)(GLfloat f
)
369 GET_CURRENT_CONTEXT(ctx
);
370 ATTR1F(VBO_ATTRIB_INDEX
, f
);
373 static void GLAPIENTRY
374 TAG(Indexfv
)(const GLfloat
* f
)
376 GET_CURRENT_CONTEXT(ctx
);
377 ATTR1FV(VBO_ATTRIB_INDEX
, f
);
382 static void GLAPIENTRY
383 TAG(MultiTexCoord1f
)(GLenum target
, GLfloat x
)
385 GET_CURRENT_CONTEXT(ctx
);
386 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
390 static void GLAPIENTRY
391 TAG(MultiTexCoord1fv
)(GLenum target
, const GLfloat
* v
)
393 GET_CURRENT_CONTEXT(ctx
);
394 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
398 static void GLAPIENTRY
399 TAG(MultiTexCoord2f
)(GLenum target
, GLfloat x
, GLfloat y
)
401 GET_CURRENT_CONTEXT(ctx
);
402 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
406 static void GLAPIENTRY
407 TAG(MultiTexCoord2fv
)(GLenum target
, const GLfloat
* v
)
409 GET_CURRENT_CONTEXT(ctx
);
410 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
414 static void GLAPIENTRY
415 TAG(MultiTexCoord3f
)(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
417 GET_CURRENT_CONTEXT(ctx
);
418 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
419 ATTR3F(attr
, x
, y
, z
);
422 static void GLAPIENTRY
423 TAG(MultiTexCoord3fv
)(GLenum target
, const GLfloat
* v
)
425 GET_CURRENT_CONTEXT(ctx
);
426 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
430 static void GLAPIENTRY
431 TAG(MultiTexCoord4f
)(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
433 GET_CURRENT_CONTEXT(ctx
);
434 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
435 ATTR4F(attr
, x
, y
, z
, w
);
438 static void GLAPIENTRY
439 TAG(MultiTexCoord4fv
)(GLenum target
, const GLfloat
* v
)
441 GET_CURRENT_CONTEXT(ctx
);
442 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
448 static void GLAPIENTRY
449 TAG(VertexAttrib1fARB
)(GLuint index
, GLfloat x
)
451 GET_CURRENT_CONTEXT(ctx
);
454 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
455 ATTR1F(VBO_ATTRIB_GENERIC0
+ index
, x
);
457 ERROR(GL_INVALID_VALUE
);
460 static void GLAPIENTRY
461 TAG(VertexAttrib1fvARB
)(GLuint index
, const GLfloat
* v
)
463 GET_CURRENT_CONTEXT(ctx
);
466 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
467 ATTR1FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
469 ERROR(GL_INVALID_VALUE
);
472 static void GLAPIENTRY
473 TAG(VertexAttrib2fARB
)(GLuint index
, GLfloat x
, GLfloat y
)
475 GET_CURRENT_CONTEXT(ctx
);
478 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
479 ATTR2F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
481 ERROR(GL_INVALID_VALUE
);
484 static void GLAPIENTRY
485 TAG(VertexAttrib2fvARB
)(GLuint index
, const GLfloat
* v
)
487 GET_CURRENT_CONTEXT(ctx
);
490 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
491 ATTR2FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
493 ERROR(GL_INVALID_VALUE
);
496 static void GLAPIENTRY
497 TAG(VertexAttrib3fARB
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
499 GET_CURRENT_CONTEXT(ctx
);
502 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
503 ATTR3F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
505 ERROR(GL_INVALID_VALUE
);
508 static void GLAPIENTRY
509 TAG(VertexAttrib3fvARB
)(GLuint index
, const GLfloat
* v
)
511 GET_CURRENT_CONTEXT(ctx
);
514 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
515 ATTR3FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
517 ERROR(GL_INVALID_VALUE
);
520 static void GLAPIENTRY
521 TAG(VertexAttrib4fARB
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
523 GET_CURRENT_CONTEXT(ctx
);
525 ATTR4F(0, x
, y
, z
, w
);
526 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
527 ATTR4F(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
529 ERROR(GL_INVALID_VALUE
);
532 static void GLAPIENTRY
533 TAG(VertexAttrib4fvARB
)(GLuint index
, const GLfloat
* v
)
535 GET_CURRENT_CONTEXT(ctx
);
538 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
539 ATTR4FV(VBO_ATTRIB_GENERIC0
+ index
, v
);
541 ERROR(GL_INVALID_VALUE
);
546 /* Integer-valued generic attributes.
547 * XXX: the integers just get converted to floats at this time
549 static void GLAPIENTRY
550 TAG(VertexAttribI1i
)(GLuint index
, GLint x
)
552 GET_CURRENT_CONTEXT(ctx
);
555 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
556 ATTR1I(VBO_ATTRIB_GENERIC0
+ index
, x
);
558 ERROR(GL_INVALID_VALUE
);
561 static void GLAPIENTRY
562 TAG(VertexAttribI2i
)(GLuint index
, GLint x
, GLint y
)
564 GET_CURRENT_CONTEXT(ctx
);
567 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
568 ATTR2I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
570 ERROR(GL_INVALID_VALUE
);
573 static void GLAPIENTRY
574 TAG(VertexAttribI3i
)(GLuint index
, GLint x
, GLint y
, GLint z
)
576 GET_CURRENT_CONTEXT(ctx
);
579 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
580 ATTR3I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
582 ERROR(GL_INVALID_VALUE
);
585 static void GLAPIENTRY
586 TAG(VertexAttribI4i
)(GLuint index
, GLint x
, GLint y
, GLint z
, GLint w
)
588 GET_CURRENT_CONTEXT(ctx
);
590 ATTR4I(0, x
, y
, z
, w
);
591 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
592 ATTR4I(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
594 ERROR(GL_INVALID_VALUE
);
597 static void GLAPIENTRY
598 TAG(VertexAttribI2iv
)(GLuint index
, const GLint
*v
)
600 GET_CURRENT_CONTEXT(ctx
);
603 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
604 ATTR2IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
606 ERROR(GL_INVALID_VALUE
);
609 static void GLAPIENTRY
610 TAG(VertexAttribI3iv
)(GLuint index
, const GLint
*v
)
612 GET_CURRENT_CONTEXT(ctx
);
615 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
616 ATTR3IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
618 ERROR(GL_INVALID_VALUE
);
621 static void GLAPIENTRY
622 TAG(VertexAttribI4iv
)(GLuint index
, const GLint
*v
)
624 GET_CURRENT_CONTEXT(ctx
);
627 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
628 ATTR4IV(VBO_ATTRIB_GENERIC0
+ index
, v
);
630 ERROR(GL_INVALID_VALUE
);
635 /* Unsigned integer-valued generic attributes.
636 * XXX: the integers just get converted to floats at this time
638 static void GLAPIENTRY
639 TAG(VertexAttribI1ui
)(GLuint index
, GLuint x
)
641 GET_CURRENT_CONTEXT(ctx
);
644 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
645 ATTR1UI(VBO_ATTRIB_GENERIC0
+ index
, x
);
647 ERROR(GL_INVALID_VALUE
);
650 static void GLAPIENTRY
651 TAG(VertexAttribI2ui
)(GLuint index
, GLuint x
, GLuint y
)
653 GET_CURRENT_CONTEXT(ctx
);
656 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
657 ATTR2UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
);
659 ERROR(GL_INVALID_VALUE
);
662 static void GLAPIENTRY
663 TAG(VertexAttribI3ui
)(GLuint index
, GLuint x
, GLuint y
, GLuint z
)
665 GET_CURRENT_CONTEXT(ctx
);
668 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
669 ATTR3UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
);
671 ERROR(GL_INVALID_VALUE
);
674 static void GLAPIENTRY
675 TAG(VertexAttribI4ui
)(GLuint index
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
677 GET_CURRENT_CONTEXT(ctx
);
679 ATTR4UI(0, x
, y
, z
, w
);
680 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
681 ATTR4UI(VBO_ATTRIB_GENERIC0
+ index
, x
, y
, z
, w
);
683 ERROR(GL_INVALID_VALUE
);
686 static void GLAPIENTRY
687 TAG(VertexAttribI2uiv
)(GLuint index
, const GLuint
*v
)
689 GET_CURRENT_CONTEXT(ctx
);
692 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
693 ATTR2UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
695 ERROR(GL_INVALID_VALUE
);
698 static void GLAPIENTRY
699 TAG(VertexAttribI3uiv
)(GLuint index
, const GLuint
*v
)
701 GET_CURRENT_CONTEXT(ctx
);
704 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
705 ATTR3UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
707 ERROR(GL_INVALID_VALUE
);
710 static void GLAPIENTRY
711 TAG(VertexAttribI4uiv
)(GLuint index
, const GLuint
*v
)
713 GET_CURRENT_CONTEXT(ctx
);
716 else if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
717 ATTR4UIV(VBO_ATTRIB_GENERIC0
+ index
, v
);
719 ERROR(GL_INVALID_VALUE
);
724 /* In addition to supporting NV_vertex_program, these entrypoints are
725 * used by the display list and other code specifically because of
726 * their property of aliasing with other attributes. (See
727 * vbo_save_loopback.c)
729 static void GLAPIENTRY
730 TAG(VertexAttrib1fNV
)(GLuint index
, GLfloat x
)
732 GET_CURRENT_CONTEXT(ctx
);
733 if (index
< VBO_ATTRIB_MAX
)
737 static void GLAPIENTRY
738 TAG(VertexAttrib1fvNV
)(GLuint index
, const GLfloat
* v
)
740 GET_CURRENT_CONTEXT(ctx
);
741 if (index
< VBO_ATTRIB_MAX
)
745 static void GLAPIENTRY
746 TAG(VertexAttrib2fNV
)(GLuint index
, GLfloat x
, GLfloat y
)
748 GET_CURRENT_CONTEXT(ctx
);
749 if (index
< VBO_ATTRIB_MAX
)
753 static void GLAPIENTRY
754 TAG(VertexAttrib2fvNV
)(GLuint index
, const GLfloat
* v
)
756 GET_CURRENT_CONTEXT(ctx
);
757 if (index
< VBO_ATTRIB_MAX
)
761 static void GLAPIENTRY
762 TAG(VertexAttrib3fNV
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
764 GET_CURRENT_CONTEXT(ctx
);
765 if (index
< VBO_ATTRIB_MAX
)
766 ATTR3F(index
, x
, y
, z
);
769 static void GLAPIENTRY
770 TAG(VertexAttrib3fvNV
)(GLuint index
,
773 GET_CURRENT_CONTEXT(ctx
);
774 if (index
< VBO_ATTRIB_MAX
)
778 static void GLAPIENTRY
779 TAG(VertexAttrib4fNV
)(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
781 GET_CURRENT_CONTEXT(ctx
);
782 if (index
< VBO_ATTRIB_MAX
)
783 ATTR4F(index
, x
, y
, z
, w
);
786 static void GLAPIENTRY
787 TAG(VertexAttrib4fvNV
)(GLuint index
, const GLfloat
* v
)
789 GET_CURRENT_CONTEXT(ctx
);
790 if (index
< VBO_ATTRIB_MAX
)
795 static void GLAPIENTRY
796 TAG(VertexP2ui
)(GLenum type
, GLuint value
)
798 GET_CURRENT_CONTEXT(ctx
);
799 ATTR_UI(2, type
, 0, VBO_ATTRIB_POS
, value
);
802 static void GLAPIENTRY
803 TAG(VertexP2uiv
)(GLenum type
, const GLuint
*value
)
805 GET_CURRENT_CONTEXT(ctx
);
806 ATTR_UI(2, type
, 0, VBO_ATTRIB_POS
, value
[0]);
809 static void GLAPIENTRY
810 TAG(VertexP3ui
)(GLenum type
, GLuint value
)
812 GET_CURRENT_CONTEXT(ctx
);
813 ATTR_UI(3, type
, 0, VBO_ATTRIB_POS
, value
);
816 static void GLAPIENTRY
817 TAG(VertexP3uiv
)(GLenum type
, const GLuint
*value
)
819 GET_CURRENT_CONTEXT(ctx
);
820 ATTR_UI(3, type
, 0, VBO_ATTRIB_POS
, value
[0]);
823 static void GLAPIENTRY
824 TAG(VertexP4ui
)(GLenum type
, GLuint value
)
826 GET_CURRENT_CONTEXT(ctx
);
827 ATTR_UI(4, type
, 0, VBO_ATTRIB_POS
, value
);
830 static void GLAPIENTRY
831 TAG(VertexP4uiv
)(GLenum type
, const GLuint
*value
)
833 GET_CURRENT_CONTEXT(ctx
);
834 ATTR_UI(4, type
, 0, VBO_ATTRIB_POS
, value
[0]);
837 static void GLAPIENTRY
838 TAG(TexCoordP1ui
)(GLenum type
, GLuint coords
)
840 GET_CURRENT_CONTEXT(ctx
);
841 ATTR_UI(1, type
, 0, VBO_ATTRIB_TEX0
, coords
);
844 static void GLAPIENTRY
845 TAG(TexCoordP1uiv
)(GLenum type
, const GLuint
*coords
)
847 GET_CURRENT_CONTEXT(ctx
);
848 ATTR_UI(1, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
851 static void GLAPIENTRY
852 TAG(TexCoordP2ui
)(GLenum type
, GLuint coords
)
854 GET_CURRENT_CONTEXT(ctx
);
855 ATTR_UI(2, type
, 0, VBO_ATTRIB_TEX0
, coords
);
858 static void GLAPIENTRY
859 TAG(TexCoordP2uiv
)(GLenum type
, const GLuint
*coords
)
861 GET_CURRENT_CONTEXT(ctx
);
862 ATTR_UI(2, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
865 static void GLAPIENTRY
866 TAG(TexCoordP3ui
)(GLenum type
, GLuint coords
)
868 GET_CURRENT_CONTEXT(ctx
);
869 ATTR_UI(3, type
, 0, VBO_ATTRIB_TEX0
, coords
);
872 static void GLAPIENTRY
873 TAG(TexCoordP3uiv
)(GLenum type
, const GLuint
*coords
)
875 GET_CURRENT_CONTEXT(ctx
);
876 ATTR_UI(3, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
879 static void GLAPIENTRY
880 TAG(TexCoordP4ui
)(GLenum type
, GLuint coords
)
882 GET_CURRENT_CONTEXT(ctx
);
883 ATTR_UI(4, type
, 0, VBO_ATTRIB_TEX0
, coords
);
886 static void GLAPIENTRY
887 TAG(TexCoordP4uiv
)(GLenum type
, const GLuint
*coords
)
889 GET_CURRENT_CONTEXT(ctx
);
890 ATTR_UI(4, type
, 0, VBO_ATTRIB_TEX0
, coords
[0]);
893 static void GLAPIENTRY
894 TAG(MultiTexCoordP1ui
)(GLenum target
, GLenum type
, GLuint coords
)
896 GET_CURRENT_CONTEXT(ctx
);
897 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
898 ATTR_UI(1, type
, 0, attr
, coords
);
901 static void GLAPIENTRY
902 TAG(MultiTexCoordP1uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
904 GET_CURRENT_CONTEXT(ctx
);
905 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
906 ATTR_UI(1, type
, 0, attr
, coords
[0]);
909 static void GLAPIENTRY
910 TAG(MultiTexCoordP2ui
)(GLenum target
, GLenum type
, GLuint coords
)
912 GET_CURRENT_CONTEXT(ctx
);
913 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
914 ATTR_UI(2, type
, 0, attr
, coords
);
917 static void GLAPIENTRY
918 TAG(MultiTexCoordP2uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
920 GET_CURRENT_CONTEXT(ctx
);
921 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
922 ATTR_UI(2, type
, 0, attr
, coords
[0]);
925 static void GLAPIENTRY
926 TAG(MultiTexCoordP3ui
)(GLenum target
, GLenum type
, GLuint coords
)
928 GET_CURRENT_CONTEXT(ctx
);
929 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
930 ATTR_UI(3, type
, 0, attr
, coords
);
933 static void GLAPIENTRY
934 TAG(MultiTexCoordP3uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
936 GET_CURRENT_CONTEXT(ctx
);
937 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
938 ATTR_UI(3, type
, 0, attr
, coords
[0]);
941 static void GLAPIENTRY
942 TAG(MultiTexCoordP4ui
)(GLenum target
, GLenum type
, GLuint coords
)
944 GET_CURRENT_CONTEXT(ctx
);
945 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
946 ATTR_UI(4, type
, 0, attr
, coords
);
949 static void GLAPIENTRY
950 TAG(MultiTexCoordP4uiv
)(GLenum target
, GLenum type
, const GLuint
*coords
)
952 GET_CURRENT_CONTEXT(ctx
);
953 GLuint attr
= (target
& 0x7) + VBO_ATTRIB_TEX0
;
954 ATTR_UI(4, type
, 0, attr
, coords
[0]);
957 static void GLAPIENTRY
958 TAG(NormalP3ui
)(GLenum type
, GLuint coords
)
960 GET_CURRENT_CONTEXT(ctx
);
961 ATTR_UI(3, type
, 1, VBO_ATTRIB_NORMAL
, coords
);
964 static void GLAPIENTRY
965 TAG(NormalP3uiv
)(GLenum type
, const GLuint
*coords
)
967 GET_CURRENT_CONTEXT(ctx
);
968 ATTR_UI(3, type
, 1, VBO_ATTRIB_NORMAL
, coords
[0]);
971 static void GLAPIENTRY
972 TAG(ColorP3ui
)(GLenum type
, GLuint color
)
974 GET_CURRENT_CONTEXT(ctx
);
975 ATTR_UI(3, type
, 1, VBO_ATTRIB_COLOR0
, color
);
978 static void GLAPIENTRY
979 TAG(ColorP3uiv
)(GLenum type
, const GLuint
*color
)
981 GET_CURRENT_CONTEXT(ctx
);
982 ATTR_UI(3, type
, 1, VBO_ATTRIB_COLOR0
, color
[0]);
985 static void GLAPIENTRY
986 TAG(ColorP4ui
)(GLenum type
, GLuint color
)
988 GET_CURRENT_CONTEXT(ctx
);
989 ATTR_UI(4, type
, 1, VBO_ATTRIB_COLOR0
, color
);
992 static void GLAPIENTRY
993 TAG(ColorP4uiv
)(GLenum type
, const GLuint
*color
)
995 GET_CURRENT_CONTEXT(ctx
);
996 ATTR_UI(4, type
, 1, VBO_ATTRIB_COLOR0
, color
[0]);
999 static void GLAPIENTRY
1000 TAG(SecondaryColorP3ui
)(GLenum type
, GLuint color
)
1002 GET_CURRENT_CONTEXT(ctx
);
1003 ATTR_UI(3, type
, 1, VBO_ATTRIB_COLOR1
, color
);
1006 static void GLAPIENTRY
1007 TAG(SecondaryColorP3uiv
)(GLenum type
, const GLuint
*color
)
1009 GET_CURRENT_CONTEXT(ctx
);
1010 ATTR_UI(3, type
, 1, VBO_ATTRIB_COLOR1
, color
[0]);
1013 static void GLAPIENTRY
1014 TAG(VertexAttribP1ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1017 GET_CURRENT_CONTEXT(ctx
);
1018 ATTR_UI_INDEX(1, type
, normalized
, index
, value
);
1021 static void GLAPIENTRY
1022 TAG(VertexAttribP2ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1025 GET_CURRENT_CONTEXT(ctx
);
1026 ATTR_UI_INDEX(2, type
, normalized
, index
, value
);
1029 static void GLAPIENTRY
1030 TAG(VertexAttribP3ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1033 GET_CURRENT_CONTEXT(ctx
);
1034 ATTR_UI_INDEX(3, type
, normalized
, index
, value
);
1037 static void GLAPIENTRY
1038 TAG(VertexAttribP4ui
)(GLuint index
, GLenum type
, GLboolean normalized
,
1041 GET_CURRENT_CONTEXT(ctx
);
1042 ATTR_UI_INDEX(4, type
, normalized
, index
, value
);
1045 static void GLAPIENTRY
1046 TAG(VertexAttribP1uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1047 const GLuint
*value
)
1049 GET_CURRENT_CONTEXT(ctx
);
1050 ATTR_UI_INDEX(1, type
, normalized
, index
, *value
);
1053 static void GLAPIENTRY
1054 TAG(VertexAttribP2uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1055 const GLuint
*value
)
1057 GET_CURRENT_CONTEXT(ctx
);
1058 ATTR_UI_INDEX(2, type
, normalized
, index
, *value
);
1061 static void GLAPIENTRY
1062 TAG(VertexAttribP3uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1063 const GLuint
*value
)
1065 GET_CURRENT_CONTEXT(ctx
);
1066 ATTR_UI_INDEX(3, type
, normalized
, index
, *value
);
1069 static void GLAPIENTRY
1070 TAG(VertexAttribP4uiv
)(GLuint index
, GLenum type
, GLboolean normalized
,
1071 const GLuint
*value
)
1073 GET_CURRENT_CONTEXT(ctx
);
1074 ATTR_UI_INDEX(4, type
, normalized
, index
, *value
);