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