Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | 610d599 | 2003-01-14 04:55:45 +0000 | [diff] [blame] | 3 | * Version: 5.1 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 4 | * |
Brian Paul | 92f9785 | 2003-05-01 22:44:02 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the "Software"), |
| 9 | * to deal in the Software without restriction, including without limitation |
| 10 | * 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 Whitwell | fc00cbe | 2001-12-20 15:30:45 +0000 | [diff] [blame] | 25 | /* Author: |
Brian Paul | 05a4b37 | 2002-10-29 20:28:36 +0000 | [diff] [blame] | 26 | * Keith Whitwell <keith@tungstengraphics.com> |
Keith Whitwell | fc00cbe | 2001-12-20 15:30:45 +0000 | [diff] [blame] | 27 | */ |
| 28 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 29 | #include "glheader.h" |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 30 | #include "api_arrayelt.h" |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 31 | #include "context.h" |
Keith Whitwell | fc00cbe | 2001-12-20 15:30:45 +0000 | [diff] [blame] | 32 | #include "glapi.h" |
Brian Paul | 3c63452 | 2002-10-24 23:57:19 +0000 | [diff] [blame] | 33 | #include "imports.h" |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 34 | #include "macros.h" |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 35 | #include "mtypes.h" |
| 36 | |
| 37 | |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 38 | typedef void (*texarray_func)( GLenum, const void * ); |
| 39 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 40 | typedef struct { |
| 41 | GLint unit; |
| 42 | struct gl_client_array *array; |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 43 | texarray_func func; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 44 | } AEtexarray; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 45 | |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 46 | typedef void (*array_func)( const void * ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 47 | |
| 48 | typedef struct { |
| 49 | struct gl_client_array *array; |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 50 | array_func func; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 51 | } AEarray; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 52 | |
| 53 | typedef struct { |
Brian Paul | 610d599 | 2003-01-14 04:55:45 +0000 | [diff] [blame] | 54 | AEtexarray texarrays[MAX_TEXTURE_COORD_UNITS + 1]; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 55 | AEarray arrays[32]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 56 | GLuint NewState; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 57 | } AEcontext; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 58 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 59 | #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) |
| 60 | #define TYPE_IDX(t) ((t) & 0xf) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 61 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 62 | static void (*colorfuncs[2][8])( const void * ) = { |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 63 | { (array_func)glColor3bv, |
Keith Whitwell | 306d3fc | 2002-04-09 16:56:50 +0000 | [diff] [blame] | 64 | (array_func)glColor3ubv, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 65 | (array_func)glColor3sv, |
| 66 | (array_func)glColor3usv, |
| 67 | (array_func)glColor3iv, |
| 68 | (array_func)glColor3uiv, |
| 69 | (array_func)glColor3fv, |
| 70 | (array_func)glColor3dv }, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 71 | |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 72 | { (array_func)glColor4bv, |
Keith Whitwell | 306d3fc | 2002-04-09 16:56:50 +0000 | [diff] [blame] | 73 | (array_func)glColor4ubv, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 74 | (array_func)glColor4sv, |
| 75 | (array_func)glColor4usv, |
| 76 | (array_func)glColor4iv, |
| 77 | (array_func)glColor4uiv, |
| 78 | (array_func)glColor4fv, |
| 79 | (array_func)glColor4dv } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 82 | static void (*vertexfuncs[3][8])( const void * ) = { |
| 83 | { 0, |
| 84 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 85 | (array_func)glVertex2sv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 86 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 87 | (array_func)glVertex2iv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 88 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 89 | (array_func)glVertex2fv, |
| 90 | (array_func)glVertex2dv }, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 91 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 92 | { 0, |
| 93 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 94 | (array_func)glVertex3sv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 95 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 96 | (array_func)glVertex3iv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 97 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 98 | (array_func)glVertex3fv, |
| 99 | (array_func)glVertex3dv }, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 100 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 101 | { 0, |
| 102 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 103 | (array_func)glVertex4sv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 104 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 105 | (array_func)glVertex4iv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 106 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 107 | (array_func)glVertex4fv, |
| 108 | (array_func)glVertex4dv } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 109 | }; |
| 110 | |
| 111 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 112 | static void (*multitexfuncs[4][8])( GLenum, const void * ) = { |
| 113 | { 0, |
| 114 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 115 | (texarray_func)glMultiTexCoord1svARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 116 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 117 | (texarray_func)glMultiTexCoord1ivARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 118 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 119 | (texarray_func)glMultiTexCoord1fvARB, |
| 120 | (texarray_func)glMultiTexCoord1dvARB }, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 121 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 122 | { 0, |
| 123 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 124 | (texarray_func)glMultiTexCoord2svARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 125 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 126 | (texarray_func)glMultiTexCoord2ivARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 127 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 128 | (texarray_func)glMultiTexCoord2fvARB, |
| 129 | (texarray_func)glMultiTexCoord2dvARB }, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 130 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 131 | { 0, |
| 132 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 133 | (texarray_func)glMultiTexCoord3svARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 134 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 135 | (texarray_func)glMultiTexCoord3ivARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 136 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 137 | (texarray_func)glMultiTexCoord3fvARB, |
| 138 | (texarray_func)glMultiTexCoord3dvARB }, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 139 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 140 | { 0, |
| 141 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 142 | (texarray_func)glMultiTexCoord4svARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 143 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 144 | (texarray_func)glMultiTexCoord4ivARB, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 145 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 146 | (texarray_func)glMultiTexCoord4fvARB, |
| 147 | (texarray_func)glMultiTexCoord4dvARB } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 148 | }; |
| 149 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 150 | static void (*indexfuncs[8])( const void * ) = { |
| 151 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 152 | (array_func)glIndexubv, |
| 153 | (array_func)glIndexsv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 154 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 155 | (array_func)glIndexiv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 156 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 157 | (array_func)glIndexfv, |
| 158 | (array_func)glIndexdv |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 159 | }; |
| 160 | |
| 161 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 162 | static void (*normalfuncs[8])( const void * ) = { |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 163 | (array_func)glNormal3bv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 164 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 165 | (array_func)glNormal3sv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 166 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 167 | (array_func)glNormal3iv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 168 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 169 | (array_func)glNormal3fv, |
| 170 | (array_func)glNormal3dv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 171 | }; |
| 172 | |
Brian Paul | 03c0c2e | 2002-01-14 16:06:35 +0000 | [diff] [blame] | 173 | |
| 174 | /* Wrapper functions in case glSecondaryColor*EXT doesn't exist */ |
| 175 | static void SecondaryColor3bvEXT(const GLbyte *c) |
| 176 | { |
| 177 | _glapi_Dispatch->SecondaryColor3bvEXT(c); |
| 178 | } |
| 179 | |
| 180 | static void SecondaryColor3ubvEXT(const GLubyte *c) |
| 181 | { |
| 182 | _glapi_Dispatch->SecondaryColor3ubvEXT(c); |
| 183 | } |
| 184 | |
| 185 | static void SecondaryColor3svEXT(const GLshort *c) |
| 186 | { |
| 187 | _glapi_Dispatch->SecondaryColor3svEXT(c); |
| 188 | } |
| 189 | |
| 190 | static void SecondaryColor3usvEXT(const GLushort *c) |
| 191 | { |
| 192 | _glapi_Dispatch->SecondaryColor3usvEXT(c); |
| 193 | } |
| 194 | |
| 195 | static void SecondaryColor3ivEXT(const GLint *c) |
| 196 | { |
| 197 | _glapi_Dispatch->SecondaryColor3ivEXT(c); |
| 198 | } |
| 199 | |
| 200 | static void SecondaryColor3uivEXT(const GLuint *c) |
| 201 | { |
| 202 | _glapi_Dispatch->SecondaryColor3uivEXT(c); |
| 203 | } |
| 204 | |
| 205 | static void SecondaryColor3fvEXT(const GLfloat *c) |
| 206 | { |
| 207 | _glapi_Dispatch->SecondaryColor3fvEXT(c); |
| 208 | } |
| 209 | |
| 210 | static void SecondaryColor3dvEXT(const GLdouble *c) |
| 211 | { |
| 212 | _glapi_Dispatch->SecondaryColor3dvEXT(c); |
| 213 | } |
| 214 | |
| 215 | static void (*secondarycolorfuncs[8])( const void * ) = { |
| 216 | (array_func) SecondaryColor3bvEXT, |
| 217 | (array_func) SecondaryColor3ubvEXT, |
| 218 | (array_func) SecondaryColor3svEXT, |
| 219 | (array_func) SecondaryColor3usvEXT, |
| 220 | (array_func) SecondaryColor3ivEXT, |
| 221 | (array_func) SecondaryColor3uivEXT, |
| 222 | (array_func) SecondaryColor3fvEXT, |
| 223 | (array_func) SecondaryColor3dvEXT, |
| 224 | }; |
| 225 | |
| 226 | |
| 227 | /* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */ |
| 228 | static void FogCoordfvEXT(const GLfloat *f) |
| 229 | { |
| 230 | _glapi_Dispatch->FogCoordfvEXT(f); |
| 231 | } |
| 232 | |
| 233 | static void FogCoorddvEXT(const GLdouble *f) |
| 234 | { |
| 235 | _glapi_Dispatch->FogCoorddvEXT(f); |
| 236 | } |
| 237 | |
| 238 | static void (*fogcoordfuncs[8])( const void * ) = { |
| 239 | 0, |
| 240 | 0, |
| 241 | 0, |
| 242 | 0, |
| 243 | 0, |
| 244 | 0, |
| 245 | (array_func) FogCoordfvEXT, |
| 246 | (array_func) FogCoorddvEXT |
| 247 | }; |
| 248 | |
| 249 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 250 | |
| 251 | GLboolean _ae_create_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 252 | { |
Keith Whitwell | ae0eaf9 | 2003-11-24 15:23:18 +0000 | [diff] [blame] | 253 | if (ctx->aelt_context) |
| 254 | return GL_TRUE; |
| 255 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 256 | ctx->aelt_context = MALLOC( sizeof(AEcontext) ); |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 257 | if (!ctx->aelt_context) |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 258 | return GL_FALSE; |
| 259 | |
| 260 | AE_CONTEXT(ctx)->NewState = ~0; |
| 261 | return GL_TRUE; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 262 | } |
| 263 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 264 | |
| 265 | void _ae_destroy_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 266 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 267 | if ( AE_CONTEXT( ctx ) ) { |
| 268 | FREE( ctx->aelt_context ); |
| 269 | ctx->aelt_context = 0; |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | |
| 274 | static void _ae_update_state( GLcontext *ctx ) |
| 275 | { |
| 276 | AEcontext *actx = AE_CONTEXT(ctx); |
| 277 | AEtexarray *ta = actx->texarrays; |
| 278 | AEarray *aa = actx->arrays; |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 279 | GLuint i; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 280 | |
Brian Paul | 92f9785 | 2003-05-01 22:44:02 +0000 | [diff] [blame] | 281 | for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 282 | if (ctx->Array.TexCoord[i].Enabled) { |
| 283 | ta->unit = i; |
| 284 | ta->array = &ctx->Array.TexCoord[i]; |
| 285 | ta->func = multitexfuncs[ta->array->Size-1][TYPE_IDX(ta->array->Type)]; |
| 286 | ta++; |
| 287 | } |
| 288 | |
| 289 | ta->func = 0; |
| 290 | |
| 291 | if (ctx->Array.Color.Enabled) { |
| 292 | aa->array = &ctx->Array.Color; |
| 293 | aa->func = colorfuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; |
| 294 | aa++; |
| 295 | } |
| 296 | |
| 297 | if (ctx->Array.Normal.Enabled) { |
| 298 | aa->array = &ctx->Array.Normal; |
| 299 | aa->func = normalfuncs[TYPE_IDX(aa->array->Type)]; |
| 300 | aa++; |
| 301 | } |
| 302 | |
| 303 | if (ctx->Array.Index.Enabled) { |
| 304 | aa->array = &ctx->Array.Index; |
| 305 | aa->func = indexfuncs[TYPE_IDX(aa->array->Type)]; |
| 306 | aa++; |
| 307 | } |
| 308 | |
| 309 | if (ctx->Array.EdgeFlag.Enabled) { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 310 | aa->array = &ctx->Array.EdgeFlag; |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 311 | aa->func = (array_func)glEdgeFlagv; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 312 | aa++; |
| 313 | } |
| 314 | |
| 315 | if (ctx->Array.FogCoord.Enabled) { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 316 | aa->array = &ctx->Array.FogCoord; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 317 | aa->func = fogcoordfuncs[TYPE_IDX(aa->array->Type)]; |
| 318 | aa++; |
| 319 | } |
| 320 | |
| 321 | if (ctx->Array.SecondaryColor.Enabled) { |
| 322 | aa->array = &ctx->Array.SecondaryColor; |
| 323 | aa->func = secondarycolorfuncs[TYPE_IDX(aa->array->Type)]; |
| 324 | aa++; |
| 325 | } |
| 326 | |
| 327 | /* Must be last |
| 328 | */ |
| 329 | if (ctx->Array.Vertex.Enabled) { |
| 330 | aa->array = &ctx->Array.Vertex; |
| 331 | aa->func = vertexfuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
| 332 | aa++; |
| 333 | } |
| 334 | |
| 335 | aa->func = 0; |
| 336 | actx->NewState = 0; |
| 337 | } |
| 338 | |
| 339 | |
Karl Schultz | d674569 | 2003-12-04 20:23:44 +0000 | [diff] [blame^] | 340 | void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 341 | { |
| 342 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 343 | AEcontext *actx = AE_CONTEXT(ctx); |
| 344 | AEtexarray *ta; |
| 345 | AEarray *aa; |
| 346 | |
| 347 | if (actx->NewState) |
| 348 | _ae_update_state( ctx ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 349 | |
| 350 | for (ta = actx->texarrays ; ta->func ; ta++) { |
Brian Paul | 57d882b | 2003-09-17 16:06:49 +0000 | [diff] [blame] | 351 | GLubyte *src = ta->array->BufferObj->Data |
| 352 | + (GLuint) ta->array->Ptr |
| 353 | + elt * ta->array->StrideB; |
| 354 | ta->func( ta->unit + GL_TEXTURE0_ARB, src); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 355 | } |
| 356 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 357 | /* Must be last |
| 358 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 359 | for (aa = actx->arrays ; aa->func ; aa++) { |
Brian Paul | 57d882b | 2003-09-17 16:06:49 +0000 | [diff] [blame] | 360 | GLubyte *src = aa->array->BufferObj->Data |
| 361 | + (GLuint) aa->array->Ptr |
| 362 | + elt * aa->array->StrideB; |
| 363 | aa->func( src ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 364 | } |
| 365 | } |
| 366 | |
| 367 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 368 | |
| 369 | void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 370 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 371 | AE_CONTEXT(ctx)->NewState |= new_state; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 372 | } |