ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

api_arrayelt.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.5.1
00004  *
00005  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 /* Author:
00026  *    Keith Whitwell <keith@tungstengraphics.com>
00027  */
00028 
00029 #include "glheader.h"
00030 #include "api_arrayelt.h"
00031 #include "context.h"
00032 #include "imports.h"
00033 #include "macros.h"
00034 #include "glapi/glapioffsets.h"
00035 #include "glapi/dispatch.h"
00036 
00037 typedef void (GLAPIENTRY *array_func)( const void * );
00038 
00039 typedef struct {
00040    const struct gl_client_array *array;
00041    int offset;
00042 } AEarray;
00043 
00044 typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data );
00045 
00046 typedef struct {
00047    const struct gl_client_array *array;
00048    attrib_func func;
00049    GLuint index;
00050 } AEattrib;
00051 
00052 typedef struct {
00053    AEarray arrays[32];
00054    AEattrib attribs[VERT_ATTRIB_MAX + 1];
00055    GLuint NewState;
00056 
00057    struct gl_buffer_object *vbo[VERT_ATTRIB_MAX];
00058    GLuint nr_vbos;
00059    GLboolean mapped_vbos;
00060 
00061 } AEcontext;
00062 
00063 #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context)
00064 
00065 
00066 /*
00067  * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
00068  * in the range [0, 7].  Luckily these type tokens are sequentially
00069  * numbered in gl.h, except for GL_DOUBLE.
00070  */
00071 #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 )
00072 
00073 static const int ColorFuncs[2][8] = {
00074    {
00075       _gloffset_Color3bv,
00076       _gloffset_Color3ubv,
00077       _gloffset_Color3sv,
00078       _gloffset_Color3usv,
00079       _gloffset_Color3iv,
00080       _gloffset_Color3uiv,
00081       _gloffset_Color3fv,
00082       _gloffset_Color3dv,
00083    },
00084    {
00085       _gloffset_Color4bv,
00086       _gloffset_Color4ubv,
00087       _gloffset_Color4sv,
00088       _gloffset_Color4usv,
00089       _gloffset_Color4iv,
00090       _gloffset_Color4uiv,
00091       _gloffset_Color4fv,
00092       _gloffset_Color4dv,
00093    },
00094 };
00095 
00096 static const int VertexFuncs[3][8] = {
00097    {
00098       -1,
00099       -1,
00100       _gloffset_Vertex2sv,
00101       -1,
00102       _gloffset_Vertex2iv,
00103       -1,
00104       _gloffset_Vertex2fv,
00105       _gloffset_Vertex2dv,
00106    },
00107    {
00108       -1,
00109       -1,
00110       _gloffset_Vertex3sv,
00111       -1,
00112       _gloffset_Vertex3iv,
00113       -1,
00114       _gloffset_Vertex3fv,
00115       _gloffset_Vertex3dv,
00116    },
00117    {
00118       -1,
00119       -1,
00120       _gloffset_Vertex4sv,
00121       -1,
00122       _gloffset_Vertex4iv,
00123       -1,
00124       _gloffset_Vertex4fv,
00125       _gloffset_Vertex4dv,
00126    },
00127 };
00128 
00129 static const int IndexFuncs[8] = {
00130    -1,
00131    _gloffset_Indexubv,
00132    _gloffset_Indexsv,
00133    -1,
00134    _gloffset_Indexiv,
00135    -1,
00136    _gloffset_Indexfv,
00137    _gloffset_Indexdv,
00138 };
00139 
00140 static const int NormalFuncs[8] = {
00141    _gloffset_Normal3bv,
00142    -1,
00143    _gloffset_Normal3sv,
00144    -1,
00145    _gloffset_Normal3iv,
00146    -1,
00147    _gloffset_Normal3fv,
00148    _gloffset_Normal3dv,
00149 };
00150 
00151 /* Note: _gloffset_* for these may not be a compile-time constant. */
00152 static int SecondaryColorFuncs[8];
00153 static int FogCoordFuncs[8];
00154 
00155 
00160 /* GL_BYTE attributes */
00161 
00162 static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v)
00163 {
00164    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0])));
00165 }
00166 
00167 static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v)
00168 {
00169    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
00170 }
00171 
00172 static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v)
00173 {
00174    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
00175 }
00176 
00177 static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v)
00178 {
00179    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00180 }
00181 
00182 static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
00183 {
00184    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
00185                            BYTE_TO_FLOAT(v[1]),
00186                            BYTE_TO_FLOAT(v[2])));
00187 }
00188 
00189 static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v)
00190 {
00191    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00192 }
00193 
00194 static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
00195 {
00196    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
00197                            BYTE_TO_FLOAT(v[1]),
00198                            BYTE_TO_FLOAT(v[2]),
00199                            BYTE_TO_FLOAT(v[3])));
00200 }
00201 
00202 static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v)
00203 {
00204    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00205 }
00206 
00207 /* GL_UNSIGNED_BYTE attributes */
00208 
00209 static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v)
00210 {
00211    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0])));
00212 }
00213 
00214 static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v)
00215 {
00216    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
00217 }
00218 
00219 static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v)
00220 {
00221    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
00222                            UBYTE_TO_FLOAT(v[1])));
00223 }
00224 
00225 static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v)
00226 {
00227    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00228 }
00229 
00230 static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v)
00231 {
00232    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
00233                            UBYTE_TO_FLOAT(v[1]),
00234                            UBYTE_TO_FLOAT(v[2])));
00235 }
00236 static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v)
00237 {
00238    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00239 }
00240 
00241 static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
00242 {
00243    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
00244                                      UBYTE_TO_FLOAT(v[1]),
00245                                      UBYTE_TO_FLOAT(v[2]),
00246                                      UBYTE_TO_FLOAT(v[3])));
00247 }
00248 
00249 static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
00250 {
00251    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00252 }
00253 
00254 /* GL_SHORT attributes */
00255 
00256 static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v)
00257 {
00258    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0])));
00259 }
00260 
00261 static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v)
00262 {
00263    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
00264 }
00265 
00266 static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v)
00267 {
00268    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
00269                            SHORT_TO_FLOAT(v[1])));
00270 }
00271 
00272 static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v)
00273 {
00274    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00275 }
00276 
00277 static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v)
00278 {
00279    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
00280                  SHORT_TO_FLOAT(v[1]),
00281                  SHORT_TO_FLOAT(v[2])));
00282 }
00283 
00284 static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v)
00285 {
00286    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00287 }
00288 
00289 static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v)
00290 {
00291    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
00292                  SHORT_TO_FLOAT(v[1]),
00293                  SHORT_TO_FLOAT(v[2]),
00294                  SHORT_TO_FLOAT(v[3])));
00295 }
00296 
00297 static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v)
00298 {
00299    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00300 }
00301 
00302 /* GL_UNSIGNED_SHORT attributes */
00303 
00304 static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v)
00305 {
00306    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0])));
00307 }
00308 
00309 static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v)
00310 {
00311    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
00312 }
00313 
00314 static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v)
00315 {
00316    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
00317                  USHORT_TO_FLOAT(v[1])));
00318 }
00319 
00320 static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v)
00321 {
00322    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00323 }
00324 
00325 static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v)
00326 {
00327    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
00328                            USHORT_TO_FLOAT(v[1]),
00329                            USHORT_TO_FLOAT(v[2])));
00330 }
00331 
00332 static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v)
00333 {
00334    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00335 }
00336 
00337 static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v)
00338 {
00339    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
00340                            USHORT_TO_FLOAT(v[1]),
00341                            USHORT_TO_FLOAT(v[2]),
00342                            USHORT_TO_FLOAT(v[3])));
00343 }
00344 
00345 static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v)
00346 {
00347    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00348 }
00349 
00350 /* GL_INT attributes */
00351 
00352 static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v)
00353 {
00354    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0])));
00355 }
00356 
00357 static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v)
00358 {
00359    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
00360 }
00361 
00362 static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v)
00363 {
00364    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
00365                            INT_TO_FLOAT(v[1])));
00366 }
00367 
00368 static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v)
00369 {
00370    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00371 }
00372 
00373 static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v)
00374 {
00375    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
00376                            INT_TO_FLOAT(v[1]),
00377                            INT_TO_FLOAT(v[2])));
00378 }
00379 
00380 static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v)
00381 {
00382    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00383 }
00384 
00385 static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v)
00386 {
00387    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
00388                            INT_TO_FLOAT(v[1]),
00389                            INT_TO_FLOAT(v[2]),
00390                            INT_TO_FLOAT(v[3])));
00391 }
00392 
00393 static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v)
00394 {
00395    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00396 }
00397 
00398 /* GL_UNSIGNED_INT attributes */
00399 
00400 static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v)
00401 {
00402    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0])));
00403 }
00404 
00405 static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v)
00406 {
00407    CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
00408 }
00409 
00410 static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v)
00411 {
00412    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
00413                            UINT_TO_FLOAT(v[1])));
00414 }
00415 
00416 static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v)
00417 {
00418    CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00419 }
00420 
00421 static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v)
00422 {
00423    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
00424                            UINT_TO_FLOAT(v[1]),
00425                            UINT_TO_FLOAT(v[2])));
00426 }
00427 
00428 static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v)
00429 {
00430    CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00431 }
00432 
00433 static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v)
00434 {
00435    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
00436                            UINT_TO_FLOAT(v[1]),
00437                            UINT_TO_FLOAT(v[2]),
00438                            UINT_TO_FLOAT(v[3])));
00439 }
00440 
00441 static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v)
00442 {
00443    CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00444 }
00445 
00446 /* GL_FLOAT attributes */
00447 
00448 static void GLAPIENTRY VertexAttrib1fvNV(GLuint index, const GLfloat *v)
00449 {
00450    CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v));
00451 }
00452 
00453 static void GLAPIENTRY VertexAttrib2fvNV(GLuint index, const GLfloat *v)
00454 {
00455    CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v));
00456 }
00457 
00458 static void GLAPIENTRY VertexAttrib3fvNV(GLuint index, const GLfloat *v)
00459 {
00460    CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v));
00461 }
00462 
00463 static void GLAPIENTRY VertexAttrib4fvNV(GLuint index, const GLfloat *v)
00464 {
00465    CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v));
00466 }
00467 
00468 /* GL_DOUBLE attributes */
00469 
00470 static void GLAPIENTRY VertexAttrib1dvNV(GLuint index, const GLdouble *v)
00471 {
00472    CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v));
00473 }
00474 
00475 static void GLAPIENTRY VertexAttrib2dvNV(GLuint index, const GLdouble *v)
00476 {
00477    CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v));
00478 }
00479 
00480 static void GLAPIENTRY VertexAttrib3dvNV(GLuint index, const GLdouble *v)
00481 {
00482    CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v));
00483 }
00484 
00485 static void GLAPIENTRY VertexAttrib4dvNV(GLuint index, const GLdouble *v)
00486 {
00487    CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v));
00488 }
00489 
00490 
00491 /*
00492  * Array [size][type] of VertexAttrib functions
00493  */
00494 static attrib_func AttribFuncsNV[2][4][8] = {
00495    {
00496       /* non-normalized */
00497       {
00498          /* size 1 */
00499          (attrib_func) VertexAttrib1bvNV,
00500          (attrib_func) VertexAttrib1ubvNV,
00501          (attrib_func) VertexAttrib1svNV,
00502          (attrib_func) VertexAttrib1usvNV,
00503          (attrib_func) VertexAttrib1ivNV,
00504          (attrib_func) VertexAttrib1uivNV,
00505          (attrib_func) VertexAttrib1fvNV,
00506          (attrib_func) VertexAttrib1dvNV
00507       },
00508       {
00509          /* size 2 */
00510          (attrib_func) VertexAttrib2bvNV,
00511          (attrib_func) VertexAttrib2ubvNV,
00512          (attrib_func) VertexAttrib2svNV,
00513          (attrib_func) VertexAttrib2usvNV,
00514          (attrib_func) VertexAttrib2ivNV,
00515          (attrib_func) VertexAttrib2uivNV,
00516          (attrib_func) VertexAttrib2fvNV,
00517          (attrib_func) VertexAttrib2dvNV
00518       },
00519       {
00520          /* size 3 */
00521          (attrib_func) VertexAttrib3bvNV,
00522          (attrib_func) VertexAttrib3ubvNV,
00523          (attrib_func) VertexAttrib3svNV,
00524          (attrib_func) VertexAttrib3usvNV,
00525          (attrib_func) VertexAttrib3ivNV,
00526          (attrib_func) VertexAttrib3uivNV,
00527          (attrib_func) VertexAttrib3fvNV,
00528          (attrib_func) VertexAttrib3dvNV
00529       },
00530       {
00531          /* size 4 */
00532          (attrib_func) VertexAttrib4bvNV,
00533          (attrib_func) VertexAttrib4ubvNV,
00534          (attrib_func) VertexAttrib4svNV,
00535          (attrib_func) VertexAttrib4usvNV,
00536          (attrib_func) VertexAttrib4ivNV,
00537          (attrib_func) VertexAttrib4uivNV,
00538          (attrib_func) VertexAttrib4fvNV,
00539          (attrib_func) VertexAttrib4dvNV
00540       }
00541    },
00542    {
00543       /* normalized (except for float/double) */
00544       {
00545          /* size 1 */
00546          (attrib_func) VertexAttrib1NbvNV,
00547          (attrib_func) VertexAttrib1NubvNV,
00548          (attrib_func) VertexAttrib1NsvNV,
00549          (attrib_func) VertexAttrib1NusvNV,
00550          (attrib_func) VertexAttrib1NivNV,
00551          (attrib_func) VertexAttrib1NuivNV,
00552          (attrib_func) VertexAttrib1fvNV,
00553          (attrib_func) VertexAttrib1dvNV
00554       },
00555       {
00556          /* size 2 */
00557          (attrib_func) VertexAttrib2NbvNV,
00558          (attrib_func) VertexAttrib2NubvNV,
00559          (attrib_func) VertexAttrib2NsvNV,
00560          (attrib_func) VertexAttrib2NusvNV,
00561          (attrib_func) VertexAttrib2NivNV,
00562          (attrib_func) VertexAttrib2NuivNV,
00563          (attrib_func) VertexAttrib2fvNV,
00564          (attrib_func) VertexAttrib2dvNV
00565       },
00566       {
00567          /* size 3 */
00568          (attrib_func) VertexAttrib3NbvNV,
00569          (attrib_func) VertexAttrib3NubvNV,
00570          (attrib_func) VertexAttrib3NsvNV,
00571          (attrib_func) VertexAttrib3NusvNV,
00572          (attrib_func) VertexAttrib3NivNV,
00573          (attrib_func) VertexAttrib3NuivNV,
00574          (attrib_func) VertexAttrib3fvNV,
00575          (attrib_func) VertexAttrib3dvNV
00576       },
00577       {
00578          /* size 4 */
00579          (attrib_func) VertexAttrib4NbvNV,
00580          (attrib_func) VertexAttrib4NubvNV,
00581          (attrib_func) VertexAttrib4NsvNV,
00582          (attrib_func) VertexAttrib4NusvNV,
00583          (attrib_func) VertexAttrib4NivNV,
00584          (attrib_func) VertexAttrib4NuivNV,
00585          (attrib_func) VertexAttrib4fvNV,
00586          (attrib_func) VertexAttrib4dvNV
00587       }
00588    }
00589 };
00590 
00591 
00596 /* GL_BYTE attributes */
00597 
00598 static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v)
00599 {
00600    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0])));
00601 }
00602 
00603 static void GLAPIENTRY VertexAttrib1bvARB(GLuint index, const GLbyte *v)
00604 {
00605    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
00606 }
00607 
00608 static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v)
00609 {
00610    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
00611 }
00612 
00613 static void GLAPIENTRY VertexAttrib2bvARB(GLuint index, const GLbyte *v)
00614 {
00615    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00616 }
00617 
00618 static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
00619 {
00620    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
00621                            BYTE_TO_FLOAT(v[1]),
00622                            BYTE_TO_FLOAT(v[2])));
00623 }
00624 
00625 static void GLAPIENTRY VertexAttrib3bvARB(GLuint index, const GLbyte *v)
00626 {
00627    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00628 }
00629 
00630 static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
00631 {
00632    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
00633                            BYTE_TO_FLOAT(v[1]),
00634                            BYTE_TO_FLOAT(v[2]),
00635                            BYTE_TO_FLOAT(v[3])));
00636 }
00637 
00638 static void GLAPIENTRY VertexAttrib4bvARB(GLuint index, const GLbyte *v)
00639 {
00640    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00641 }
00642 
00643 /* GL_UNSIGNED_BYTE attributes */
00644 
00645 static void GLAPIENTRY VertexAttrib1NubvARB(GLuint index, const GLubyte *v)
00646 {
00647    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0])));
00648 }
00649 
00650 static void GLAPIENTRY VertexAttrib1ubvARB(GLuint index, const GLubyte *v)
00651 {
00652    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
00653 }
00654 
00655 static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
00656 {
00657    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
00658                            UBYTE_TO_FLOAT(v[1])));
00659 }
00660 
00661 static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v)
00662 {
00663    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00664 }
00665 
00666 static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
00667 {
00668    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
00669                            UBYTE_TO_FLOAT(v[1]),
00670                            UBYTE_TO_FLOAT(v[2])));
00671 }
00672 static void GLAPIENTRY VertexAttrib3ubvARB(GLuint index, const GLubyte *v)
00673 {
00674    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00675 }
00676 
00677 static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
00678 {
00679    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
00680                                      UBYTE_TO_FLOAT(v[1]),
00681                                      UBYTE_TO_FLOAT(v[2]),
00682                                      UBYTE_TO_FLOAT(v[3])));
00683 }
00684 
00685 static void GLAPIENTRY VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
00686 {
00687    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00688 }
00689 
00690 /* GL_SHORT attributes */
00691 
00692 static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v)
00693 {
00694    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0])));
00695 }
00696 
00697 static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v)
00698 {
00699    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
00700 }
00701 
00702 static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v)
00703 {
00704    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
00705                            SHORT_TO_FLOAT(v[1])));
00706 }
00707 
00708 static void GLAPIENTRY VertexAttrib2svARB(GLuint index, const GLshort *v)
00709 {
00710    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00711 }
00712 
00713 static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v)
00714 {
00715    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
00716                  SHORT_TO_FLOAT(v[1]),
00717                  SHORT_TO_FLOAT(v[2])));
00718 }
00719 
00720 static void GLAPIENTRY VertexAttrib3svARB(GLuint index, const GLshort *v)
00721 {
00722    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00723 }
00724 
00725 static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v)
00726 {
00727    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
00728                  SHORT_TO_FLOAT(v[1]),
00729                  SHORT_TO_FLOAT(v[2]),
00730                  SHORT_TO_FLOAT(v[3])));
00731 }
00732 
00733 static void GLAPIENTRY VertexAttrib4svARB(GLuint index, const GLshort *v)
00734 {
00735    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00736 }
00737 
00738 /* GL_UNSIGNED_SHORT attributes */
00739 
00740 static void GLAPIENTRY VertexAttrib1NusvARB(GLuint index, const GLushort *v)
00741 {
00742    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0])));
00743 }
00744 
00745 static void GLAPIENTRY VertexAttrib1usvARB(GLuint index, const GLushort *v)
00746 {
00747    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
00748 }
00749 
00750 static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v)
00751 {
00752    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
00753                  USHORT_TO_FLOAT(v[1])));
00754 }
00755 
00756 static void GLAPIENTRY VertexAttrib2usvARB(GLuint index, const GLushort *v)
00757 {
00758    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00759 }
00760 
00761 static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v)
00762 {
00763    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
00764                            USHORT_TO_FLOAT(v[1]),
00765                            USHORT_TO_FLOAT(v[2])));
00766 }
00767 
00768 static void GLAPIENTRY VertexAttrib3usvARB(GLuint index, const GLushort *v)
00769 {
00770    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00771 }
00772 
00773 static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v)
00774 {
00775    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
00776                            USHORT_TO_FLOAT(v[1]),
00777                            USHORT_TO_FLOAT(v[2]),
00778                            USHORT_TO_FLOAT(v[3])));
00779 }
00780 
00781 static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v)
00782 {
00783    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00784 }
00785 
00786 /* GL_INT attributes */
00787 
00788 static void GLAPIENTRY VertexAttrib1NivARB(GLuint index, const GLint *v)
00789 {
00790    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0])));
00791 }
00792 
00793 static void GLAPIENTRY VertexAttrib1ivARB(GLuint index, const GLint *v)
00794 {
00795    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
00796 }
00797 
00798 static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v)
00799 {
00800    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
00801                            INT_TO_FLOAT(v[1])));
00802 }
00803 
00804 static void GLAPIENTRY VertexAttrib2ivARB(GLuint index, const GLint *v)
00805 {
00806    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00807 }
00808 
00809 static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v)
00810 {
00811    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
00812                            INT_TO_FLOAT(v[1]),
00813                            INT_TO_FLOAT(v[2])));
00814 }
00815 
00816 static void GLAPIENTRY VertexAttrib3ivARB(GLuint index, const GLint *v)
00817 {
00818    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00819 }
00820 
00821 static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v)
00822 {
00823    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
00824                            INT_TO_FLOAT(v[1]),
00825                            INT_TO_FLOAT(v[2]),
00826                            INT_TO_FLOAT(v[3])));
00827 }
00828 
00829 static void GLAPIENTRY VertexAttrib4ivARB(GLuint index, const GLint *v)
00830 {
00831    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00832 }
00833 
00834 /* GL_UNSIGNED_INT attributes */
00835 
00836 static void GLAPIENTRY VertexAttrib1NuivARB(GLuint index, const GLuint *v)
00837 {
00838    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0])));
00839 }
00840 
00841 static void GLAPIENTRY VertexAttrib1uivARB(GLuint index, const GLuint *v)
00842 {
00843    CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
00844 }
00845 
00846 static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v)
00847 {
00848    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
00849                            UINT_TO_FLOAT(v[1])));
00850 }
00851 
00852 static void GLAPIENTRY VertexAttrib2uivARB(GLuint index, const GLuint *v)
00853 {
00854    CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
00855 }
00856 
00857 static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v)
00858 {
00859    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
00860                            UINT_TO_FLOAT(v[1]),
00861                            UINT_TO_FLOAT(v[2])));
00862 }
00863 
00864 static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v)
00865 {
00866    CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
00867 }
00868 
00869 static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v)
00870 {
00871    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
00872                            UINT_TO_FLOAT(v[1]),
00873                            UINT_TO_FLOAT(v[2]),
00874                            UINT_TO_FLOAT(v[3])));
00875 }
00876 
00877 static void GLAPIENTRY VertexAttrib4uivARB(GLuint index, const GLuint *v)
00878 {
00879    CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
00880 }
00881 
00882 /* GL_FLOAT attributes */
00883 
00884 static void GLAPIENTRY VertexAttrib1fvARB(GLuint index, const GLfloat *v)
00885 {
00886    CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index, v));
00887 }
00888 
00889 static void GLAPIENTRY VertexAttrib2fvARB(GLuint index, const GLfloat *v)
00890 {
00891    CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index, v));
00892 }
00893 
00894 static void GLAPIENTRY VertexAttrib3fvARB(GLuint index, const GLfloat *v)
00895 {
00896    CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index, v));
00897 }
00898 
00899 static void GLAPIENTRY VertexAttrib4fvARB(GLuint index, const GLfloat *v)
00900 {
00901    CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v));
00902 }
00903 
00904 /* GL_DOUBLE attributes */
00905 
00906 static void GLAPIENTRY VertexAttrib1dvARB(GLuint index, const GLdouble *v)
00907 {
00908    CALL_VertexAttrib1dvARB(GET_DISPATCH(), (index, v));
00909 }
00910 
00911 static void GLAPIENTRY VertexAttrib2dvARB(GLuint index, const GLdouble *v)
00912 {
00913    CALL_VertexAttrib2dvARB(GET_DISPATCH(), (index, v));
00914 }
00915 
00916 static void GLAPIENTRY VertexAttrib3dvARB(GLuint index, const GLdouble *v)
00917 {
00918    CALL_VertexAttrib3dvARB(GET_DISPATCH(), (index, v));
00919 }
00920 
00921 static void GLAPIENTRY VertexAttrib4dvARB(GLuint index, const GLdouble *v)
00922 {
00923    CALL_VertexAttrib4dvARB(GET_DISPATCH(), (index, v));
00924 }
00925 
00926 
00927 /*
00928  * Array [size][type] of VertexAttrib functions
00929  */
00930 static attrib_func AttribFuncsARB[2][4][8] = {
00931    {
00932       /* non-normalized */
00933       {
00934          /* size 1 */
00935          (attrib_func) VertexAttrib1bvARB,
00936          (attrib_func) VertexAttrib1ubvARB,
00937          (attrib_func) VertexAttrib1svARB,
00938          (attrib_func) VertexAttrib1usvARB,
00939          (attrib_func) VertexAttrib1ivARB,
00940          (attrib_func) VertexAttrib1uivARB,
00941          (attrib_func) VertexAttrib1fvARB,
00942          (attrib_func) VertexAttrib1dvARB
00943       },
00944       {
00945          /* size 2 */
00946          (attrib_func) VertexAttrib2bvARB,
00947          (attrib_func) VertexAttrib2ubvARB,
00948          (attrib_func) VertexAttrib2svARB,
00949          (attrib_func) VertexAttrib2usvARB,
00950          (attrib_func) VertexAttrib2ivARB,
00951          (attrib_func) VertexAttrib2uivARB,
00952          (attrib_func) VertexAttrib2fvARB,
00953          (attrib_func) VertexAttrib2dvARB
00954       },
00955       {
00956          /* size 3 */
00957          (attrib_func) VertexAttrib3bvARB,
00958          (attrib_func) VertexAttrib3ubvARB,
00959          (attrib_func) VertexAttrib3svARB,
00960          (attrib_func) VertexAttrib3usvARB,
00961          (attrib_func) VertexAttrib3ivARB,
00962          (attrib_func) VertexAttrib3uivARB,
00963          (attrib_func) VertexAttrib3fvARB,
00964          (attrib_func) VertexAttrib3dvARB
00965       },
00966       {
00967          /* size 4 */
00968          (attrib_func) VertexAttrib4bvARB,
00969          (attrib_func) VertexAttrib4ubvARB,
00970          (attrib_func) VertexAttrib4svARB,
00971          (attrib_func) VertexAttrib4usvARB,
00972          (attrib_func) VertexAttrib4ivARB,
00973          (attrib_func) VertexAttrib4uivARB,
00974          (attrib_func) VertexAttrib4fvARB,
00975          (attrib_func) VertexAttrib4dvARB
00976       }
00977    },
00978    {
00979       /* normalized (except for float/double) */
00980       {
00981          /* size 1 */
00982          (attrib_func) VertexAttrib1NbvARB,
00983          (attrib_func) VertexAttrib1NubvARB,
00984          (attrib_func) VertexAttrib1NsvARB,
00985          (attrib_func) VertexAttrib1NusvARB,
00986          (attrib_func) VertexAttrib1NivARB,
00987          (attrib_func) VertexAttrib1NuivARB,
00988          (attrib_func) VertexAttrib1fvARB,
00989          (attrib_func) VertexAttrib1dvARB
00990       },
00991       {
00992          /* size 2 */
00993          (attrib_func) VertexAttrib2NbvARB,
00994          (attrib_func) VertexAttrib2NubvARB,
00995          (attrib_func) VertexAttrib2NsvARB,
00996          (attrib_func) VertexAttrib2NusvARB,
00997          (attrib_func) VertexAttrib2NivARB,
00998          (attrib_func) VertexAttrib2NuivARB,
00999          (attrib_func) VertexAttrib2fvARB,
01000          (attrib_func) VertexAttrib2dvARB
01001       },
01002       {
01003          /* size 3 */
01004          (attrib_func) VertexAttrib3NbvARB,
01005          (attrib_func) VertexAttrib3NubvARB,
01006          (attrib_func) VertexAttrib3NsvARB,
01007          (attrib_func) VertexAttrib3NusvARB,
01008          (attrib_func) VertexAttrib3NivARB,
01009          (attrib_func) VertexAttrib3NuivARB,
01010          (attrib_func) VertexAttrib3fvARB,
01011          (attrib_func) VertexAttrib3dvARB
01012       },
01013       {
01014          /* size 4 */
01015          (attrib_func) VertexAttrib4NbvARB,
01016          (attrib_func) VertexAttrib4NubvARB,
01017          (attrib_func) VertexAttrib4NsvARB,
01018          (attrib_func) VertexAttrib4NusvARB,
01019          (attrib_func) VertexAttrib4NivARB,
01020          (attrib_func) VertexAttrib4NuivARB,
01021          (attrib_func) VertexAttrib4fvARB,
01022          (attrib_func) VertexAttrib4dvARB
01023       }
01024    }
01025 };
01026 
01027 /**********************************************************************/
01028 
01029 
01030 GLboolean _ae_create_context( GLcontext *ctx )
01031 {
01032    if (ctx->aelt_context)
01033       return GL_TRUE;
01034 
01035    /* These _gloffset_* values may not be compile-time constants */
01036    SecondaryColorFuncs[0] = _gloffset_SecondaryColor3bvEXT;
01037    SecondaryColorFuncs[1] = _gloffset_SecondaryColor3ubvEXT;
01038    SecondaryColorFuncs[2] = _gloffset_SecondaryColor3svEXT;
01039    SecondaryColorFuncs[3] = _gloffset_SecondaryColor3usvEXT;
01040    SecondaryColorFuncs[4] = _gloffset_SecondaryColor3ivEXT;
01041    SecondaryColorFuncs[5] = _gloffset_SecondaryColor3uivEXT;
01042    SecondaryColorFuncs[6] = _gloffset_SecondaryColor3fvEXT;
01043    SecondaryColorFuncs[7] = _gloffset_SecondaryColor3dvEXT;
01044 
01045    FogCoordFuncs[0] = -1;
01046    FogCoordFuncs[1] = -1;
01047    FogCoordFuncs[2] = -1;
01048    FogCoordFuncs[3] = -1;
01049    FogCoordFuncs[4] = -1;
01050    FogCoordFuncs[5] = -1;
01051    FogCoordFuncs[6] = _gloffset_FogCoordfvEXT;
01052    FogCoordFuncs[7] = _gloffset_FogCoorddvEXT;
01053 
01054    ctx->aelt_context = CALLOC( sizeof(AEcontext) );
01055    if (!ctx->aelt_context)
01056       return GL_FALSE;
01057 
01058    AE_CONTEXT(ctx)->NewState = ~0;
01059    return GL_TRUE;
01060 }
01061 
01062 
01063 void _ae_destroy_context( GLcontext *ctx )
01064 {
01065    if ( AE_CONTEXT( ctx ) ) {
01066       FREE( ctx->aelt_context );
01067       ctx->aelt_context = NULL;
01068    }
01069 }
01070 
01071 static void check_vbo( AEcontext *actx,
01072                struct gl_buffer_object *vbo )
01073 {
01074    if (vbo->Name && !vbo->Pointer) {
01075       GLuint i;
01076       for (i = 0; i < actx->nr_vbos; i++)
01077      if (actx->vbo[i] == vbo)
01078         return;
01079       assert(actx->nr_vbos < VERT_ATTRIB_MAX);
01080       actx->vbo[actx->nr_vbos++] = vbo;
01081    }
01082 }
01083 
01084 
01091 static void _ae_update_state( GLcontext *ctx )
01092 {
01093    AEcontext *actx = AE_CONTEXT(ctx);
01094    AEarray *aa = actx->arrays;
01095    AEattrib *at = actx->attribs;
01096    GLuint i;
01097 
01098    actx->nr_vbos = 0;
01099 
01100    /* conventional vertex arrays */
01101   if (ctx->Array.ArrayObj->Index.Enabled) {
01102       aa->array = &ctx->Array.ArrayObj->Index;
01103       aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
01104       check_vbo(actx, aa->array->BufferObj);
01105       aa++;
01106    }
01107    if (ctx->Array.ArrayObj->EdgeFlag.Enabled) {
01108       aa->array = &ctx->Array.ArrayObj->EdgeFlag;
01109       aa->offset = _gloffset_EdgeFlagv;
01110       check_vbo(actx, aa->array->BufferObj);
01111       aa++;
01112    }
01113    if (ctx->Array.ArrayObj->Normal.Enabled) {
01114       aa->array = &ctx->Array.ArrayObj->Normal;
01115       aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
01116       check_vbo(actx, aa->array->BufferObj);
01117       aa++;
01118    }
01119    if (ctx->Array.ArrayObj->Color.Enabled) {
01120       aa->array = &ctx->Array.ArrayObj->Color;
01121       aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
01122       check_vbo(actx, aa->array->BufferObj);
01123       aa++;
01124    }
01125    if (ctx->Array.ArrayObj->SecondaryColor.Enabled) {
01126       aa->array = &ctx->Array.ArrayObj->SecondaryColor;
01127       aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
01128       check_vbo(actx, aa->array->BufferObj);
01129       aa++;
01130    }
01131    if (ctx->Array.ArrayObj->FogCoord.Enabled) {
01132       aa->array = &ctx->Array.ArrayObj->FogCoord;
01133       aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
01134       check_vbo(actx, aa->array->BufferObj);
01135       aa++;
01136    }
01137    for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
01138       struct gl_client_array *attribArray = &ctx->Array.ArrayObj->TexCoord[i];
01139       if (attribArray->Enabled) {
01140          /* NOTE: we use generic glVertexAttribNV functions here.
01141           * If we ever remove GL_NV_vertex_program this will have to change.
01142           */
01143          at->array = attribArray;
01144          ASSERT(!at->array->Normalized);
01145          at->func = AttribFuncsNV[at->array->Normalized]
01146                                  [at->array->Size-1]
01147                                  [TYPE_IDX(at->array->Type)];
01148          at->index = VERT_ATTRIB_TEX0 + i;
01149      check_vbo(actx, at->array->BufferObj);
01150          at++;
01151       }
01152    }
01153 
01154    /* generic vertex attribute arrays */   
01155    for (i = 1; i < VERT_ATTRIB_MAX; i++) {  /* skip zero! */
01156       struct gl_client_array *attribArray = &ctx->Array.ArrayObj->VertexAttrib[i];
01157       if (attribArray->Enabled) {
01158          at->array = attribArray;
01159          /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
01160           * function pointer here (for float arrays) since the pointer may
01161           * change from one execution of _ae_loopback_array_elt() to
01162           * the next.  Doing so caused UT to break.
01163           */
01164          if (ctx->VertexProgram._Enabled
01165              && ctx->VertexProgram.Current->IsNVProgram) {
01166             at->func = AttribFuncsNV[at->array->Normalized]
01167                                     [at->array->Size-1]
01168                                     [TYPE_IDX(at->array->Type)];
01169          }
01170          else {
01171             at->func = AttribFuncsARB[at->array->Normalized]
01172                                      [at->array->Size-1]
01173                                      [TYPE_IDX(at->array->Type)];
01174          }
01175          at->index = i;
01176      check_vbo(actx, at->array->BufferObj);
01177          at++;
01178       }
01179    }
01180 
01181    /* finally, vertex position */
01182    if (ctx->Array.ArrayObj->VertexAttrib[0].Enabled) {
01183       /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
01184        * issued as the last (provoking) attribute).
01185        */
01186       aa->array = &ctx->Array.ArrayObj->VertexAttrib[0];
01187       assert(aa->array->Size >= 2); /* XXX fix someday? */
01188       aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
01189       check_vbo(actx, aa->array->BufferObj);
01190       aa++;
01191    }
01192    else if (ctx->Array.ArrayObj->Vertex.Enabled) {
01193       aa->array = &ctx->Array.ArrayObj->Vertex;
01194       aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
01195       check_vbo(actx, aa->array->BufferObj);
01196       aa++;
01197    }
01198 
01199    check_vbo(actx, ctx->Array.ElementArrayBufferObj);
01200 
01201    ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX);
01202    ASSERT(aa - actx->arrays < 32);
01203    at->func = NULL;  /* terminate the list */
01204    aa->offset = -1;  /* terminate the list */
01205 
01206    actx->NewState = 0;
01207 }
01208 
01209 void _ae_map_vbos( GLcontext *ctx )
01210 {
01211    AEcontext *actx = AE_CONTEXT(ctx);
01212    GLuint i;
01213    
01214    if (actx->mapped_vbos)
01215       return;
01216 
01217    if (actx->NewState)
01218       _ae_update_state(ctx);
01219 
01220    for (i = 0; i < actx->nr_vbos; i++)
01221       ctx->Driver.MapBuffer(ctx,
01222                 GL_ARRAY_BUFFER_ARB,
01223                 GL_DYNAMIC_DRAW_ARB,
01224                 actx->vbo[i]);
01225 
01226    if (actx->nr_vbos)
01227       actx->mapped_vbos = GL_TRUE;
01228 }
01229 
01230 void _ae_unmap_vbos( GLcontext *ctx )
01231 {
01232    AEcontext *actx = AE_CONTEXT(ctx);
01233    GLuint i;
01234 
01235    if (!actx->mapped_vbos)
01236       return;
01237 
01238    assert (!actx->NewState);
01239 
01240    for (i = 0; i < actx->nr_vbos; i++)
01241       ctx->Driver.UnmapBuffer(ctx,
01242                   GL_ARRAY_BUFFER_ARB,
01243                   actx->vbo[i]);
01244 
01245    actx->mapped_vbos = GL_FALSE;
01246 }
01247 
01248 
01255 void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
01256 {
01257    GET_CURRENT_CONTEXT(ctx);
01258    const AEcontext *actx = AE_CONTEXT(ctx);
01259    const AEarray *aa;
01260    const AEattrib *at;
01261    const struct _glapi_table * const disp = GET_DISPATCH();
01262    GLboolean do_map;
01263 
01264    if (actx->NewState) {
01265       assert(!actx->mapped_vbos);
01266       _ae_update_state( ctx );
01267    }
01268 
01269    do_map = actx->nr_vbos && !actx->mapped_vbos;
01270 
01271    /* 
01272     */
01273    if (do_map)
01274       _ae_map_vbos(ctx);
01275    
01276    /* generic attributes */
01277    for (at = actx->attribs; at->func; at++) {
01278       const GLubyte *src
01279          = ADD_POINTERS(at->array->BufferObj->Pointer, at->array->Ptr)
01280          + elt * at->array->StrideB;
01281       at->func( at->index, src );
01282    }
01283 
01284    /* conventional arrays */
01285    for (aa = actx->arrays; aa->offset != -1 ; aa++) {
01286       const GLubyte *src
01287          = ADD_POINTERS(aa->array->BufferObj->Pointer, aa->array->Ptr)
01288          + elt * aa->array->StrideB;
01289       CALL_by_offset( disp, (array_func), aa->offset, 
01290               ((const void *) src) );
01291    }
01292 
01293    if (do_map)
01294       _ae_unmap_vbos(ctx);
01295 }
01296 
01297 
01298 void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
01299 {
01300    AEcontext *actx = AE_CONTEXT(ctx);
01301 
01302    
01303    /* Only interested in this subset of mesa state.  Need to prune
01304     * this down as both tnl/ and the drivers can raise statechanges
01305     * for arcane reasons in the middle of seemingly atomic operations
01306     * like DrawElements, over which we'd like to keep a known set of
01307     * arrays and vbo's mapped.  
01308     *
01309     * Luckily, neither the drivers nor tnl muck with the state that
01310     * concerns us here:
01311     */
01312    new_state &= _NEW_ARRAY | _NEW_PROGRAM;
01313    if (new_state) {
01314       assert(!actx->mapped_vbos);
01315       actx->NewState |= new_state;
01316    }
01317 }

Generated on Sun May 27 2012 04:20:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.