mesa/vbo: Support the ES 3.0 signed normalized scaling rules.
[mesa.git] / src / mesa / vbo / vbo_attrib_tmp.h
1 /**************************************************************************
2
3 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
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 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.
25
26 **************************************************************************/
27
28 /* float */
29 #define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
30 #define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
31 #define ATTR3FV( A, V ) ATTR( A, 3, GL_FLOAT, (V)[0], (V)[1], (V)[2], 1 )
32 #define ATTR4FV( A, V ) ATTR( A, 4, GL_FLOAT, (V)[0], (V)[1], (V)[2], (V)[3] )
33
34 #define ATTR1F( A, X ) ATTR( A, 1, GL_FLOAT, X, 0, 0, 1 )
35 #define ATTR2F( A, X, Y ) ATTR( A, 2, GL_FLOAT, X, Y, 0, 1 )
36 #define ATTR3F( A, X, Y, Z ) ATTR( A, 3, GL_FLOAT, X, Y, Z, 1 )
37 #define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, GL_FLOAT, X, Y, Z, W )
38
39 /* int */
40 #define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
41 INT_AS_FLT(X), INT_AS_FLT(Y), \
42 INT_AS_FLT(Z), INT_AS_FLT(W) )
43
44 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
45 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
46 #define ATTR4IV( A, V ) ATTRI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
47
48 #define ATTR1I( A, X ) ATTRI( A, 1, X, 0, 0, 1 )
49 #define ATTR2I( A, X, Y ) ATTRI( A, 2, X, Y, 0, 1 )
50 #define ATTR3I( A, X, Y, Z ) ATTRI( A, 3, X, Y, Z, 1 )
51 #define ATTR4I( A, X, Y, Z, W ) ATTRI( A, 4, X, Y, Z, W )
52
53
54 /* uint */
55 #define ATTRUI( A, N, X, Y, Z, W) ATTR( A, N, GL_UNSIGNED_INT, \
56 UINT_AS_FLT(X), UINT_AS_FLT(Y), \
57 UINT_AS_FLT(Z), UINT_AS_FLT(W) )
58
59 #define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0], (V)[1], 0, 1 )
60 #define ATTR3UIV( A, V ) ATTRUI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
61 #define ATTR4UIV( A, V ) ATTRUI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
62
63 #define ATTR1UI( A, X ) ATTRUI( A, 1, X, 0, 0, 1 )
64 #define ATTR2UI( A, X, Y ) ATTRUI( A, 2, X, Y, 0, 1 )
65 #define ATTR3UI( A, X, Y, Z ) ATTRUI( A, 3, X, Y, Z, 1 )
66 #define ATTR4UI( A, X, Y, Z, W ) ATTRUI( A, 4, X, Y, Z, W )
67
68 #define MAT_ATTR( A, N, V ) ATTR( A, N, GL_FLOAT, (V)[0], (V)[1], (V)[2], (V)[3] )
69
70 static inline float conv_ui10_to_norm_float(unsigned ui10)
71 {
72 return ui10 / 1023.0f;
73 }
74
75 static inline float conv_ui2_to_norm_float(unsigned ui2)
76 {
77 return ui2 / 3.0f;
78 }
79
80 #define ATTRUI10_1( A, UI ) ATTR( A, 1, GL_FLOAT, (UI) & 0x3ff, 0, 0, 1 )
81 #define ATTRUI10_2( A, UI ) ATTR( A, 2, GL_FLOAT, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, 0, 1 )
82 #define ATTRUI10_3( A, UI ) ATTR( A, 3, GL_FLOAT, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, 1 )
83 #define ATTRUI10_4( A, UI ) ATTR( A, 4, GL_FLOAT, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, ((UI) >> 30) & 0x3 )
84
85 #define ATTRUI10N_1( A, UI ) ATTR( A, 1, GL_FLOAT, conv_ui10_to_norm_float((UI) & 0x3ff), 0, 0, 1 )
86 #define ATTRUI10N_2( A, UI ) ATTR( A, 2, GL_FLOAT, \
87 conv_ui10_to_norm_float((UI) & 0x3ff), \
88 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), 0, 1 )
89 #define ATTRUI10N_3( A, UI ) ATTR( A, 3, GL_FLOAT, \
90 conv_ui10_to_norm_float((UI) & 0x3ff), \
91 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
92 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), 1 )
93 #define ATTRUI10N_4( A, UI ) ATTR( A, 4, GL_FLOAT, \
94 conv_ui10_to_norm_float((UI) & 0x3ff), \
95 conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
96 conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), \
97 conv_ui2_to_norm_float(((UI) >> 30) & 0x3) )
98
99 struct attr_bits_10 {signed int x:10;};
100 struct attr_bits_2 {signed int x:2;};
101
102 static inline float conv_i10_to_i(int i10)
103 {
104 struct attr_bits_10 val;
105 val.x = i10;
106 return (float)val.x;
107 }
108
109 static inline float conv_i2_to_i(int i2)
110 {
111 struct attr_bits_2 val;
112 val.x = i2;
113 return (float)val.x;
114 }
115
116 static inline float conv_i10_to_norm_float(const struct gl_context *ctx, int i10)
117 {
118 struct attr_bits_10 val;
119 val.x = i10;
120
121 /* Traditionally, OpenGL has had two equations for converting from
122 * normalized fixed-point data to floating-point data. In the OpenGL 3.2
123 * specification, these are equations 2.2 and 2.3, respectively:
124 *
125 * f = (2c + 1)/(2^b - 1). (2.2)
126 *
127 * Comments below this equation state: "In general, this representation is
128 * used for signed normalized fixed-point parameters in GL commands, such
129 * as vertex attribute values." Which is what we're doing here.
130 *
131 * f = max{c/(2^(b-1) - 1), -1.0} (2.3)
132 *
133 * Comments below this equation state: "In general, this representation is
134 * used for signed normalized fixed-point texture or floating point values."
135 *
136 * OpenGL 4.2+ and ES 3.0 remedy this and state that equation 2.3 (above)
137 * is used in every case. They remove equation 2.2 completely.
138 */
139 if (_mesa_is_gles3(ctx) ||
140 (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
141 /* Equation 2.3 above. */
142 float f = ((float) val.x) / 511.0F;
143 return MAX2(f, -1.0);
144 } else {
145 /* Equation 2.2 above. */
146 return (2.0F * (float)val.x + 1.0F) * (1.0F / 1023.0F);
147 }
148 }
149
150 static inline float conv_i2_to_norm_float(const struct gl_context *ctx, int i2)
151 {
152 struct attr_bits_2 val;
153 val.x = i2;
154
155 if (_mesa_is_gles3(ctx) ||
156 (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
157 /* Equation 2.3 above. */
158 float f = (float) val.x;
159 return MAX2(f, -1.0);
160 } else {
161 /* Equation 2.2 above. */
162 return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
163 }
164 }
165
166 #define ATTRI10_1( A, I10 ) ATTR( A, 1, GL_FLOAT, conv_i10_to_i((I10) & 0x3ff), 0, 0, 1 )
167 #define ATTRI10_2( A, I10 ) ATTR( A, 2, GL_FLOAT, \
168 conv_i10_to_i((I10) & 0x3ff), \
169 conv_i10_to_i(((I10) >> 10) & 0x3ff), 0, 1 )
170 #define ATTRI10_3( A, I10 ) ATTR( A, 3, GL_FLOAT, \
171 conv_i10_to_i((I10) & 0x3ff), \
172 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
173 conv_i10_to_i(((I10) >> 20) & 0x3ff), 1 )
174 #define ATTRI10_4( A, I10 ) ATTR( A, 4, GL_FLOAT, \
175 conv_i10_to_i((I10) & 0x3ff), \
176 conv_i10_to_i(((I10) >> 10) & 0x3ff), \
177 conv_i10_to_i(((I10) >> 20) & 0x3ff), \
178 conv_i2_to_i(((I10) >> 30) & 0x3))
179
180
181 #define ATTRI10N_1(ctx, A, I10) ATTR(A, 1, GL_FLOAT, conv_i10_to_norm_float(ctx, (I10) & 0x3ff), 0, 0, 1 )
182 #define ATTRI10N_2(ctx, A, I10) ATTR(A, 2, GL_FLOAT, \
183 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
184 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), 0, 1 )
185 #define ATTRI10N_3(ctx, A, I10) ATTR(A, 3, GL_FLOAT, \
186 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
187 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \
188 conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), 1 )
189 #define ATTRI10N_4(ctx, A, I10) ATTR(A, 4, GL_FLOAT, \
190 conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \
191 conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \
192 conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), \
193 conv_i2_to_norm_float(ctx, ((I10) >> 30) & 0x3))
194
195 #define ATTR_UI(ctx, val, type, normalized, attr, arg) do { \
196 if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
197 if (normalized) { \
198 ATTRUI10N_##val((attr), (arg)); \
199 } else { \
200 ATTRUI10_##val((attr), (arg)); \
201 } \
202 } else if ((type) == GL_INT_2_10_10_10_REV) { \
203 if (normalized) { \
204 ATTRI10N_##val(ctx, (attr), (arg)); \
205 } else { \
206 ATTRI10_##val((attr), (arg)); \
207 } \
208 } else \
209 ERROR(GL_INVALID_VALUE); \
210 } while(0)
211
212 #define ATTR_UI_INDEX(ctx, val, type, normalized, index, arg) do { \
213 if ((index) == 0) { \
214 ATTR_UI(ctx, val, (type), normalized, 0, (arg)); \
215 } else if ((index) < MAX_VERTEX_GENERIC_ATTRIBS) { \
216 ATTR_UI(ctx, val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), (arg)); \
217 } else \
218 ERROR(GL_INVALID_VALUE); \
219 } while(0)
220
221 static void GLAPIENTRY
222 TAG(Vertex2f)(GLfloat x, GLfloat y)
223 {
224 GET_CURRENT_CONTEXT(ctx);
225 ATTR2F(VBO_ATTRIB_POS, x, y);
226 }
227
228 static void GLAPIENTRY
229 TAG(Vertex2fv)(const GLfloat * v)
230 {
231 GET_CURRENT_CONTEXT(ctx);
232 ATTR2FV(VBO_ATTRIB_POS, v);
233 }
234
235 static void GLAPIENTRY
236 TAG(Vertex3f)(GLfloat x, GLfloat y, GLfloat z)
237 {
238 GET_CURRENT_CONTEXT(ctx);
239 ATTR3F(VBO_ATTRIB_POS, x, y, z);
240 }
241
242 static void GLAPIENTRY
243 TAG(Vertex3fv)(const GLfloat * v)
244 {
245 GET_CURRENT_CONTEXT(ctx);
246 ATTR3FV(VBO_ATTRIB_POS, v);
247 }
248
249 static void GLAPIENTRY
250 TAG(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
251 {
252 GET_CURRENT_CONTEXT(ctx);
253 ATTR4F(VBO_ATTRIB_POS, x, y, z, w);
254 }
255
256 static void GLAPIENTRY
257 TAG(Vertex4fv)(const GLfloat * v)
258 {
259 GET_CURRENT_CONTEXT(ctx);
260 ATTR4FV(VBO_ATTRIB_POS, v);
261 }
262
263
264
265 static void GLAPIENTRY
266 TAG(TexCoord1f)(GLfloat x)
267 {
268 GET_CURRENT_CONTEXT(ctx);
269 ATTR1F(VBO_ATTRIB_TEX0, x);
270 }
271
272 static void GLAPIENTRY
273 TAG(TexCoord1fv)(const GLfloat * v)
274 {
275 GET_CURRENT_CONTEXT(ctx);
276 ATTR1FV(VBO_ATTRIB_TEX0, v);
277 }
278
279 static void GLAPIENTRY
280 TAG(TexCoord2f)(GLfloat x, GLfloat y)
281 {
282 GET_CURRENT_CONTEXT(ctx);
283 ATTR2F(VBO_ATTRIB_TEX0, x, y);
284 }
285
286 static void GLAPIENTRY
287 TAG(TexCoord2fv)(const GLfloat * v)
288 {
289 GET_CURRENT_CONTEXT(ctx);
290 ATTR2FV(VBO_ATTRIB_TEX0, v);
291 }
292
293 static void GLAPIENTRY
294 TAG(TexCoord3f)(GLfloat x, GLfloat y, GLfloat z)
295 {
296 GET_CURRENT_CONTEXT(ctx);
297 ATTR3F(VBO_ATTRIB_TEX0, x, y, z);
298 }
299
300 static void GLAPIENTRY
301 TAG(TexCoord3fv)(const GLfloat * v)
302 {
303 GET_CURRENT_CONTEXT(ctx);
304 ATTR3FV(VBO_ATTRIB_TEX0, v);
305 }
306
307 static void GLAPIENTRY
308 TAG(TexCoord4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
309 {
310 GET_CURRENT_CONTEXT(ctx);
311 ATTR4F(VBO_ATTRIB_TEX0, x, y, z, w);
312 }
313
314 static void GLAPIENTRY
315 TAG(TexCoord4fv)(const GLfloat * v)
316 {
317 GET_CURRENT_CONTEXT(ctx);
318 ATTR4FV(VBO_ATTRIB_TEX0, v);
319 }
320
321
322
323 static void GLAPIENTRY
324 TAG(Normal3f)(GLfloat x, GLfloat y, GLfloat z)
325 {
326 GET_CURRENT_CONTEXT(ctx);
327 ATTR3F(VBO_ATTRIB_NORMAL, x, y, z);
328 }
329
330 static void GLAPIENTRY
331 TAG(Normal3fv)(const GLfloat * v)
332 {
333 GET_CURRENT_CONTEXT(ctx);
334 ATTR3FV(VBO_ATTRIB_NORMAL, v);
335 }
336
337
338
339 static void GLAPIENTRY
340 TAG(FogCoordfEXT)(GLfloat x)
341 {
342 GET_CURRENT_CONTEXT(ctx);
343 ATTR1F(VBO_ATTRIB_FOG, x);
344 }
345
346
347
348 static void GLAPIENTRY
349 TAG(FogCoordfvEXT)(const GLfloat * v)
350 {
351 GET_CURRENT_CONTEXT(ctx);
352 ATTR1FV(VBO_ATTRIB_FOG, v);
353 }
354
355 static void GLAPIENTRY
356 TAG(Color3f)(GLfloat x, GLfloat y, GLfloat z)
357 {
358 GET_CURRENT_CONTEXT(ctx);
359 ATTR3F(VBO_ATTRIB_COLOR0, x, y, z);
360 }
361
362 static void GLAPIENTRY
363 TAG(Color3fv)(const GLfloat * v)
364 {
365 GET_CURRENT_CONTEXT(ctx);
366 ATTR3FV(VBO_ATTRIB_COLOR0, v);
367 }
368
369 static void GLAPIENTRY
370 TAG(Color4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
371 {
372 GET_CURRENT_CONTEXT(ctx);
373 ATTR4F(VBO_ATTRIB_COLOR0, x, y, z, w);
374 }
375
376 static void GLAPIENTRY
377 TAG(Color4fv)(const GLfloat * v)
378 {
379 GET_CURRENT_CONTEXT(ctx);
380 ATTR4FV(VBO_ATTRIB_COLOR0, v);
381 }
382
383
384
385 static void GLAPIENTRY
386 TAG(SecondaryColor3fEXT)(GLfloat x, GLfloat y, GLfloat z)
387 {
388 GET_CURRENT_CONTEXT(ctx);
389 ATTR3F(VBO_ATTRIB_COLOR1, x, y, z);
390 }
391
392 static void GLAPIENTRY
393 TAG(SecondaryColor3fvEXT)(const GLfloat * v)
394 {
395 GET_CURRENT_CONTEXT(ctx);
396 ATTR3FV(VBO_ATTRIB_COLOR1, v);
397 }
398
399
400
401 static void GLAPIENTRY
402 TAG(EdgeFlag)(GLboolean b)
403 {
404 GET_CURRENT_CONTEXT(ctx);
405 ATTR1F(VBO_ATTRIB_EDGEFLAG, (GLfloat) b);
406 }
407
408
409
410 static void GLAPIENTRY
411 TAG(Indexf)(GLfloat f)
412 {
413 GET_CURRENT_CONTEXT(ctx);
414 ATTR1F(VBO_ATTRIB_INDEX, f);
415 }
416
417 static void GLAPIENTRY
418 TAG(Indexfv)(const GLfloat * f)
419 {
420 GET_CURRENT_CONTEXT(ctx);
421 ATTR1FV(VBO_ATTRIB_INDEX, f);
422 }
423
424
425
426 static void GLAPIENTRY
427 TAG(MultiTexCoord1f)(GLenum target, GLfloat x)
428 {
429 GET_CURRENT_CONTEXT(ctx);
430 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
431 ATTR1F(attr, x);
432 }
433
434 static void GLAPIENTRY
435 TAG(MultiTexCoord1fv)(GLenum target, const GLfloat * v)
436 {
437 GET_CURRENT_CONTEXT(ctx);
438 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
439 ATTR1FV(attr, v);
440 }
441
442 static void GLAPIENTRY
443 TAG(MultiTexCoord2f)(GLenum target, GLfloat x, GLfloat y)
444 {
445 GET_CURRENT_CONTEXT(ctx);
446 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
447 ATTR2F(attr, x, y);
448 }
449
450 static void GLAPIENTRY
451 TAG(MultiTexCoord2fv)(GLenum target, const GLfloat * v)
452 {
453 GET_CURRENT_CONTEXT(ctx);
454 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
455 ATTR2FV(attr, v);
456 }
457
458 static void GLAPIENTRY
459 TAG(MultiTexCoord3f)(GLenum target, GLfloat x, GLfloat y, GLfloat z)
460 {
461 GET_CURRENT_CONTEXT(ctx);
462 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
463 ATTR3F(attr, x, y, z);
464 }
465
466 static void GLAPIENTRY
467 TAG(MultiTexCoord3fv)(GLenum target, const GLfloat * v)
468 {
469 GET_CURRENT_CONTEXT(ctx);
470 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
471 ATTR3FV(attr, v);
472 }
473
474 static void GLAPIENTRY
475 TAG(MultiTexCoord4f)(GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
476 {
477 GET_CURRENT_CONTEXT(ctx);
478 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
479 ATTR4F(attr, x, y, z, w);
480 }
481
482 static void GLAPIENTRY
483 TAG(MultiTexCoord4fv)(GLenum target, const GLfloat * v)
484 {
485 GET_CURRENT_CONTEXT(ctx);
486 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
487 ATTR4FV(attr, v);
488 }
489
490
491
492 static void GLAPIENTRY
493 TAG(VertexAttrib1fARB)(GLuint index, GLfloat x)
494 {
495 GET_CURRENT_CONTEXT(ctx);
496 if (index == 0)
497 ATTR1F(0, x);
498 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
499 ATTR1F(VBO_ATTRIB_GENERIC0 + index, x);
500 else
501 ERROR(GL_INVALID_VALUE);
502 }
503
504 static void GLAPIENTRY
505 TAG(VertexAttrib1fvARB)(GLuint index, const GLfloat * v)
506 {
507 GET_CURRENT_CONTEXT(ctx);
508 if (index == 0)
509 ATTR1FV(0, v);
510 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
511 ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v);
512 else
513 ERROR(GL_INVALID_VALUE);
514 }
515
516 static void GLAPIENTRY
517 TAG(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y)
518 {
519 GET_CURRENT_CONTEXT(ctx);
520 if (index == 0)
521 ATTR2F(0, x, y);
522 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
523 ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y);
524 else
525 ERROR(GL_INVALID_VALUE);
526 }
527
528 static void GLAPIENTRY
529 TAG(VertexAttrib2fvARB)(GLuint index, const GLfloat * v)
530 {
531 GET_CURRENT_CONTEXT(ctx);
532 if (index == 0)
533 ATTR2FV(0, v);
534 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
535 ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v);
536 else
537 ERROR(GL_INVALID_VALUE);
538 }
539
540 static void GLAPIENTRY
541 TAG(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
542 {
543 GET_CURRENT_CONTEXT(ctx);
544 if (index == 0)
545 ATTR3F(0, x, y, z);
546 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
547 ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z);
548 else
549 ERROR(GL_INVALID_VALUE);
550 }
551
552 static void GLAPIENTRY
553 TAG(VertexAttrib3fvARB)(GLuint index, const GLfloat * v)
554 {
555 GET_CURRENT_CONTEXT(ctx);
556 if (index == 0)
557 ATTR3FV(0, v);
558 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
559 ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v);
560 else
561 ERROR(GL_INVALID_VALUE);
562 }
563
564 static void GLAPIENTRY
565 TAG(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
566 {
567 GET_CURRENT_CONTEXT(ctx);
568 if (index == 0)
569 ATTR4F(0, x, y, z, w);
570 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
571 ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
572 else
573 ERROR(GL_INVALID_VALUE);
574 }
575
576 static void GLAPIENTRY
577 TAG(VertexAttrib4fvARB)(GLuint index, const GLfloat * v)
578 {
579 GET_CURRENT_CONTEXT(ctx);
580 if (index == 0)
581 ATTR4FV(0, v);
582 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
583 ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v);
584 else
585 ERROR(GL_INVALID_VALUE);
586 }
587
588
589
590 /* Integer-valued generic attributes.
591 * XXX: the integers just get converted to floats at this time
592 */
593 static void GLAPIENTRY
594 TAG(VertexAttribI1i)(GLuint index, GLint x)
595 {
596 GET_CURRENT_CONTEXT(ctx);
597 if (index == 0)
598 ATTR1I(0, x);
599 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
600 ATTR1I(VBO_ATTRIB_GENERIC0 + index, x);
601 else
602 ERROR(GL_INVALID_VALUE);
603 }
604
605 static void GLAPIENTRY
606 TAG(VertexAttribI2i)(GLuint index, GLint x, GLint y)
607 {
608 GET_CURRENT_CONTEXT(ctx);
609 if (index == 0)
610 ATTR2I(0, x, y);
611 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
612 ATTR2I(VBO_ATTRIB_GENERIC0 + index, x, y);
613 else
614 ERROR(GL_INVALID_VALUE);
615 }
616
617 static void GLAPIENTRY
618 TAG(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z)
619 {
620 GET_CURRENT_CONTEXT(ctx);
621 if (index == 0)
622 ATTR3I(0, x, y, z);
623 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
624 ATTR3I(VBO_ATTRIB_GENERIC0 + index, x, y, z);
625 else
626 ERROR(GL_INVALID_VALUE);
627 }
628
629 static void GLAPIENTRY
630 TAG(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w)
631 {
632 GET_CURRENT_CONTEXT(ctx);
633 if (index == 0)
634 ATTR4I(0, x, y, z, w);
635 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
636 ATTR4I(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
637 else
638 ERROR(GL_INVALID_VALUE);
639 }
640
641 static void GLAPIENTRY
642 TAG(VertexAttribI2iv)(GLuint index, const GLint *v)
643 {
644 GET_CURRENT_CONTEXT(ctx);
645 if (index == 0)
646 ATTR2IV(0, v);
647 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
648 ATTR2IV(VBO_ATTRIB_GENERIC0 + index, v);
649 else
650 ERROR(GL_INVALID_VALUE);
651 }
652
653 static void GLAPIENTRY
654 TAG(VertexAttribI3iv)(GLuint index, const GLint *v)
655 {
656 GET_CURRENT_CONTEXT(ctx);
657 if (index == 0)
658 ATTR3IV(0, v);
659 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
660 ATTR3IV(VBO_ATTRIB_GENERIC0 + index, v);
661 else
662 ERROR(GL_INVALID_VALUE);
663 }
664
665 static void GLAPIENTRY
666 TAG(VertexAttribI4iv)(GLuint index, const GLint *v)
667 {
668 GET_CURRENT_CONTEXT(ctx);
669 if (index == 0)
670 ATTR4IV(0, v);
671 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
672 ATTR4IV(VBO_ATTRIB_GENERIC0 + index, v);
673 else
674 ERROR(GL_INVALID_VALUE);
675 }
676
677
678
679 /* Unsigned integer-valued generic attributes.
680 * XXX: the integers just get converted to floats at this time
681 */
682 static void GLAPIENTRY
683 TAG(VertexAttribI1ui)(GLuint index, GLuint x)
684 {
685 GET_CURRENT_CONTEXT(ctx);
686 if (index == 0)
687 ATTR1UI(0, x);
688 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
689 ATTR1UI(VBO_ATTRIB_GENERIC0 + index, x);
690 else
691 ERROR(GL_INVALID_VALUE);
692 }
693
694 static void GLAPIENTRY
695 TAG(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y)
696 {
697 GET_CURRENT_CONTEXT(ctx);
698 if (index == 0)
699 ATTR2UI(0, x, y);
700 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
701 ATTR2UI(VBO_ATTRIB_GENERIC0 + index, x, y);
702 else
703 ERROR(GL_INVALID_VALUE);
704 }
705
706 static void GLAPIENTRY
707 TAG(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z)
708 {
709 GET_CURRENT_CONTEXT(ctx);
710 if (index == 0)
711 ATTR3UI(0, x, y, z);
712 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
713 ATTR3UI(VBO_ATTRIB_GENERIC0 + index, x, y, z);
714 else
715 ERROR(GL_INVALID_VALUE);
716 }
717
718 static void GLAPIENTRY
719 TAG(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
720 {
721 GET_CURRENT_CONTEXT(ctx);
722 if (index == 0)
723 ATTR4UI(0, x, y, z, w);
724 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
725 ATTR4UI(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
726 else
727 ERROR(GL_INVALID_VALUE);
728 }
729
730 static void GLAPIENTRY
731 TAG(VertexAttribI2uiv)(GLuint index, const GLuint *v)
732 {
733 GET_CURRENT_CONTEXT(ctx);
734 if (index == 0)
735 ATTR2UIV(0, v);
736 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
737 ATTR2UIV(VBO_ATTRIB_GENERIC0 + index, v);
738 else
739 ERROR(GL_INVALID_VALUE);
740 }
741
742 static void GLAPIENTRY
743 TAG(VertexAttribI3uiv)(GLuint index, const GLuint *v)
744 {
745 GET_CURRENT_CONTEXT(ctx);
746 if (index == 0)
747 ATTR3UIV(0, v);
748 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
749 ATTR3UIV(VBO_ATTRIB_GENERIC0 + index, v);
750 else
751 ERROR(GL_INVALID_VALUE);
752 }
753
754 static void GLAPIENTRY
755 TAG(VertexAttribI4uiv)(GLuint index, const GLuint *v)
756 {
757 GET_CURRENT_CONTEXT(ctx);
758 if (index == 0)
759 ATTR4UIV(0, v);
760 else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
761 ATTR4UIV(VBO_ATTRIB_GENERIC0 + index, v);
762 else
763 ERROR(GL_INVALID_VALUE);
764 }
765
766
767
768 /* In addition to supporting NV_vertex_program, these entrypoints are
769 * used by the display list and other code specifically because of
770 * their property of aliasing with other attributes. (See
771 * vbo_save_loopback.c)
772 */
773 static void GLAPIENTRY
774 TAG(VertexAttrib1fNV)(GLuint index, GLfloat x)
775 {
776 GET_CURRENT_CONTEXT(ctx);
777 if (index < VBO_ATTRIB_MAX)
778 ATTR1F(index, x);
779 }
780
781 static void GLAPIENTRY
782 TAG(VertexAttrib1fvNV)(GLuint index, const GLfloat * v)
783 {
784 GET_CURRENT_CONTEXT(ctx);
785 if (index < VBO_ATTRIB_MAX)
786 ATTR1FV(index, v);
787 }
788
789 static void GLAPIENTRY
790 TAG(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y)
791 {
792 GET_CURRENT_CONTEXT(ctx);
793 if (index < VBO_ATTRIB_MAX)
794 ATTR2F(index, x, y);
795 }
796
797 static void GLAPIENTRY
798 TAG(VertexAttrib2fvNV)(GLuint index, const GLfloat * v)
799 {
800 GET_CURRENT_CONTEXT(ctx);
801 if (index < VBO_ATTRIB_MAX)
802 ATTR2FV(index, v);
803 }
804
805 static void GLAPIENTRY
806 TAG(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
807 {
808 GET_CURRENT_CONTEXT(ctx);
809 if (index < VBO_ATTRIB_MAX)
810 ATTR3F(index, x, y, z);
811 }
812
813 static void GLAPIENTRY
814 TAG(VertexAttrib3fvNV)(GLuint index,
815 const GLfloat * v)
816 {
817 GET_CURRENT_CONTEXT(ctx);
818 if (index < VBO_ATTRIB_MAX)
819 ATTR3FV(index, v);
820 }
821
822 static void GLAPIENTRY
823 TAG(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
824 {
825 GET_CURRENT_CONTEXT(ctx);
826 if (index < VBO_ATTRIB_MAX)
827 ATTR4F(index, x, y, z, w);
828 }
829
830 static void GLAPIENTRY
831 TAG(VertexAttrib4fvNV)(GLuint index, const GLfloat * v)
832 {
833 GET_CURRENT_CONTEXT(ctx);
834 if (index < VBO_ATTRIB_MAX)
835 ATTR4FV(index, v);
836 }
837
838
839 static void GLAPIENTRY
840 TAG(VertexP2ui)(GLenum type, GLuint value)
841 {
842 GET_CURRENT_CONTEXT(ctx);
843 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_POS, value);
844 }
845
846 static void GLAPIENTRY
847 TAG(VertexP2uiv)(GLenum type, const GLuint *value)
848 {
849 GET_CURRENT_CONTEXT(ctx);
850 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_POS, value[0]);
851 }
852
853 static void GLAPIENTRY
854 TAG(VertexP3ui)(GLenum type, GLuint value)
855 {
856 GET_CURRENT_CONTEXT(ctx);
857 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_POS, value);
858 }
859
860 static void GLAPIENTRY
861 TAG(VertexP3uiv)(GLenum type, const GLuint *value)
862 {
863 GET_CURRENT_CONTEXT(ctx);
864 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_POS, value[0]);
865 }
866
867 static void GLAPIENTRY
868 TAG(VertexP4ui)(GLenum type, GLuint value)
869 {
870 GET_CURRENT_CONTEXT(ctx);
871 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_POS, value);
872 }
873
874 static void GLAPIENTRY
875 TAG(VertexP4uiv)(GLenum type, const GLuint *value)
876 {
877 GET_CURRENT_CONTEXT(ctx);
878 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_POS, value[0]);
879 }
880
881 static void GLAPIENTRY
882 TAG(TexCoordP1ui)(GLenum type, GLuint coords)
883 {
884 GET_CURRENT_CONTEXT(ctx);
885 ATTR_UI(ctx, 1, type, 0, VBO_ATTRIB_TEX0, coords);
886 }
887
888 static void GLAPIENTRY
889 TAG(TexCoordP1uiv)(GLenum type, const GLuint *coords)
890 {
891 GET_CURRENT_CONTEXT(ctx);
892 ATTR_UI(ctx, 1, type, 0, VBO_ATTRIB_TEX0, coords[0]);
893 }
894
895 static void GLAPIENTRY
896 TAG(TexCoordP2ui)(GLenum type, GLuint coords)
897 {
898 GET_CURRENT_CONTEXT(ctx);
899 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_TEX0, coords);
900 }
901
902 static void GLAPIENTRY
903 TAG(TexCoordP2uiv)(GLenum type, const GLuint *coords)
904 {
905 GET_CURRENT_CONTEXT(ctx);
906 ATTR_UI(ctx, 2, type, 0, VBO_ATTRIB_TEX0, coords[0]);
907 }
908
909 static void GLAPIENTRY
910 TAG(TexCoordP3ui)(GLenum type, GLuint coords)
911 {
912 GET_CURRENT_CONTEXT(ctx);
913 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_TEX0, coords);
914 }
915
916 static void GLAPIENTRY
917 TAG(TexCoordP3uiv)(GLenum type, const GLuint *coords)
918 {
919 GET_CURRENT_CONTEXT(ctx);
920 ATTR_UI(ctx, 3, type, 0, VBO_ATTRIB_TEX0, coords[0]);
921 }
922
923 static void GLAPIENTRY
924 TAG(TexCoordP4ui)(GLenum type, GLuint coords)
925 {
926 GET_CURRENT_CONTEXT(ctx);
927 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_TEX0, coords);
928 }
929
930 static void GLAPIENTRY
931 TAG(TexCoordP4uiv)(GLenum type, const GLuint *coords)
932 {
933 GET_CURRENT_CONTEXT(ctx);
934 ATTR_UI(ctx, 4, type, 0, VBO_ATTRIB_TEX0, coords[0]);
935 }
936
937 static void GLAPIENTRY
938 TAG(MultiTexCoordP1ui)(GLenum target, GLenum type, GLuint coords)
939 {
940 GET_CURRENT_CONTEXT(ctx);
941 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
942 ATTR_UI(ctx, 1, type, 0, attr, coords);
943 }
944
945 static void GLAPIENTRY
946 TAG(MultiTexCoordP1uiv)(GLenum target, GLenum type, const GLuint *coords)
947 {
948 GET_CURRENT_CONTEXT(ctx);
949 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
950 ATTR_UI(ctx, 1, type, 0, attr, coords[0]);
951 }
952
953 static void GLAPIENTRY
954 TAG(MultiTexCoordP2ui)(GLenum target, GLenum type, GLuint coords)
955 {
956 GET_CURRENT_CONTEXT(ctx);
957 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
958 ATTR_UI(ctx, 2, type, 0, attr, coords);
959 }
960
961 static void GLAPIENTRY
962 TAG(MultiTexCoordP2uiv)(GLenum target, GLenum type, const GLuint *coords)
963 {
964 GET_CURRENT_CONTEXT(ctx);
965 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
966 ATTR_UI(ctx, 2, type, 0, attr, coords[0]);
967 }
968
969 static void GLAPIENTRY
970 TAG(MultiTexCoordP3ui)(GLenum target, GLenum type, GLuint coords)
971 {
972 GET_CURRENT_CONTEXT(ctx);
973 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
974 ATTR_UI(ctx, 3, type, 0, attr, coords);
975 }
976
977 static void GLAPIENTRY
978 TAG(MultiTexCoordP3uiv)(GLenum target, GLenum type, const GLuint *coords)
979 {
980 GET_CURRENT_CONTEXT(ctx);
981 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
982 ATTR_UI(ctx, 3, type, 0, attr, coords[0]);
983 }
984
985 static void GLAPIENTRY
986 TAG(MultiTexCoordP4ui)(GLenum target, GLenum type, GLuint coords)
987 {
988 GET_CURRENT_CONTEXT(ctx);
989 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
990 ATTR_UI(ctx, 4, type, 0, attr, coords);
991 }
992
993 static void GLAPIENTRY
994 TAG(MultiTexCoordP4uiv)(GLenum target, GLenum type, const GLuint *coords)
995 {
996 GET_CURRENT_CONTEXT(ctx);
997 GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0;
998 ATTR_UI(ctx, 4, type, 0, attr, coords[0]);
999 }
1000
1001 static void GLAPIENTRY
1002 TAG(NormalP3ui)(GLenum type, GLuint coords)
1003 {
1004 GET_CURRENT_CONTEXT(ctx);
1005 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_NORMAL, coords);
1006 }
1007
1008 static void GLAPIENTRY
1009 TAG(NormalP3uiv)(GLenum type, const GLuint *coords)
1010 {
1011 GET_CURRENT_CONTEXT(ctx);
1012 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_NORMAL, coords[0]);
1013 }
1014
1015 static void GLAPIENTRY
1016 TAG(ColorP3ui)(GLenum type, GLuint color)
1017 {
1018 GET_CURRENT_CONTEXT(ctx);
1019 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR0, color);
1020 }
1021
1022 static void GLAPIENTRY
1023 TAG(ColorP3uiv)(GLenum type, const GLuint *color)
1024 {
1025 GET_CURRENT_CONTEXT(ctx);
1026 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR0, color[0]);
1027 }
1028
1029 static void GLAPIENTRY
1030 TAG(ColorP4ui)(GLenum type, GLuint color)
1031 {
1032 GET_CURRENT_CONTEXT(ctx);
1033 ATTR_UI(ctx, 4, type, 1, VBO_ATTRIB_COLOR0, color);
1034 }
1035
1036 static void GLAPIENTRY
1037 TAG(ColorP4uiv)(GLenum type, const GLuint *color)
1038 {
1039 GET_CURRENT_CONTEXT(ctx);
1040 ATTR_UI(ctx, 4, type, 1, VBO_ATTRIB_COLOR0, color[0]);
1041 }
1042
1043 static void GLAPIENTRY
1044 TAG(SecondaryColorP3ui)(GLenum type, GLuint color)
1045 {
1046 GET_CURRENT_CONTEXT(ctx);
1047 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR1, color);
1048 }
1049
1050 static void GLAPIENTRY
1051 TAG(SecondaryColorP3uiv)(GLenum type, const GLuint *color)
1052 {
1053 GET_CURRENT_CONTEXT(ctx);
1054 ATTR_UI(ctx, 3, type, 1, VBO_ATTRIB_COLOR1, color[0]);
1055 }
1056
1057 static void GLAPIENTRY
1058 TAG(VertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized,
1059 GLuint value)
1060 {
1061 GET_CURRENT_CONTEXT(ctx);
1062 ATTR_UI_INDEX(ctx, 1, type, normalized, index, value);
1063 }
1064
1065 static void GLAPIENTRY
1066 TAG(VertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized,
1067 GLuint value)
1068 {
1069 GET_CURRENT_CONTEXT(ctx);
1070 ATTR_UI_INDEX(ctx, 2, type, normalized, index, value);
1071 }
1072
1073 static void GLAPIENTRY
1074 TAG(VertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized,
1075 GLuint value)
1076 {
1077 GET_CURRENT_CONTEXT(ctx);
1078 ATTR_UI_INDEX(ctx, 3, type, normalized, index, value);
1079 }
1080
1081 static void GLAPIENTRY
1082 TAG(VertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized,
1083 GLuint value)
1084 {
1085 GET_CURRENT_CONTEXT(ctx);
1086 ATTR_UI_INDEX(ctx, 4, type, normalized, index, value);
1087 }
1088
1089 static void GLAPIENTRY
1090 TAG(VertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized,
1091 const GLuint *value)
1092 {
1093 GET_CURRENT_CONTEXT(ctx);
1094 ATTR_UI_INDEX(ctx, 1, type, normalized, index, *value);
1095 }
1096
1097 static void GLAPIENTRY
1098 TAG(VertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized,
1099 const GLuint *value)
1100 {
1101 GET_CURRENT_CONTEXT(ctx);
1102 ATTR_UI_INDEX(ctx, 2, type, normalized, index, *value);
1103 }
1104
1105 static void GLAPIENTRY
1106 TAG(VertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized,
1107 const GLuint *value)
1108 {
1109 GET_CURRENT_CONTEXT(ctx);
1110 ATTR_UI_INDEX(ctx, 3, type, normalized, index, *value);
1111 }
1112
1113 static void GLAPIENTRY
1114 TAG(VertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized,
1115 const GLuint *value)
1116 {
1117 GET_CURRENT_CONTEXT(ctx);
1118 ATTR_UI_INDEX(ctx, 4, type, normalized, index, *value);
1119 }
1120
1121
1122 #undef ATTR1FV
1123 #undef ATTR2FV
1124 #undef ATTR3FV
1125 #undef ATTR4FV
1126
1127 #undef ATTR1F
1128 #undef ATTR2F
1129 #undef ATTR3F
1130 #undef ATTR4F
1131
1132 #undef ATTR_UI
1133
1134 #undef MAT