vc4: Introduce XML-based packet header generation like Intel's.
[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 (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);
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 (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);
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_INDEX, f);
449 }
450
451 static void GLAPIENTRY
452 TAG(Indexfv)(const GLfloat * f)
453 {
454 GET_CURRENT_CONTEXT(ctx);
455 ATTR1FV(VBO_ATTRIB_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
526 static void GLAPIENTRY
527 TAG(VertexAttrib1fARB)(GLuint index, GLfloat x)
528 {
529 GET_CURRENT_CONTEXT(ctx);
530 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
531 ATTR1F(0, x);
532 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
533 ATTR1F(VBO_ATTRIB_GENERIC0 + index, x);
534 else
535 ERROR(GL_INVALID_VALUE);
536 }
537
538 static void GLAPIENTRY
539 TAG(VertexAttrib1fvARB)(GLuint index, const GLfloat * v)
540 {
541 GET_CURRENT_CONTEXT(ctx);
542 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
543 ATTR1FV(0, v);
544 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
545 ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v);
546 else
547 ERROR(GL_INVALID_VALUE);
548 }
549
550 static void GLAPIENTRY
551 TAG(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y)
552 {
553 GET_CURRENT_CONTEXT(ctx);
554 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
555 ATTR2F(0, x, y);
556 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
557 ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y);
558 else
559 ERROR(GL_INVALID_VALUE);
560 }
561
562 static void GLAPIENTRY
563 TAG(VertexAttrib2fvARB)(GLuint index, const GLfloat * v)
564 {
565 GET_CURRENT_CONTEXT(ctx);
566 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
567 ATTR2FV(0, v);
568 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
569 ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v);
570 else
571 ERROR(GL_INVALID_VALUE);
572 }
573
574 static void GLAPIENTRY
575 TAG(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
576 {
577 GET_CURRENT_CONTEXT(ctx);
578 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
579 ATTR3F(0, x, y, z);
580 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
581 ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z);
582 else
583 ERROR(GL_INVALID_VALUE);
584 }
585
586 static void GLAPIENTRY
587 TAG(VertexAttrib3fvARB)(GLuint index, const GLfloat * v)
588 {
589 GET_CURRENT_CONTEXT(ctx);
590 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
591 ATTR3FV(0, v);
592 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
593 ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v);
594 else
595 ERROR(GL_INVALID_VALUE);
596 }
597
598 static void GLAPIENTRY
599 TAG(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
600 {
601 GET_CURRENT_CONTEXT(ctx);
602 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
603 ATTR4F(0, x, y, z, w);
604 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
605 ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
606 else
607 ERROR(GL_INVALID_VALUE);
608 }
609
610 static void GLAPIENTRY
611 TAG(VertexAttrib4fvARB)(GLuint index, const GLfloat * v)
612 {
613 GET_CURRENT_CONTEXT(ctx);
614 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
615 ATTR4FV(0, v);
616 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
617 ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v);
618 else
619 ERROR(GL_INVALID_VALUE);
620 }
621
622
623
624 /* Integer-valued generic attributes.
625 * XXX: the integers just get converted to floats at this time
626 */
627 static void GLAPIENTRY
628 TAG(VertexAttribI1i)(GLuint index, GLint x)
629 {
630 GET_CURRENT_CONTEXT(ctx);
631 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
632 ATTR1I(0, x);
633 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
634 ATTR1I(VBO_ATTRIB_GENERIC0 + index, x);
635 else
636 ERROR(GL_INVALID_VALUE);
637 }
638
639 static void GLAPIENTRY
640 TAG(VertexAttribI2i)(GLuint index, GLint x, GLint y)
641 {
642 GET_CURRENT_CONTEXT(ctx);
643 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
644 ATTR2I(0, x, y);
645 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
646 ATTR2I(VBO_ATTRIB_GENERIC0 + index, x, y);
647 else
648 ERROR(GL_INVALID_VALUE);
649 }
650
651 static void GLAPIENTRY
652 TAG(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z)
653 {
654 GET_CURRENT_CONTEXT(ctx);
655 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
656 ATTR3I(0, x, y, z);
657 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
658 ATTR3I(VBO_ATTRIB_GENERIC0 + index, x, y, z);
659 else
660 ERROR(GL_INVALID_VALUE);
661 }
662
663 static void GLAPIENTRY
664 TAG(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w)
665 {
666 GET_CURRENT_CONTEXT(ctx);
667 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
668 ATTR4I(0, x, y, z, w);
669 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
670 ATTR4I(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
671 else
672 ERROR(GL_INVALID_VALUE);
673 }
674
675 static void GLAPIENTRY
676 TAG(VertexAttribI2iv)(GLuint index, const GLint *v)
677 {
678 GET_CURRENT_CONTEXT(ctx);
679 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
680 ATTR2IV(0, v);
681 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
682 ATTR2IV(VBO_ATTRIB_GENERIC0 + index, v);
683 else
684 ERROR(GL_INVALID_VALUE);
685 }
686
687 static void GLAPIENTRY
688 TAG(VertexAttribI3iv)(GLuint index, const GLint *v)
689 {
690 GET_CURRENT_CONTEXT(ctx);
691 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
692 ATTR3IV(0, v);
693 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
694 ATTR3IV(VBO_ATTRIB_GENERIC0 + index, v);
695 else
696 ERROR(GL_INVALID_VALUE);
697 }
698
699 static void GLAPIENTRY
700 TAG(VertexAttribI4iv)(GLuint index, const GLint *v)
701 {
702 GET_CURRENT_CONTEXT(ctx);
703 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
704 ATTR4IV(0, v);
705 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
706 ATTR4IV(VBO_ATTRIB_GENERIC0 + index, v);
707 else
708 ERROR(GL_INVALID_VALUE);
709 }
710
711
712
713 /* Unsigned integer-valued generic attributes.
714 * XXX: the integers just get converted to floats at this time
715 */
716 static void GLAPIENTRY
717 TAG(VertexAttribI1ui)(GLuint index, GLuint x)
718 {
719 GET_CURRENT_CONTEXT(ctx);
720 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
721 ATTR1UI(0, x);
722 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
723 ATTR1UI(VBO_ATTRIB_GENERIC0 + index, x);
724 else
725 ERROR(GL_INVALID_VALUE);
726 }
727
728 static void GLAPIENTRY
729 TAG(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y)
730 {
731 GET_CURRENT_CONTEXT(ctx);
732 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
733 ATTR2UI(0, x, y);
734 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
735 ATTR2UI(VBO_ATTRIB_GENERIC0 + index, x, y);
736 else
737 ERROR(GL_INVALID_VALUE);
738 }
739
740 static void GLAPIENTRY
741 TAG(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z)
742 {
743 GET_CURRENT_CONTEXT(ctx);
744 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
745 ATTR3UI(0, x, y, z);
746 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
747 ATTR3UI(VBO_ATTRIB_GENERIC0 + index, x, y, z);
748 else
749 ERROR(GL_INVALID_VALUE);
750 }
751
752 static void GLAPIENTRY
753 TAG(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
754 {
755 GET_CURRENT_CONTEXT(ctx);
756 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
757 ATTR4UI(0, x, y, z, w);
758 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
759 ATTR4UI(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
760 else
761 ERROR(GL_INVALID_VALUE);
762 }
763
764 static void GLAPIENTRY
765 TAG(VertexAttribI2uiv)(GLuint index, const GLuint *v)
766 {
767 GET_CURRENT_CONTEXT(ctx);
768 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
769 ATTR2UIV(0, v);
770 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
771 ATTR2UIV(VBO_ATTRIB_GENERIC0 + index, v);
772 else
773 ERROR(GL_INVALID_VALUE);
774 }
775
776 static void GLAPIENTRY
777 TAG(VertexAttribI3uiv)(GLuint index, const GLuint *v)
778 {
779 GET_CURRENT_CONTEXT(ctx);
780 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
781 ATTR3UIV(0, v);
782 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
783 ATTR3UIV(VBO_ATTRIB_GENERIC0 + index, v);
784 else
785 ERROR(GL_INVALID_VALUE);
786 }
787
788 static void GLAPIENTRY
789 TAG(VertexAttribI4uiv)(GLuint index, const GLuint *v)
790 {
791 GET_CURRENT_CONTEXT(ctx);
792 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
793 ATTR4UIV(0, v);
794 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
795 ATTR4UIV(VBO_ATTRIB_GENERIC0 + index, v);
796 else
797 ERROR(GL_INVALID_VALUE);
798 }
799
800
801
802 /* In addition to supporting NV_vertex_program, these entrypoints are
803 * used by the display list and other code specifically because of
804 * their property of aliasing with other attributes. (See
805 * vbo_save_loopback.c)
806 */
807 static void GLAPIENTRY
808 TAG(VertexAttrib1fNV)(GLuint index, GLfloat x)
809 {
810 GET_CURRENT_CONTEXT(ctx);
811 if (index < VBO_ATTRIB_MAX)
812 ATTR1F(index, x);
813 }
814
815 static void GLAPIENTRY
816 TAG(VertexAttrib1fvNV)(GLuint index, const GLfloat * v)
817 {
818 GET_CURRENT_CONTEXT(ctx);
819 if (index < VBO_ATTRIB_MAX)
820 ATTR1FV(index, v);
821 }
822
823 static void GLAPIENTRY
824 TAG(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y)
825 {
826 GET_CURRENT_CONTEXT(ctx);
827 if (index < VBO_ATTRIB_MAX)
828 ATTR2F(index, x, y);
829 }
830
831 static void GLAPIENTRY
832 TAG(VertexAttrib2fvNV)(GLuint index, const GLfloat * v)
833 {
834 GET_CURRENT_CONTEXT(ctx);
835 if (index < VBO_ATTRIB_MAX)
836 ATTR2FV(index, v);
837 }
838
839 static void GLAPIENTRY
840 TAG(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
841 {
842 GET_CURRENT_CONTEXT(ctx);
843 if (index < VBO_ATTRIB_MAX)
844 ATTR3F(index, x, y, z);
845 }
846
847 static void GLAPIENTRY
848 TAG(VertexAttrib3fvNV)(GLuint index,
849 const GLfloat * v)
850 {
851 GET_CURRENT_CONTEXT(ctx);
852 if (index < VBO_ATTRIB_MAX)
853 ATTR3FV(index, v);
854 }
855
856 static void GLAPIENTRY
857 TAG(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
858 {
859 GET_CURRENT_CONTEXT(ctx);
860 if (index < VBO_ATTRIB_MAX)
861 ATTR4F(index, x, y, z, w);
862 }
863
864 static void GLAPIENTRY
865 TAG(VertexAttrib4fvNV)(GLuint index, const GLfloat * v)
866 {
867 GET_CURRENT_CONTEXT(ctx);
868 if (index < VBO_ATTRIB_MAX)
869 ATTR4FV(index, v);
870 }
871
872
873 #define ERROR_IF_NOT_PACKED_TYPE(ctx, type, func) \
874 if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV) { \
875 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \
876 return; \
877 }
878
879 /* Extended version of ERROR_IF_NOT_PACKED_TYPE which also
880 * accepts GL_UNSIGNED_INT_10F_11F_11F_REV.
881 *
882 * Only used for VertexAttribP[123]ui[v]; VertexAttribP4* cannot use this type,
883 * and neither can legacy vertex attribs.
884 */
885 #define ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, func) \
886 if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV && \
887 type != GL_UNSIGNED_INT_10F_11F_11F_REV) { \
888 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \
889 return; \
890 }
891
892 static void GLAPIENTRY
893 TAG(VertexP2ui)(GLenum type, GLuint value)
894 {
895 GET_CURRENT_CONTEXT(ctx);
896 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP2ui");
897 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_POS, value);
898 }
899
900 static void GLAPIENTRY
901 TAG(VertexP2uiv)(GLenum type, const GLuint *value)
902 {
903 GET_CURRENT_CONTEXT(ctx);
904 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP2uiv");
905 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_POS, value[0]);
906 }
907
908 static void GLAPIENTRY
909 TAG(VertexP3ui)(GLenum type, GLuint value)
910 {
911 GET_CURRENT_CONTEXT(ctx);
912 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP3ui");
913 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_POS, value);
914 }
915
916 static void GLAPIENTRY
917 TAG(VertexP3uiv)(GLenum type, const GLuint *value)
918 {
919 GET_CURRENT_CONTEXT(ctx);
920 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP3uiv");
921 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_POS, value[0]);
922 }
923
924 static void GLAPIENTRY
925 TAG(VertexP4ui)(GLenum type, GLuint value)
926 {
927 GET_CURRENT_CONTEXT(ctx);
928 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP4ui");
929 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_POS, value);
930 }
931
932 static void GLAPIENTRY
933 TAG(VertexP4uiv)(GLenum type, const GLuint *value)
934 {
935 GET_CURRENT_CONTEXT(ctx);
936 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP4uiv");
937 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_POS, value[0]);
938 }
939
940 static void GLAPIENTRY
941 TAG(TexCoordP1ui)(GLenum type, GLuint coords)
942 {
943 GET_CURRENT_CONTEXT(ctx);
944 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP1ui");
945 ATTR_UI(ctx, 1, type, 0, VBO_ATTRIB_TEX0, coords);
946 }
947
948 static void GLAPIENTRY
949 TAG(TexCoordP1uiv)(GLenum type, const GLuint *coords)
950 {
951 GET_CURRENT_CONTEXT(ctx);
952 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP1uiv");
953 ATTR_UI(ctx, 1, type, 0, VBO_ATTRIB_TEX0, coords[0]);
954 }
955
956 static void GLAPIENTRY
957 TAG(TexCoordP2ui)(GLenum type, GLuint coords)
958 {
959 GET_CURRENT_CONTEXT(ctx);
960 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP2ui");
961 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_TEX0, coords);
962 }
963
964 static void GLAPIENTRY
965 TAG(TexCoordP2uiv)(GLenum type, const GLuint *coords)
966 {
967 GET_CURRENT_CONTEXT(ctx);
968 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP2uiv");
969 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_TEX0, coords[0]);
970 }
971
972 static void GLAPIENTRY
973 TAG(TexCoordP3ui)(GLenum type, GLuint coords)
974 {
975 GET_CURRENT_CONTEXT(ctx);
976 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP3ui");
977 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_TEX0, coords);
978 }
979
980 static void GLAPIENTRY
981 TAG(TexCoordP3uiv)(GLenum type, const GLuint *coords)
982 {
983 GET_CURRENT_CONTEXT(ctx);
984 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP3uiv");
985 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_TEX0, coords[0]);
986 }
987
988 static void GLAPIENTRY
989 TAG(TexCoordP4ui)(GLenum type, GLuint coords)
990 {
991 GET_CURRENT_CONTEXT(ctx);
992 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP4ui");
993 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_TEX0, coords);
994 }
995
996 static void GLAPIENTRY
997 TAG(TexCoordP4uiv)(GLenum type, const GLuint *coords)
998 {
999 GET_CURRENT_CONTEXT(ctx);
1000 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP4uiv");
1001 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_TEX0, coords[0]);
1002 }
1003
1004 static void GLAPIENTRY
1005 TAG(MultiTexCoordP1ui)(GLenum target, GLenum type, GLuint coords)
1006 {
1007 GET_CURRENT_CONTEXT(ctx);
1008 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1009 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP1ui");
1010 ATTR_UI(ctx, 1, type, 0, attr, coords);
1011 }
1012
1013 static void GLAPIENTRY
1014 TAG(MultiTexCoordP1uiv)(GLenum target, GLenum type, const GLuint *coords)
1015 {
1016 GET_CURRENT_CONTEXT(ctx);
1017 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1018 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP1uiv");
1019 ATTR_UI(ctx, 1, type, 0, attr, coords[0]);
1020 }
1021
1022 static void GLAPIENTRY
1023 TAG(MultiTexCoordP2ui)(GLenum target, GLenum type, GLuint coords)
1024 {
1025 GET_CURRENT_CONTEXT(ctx);
1026 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1027 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP2ui");
1028 ATTR_UI(ctx, 2, type, 0, attr, coords);
1029 }
1030
1031 static void GLAPIENTRY
1032 TAG(MultiTexCoordP2uiv)(GLenum target, GLenum type, const GLuint *coords)
1033 {
1034 GET_CURRENT_CONTEXT(ctx);
1035 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1036 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP2uiv");
1037 ATTR_UI(ctx, 2, type, 0, attr, coords[0]);
1038 }
1039
1040 static void GLAPIENTRY
1041 TAG(MultiTexCoordP3ui)(GLenum target, GLenum type, GLuint coords)
1042 {
1043 GET_CURRENT_CONTEXT(ctx);
1044 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1045 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP3ui");
1046 ATTR_UI(ctx, 3, type, 0, attr, coords);
1047 }
1048
1049 static void GLAPIENTRY
1050 TAG(MultiTexCoordP3uiv)(GLenum target, GLenum type, const GLuint *coords)
1051 {
1052 GET_CURRENT_CONTEXT(ctx);
1053 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1054 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP3uiv");
1055 ATTR_UI(ctx, 3, type, 0, attr, coords[0]);
1056 }
1057
1058 static void GLAPIENTRY
1059 TAG(MultiTexCoordP4ui)(GLenum target, GLenum type, GLuint coords)
1060 {
1061 GET_CURRENT_CONTEXT(ctx);
1062 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1063 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP4ui");
1064 ATTR_UI(ctx, 4, type, 0, attr, coords);
1065 }
1066
1067 static void GLAPIENTRY
1068 TAG(MultiTexCoordP4uiv)(GLenum target, GLenum type, const GLuint *coords)
1069 {
1070 GET_CURRENT_CONTEXT(ctx);
1071 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
1072 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP4uiv");
1073 ATTR_UI(ctx, 4, type, 0, attr, coords[0]);
1074 }
1075
1076 static void GLAPIENTRY
1077 TAG(NormalP3ui)(GLenum type, GLuint coords)
1078 {
1079 GET_CURRENT_CONTEXT(ctx);
1080 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glNormalP3ui");
1081 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_NORMAL, coords);
1082 }
1083
1084 static void GLAPIENTRY
1085 TAG(NormalP3uiv)(GLenum type, const GLuint *coords)
1086 {
1087 GET_CURRENT_CONTEXT(ctx);
1088 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glNormalP3uiv");
1089 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_NORMAL, coords[0]);
1090 }
1091
1092 static void GLAPIENTRY
1093 TAG(ColorP3ui)(GLenum type, GLuint color)
1094 {
1095 GET_CURRENT_CONTEXT(ctx);
1096 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP3ui");
1097 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR0, color);
1098 }
1099
1100 static void GLAPIENTRY
1101 TAG(ColorP3uiv)(GLenum type, const GLuint *color)
1102 {
1103 GET_CURRENT_CONTEXT(ctx);
1104 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP3uiv");
1105 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR0, color[0]);
1106 }
1107
1108 static void GLAPIENTRY
1109 TAG(ColorP4ui)(GLenum type, GLuint color)
1110 {
1111 GET_CURRENT_CONTEXT(ctx);
1112 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP4ui");
1113 ATTR_UI(ctx, 4, type, 1, VBO_ATTRIB_COLOR0, color);
1114 }
1115
1116 static void GLAPIENTRY
1117 TAG(ColorP4uiv)(GLenum type, const GLuint *color)
1118 {
1119 GET_CURRENT_CONTEXT(ctx);
1120 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP4uiv");
1121 ATTR_UI(ctx, 4, type, 1, VBO_ATTRIB_COLOR0, color[0]);
1122 }
1123
1124 static void GLAPIENTRY
1125 TAG(SecondaryColorP3ui)(GLenum type, GLuint color)
1126 {
1127 GET_CURRENT_CONTEXT(ctx);
1128 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glSecondaryColorP3ui");
1129 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR1, color);
1130 }
1131
1132 static void GLAPIENTRY
1133 TAG(SecondaryColorP3uiv)(GLenum type, const GLuint *color)
1134 {
1135 GET_CURRENT_CONTEXT(ctx);
1136 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glSecondaryColorP3uiv");
1137 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR1, color[0]);
1138 }
1139
1140 static void GLAPIENTRY
1141 TAG(VertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized,
1142 GLuint value)
1143 {
1144 GET_CURRENT_CONTEXT(ctx);
1145 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1ui");
1146 ATTR_UI_INDEX(ctx, 1, type, normalized, index, value);
1147 }
1148
1149 static void GLAPIENTRY
1150 TAG(VertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized,
1151 GLuint value)
1152 {
1153 GET_CURRENT_CONTEXT(ctx);
1154 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2ui");
1155 ATTR_UI_INDEX(ctx, 2, type, normalized, index, value);
1156 }
1157
1158 static void GLAPIENTRY
1159 TAG(VertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized,
1160 GLuint value)
1161 {
1162 GET_CURRENT_CONTEXT(ctx);
1163 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3ui");
1164 ATTR_UI_INDEX(ctx, 3, type, normalized, index, value);
1165 }
1166
1167 static void GLAPIENTRY
1168 TAG(VertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized,
1169 GLuint value)
1170 {
1171 GET_CURRENT_CONTEXT(ctx);
1172 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP4ui");
1173 ATTR_UI_INDEX(ctx, 4, type, normalized, index, value);
1174 }
1175
1176 static void GLAPIENTRY
1177 TAG(VertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized,
1178 const GLuint *value)
1179 {
1180 GET_CURRENT_CONTEXT(ctx);
1181 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1uiv");
1182 ATTR_UI_INDEX(ctx, 1, type, normalized, index, *value);
1183 }
1184
1185 static void GLAPIENTRY
1186 TAG(VertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized,
1187 const GLuint *value)
1188 {
1189 GET_CURRENT_CONTEXT(ctx);
1190 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2uiv");
1191 ATTR_UI_INDEX(ctx, 2, type, normalized, index, *value);
1192 }
1193
1194 static void GLAPIENTRY
1195 TAG(VertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized,
1196 const GLuint *value)
1197 {
1198 GET_CURRENT_CONTEXT(ctx);
1199 ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3uiv");
1200 ATTR_UI_INDEX(ctx, 3, type, normalized, index, *value);
1201 }
1202
1203 static void GLAPIENTRY
1204 TAG(VertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized,
1205 const GLuint *value)
1206 {
1207 GET_CURRENT_CONTEXT(ctx);
1208 ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP4uiv");
1209 ATTR_UI_INDEX(ctx, 4, type, normalized, index, *value);
1210 }
1211
1212
1213
1214 static void GLAPIENTRY
1215 TAG(VertexAttribL1d)(GLuint index, GLdouble x)
1216 {
1217 GET_CURRENT_CONTEXT(ctx);
1218 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1219 ATTR1D(0, x);
1220 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1221 ATTR1D(VBO_ATTRIB_GENERIC0 + index, x);
1222 else
1223 ERROR(GL_INVALID_VALUE);
1224 }
1225
1226 static void GLAPIENTRY
1227 TAG(VertexAttribL1dv)(GLuint index, const GLdouble * v)
1228 {
1229 GET_CURRENT_CONTEXT(ctx);
1230 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1231 ATTR1DV(0, v);
1232 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1233 ATTR1DV(VBO_ATTRIB_GENERIC0 + index, v);
1234 else
1235 ERROR(GL_INVALID_VALUE);
1236 }
1237
1238 static void GLAPIENTRY
1239 TAG(VertexAttribL2d)(GLuint index, GLdouble x, GLdouble y)
1240 {
1241 GET_CURRENT_CONTEXT(ctx);
1242 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1243 ATTR2D(0, x, y);
1244 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1245 ATTR2D(VBO_ATTRIB_GENERIC0 + index, x, y);
1246 else
1247 ERROR(GL_INVALID_VALUE);
1248 }
1249
1250 static void GLAPIENTRY
1251 TAG(VertexAttribL2dv)(GLuint index, const GLdouble * v)
1252 {
1253 GET_CURRENT_CONTEXT(ctx);
1254 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1255 ATTR2DV(0, v);
1256 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1257 ATTR2DV(VBO_ATTRIB_GENERIC0 + index, v);
1258 else
1259 ERROR(GL_INVALID_VALUE);
1260 }
1261
1262 static void GLAPIENTRY
1263 TAG(VertexAttribL3d)(GLuint index, GLdouble x, GLdouble y, GLdouble z)
1264 {
1265 GET_CURRENT_CONTEXT(ctx);
1266 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1267 ATTR3D(0, x, y, z);
1268 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1269 ATTR3D(VBO_ATTRIB_GENERIC0 + index, x, y, z);
1270 else
1271 ERROR(GL_INVALID_VALUE);
1272 }
1273
1274 static void GLAPIENTRY
1275 TAG(VertexAttribL3dv)(GLuint index, const GLdouble * v)
1276 {
1277 GET_CURRENT_CONTEXT(ctx);
1278 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1279 ATTR3DV(0, v);
1280 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1281 ATTR3DV(VBO_ATTRIB_GENERIC0 + index, v);
1282 else
1283 ERROR(GL_INVALID_VALUE);
1284 }
1285
1286 static void GLAPIENTRY
1287 TAG(VertexAttribL4d)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
1288 {
1289 GET_CURRENT_CONTEXT(ctx);
1290 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1291 ATTR4D(0, x, y, z, w);
1292 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1293 ATTR4D(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
1294 else
1295 ERROR(GL_INVALID_VALUE);
1296 }
1297
1298 static void GLAPIENTRY
1299 TAG(VertexAttribL4dv)(GLuint index, const GLdouble * v)
1300 {
1301 GET_CURRENT_CONTEXT(ctx);
1302 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1303 ATTR4DV(0, v);
1304 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1305 ATTR4DV(VBO_ATTRIB_GENERIC0 + index, v);
1306 else
1307 ERROR(GL_INVALID_VALUE);
1308 }
1309
1310 static void GLAPIENTRY
1311 TAG(VertexAttribL1ui64ARB)(GLuint index, GLuint64EXT x)
1312 {
1313 GET_CURRENT_CONTEXT(ctx);
1314 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1315 ATTR1UI64(0, x);
1316 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1317 ATTR1UI64(VBO_ATTRIB_GENERIC0 + index, x);
1318 else
1319 ERROR(GL_INVALID_VALUE);
1320 }
1321
1322 static void GLAPIENTRY
1323 TAG(VertexAttribL1ui64vARB)(GLuint index, const GLuint64EXT *v)
1324 {
1325 GET_CURRENT_CONTEXT(ctx);
1326 if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
1327 ATTR1UIV64(0, v);
1328 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
1329 ATTR1UIV64(VBO_ATTRIB_GENERIC0 + index, v);
1330 else
1331 ERROR(GL_INVALID_VALUE);
1332 }
1333
1334 #undef ATTR1FV
1335 #undef ATTR2FV
1336 #undef ATTR3FV
1337 #undef ATTR4FV
1338
1339 #undef ATTR1F
1340 #undef ATTR2F
1341 #undef ATTR3F
1342 #undef ATTR4F
1343
1344 #undef ATTR_UI
1345
1346 #undef MAT