blob: 6a531aa2aad8e731dc66b39a4a4d272b12ba0ef0 [file] [log] [blame]
Gareth Hughes22144ab2001-03-12 00:48:37 +00001/*
2 * Mesa 3-D graphics library
Brian Paulb5b8d222004-11-27 20:07:08 +00003 * Version: 6.3
Gareth Hughes22144ab2001-03-12 00:48:37 +00004 *
Brian Paul0d4393a2004-02-11 22:53:38 +00005 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
Gareth Hughes22144ab2001-03-12 00:48:37 +00006 *
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
Keith Whitwellfc00cbe2001-12-20 15:30:45 +000025/* Author:
Brian Paul05a4b372002-10-29 20:28:36 +000026 * Keith Whitwell <keith@tungstengraphics.com>
Keith Whitwellfc00cbe2001-12-20 15:30:45 +000027 */
28
Keith Whitwellcab974c2000-12-26 05:09:27 +000029#include "glheader.h"
Keith Whitwell4b7d6f22001-06-01 22:22:10 +000030#include "api_arrayelt.h"
Keith Whitwellcab974c2000-12-26 05:09:27 +000031#include "context.h"
Keith Whitwellfc00cbe2001-12-20 15:30:45 +000032#include "glapi.h"
Brian Paul3c634522002-10-24 23:57:19 +000033#include "imports.h"
Keith Whitwellcab974c2000-12-26 05:09:27 +000034#include "macros.h"
Keith Whitwellcab974c2000-12-26 05:09:27 +000035#include "mtypes.h"
36
Karl Schultzb72902e2004-01-28 22:24:12 +000037typedef void (GLAPIENTRY *array_func)( const void * );
Keith Whitwellcab974c2000-12-26 05:09:27 +000038
39typedef struct {
Brian Paul0d4393a2004-02-11 22:53:38 +000040 const struct gl_client_array *array;
Gareth Hughes1fb0a432001-12-28 06:28:10 +000041 array_func func;
Keith Whitwell4b7d6f22001-06-01 22:22:10 +000042} AEarray;
Keith Whitwellcab974c2000-12-26 05:09:27 +000043
Brian Paul0d4393a2004-02-11 22:53:38 +000044typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data );
45
Keith Whitwellcab974c2000-12-26 05:09:27 +000046typedef struct {
Brian Paul0d4393a2004-02-11 22:53:38 +000047 const struct gl_client_array *array;
48 attrib_func func;
49 GLuint index;
50} AEattrib;
51
52typedef struct {
Brian Paul53ad0362004-02-09 00:24:48 +000053 AEarray arrays[32];
Brian Paul0d4393a2004-02-11 22:53:38 +000054 AEattrib attribs[VERT_ATTRIB_MAX + 1];
Keith Whitwellcab974c2000-12-26 05:09:27 +000055 GLuint NewState;
Keith Whitwell4b7d6f22001-06-01 22:22:10 +000056} AEcontext;
Keith Whitwellcab974c2000-12-26 05:09:27 +000057
Keith Whitwell4b7d6f22001-06-01 22:22:10 +000058#define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context)
Brian Paul0d4393a2004-02-11 22:53:38 +000059
60/*
61 * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
62 * in the range [0, 7]. Luckily these type tokens are sequentially
Brian Paulf2f33502004-04-23 17:58:06 +000063 * numbered in gl.h, except for GL_DOUBLE.
Brian Paul0d4393a2004-02-11 22:53:38 +000064 */
Brian Paulf2f33502004-04-23 17:58:06 +000065#define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 )
Keith Whitwellcab974c2000-12-26 05:09:27 +000066
Adam Jackson94987be2004-10-24 02:05:40 +000067static void GLAPIENTRY Color3bv(const GLbyte *v)
68{
69 GL_CALL(Color3bv)(v);
70}
Brian Paul0d4393a2004-02-11 22:53:38 +000071
Adam Jackson94987be2004-10-24 02:05:40 +000072static void GLAPIENTRY Color3ubv(const GLubyte *v)
73{
74 GL_CALL(Color3ubv)(v);
75}
Brian Paul53ad0362004-02-09 00:24:48 +000076
Adam Jackson94987be2004-10-24 02:05:40 +000077static void GLAPIENTRY Color3sv(const GLshort *v)
78{
79 GL_CALL(Color3sv)(v);
80}
81
82static void GLAPIENTRY Color3usv(const GLushort *v)
83{
84 GL_CALL(Color3usv)(v);
85}
86
87static void GLAPIENTRY Color3iv(const GLint *v)
88{
89 GL_CALL(Color3iv)(v);
90}
91
92static void GLAPIENTRY Color3uiv(const GLuint *v)
93{
94 GL_CALL(Color3uiv)(v);
95}
96
97static void GLAPIENTRY Color3fv(const GLfloat *v)
98{
99 GL_CALL(Color3fv)(v);
100}
101
102static void GLAPIENTRY Color3dv(const GLdouble *v)
103{
104 GL_CALL(Color3dv)(v);
105}
106
107static void GLAPIENTRY Color4bv(const GLbyte *v)
108{
109 GL_CALL(Color4bv)(v);
110}
111
112static void GLAPIENTRY Color4ubv(const GLubyte *v)
113{
114 GL_CALL(Color4ubv)(v);
115}
116
117static void GLAPIENTRY Color4sv(const GLshort *v)
118{
119 GL_CALL(Color4sv)(v);
120}
121
122static void GLAPIENTRY Color4usv(const GLushort *v)
123{
124 GL_CALL(Color4usv)(v);
125}
126
127static void GLAPIENTRY Color4iv(const GLint *v)
128{
129 GL_CALL(Color4iv)(v);
130}
131
132static void GLAPIENTRY Color4uiv(const GLuint *v)
133{
134 GL_CALL(Color4uiv)(v);
135}
136
137static void GLAPIENTRY Color4fv(const GLfloat *v)
138{
139 GL_CALL(Color4fv)(v);
140}
141
142static void GLAPIENTRY Color4dv(const GLdouble *v)
143{
144 GL_CALL(Color4dv)(v);
145}
146
147static const array_func ColorFuncs[2][8] = {
148 {
149 (array_func) Color3bv,
150 (array_func) Color3ubv,
151 (array_func) Color3sv,
152 (array_func) Color3usv,
153 (array_func) Color3iv,
154 (array_func) Color3uiv,
155 (array_func) Color3fv,
156 (array_func) Color3dv,
157 },
158 {
159 (array_func) Color4bv,
160 (array_func) Color4ubv,
161 (array_func) Color4sv,
162 (array_func) Color4usv,
163 (array_func) Color4iv,
164 (array_func) Color4uiv,
165 (array_func) Color4fv,
166 (array_func) Color4dv,
167 },
Brian Paul53ad0362004-02-09 00:24:48 +0000168};
169
Adam Jackson94987be2004-10-24 02:05:40 +0000170static void GLAPIENTRY Vertex2sv(const GLshort *v)
171{
172 GL_CALL(Vertex2sv)(v);
173}
Brian Paul53ad0362004-02-09 00:24:48 +0000174
Adam Jackson94987be2004-10-24 02:05:40 +0000175static void GLAPIENTRY Vertex2iv(const GLint *v)
176{
177 GL_CALL(Vertex2iv)(v);
178}
Brian Paul53ad0362004-02-09 00:24:48 +0000179
Adam Jackson94987be2004-10-24 02:05:40 +0000180static void GLAPIENTRY Vertex2fv(const GLfloat *v)
181{
182 GL_CALL(Vertex2fv)(v);
183}
184
185static void GLAPIENTRY Vertex2dv(const GLdouble *v)
186{
187 GL_CALL(Vertex2dv)(v);
188}
189
190static void GLAPIENTRY Vertex3sv(const GLshort *v)
191{
192 GL_CALL(Vertex3sv)(v);
193}
194
195static void GLAPIENTRY Vertex3iv(const GLint *v)
196{
197 GL_CALL(Vertex3iv)(v);
198}
199
200static void GLAPIENTRY Vertex3fv(const GLfloat *v)
201{
202 GL_CALL(Vertex3fv)(v);
203}
204
205static void GLAPIENTRY Vertex3dv(const GLdouble *v)
206{
207 GL_CALL(Vertex3dv)(v);
208}
209
210static void GLAPIENTRY Vertex4sv(const GLshort *v)
211{
212 GL_CALL(Vertex4sv)(v);
213}
214
215static void GLAPIENTRY Vertex4iv(const GLint *v)
216{
217 GL_CALL(Vertex4iv)(v);
218}
219
220static void GLAPIENTRY Vertex4fv(const GLfloat *v)
221{
222 GL_CALL(Vertex4fv)(v);
223}
224
225static void GLAPIENTRY Vertex4dv(const GLdouble *v)
226{
227 GL_CALL(Vertex4dv)(v);
228}
229
230static const array_func VertexFuncs[3][8] = {
231 {
Keith Whitwella0c85242005-02-11 09:34:05 +0000232 NULL,
233 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000234 (array_func) Vertex2sv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000235 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000236 (array_func) Vertex2iv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000237 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000238 (array_func) Vertex2fv,
239 (array_func) Vertex2dv,
240 },
241 {
Keith Whitwella0c85242005-02-11 09:34:05 +0000242 NULL,
243 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000244 (array_func) Vertex3sv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000245 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000246 (array_func) Vertex3iv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000247 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000248 (array_func) Vertex3fv,
249 (array_func) Vertex3dv,
250 },
251 {
Keith Whitwella0c85242005-02-11 09:34:05 +0000252 NULL,
253 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000254 (array_func) Vertex4sv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000255 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000256 (array_func) Vertex4iv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000257 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000258 (array_func) Vertex4fv,
259 (array_func) Vertex4dv,
260 },
Brian Paul53ad0362004-02-09 00:24:48 +0000261};
262
Adam Jackson94987be2004-10-24 02:05:40 +0000263static void GLAPIENTRY Indexubv(const GLubyte *c)
264{
265 GL_CALL(Indexubv)(c);
266}
267
268static void GLAPIENTRY Indexsv(const GLshort *c)
269{
270 GL_CALL(Indexsv)(c);
271}
272
273static void GLAPIENTRY Indexiv(const GLint *c)
274{
275 GL_CALL(Indexiv)(c);
276}
277
278static void GLAPIENTRY Indexfv(const GLfloat *c)
279{
280 GL_CALL(Indexfv)(c);
281}
282
283static void GLAPIENTRY Indexdv(const GLdouble *c)
284{
285 GL_CALL(Indexdv)(c);
286}
287
288static const array_func IndexFuncs[8] = {
Keith Whitwella0c85242005-02-11 09:34:05 +0000289 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000290 (array_func) Indexubv,
291 (array_func) Indexsv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000292 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000293 (array_func) Indexiv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000294 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000295 (array_func) Indexfv,
296 (array_func) Indexdv,
Keith Whitwellcab974c2000-12-26 05:09:27 +0000297};
298
Adam Jackson94987be2004-10-24 02:05:40 +0000299static void GLAPIENTRY Normal3bv(const GLbyte *v)
300{
301 GL_CALL(Normal3bv)(v);
302}
Brian Paul53ad0362004-02-09 00:24:48 +0000303
Adam Jackson94987be2004-10-24 02:05:40 +0000304static void GLAPIENTRY Normal3sv(const GLshort *v)
305{
306 GL_CALL(Normal3sv)(v);
307}
308
309static void GLAPIENTRY Normal3iv(const GLint *v)
310{
311 GL_CALL(Normal3iv)(v);
312}
313
314static void GLAPIENTRY Normal3fv(const GLfloat *v)
315{
316 GL_CALL(Normal3fv)(v);
317}
318
319static void GLAPIENTRY Normal3dv(const GLdouble *v)
320{
321 GL_CALL(Normal3dv)(v);
322}
323
324static const array_func NormalFuncs[8] = {
325 (array_func) Normal3bv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000326 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000327 (array_func) Normal3sv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000328 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000329 (array_func) Normal3iv,
Keith Whitwella0c85242005-02-11 09:34:05 +0000330 NULL,
Adam Jackson94987be2004-10-24 02:05:40 +0000331 (array_func) Normal3fv,
332 (array_func) Normal3dv,
333};
Brian Paul53ad0362004-02-09 00:24:48 +0000334
335/* Wrapper functions in case glSecondaryColor*EXT doesn't exist */
Brian Paul2615e812004-02-24 14:47:01 +0000336static void GLAPIENTRY SecondaryColor3bvEXT(const GLbyte *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000337{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000338 GL_CALL(SecondaryColor3bvEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000339}
340
Brian Paul2615e812004-02-24 14:47:01 +0000341static void GLAPIENTRY SecondaryColor3ubvEXT(const GLubyte *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000342{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000343 GL_CALL(SecondaryColor3ubvEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000344}
345
Brian Paul2615e812004-02-24 14:47:01 +0000346static void GLAPIENTRY SecondaryColor3svEXT(const GLshort *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000347{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000348 GL_CALL(SecondaryColor3svEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000349}
350
Brian Paul2615e812004-02-24 14:47:01 +0000351static void GLAPIENTRY SecondaryColor3usvEXT(const GLushort *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000352{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000353 GL_CALL(SecondaryColor3usvEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000354}
355
Brian Paul2615e812004-02-24 14:47:01 +0000356static void GLAPIENTRY SecondaryColor3ivEXT(const GLint *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000357{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000358 GL_CALL(SecondaryColor3ivEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000359}
360
Brian Paul2615e812004-02-24 14:47:01 +0000361static void GLAPIENTRY SecondaryColor3uivEXT(const GLuint *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000362{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000363 GL_CALL(SecondaryColor3uivEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000364}
365
Brian Paul2615e812004-02-24 14:47:01 +0000366static void GLAPIENTRY SecondaryColor3fvEXT(const GLfloat *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000367{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000368 GL_CALL(SecondaryColor3fvEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000369}
370
Brian Paul2615e812004-02-24 14:47:01 +0000371static void GLAPIENTRY SecondaryColor3dvEXT(const GLdouble *c)
Brian Paul53ad0362004-02-09 00:24:48 +0000372{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000373 GL_CALL(SecondaryColor3dvEXT)(c);
Brian Paul53ad0362004-02-09 00:24:48 +0000374}
375
Adam Jackson94987be2004-10-24 02:05:40 +0000376static const array_func SecondaryColorFuncs[8] = {
Brian Paul53ad0362004-02-09 00:24:48 +0000377 (array_func) SecondaryColor3bvEXT,
378 (array_func) SecondaryColor3ubvEXT,
379 (array_func) SecondaryColor3svEXT,
380 (array_func) SecondaryColor3usvEXT,
381 (array_func) SecondaryColor3ivEXT,
382 (array_func) SecondaryColor3uivEXT,
383 (array_func) SecondaryColor3fvEXT,
384 (array_func) SecondaryColor3dvEXT,
385};
386
387
388/* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */
Brian Paul2615e812004-02-24 14:47:01 +0000389static void GLAPIENTRY FogCoordfvEXT(const GLfloat *f)
Brian Paul53ad0362004-02-09 00:24:48 +0000390{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000391 GL_CALL(FogCoordfvEXT)(f);
Brian Paul53ad0362004-02-09 00:24:48 +0000392}
393
Brian Paul2615e812004-02-24 14:47:01 +0000394static void GLAPIENTRY FogCoorddvEXT(const GLdouble *f)
Brian Paul53ad0362004-02-09 00:24:48 +0000395{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000396 GL_CALL(FogCoorddvEXT)(f);
Brian Paul53ad0362004-02-09 00:24:48 +0000397}
398
Adam Jackson94987be2004-10-24 02:05:40 +0000399static const array_func FogCoordFuncs[8] = {
Keith Whitwella0c85242005-02-11 09:34:05 +0000400 NULL,
401 NULL,
402 NULL,
403 NULL,
404 NULL,
405 NULL,
Brian Paul53ad0362004-02-09 00:24:48 +0000406 (array_func) FogCoordfvEXT,
407 (array_func) FogCoorddvEXT
408};
409
Brian Paul0d4393a2004-02-11 22:53:38 +0000410/**********************************************************************/
411
412/* GL_BYTE attributes */
413
Brian Paulb5b8d222004-11-27 20:07:08 +0000414static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000415{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000416 GL_CALL(VertexAttrib1fNV)(index, BYTE_TO_FLOAT(v[0]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000417}
418
Brian Paulb5b8d222004-11-27 20:07:08 +0000419static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000420{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000421 GL_CALL(VertexAttrib1fNV)(index, v[0]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000422}
423
Brian Paulb5b8d222004-11-27 20:07:08 +0000424static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000425{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000426 GL_CALL(VertexAttrib2fNV)(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000427}
428
Brian Paulb5b8d222004-11-27 20:07:08 +0000429static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000430{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000431 GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000432}
433
Brian Paulb5b8d222004-11-27 20:07:08 +0000434static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000435{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000436 GL_CALL(VertexAttrib3fNV)(index, BYTE_TO_FLOAT(v[0]),
437 BYTE_TO_FLOAT(v[1]),
438 BYTE_TO_FLOAT(v[2]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000439}
440
Brian Paulb5b8d222004-11-27 20:07:08 +0000441static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000442{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000443 GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000444}
445
Brian Paulb5b8d222004-11-27 20:07:08 +0000446static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000447{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000448 GL_CALL(VertexAttrib4fNV)(index, BYTE_TO_FLOAT(v[0]),
449 BYTE_TO_FLOAT(v[1]),
450 BYTE_TO_FLOAT(v[2]),
451 BYTE_TO_FLOAT(v[3]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000452}
453
Brian Paulb5b8d222004-11-27 20:07:08 +0000454static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000455{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000456 GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000457}
458
459/* GL_UNSIGNED_BYTE attributes */
460
Brian Paulb5b8d222004-11-27 20:07:08 +0000461static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000462{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000463 GL_CALL(VertexAttrib1fNV)(index, UBYTE_TO_FLOAT(v[0]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000464}
465
Brian Paulb5b8d222004-11-27 20:07:08 +0000466static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000467{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000468 GL_CALL(VertexAttrib1fNV)(index, v[0]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000469}
470
Brian Paulb5b8d222004-11-27 20:07:08 +0000471static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000472{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000473 GL_CALL(VertexAttrib2fNV)(index, UBYTE_TO_FLOAT(v[0]),
474 UBYTE_TO_FLOAT(v[1]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000475}
476
Brian Paulb5b8d222004-11-27 20:07:08 +0000477static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000478{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000479 GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000480}
481
Brian Paulb5b8d222004-11-27 20:07:08 +0000482static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000483{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000484 GL_CALL(VertexAttrib3fNV)(index, UBYTE_TO_FLOAT(v[0]),
485 UBYTE_TO_FLOAT(v[1]),
486 UBYTE_TO_FLOAT(v[2]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000487}
Brian Paulb5b8d222004-11-27 20:07:08 +0000488static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000489{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000490 GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000491}
492
Brian Paulb5b8d222004-11-27 20:07:08 +0000493static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000494{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000495 GL_CALL(VertexAttrib4fNV)(index, UBYTE_TO_FLOAT(v[0]),
Brian Paul0d4393a2004-02-11 22:53:38 +0000496 UBYTE_TO_FLOAT(v[1]),
497 UBYTE_TO_FLOAT(v[2]),
498 UBYTE_TO_FLOAT(v[3]));
499}
500
Brian Paulb5b8d222004-11-27 20:07:08 +0000501static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000502{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000503 GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000504}
505
506/* GL_SHORT attributes */
507
Brian Paulb5b8d222004-11-27 20:07:08 +0000508static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000509{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000510 GL_CALL(VertexAttrib1fNV)(index, SHORT_TO_FLOAT(v[0]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000511}
512
Brian Paulb5b8d222004-11-27 20:07:08 +0000513static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000514{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000515 GL_CALL(VertexAttrib1fNV)(index, v[0]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000516}
517
Brian Paulb5b8d222004-11-27 20:07:08 +0000518static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000519{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000520 GL_CALL(VertexAttrib2fNV)(index, SHORT_TO_FLOAT(v[0]),
521 SHORT_TO_FLOAT(v[1]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000522}
523
Brian Paulb5b8d222004-11-27 20:07:08 +0000524static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000525{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000526 GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000527}
528
Brian Paulb5b8d222004-11-27 20:07:08 +0000529static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000530{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000531 GL_CALL(VertexAttrib3fNV)(index, SHORT_TO_FLOAT(v[0]),
532 SHORT_TO_FLOAT(v[1]),
533 SHORT_TO_FLOAT(v[2]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000534}
535
Brian Paulb5b8d222004-11-27 20:07:08 +0000536static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000537{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000538 GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000539}
540
Brian Paulb5b8d222004-11-27 20:07:08 +0000541static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000542{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000543 GL_CALL(VertexAttrib4fNV)(index, SHORT_TO_FLOAT(v[0]),
544 SHORT_TO_FLOAT(v[1]),
545 SHORT_TO_FLOAT(v[2]),
546 SHORT_TO_FLOAT(v[3]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000547}
548
Brian Paulb5b8d222004-11-27 20:07:08 +0000549static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000550{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000551 GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000552}
553
554/* GL_UNSIGNED_SHORT attributes */
555
Brian Paulb5b8d222004-11-27 20:07:08 +0000556static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000557{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000558 GL_CALL(VertexAttrib1fNV)(index, USHORT_TO_FLOAT(v[0]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000559}
560
Brian Paulb5b8d222004-11-27 20:07:08 +0000561static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000562{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000563 GL_CALL(VertexAttrib1fNV)(index, v[0]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000564}
565
Brian Paulb5b8d222004-11-27 20:07:08 +0000566static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000567{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000568 GL_CALL(VertexAttrib2fNV)(index, USHORT_TO_FLOAT(v[0]),
569 USHORT_TO_FLOAT(v[1]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000570}
571
Brian Paulb5b8d222004-11-27 20:07:08 +0000572static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000573{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000574 GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000575}
576
Brian Paulb5b8d222004-11-27 20:07:08 +0000577static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000578{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000579 GL_CALL(VertexAttrib3fNV)(index, USHORT_TO_FLOAT(v[0]),
580 USHORT_TO_FLOAT(v[1]),
581 USHORT_TO_FLOAT(v[2]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000582}
583
Brian Paulb5b8d222004-11-27 20:07:08 +0000584static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000585{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000586 GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000587}
588
Brian Paulb5b8d222004-11-27 20:07:08 +0000589static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000590{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000591 GL_CALL(VertexAttrib4fNV)(index, USHORT_TO_FLOAT(v[0]),
592 USHORT_TO_FLOAT(v[1]),
593 USHORT_TO_FLOAT(v[2]),
594 USHORT_TO_FLOAT(v[3]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000595}
596
Brian Paulb5b8d222004-11-27 20:07:08 +0000597static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000598{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000599 GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000600}
601
602/* GL_INT attributes */
603
Brian Paulb5b8d222004-11-27 20:07:08 +0000604static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000605{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000606 GL_CALL(VertexAttrib1fNV)(index, INT_TO_FLOAT(v[0]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000607}
608
Brian Paulb5b8d222004-11-27 20:07:08 +0000609static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000610{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000611 GL_CALL(VertexAttrib1fNV)(index, v[0]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000612}
613
Brian Paulb5b8d222004-11-27 20:07:08 +0000614static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000615{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000616 GL_CALL(VertexAttrib2fNV)(index, INT_TO_FLOAT(v[0]),
617 INT_TO_FLOAT(v[1]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000618}
619
Brian Paulb5b8d222004-11-27 20:07:08 +0000620static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000621{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000622 GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000623}
624
Brian Paulb5b8d222004-11-27 20:07:08 +0000625static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000626{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000627 GL_CALL(VertexAttrib3fNV)(index, INT_TO_FLOAT(v[0]),
628 INT_TO_FLOAT(v[1]),
629 INT_TO_FLOAT(v[2]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000630}
631
Brian Paulb5b8d222004-11-27 20:07:08 +0000632static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000633{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000634 GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000635}
636
Brian Paulb5b8d222004-11-27 20:07:08 +0000637static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000638{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000639 GL_CALL(VertexAttrib4fNV)(index, INT_TO_FLOAT(v[0]),
640 INT_TO_FLOAT(v[1]),
641 INT_TO_FLOAT(v[2]),
642 INT_TO_FLOAT(v[3]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000643}
644
Brian Paulb5b8d222004-11-27 20:07:08 +0000645static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000646{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000647 GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000648}
649
650/* GL_UNSIGNED_INT attributes */
651
Brian Paulb5b8d222004-11-27 20:07:08 +0000652static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000653{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000654 GL_CALL(VertexAttrib1fNV)(index, UINT_TO_FLOAT(v[0]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000655}
656
Brian Paulb5b8d222004-11-27 20:07:08 +0000657static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000658{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000659 GL_CALL(VertexAttrib1fNV)(index, v[0]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000660}
661
Brian Paulb5b8d222004-11-27 20:07:08 +0000662static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000663{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000664 GL_CALL(VertexAttrib2fNV)(index, UINT_TO_FLOAT(v[0]),
665 UINT_TO_FLOAT(v[1]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000666}
667
Brian Paulb5b8d222004-11-27 20:07:08 +0000668static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000669{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000670 GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000671}
672
Brian Paulb5b8d222004-11-27 20:07:08 +0000673static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000674{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000675 GL_CALL(VertexAttrib3fNV)(index, UINT_TO_FLOAT(v[0]),
676 UINT_TO_FLOAT(v[1]),
677 UINT_TO_FLOAT(v[2]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000678}
679
Brian Paulb5b8d222004-11-27 20:07:08 +0000680static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000681{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000682 GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000683}
684
Brian Paulb5b8d222004-11-27 20:07:08 +0000685static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000686{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000687 GL_CALL(VertexAttrib4fNV)(index, UINT_TO_FLOAT(v[0]),
688 UINT_TO_FLOAT(v[1]),
689 UINT_TO_FLOAT(v[2]),
690 UINT_TO_FLOAT(v[3]));
Brian Paul0d4393a2004-02-11 22:53:38 +0000691}
692
Brian Paulb5b8d222004-11-27 20:07:08 +0000693static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000694{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000695 GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]);
Brian Paul0d4393a2004-02-11 22:53:38 +0000696}
697
698/* GL_FLOAT attributes */
699
Brian Paulb5b8d222004-11-27 20:07:08 +0000700static void GLAPIENTRY VertexAttrib1fvNV(GLuint index, const GLfloat *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000701{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000702 GL_CALL(VertexAttrib1fvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000703}
704
Brian Paulb5b8d222004-11-27 20:07:08 +0000705static void GLAPIENTRY VertexAttrib2fvNV(GLuint index, const GLfloat *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000706{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000707 GL_CALL(VertexAttrib2fvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000708}
709
Brian Paulb5b8d222004-11-27 20:07:08 +0000710static void GLAPIENTRY VertexAttrib3fvNV(GLuint index, const GLfloat *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000711{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000712 GL_CALL(VertexAttrib3fvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000713}
714
Brian Paulb5b8d222004-11-27 20:07:08 +0000715static void GLAPIENTRY VertexAttrib4fvNV(GLuint index, const GLfloat *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000716{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000717 GL_CALL(VertexAttrib4fvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000718}
719
720/* GL_DOUBLE attributes */
721
Brian Paulb5b8d222004-11-27 20:07:08 +0000722static void GLAPIENTRY VertexAttrib1dvNV(GLuint index, const GLdouble *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000723{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000724 GL_CALL(VertexAttrib1dvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000725}
726
Brian Paulb5b8d222004-11-27 20:07:08 +0000727static void GLAPIENTRY VertexAttrib2dvNV(GLuint index, const GLdouble *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000728{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000729 GL_CALL(VertexAttrib2dvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000730}
731
Brian Paulb5b8d222004-11-27 20:07:08 +0000732static void GLAPIENTRY VertexAttrib3dvNV(GLuint index, const GLdouble *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000733{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000734 GL_CALL(VertexAttrib3dvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000735}
736
Brian Paulb5b8d222004-11-27 20:07:08 +0000737static void GLAPIENTRY VertexAttrib4dvNV(GLuint index, const GLdouble *v)
Brian Paul0d4393a2004-02-11 22:53:38 +0000738{
Ian Romanickc1d455f2004-05-27 00:03:53 +0000739 GL_CALL(VertexAttrib4dvNV)(index, v);
Brian Paul0d4393a2004-02-11 22:53:38 +0000740}
741
742
743/*
744 * Array [size][type] of VertexAttrib functions
745 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000746static attrib_func AttribFuncsNV[2][4][8] = {
Brian Paul0d4393a2004-02-11 22:53:38 +0000747 {
748 /* non-normalized */
749 {
750 /* size 1 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000751 (attrib_func) VertexAttrib1bvNV,
752 (attrib_func) VertexAttrib1ubvNV,
753 (attrib_func) VertexAttrib1svNV,
754 (attrib_func) VertexAttrib1usvNV,
755 (attrib_func) VertexAttrib1ivNV,
756 (attrib_func) VertexAttrib1uivNV,
757 (attrib_func) VertexAttrib1fvNV,
758 (attrib_func) VertexAttrib1dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000759 },
760 {
761 /* size 2 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000762 (attrib_func) VertexAttrib2bvNV,
763 (attrib_func) VertexAttrib2ubvNV,
764 (attrib_func) VertexAttrib2svNV,
765 (attrib_func) VertexAttrib2usvNV,
766 (attrib_func) VertexAttrib2ivNV,
767 (attrib_func) VertexAttrib2uivNV,
768 (attrib_func) VertexAttrib2fvNV,
769 (attrib_func) VertexAttrib2dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000770 },
771 {
772 /* size 3 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000773 (attrib_func) VertexAttrib3bvNV,
774 (attrib_func) VertexAttrib3ubvNV,
775 (attrib_func) VertexAttrib3svNV,
776 (attrib_func) VertexAttrib3usvNV,
777 (attrib_func) VertexAttrib3ivNV,
778 (attrib_func) VertexAttrib3uivNV,
779 (attrib_func) VertexAttrib3fvNV,
780 (attrib_func) VertexAttrib3dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000781 },
782 {
783 /* size 4 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000784 (attrib_func) VertexAttrib4bvNV,
785 (attrib_func) VertexAttrib4ubvNV,
786 (attrib_func) VertexAttrib4svNV,
787 (attrib_func) VertexAttrib4usvNV,
788 (attrib_func) VertexAttrib4ivNV,
789 (attrib_func) VertexAttrib4uivNV,
790 (attrib_func) VertexAttrib4fvNV,
791 (attrib_func) VertexAttrib4dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000792 }
793 },
794 {
795 /* normalized (except for float/double) */
796 {
797 /* size 1 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000798 (attrib_func) VertexAttrib1NbvNV,
799 (attrib_func) VertexAttrib1NubvNV,
800 (attrib_func) VertexAttrib1NsvNV,
801 (attrib_func) VertexAttrib1NusvNV,
802 (attrib_func) VertexAttrib1NivNV,
803 (attrib_func) VertexAttrib1NuivNV,
804 (attrib_func) VertexAttrib1fvNV,
805 (attrib_func) VertexAttrib1dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000806 },
807 {
808 /* size 2 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000809 (attrib_func) VertexAttrib2NbvNV,
810 (attrib_func) VertexAttrib2NubvNV,
811 (attrib_func) VertexAttrib2NsvNV,
812 (attrib_func) VertexAttrib2NusvNV,
813 (attrib_func) VertexAttrib2NivNV,
814 (attrib_func) VertexAttrib2NuivNV,
815 (attrib_func) VertexAttrib2fvNV,
816 (attrib_func) VertexAttrib2dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000817 },
818 {
819 /* size 3 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000820 (attrib_func) VertexAttrib3NbvNV,
821 (attrib_func) VertexAttrib3NubvNV,
822 (attrib_func) VertexAttrib3NsvNV,
823 (attrib_func) VertexAttrib3NusvNV,
824 (attrib_func) VertexAttrib3NivNV,
825 (attrib_func) VertexAttrib3NuivNV,
826 (attrib_func) VertexAttrib3fvNV,
827 (attrib_func) VertexAttrib3dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000828 },
829 {
830 /* size 4 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000831 (attrib_func) VertexAttrib4NbvNV,
832 (attrib_func) VertexAttrib4NubvNV,
833 (attrib_func) VertexAttrib4NsvNV,
834 (attrib_func) VertexAttrib4NusvNV,
835 (attrib_func) VertexAttrib4NivNV,
836 (attrib_func) VertexAttrib4NuivNV,
837 (attrib_func) VertexAttrib4fvNV,
838 (attrib_func) VertexAttrib4dvNV
Brian Paul0d4393a2004-02-11 22:53:38 +0000839 }
840 }
841};
842
Adam Jackson94987be2004-10-24 02:05:40 +0000843static void GLAPIENTRY EdgeFlagv(const GLboolean *flag)
844{
845 GL_CALL(EdgeFlagv)(flag);
846}
847
Brian Paul0d4393a2004-02-11 22:53:38 +0000848/**********************************************************************/
849
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000850
851GLboolean _ae_create_context( GLcontext *ctx )
Keith Whitwellcab974c2000-12-26 05:09:27 +0000852{
Keith Whitwellae0eaf92003-11-24 15:23:18 +0000853 if (ctx->aelt_context)
854 return GL_TRUE;
855
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000856 ctx->aelt_context = MALLOC( sizeof(AEcontext) );
Gareth Hughes1fb0a432001-12-28 06:28:10 +0000857 if (!ctx->aelt_context)
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000858 return GL_FALSE;
859
860 AE_CONTEXT(ctx)->NewState = ~0;
861 return GL_TRUE;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000862}
863
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000864
865void _ae_destroy_context( GLcontext *ctx )
Keith Whitwellcab974c2000-12-26 05:09:27 +0000866{
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000867 if ( AE_CONTEXT( ctx ) ) {
868 FREE( ctx->aelt_context );
Keith Whitwella0c85242005-02-11 09:34:05 +0000869 ctx->aelt_context = NULL;
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000870 }
871}
872
873
Brian Paul0d4393a2004-02-11 22:53:38 +0000874/**
875 * Make a list of per-vertex functions to call for each glArrayElement call.
Brian Paul1e3d8682004-02-24 02:49:43 +0000876 * These functions access the array data (i.e. glVertex, glColor, glNormal,
877 * etc).
878 * Note: this may be called during display list construction.
Brian Paul0d4393a2004-02-11 22:53:38 +0000879 */
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000880static void _ae_update_state( GLcontext *ctx )
881{
882 AEcontext *actx = AE_CONTEXT(ctx);
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000883 AEarray *aa = actx->arrays;
Brian Paul0d4393a2004-02-11 22:53:38 +0000884 AEattrib *at = actx->attribs;
Brian Pauldb07de02002-04-19 00:23:08 +0000885 GLuint i;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000886
Brian Paul1e3d8682004-02-24 02:49:43 +0000887 /* conventional vertex arrays */
888 if (ctx->Array.Index.Enabled) {
Keith Whitwellcab974c2000-12-26 05:09:27 +0000889 aa->array = &ctx->Array.Index;
Brian Paul2615e812004-02-24 14:47:01 +0000890 aa->func = IndexFuncs[TYPE_IDX(aa->array->Type)];
Keith Whitwellcab974c2000-12-26 05:09:27 +0000891 aa++;
892 }
Keith Whitwellcab974c2000-12-26 05:09:27 +0000893 if (ctx->Array.EdgeFlag.Enabled) {
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000894 aa->array = &ctx->Array.EdgeFlag;
Adam Jackson94987be2004-10-24 02:05:40 +0000895 aa->func = (array_func) EdgeFlagv;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000896 aa++;
897 }
Brian Paul1e3d8682004-02-24 02:49:43 +0000898 if (ctx->Array.Normal.Enabled) {
899 aa->array = &ctx->Array.Normal;
Brian Paul2615e812004-02-24 14:47:01 +0000900 aa->func = NormalFuncs[TYPE_IDX(aa->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000901 aa++;
902 }
903 if (ctx->Array.Color.Enabled) {
904 aa->array = &ctx->Array.Color;
Brian Paul2615e812004-02-24 14:47:01 +0000905 aa->func = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000906 aa++;
907 }
908 if (ctx->Array.SecondaryColor.Enabled) {
909 aa->array = &ctx->Array.SecondaryColor;
Brian Paul2615e812004-02-24 14:47:01 +0000910 aa->func = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000911 aa++;
912 }
913 if (ctx->Array.FogCoord.Enabled) {
914 aa->array = &ctx->Array.FogCoord;
Brian Paul2615e812004-02-24 14:47:01 +0000915 aa->func = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000916 aa++;
917 }
918 for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
919 if (ctx->Array.TexCoord[i].Enabled) {
920 /* NOTE: we use generic glVertexAttrib functions here.
921 * If we ever de-alias conventional/generic vertex attribs this
922 * will have to change.
923 */
924 struct gl_client_array *attribArray = &ctx->Array.TexCoord[i];
925 at->array = attribArray;
Brian Paulb5b8d222004-11-27 20:07:08 +0000926 at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)];
Brian Paul9d1ff8c2004-02-24 14:59:26 +0000927 at->index = VERT_ATTRIB_TEX0 + i;
Brian Paul1e3d8682004-02-24 02:49:43 +0000928 at++;
Brian Paul0d4393a2004-02-11 22:53:38 +0000929 }
Brian Paul1e3d8682004-02-24 02:49:43 +0000930 }
Roland Scheideggerfaaf78a2004-02-11 01:06:03 +0000931
Brian Paul1e3d8682004-02-24 02:49:43 +0000932 /* generic vertex attribute arrays */
933 for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */
934 if (ctx->Array.VertexAttrib[i].Enabled) {
935 struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i];
Brian Paul0d4393a2004-02-11 22:53:38 +0000936 at->array = attribArray;
937 /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
938 * function pointer here (for float arrays) since the pointer may
939 * change from one execution of _ae_loopback_array_elt() to
940 * the next. Doing so caused UT to break.
941 */
Brian Paulb5b8d222004-11-27 20:07:08 +0000942 at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000943 at->index = i;
Brian Paul0d4393a2004-02-11 22:53:38 +0000944 at++;
945 }
Roland Scheideggerfaaf78a2004-02-11 01:06:03 +0000946 }
Brian Paul1e3d8682004-02-24 02:49:43 +0000947
948 /* finally, vertex position */
949 if (ctx->Array.VertexAttrib[0].Enabled) {
950 /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
951 * issued as the last (proviking) attribute).
952 */
953 aa->array = &ctx->Array.VertexAttrib[0];
954 assert(aa->array->Size >= 2); /* XXX fix someday? */
Brian Paul2615e812004-02-24 14:47:01 +0000955 aa->func = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000956 aa++;
957 }
958 else if (ctx->Array.Vertex.Enabled) {
959 aa->array = &ctx->Array.Vertex;
Brian Paul2615e812004-02-24 14:47:01 +0000960 aa->func = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
Brian Paul1e3d8682004-02-24 02:49:43 +0000961 aa++;
962 }
963
Brian Paul0d4393a2004-02-11 22:53:38 +0000964 ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX);
965 ASSERT(aa - actx->arrays < 32);
966 at->func = NULL; /* terminate the list */
967 aa->func = NULL; /* terminate the list */
Roland Scheideggerfaaf78a2004-02-11 01:06:03 +0000968
Keith Whitwellcab974c2000-12-26 05:09:27 +0000969 actx->NewState = 0;
970}
971
972
Brian Paul1e3d8682004-02-24 02:49:43 +0000973/**
974 * Called via glArrayElement() and glDrawArrays().
975 * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions
976 * for all enabled vertex arrays (for elt-th element).
977 * Note: this may be called during display list construction.
978 */
Karl Schultzd6745692003-12-04 20:23:44 +0000979void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
Keith Whitwellcab974c2000-12-26 05:09:27 +0000980{
981 GET_CURRENT_CONTEXT(ctx);
Brian Paul0d4393a2004-02-11 22:53:38 +0000982 const AEcontext *actx = AE_CONTEXT(ctx);
983 const AEarray *aa;
984 const AEattrib *at;
Keith Whitwell4b7d6f22001-06-01 22:22:10 +0000985
986 if (actx->NewState)
987 _ae_update_state( ctx );
Keith Whitwellcab974c2000-12-26 05:09:27 +0000988
Brian Paul0d4393a2004-02-11 22:53:38 +0000989 /* generic attributes */
990 for (at = actx->attribs; at->func; at++) {
991 const GLubyte *src = at->array->BufferObj->Data
Karl Schultz6258b762005-05-05 21:08:07 +0000992 + (uintptr_t) at->array->Ptr
Brian Paul0d4393a2004-02-11 22:53:38 +0000993 + elt * at->array->StrideB;
994 at->func( at->index, src );
Brian Paul53ad0362004-02-09 00:24:48 +0000995 }
996
Brian Paul0d4393a2004-02-11 22:53:38 +0000997 /* conventional arrays */
998 for (aa = actx->arrays; aa->func ; aa++) {
999 const GLubyte *src = aa->array->BufferObj->Data
Karl Schultz6258b762005-05-05 21:08:07 +00001000 + (uintptr_t) aa->array->Ptr
Brian Paul0d4393a2004-02-11 22:53:38 +00001001 + elt * aa->array->StrideB;
Brian Paul0aa8a102004-02-08 02:03:41 +00001002 aa->func( src );
Keith Whitwellcab974c2000-12-26 05:09:27 +00001003 }
Keith Whitwellcab974c2000-12-26 05:09:27 +00001004}
1005
1006
Keith Whitwell4b7d6f22001-06-01 22:22:10 +00001007void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
Keith Whitwellcab974c2000-12-26 05:09:27 +00001008{
Keith Whitwell4b7d6f22001-06-01 22:22:10 +00001009 AE_CONTEXT(ctx)->NewState |= new_state;
Keith Whitwellcab974c2000-12-26 05:09:27 +00001010}