Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 3 | * Version: 6.1 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 4 | * |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2004 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 | |
Karl Schultz | b72902e | 2004-01-28 22:24:12 +0000 | [diff] [blame] | 37 | typedef void (GLAPIENTRY *array_func)( const void * ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 38 | |
| 39 | typedef struct { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 40 | const struct gl_client_array *array; |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 41 | array_func func; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 42 | } AEarray; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 43 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 44 | typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data ); |
| 45 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 46 | typedef struct { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 47 | const struct gl_client_array *array; |
| 48 | attrib_func func; |
| 49 | GLuint index; |
| 50 | } AEattrib; |
| 51 | |
| 52 | typedef struct { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 53 | AEarray arrays[32]; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 54 | AEattrib attribs[VERT_ATTRIB_MAX + 1]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 55 | GLuint NewState; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 56 | } AEcontext; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 57 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 58 | #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 59 | |
| 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 Paul | f2f3350 | 2004-04-23 17:58:06 +0000 | [diff] [blame] | 63 | * numbered in gl.h, except for GL_DOUBLE. |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 64 | */ |
Brian Paul | f2f3350 | 2004-04-23 17:58:06 +0000 | [diff] [blame] | 65 | #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 66 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 67 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 68 | static array_func ColorFuncs[2][8] = { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 69 | { (array_func)glColor3bv, |
| 70 | (array_func)glColor3ubv, |
| 71 | (array_func)glColor3sv, |
| 72 | (array_func)glColor3usv, |
| 73 | (array_func)glColor3iv, |
| 74 | (array_func)glColor3uiv, |
| 75 | (array_func)glColor3fv, |
| 76 | (array_func)glColor3dv }, |
| 77 | |
| 78 | { (array_func)glColor4bv, |
| 79 | (array_func)glColor4ubv, |
| 80 | (array_func)glColor4sv, |
| 81 | (array_func)glColor4usv, |
| 82 | (array_func)glColor4iv, |
| 83 | (array_func)glColor4uiv, |
| 84 | (array_func)glColor4fv, |
| 85 | (array_func)glColor4dv } |
| 86 | }; |
| 87 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 88 | static array_func VertexFuncs[3][8] = { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 89 | { 0, |
| 90 | 0, |
| 91 | (array_func)glVertex2sv, |
| 92 | 0, |
| 93 | (array_func)glVertex2iv, |
| 94 | 0, |
| 95 | (array_func)glVertex2fv, |
| 96 | (array_func)glVertex2dv }, |
| 97 | |
| 98 | { 0, |
| 99 | 0, |
| 100 | (array_func)glVertex3sv, |
| 101 | 0, |
| 102 | (array_func)glVertex3iv, |
| 103 | 0, |
| 104 | (array_func)glVertex3fv, |
| 105 | (array_func)glVertex3dv }, |
| 106 | |
| 107 | { 0, |
| 108 | 0, |
| 109 | (array_func)glVertex4sv, |
| 110 | 0, |
| 111 | (array_func)glVertex4iv, |
| 112 | 0, |
| 113 | (array_func)glVertex4fv, |
| 114 | (array_func)glVertex4dv } |
| 115 | }; |
| 116 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 117 | static array_func IndexFuncs[8] = { |
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 | (array_func)glIndexubv, |
| 120 | (array_func)glIndexsv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 121 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 122 | (array_func)glIndexiv, |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 123 | 0, |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 124 | (array_func)glIndexfv, |
| 125 | (array_func)glIndexdv |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 126 | }; |
| 127 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 128 | static array_func NormalFuncs[8] = { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 129 | (array_func)glNormal3bv, |
| 130 | 0, |
| 131 | (array_func)glNormal3sv, |
| 132 | 0, |
| 133 | (array_func)glNormal3iv, |
| 134 | 0, |
| 135 | (array_func)glNormal3fv, |
| 136 | (array_func)glNormal3dv, |
| 137 | }; |
| 138 | |
| 139 | |
| 140 | /* Wrapper functions in case glSecondaryColor*EXT doesn't exist */ |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 141 | static void GLAPIENTRY SecondaryColor3bvEXT(const GLbyte *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 142 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 143 | GL_CALL(SecondaryColor3bvEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 144 | } |
| 145 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 146 | static void GLAPIENTRY SecondaryColor3ubvEXT(const GLubyte *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 147 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 148 | GL_CALL(SecondaryColor3ubvEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 149 | } |
| 150 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 151 | static void GLAPIENTRY SecondaryColor3svEXT(const GLshort *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 152 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 153 | GL_CALL(SecondaryColor3svEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 154 | } |
| 155 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 156 | static void GLAPIENTRY SecondaryColor3usvEXT(const GLushort *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 157 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 158 | GL_CALL(SecondaryColor3usvEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 161 | static void GLAPIENTRY SecondaryColor3ivEXT(const GLint *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 162 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 163 | GL_CALL(SecondaryColor3ivEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 164 | } |
| 165 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 166 | static void GLAPIENTRY SecondaryColor3uivEXT(const GLuint *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 167 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 168 | GL_CALL(SecondaryColor3uivEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 169 | } |
| 170 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 171 | static void GLAPIENTRY SecondaryColor3fvEXT(const GLfloat *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 172 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 173 | GL_CALL(SecondaryColor3fvEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 174 | } |
| 175 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 176 | static void GLAPIENTRY SecondaryColor3dvEXT(const GLdouble *c) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 177 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 178 | GL_CALL(SecondaryColor3dvEXT)(c); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 179 | } |
| 180 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 181 | static array_func SecondaryColorFuncs[8] = { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 182 | (array_func) SecondaryColor3bvEXT, |
| 183 | (array_func) SecondaryColor3ubvEXT, |
| 184 | (array_func) SecondaryColor3svEXT, |
| 185 | (array_func) SecondaryColor3usvEXT, |
| 186 | (array_func) SecondaryColor3ivEXT, |
| 187 | (array_func) SecondaryColor3uivEXT, |
| 188 | (array_func) SecondaryColor3fvEXT, |
| 189 | (array_func) SecondaryColor3dvEXT, |
| 190 | }; |
| 191 | |
| 192 | |
| 193 | /* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */ |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 194 | static void GLAPIENTRY FogCoordfvEXT(const GLfloat *f) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 195 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 196 | GL_CALL(FogCoordfvEXT)(f); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 197 | } |
| 198 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 199 | static void GLAPIENTRY FogCoorddvEXT(const GLdouble *f) |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 200 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 201 | GL_CALL(FogCoorddvEXT)(f); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 202 | } |
| 203 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 204 | static array_func FogCoordFuncs[8] = { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 205 | 0, |
| 206 | 0, |
| 207 | 0, |
| 208 | 0, |
| 209 | 0, |
| 210 | 0, |
| 211 | (array_func) FogCoordfvEXT, |
| 212 | (array_func) FogCoorddvEXT |
| 213 | }; |
| 214 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 215 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 216 | /**********************************************************************/ |
| 217 | |
| 218 | /* GL_BYTE attributes */ |
| 219 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 220 | static void GLAPIENTRY VertexAttrib1Nbv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 221 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 222 | GL_CALL(VertexAttrib1fNV)(index, BYTE_TO_FLOAT(v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 223 | } |
| 224 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 225 | static void GLAPIENTRY VertexAttrib1bv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 226 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 227 | GL_CALL(VertexAttrib1fNV)(index, v[0]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 230 | static void GLAPIENTRY VertexAttrib2Nbv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 231 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 232 | GL_CALL(VertexAttrib2fNV)(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 235 | static void GLAPIENTRY VertexAttrib2bv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 236 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 237 | GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 238 | } |
| 239 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 240 | static void GLAPIENTRY VertexAttrib3Nbv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 241 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 242 | GL_CALL(VertexAttrib3fNV)(index, BYTE_TO_FLOAT(v[0]), |
| 243 | BYTE_TO_FLOAT(v[1]), |
| 244 | BYTE_TO_FLOAT(v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 245 | } |
| 246 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 247 | static void GLAPIENTRY VertexAttrib3bv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 248 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 249 | GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 250 | } |
| 251 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 252 | static void GLAPIENTRY VertexAttrib4Nbv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 253 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 254 | GL_CALL(VertexAttrib4fNV)(index, BYTE_TO_FLOAT(v[0]), |
| 255 | BYTE_TO_FLOAT(v[1]), |
| 256 | BYTE_TO_FLOAT(v[2]), |
| 257 | BYTE_TO_FLOAT(v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 258 | } |
| 259 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 260 | static void GLAPIENTRY VertexAttrib4bv(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 261 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 262 | GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | /* GL_UNSIGNED_BYTE attributes */ |
| 266 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 267 | static void GLAPIENTRY VertexAttrib1Nubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 268 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 269 | GL_CALL(VertexAttrib1fNV)(index, UBYTE_TO_FLOAT(v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 270 | } |
| 271 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 272 | static void GLAPIENTRY VertexAttrib1ubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 273 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 274 | GL_CALL(VertexAttrib1fNV)(index, v[0]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 275 | } |
| 276 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 277 | static void GLAPIENTRY VertexAttrib2Nubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 278 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 279 | GL_CALL(VertexAttrib2fNV)(index, UBYTE_TO_FLOAT(v[0]), |
| 280 | UBYTE_TO_FLOAT(v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 281 | } |
| 282 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 283 | static void GLAPIENTRY VertexAttrib2ubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 284 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 285 | GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 286 | } |
| 287 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 288 | static void GLAPIENTRY VertexAttrib3Nubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 289 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 290 | GL_CALL(VertexAttrib3fNV)(index, UBYTE_TO_FLOAT(v[0]), |
| 291 | UBYTE_TO_FLOAT(v[1]), |
| 292 | UBYTE_TO_FLOAT(v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 293 | } |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 294 | static void GLAPIENTRY VertexAttrib3ubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 295 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 296 | GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 297 | } |
| 298 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 299 | static void GLAPIENTRY VertexAttrib4Nubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 300 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 301 | GL_CALL(VertexAttrib4fNV)(index, UBYTE_TO_FLOAT(v[0]), |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 302 | UBYTE_TO_FLOAT(v[1]), |
| 303 | UBYTE_TO_FLOAT(v[2]), |
| 304 | UBYTE_TO_FLOAT(v[3])); |
| 305 | } |
| 306 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 307 | static void GLAPIENTRY VertexAttrib4ubv(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 308 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 309 | GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | /* GL_SHORT attributes */ |
| 313 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 314 | static void GLAPIENTRY VertexAttrib1Nsv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 315 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 316 | GL_CALL(VertexAttrib1fNV)(index, SHORT_TO_FLOAT(v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 317 | } |
| 318 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 319 | static void GLAPIENTRY VertexAttrib1sv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 320 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 321 | GL_CALL(VertexAttrib1fNV)(index, v[0]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 322 | } |
| 323 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 324 | static void GLAPIENTRY VertexAttrib2Nsv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 325 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 326 | GL_CALL(VertexAttrib2fNV)(index, SHORT_TO_FLOAT(v[0]), |
| 327 | SHORT_TO_FLOAT(v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 328 | } |
| 329 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 330 | static void GLAPIENTRY VertexAttrib2sv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 331 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 332 | GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 335 | static void GLAPIENTRY VertexAttrib3Nsv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 336 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 337 | GL_CALL(VertexAttrib3fNV)(index, SHORT_TO_FLOAT(v[0]), |
| 338 | SHORT_TO_FLOAT(v[1]), |
| 339 | SHORT_TO_FLOAT(v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 340 | } |
| 341 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 342 | static void GLAPIENTRY VertexAttrib3sv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 343 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 344 | GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 345 | } |
| 346 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 347 | static void GLAPIENTRY VertexAttrib4Nsv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 348 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 349 | GL_CALL(VertexAttrib4fNV)(index, SHORT_TO_FLOAT(v[0]), |
| 350 | SHORT_TO_FLOAT(v[1]), |
| 351 | SHORT_TO_FLOAT(v[2]), |
| 352 | SHORT_TO_FLOAT(v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 353 | } |
| 354 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 355 | static void GLAPIENTRY VertexAttrib4sv(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 356 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 357 | GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | /* GL_UNSIGNED_SHORT attributes */ |
| 361 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 362 | static void GLAPIENTRY VertexAttrib1Nusv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 363 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 364 | GL_CALL(VertexAttrib1fNV)(index, USHORT_TO_FLOAT(v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 365 | } |
| 366 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 367 | static void GLAPIENTRY VertexAttrib1usv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 368 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 369 | GL_CALL(VertexAttrib1fNV)(index, v[0]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 370 | } |
| 371 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 372 | static void GLAPIENTRY VertexAttrib2Nusv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 373 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 374 | GL_CALL(VertexAttrib2fNV)(index, USHORT_TO_FLOAT(v[0]), |
| 375 | USHORT_TO_FLOAT(v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 376 | } |
| 377 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 378 | static void GLAPIENTRY VertexAttrib2usv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 379 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 380 | GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 381 | } |
| 382 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 383 | static void GLAPIENTRY VertexAttrib3Nusv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 384 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 385 | GL_CALL(VertexAttrib3fNV)(index, USHORT_TO_FLOAT(v[0]), |
| 386 | USHORT_TO_FLOAT(v[1]), |
| 387 | USHORT_TO_FLOAT(v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 388 | } |
| 389 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 390 | static void GLAPIENTRY VertexAttrib3usv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 391 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 392 | GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 393 | } |
| 394 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 395 | static void GLAPIENTRY VertexAttrib4Nusv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 396 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 397 | GL_CALL(VertexAttrib4fNV)(index, USHORT_TO_FLOAT(v[0]), |
| 398 | USHORT_TO_FLOAT(v[1]), |
| 399 | USHORT_TO_FLOAT(v[2]), |
| 400 | USHORT_TO_FLOAT(v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 401 | } |
| 402 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 403 | static void GLAPIENTRY VertexAttrib4usv(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 404 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 405 | GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | /* GL_INT attributes */ |
| 409 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 410 | static void GLAPIENTRY VertexAttrib1Niv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 411 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 412 | GL_CALL(VertexAttrib1fNV)(index, INT_TO_FLOAT(v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 413 | } |
| 414 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 415 | static void GLAPIENTRY VertexAttrib1iv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 416 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 417 | GL_CALL(VertexAttrib1fNV)(index, v[0]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 418 | } |
| 419 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 420 | static void GLAPIENTRY VertexAttrib2Niv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 421 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 422 | GL_CALL(VertexAttrib2fNV)(index, INT_TO_FLOAT(v[0]), |
| 423 | INT_TO_FLOAT(v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 424 | } |
| 425 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 426 | static void GLAPIENTRY VertexAttrib2iv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 427 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 428 | GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 429 | } |
| 430 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 431 | static void GLAPIENTRY VertexAttrib3Niv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 432 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 433 | GL_CALL(VertexAttrib3fNV)(index, INT_TO_FLOAT(v[0]), |
| 434 | INT_TO_FLOAT(v[1]), |
| 435 | INT_TO_FLOAT(v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 436 | } |
| 437 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 438 | static void GLAPIENTRY VertexAttrib3iv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 439 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 440 | GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 441 | } |
| 442 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 443 | static void GLAPIENTRY VertexAttrib4Niv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 444 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 445 | GL_CALL(VertexAttrib4fNV)(index, INT_TO_FLOAT(v[0]), |
| 446 | INT_TO_FLOAT(v[1]), |
| 447 | INT_TO_FLOAT(v[2]), |
| 448 | INT_TO_FLOAT(v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 449 | } |
| 450 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 451 | static void GLAPIENTRY VertexAttrib4iv(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 452 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 453 | GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | /* GL_UNSIGNED_INT attributes */ |
| 457 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 458 | static void GLAPIENTRY VertexAttrib1Nuiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 459 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 460 | GL_CALL(VertexAttrib1fNV)(index, UINT_TO_FLOAT(v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 461 | } |
| 462 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 463 | static void GLAPIENTRY VertexAttrib1uiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 464 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 465 | GL_CALL(VertexAttrib1fNV)(index, v[0]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 466 | } |
| 467 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 468 | static void GLAPIENTRY VertexAttrib2Nuiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 469 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 470 | GL_CALL(VertexAttrib2fNV)(index, UINT_TO_FLOAT(v[0]), |
| 471 | UINT_TO_FLOAT(v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 472 | } |
| 473 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 474 | static void GLAPIENTRY VertexAttrib2uiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 475 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 476 | GL_CALL(VertexAttrib2fNV)(index, v[0], v[1]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 477 | } |
| 478 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 479 | static void GLAPIENTRY VertexAttrib3Nuiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 480 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 481 | GL_CALL(VertexAttrib3fNV)(index, UINT_TO_FLOAT(v[0]), |
| 482 | UINT_TO_FLOAT(v[1]), |
| 483 | UINT_TO_FLOAT(v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 484 | } |
| 485 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 486 | static void GLAPIENTRY VertexAttrib3uiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 487 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 488 | GL_CALL(VertexAttrib3fNV)(index, v[0], v[1], v[2]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 489 | } |
| 490 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 491 | static void GLAPIENTRY VertexAttrib4Nuiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 492 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 493 | GL_CALL(VertexAttrib4fNV)(index, UINT_TO_FLOAT(v[0]), |
| 494 | UINT_TO_FLOAT(v[1]), |
| 495 | UINT_TO_FLOAT(v[2]), |
| 496 | UINT_TO_FLOAT(v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 497 | } |
| 498 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 499 | static void GLAPIENTRY VertexAttrib4uiv(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 500 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 501 | GL_CALL(VertexAttrib4fNV)(index, v[0], v[1], v[2], v[3]); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | /* GL_FLOAT attributes */ |
| 505 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 506 | static void GLAPIENTRY VertexAttrib1fv(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 507 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 508 | GL_CALL(VertexAttrib1fvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 509 | } |
| 510 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 511 | static void GLAPIENTRY VertexAttrib2fv(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 512 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 513 | GL_CALL(VertexAttrib2fvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 514 | } |
| 515 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 516 | static void GLAPIENTRY VertexAttrib3fv(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 517 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 518 | GL_CALL(VertexAttrib3fvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 519 | } |
| 520 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 521 | static void GLAPIENTRY VertexAttrib4fv(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 522 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 523 | GL_CALL(VertexAttrib4fvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | /* GL_DOUBLE attributes */ |
| 527 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 528 | static void GLAPIENTRY VertexAttrib1dv(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 529 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 530 | GL_CALL(VertexAttrib1dvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 531 | } |
| 532 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 533 | static void GLAPIENTRY VertexAttrib2dv(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 534 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 535 | GL_CALL(VertexAttrib2dvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 536 | } |
| 537 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 538 | static void GLAPIENTRY VertexAttrib3dv(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 539 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 540 | GL_CALL(VertexAttrib3dvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 541 | } |
| 542 | |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 543 | static void GLAPIENTRY VertexAttrib4dv(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 544 | { |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame^] | 545 | GL_CALL(VertexAttrib4dvNV)(index, v); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | |
| 549 | /* |
| 550 | * Array [size][type] of VertexAttrib functions |
| 551 | */ |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 552 | static attrib_func AttribFuncs[2][4][8] = { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 553 | { |
| 554 | /* non-normalized */ |
| 555 | { |
| 556 | /* size 1 */ |
| 557 | (attrib_func) VertexAttrib1bv, |
| 558 | (attrib_func) VertexAttrib1ubv, |
| 559 | (attrib_func) VertexAttrib1sv, |
| 560 | (attrib_func) VertexAttrib1usv, |
| 561 | (attrib_func) VertexAttrib1iv, |
| 562 | (attrib_func) VertexAttrib1uiv, |
| 563 | (attrib_func) VertexAttrib1fv, |
| 564 | (attrib_func) VertexAttrib1dv |
| 565 | }, |
| 566 | { |
| 567 | /* size 2 */ |
| 568 | (attrib_func) VertexAttrib2bv, |
| 569 | (attrib_func) VertexAttrib2ubv, |
| 570 | (attrib_func) VertexAttrib2sv, |
| 571 | (attrib_func) VertexAttrib2usv, |
| 572 | (attrib_func) VertexAttrib2iv, |
| 573 | (attrib_func) VertexAttrib2uiv, |
| 574 | (attrib_func) VertexAttrib2fv, |
| 575 | (attrib_func) VertexAttrib2dv |
| 576 | }, |
| 577 | { |
| 578 | /* size 3 */ |
| 579 | (attrib_func) VertexAttrib3bv, |
| 580 | (attrib_func) VertexAttrib3ubv, |
| 581 | (attrib_func) VertexAttrib3sv, |
| 582 | (attrib_func) VertexAttrib3usv, |
| 583 | (attrib_func) VertexAttrib3iv, |
| 584 | (attrib_func) VertexAttrib3uiv, |
| 585 | (attrib_func) VertexAttrib3fv, |
| 586 | (attrib_func) VertexAttrib3dv |
| 587 | }, |
| 588 | { |
| 589 | /* size 4 */ |
| 590 | (attrib_func) VertexAttrib4bv, |
| 591 | (attrib_func) VertexAttrib4ubv, |
| 592 | (attrib_func) VertexAttrib4sv, |
| 593 | (attrib_func) VertexAttrib4usv, |
| 594 | (attrib_func) VertexAttrib4iv, |
| 595 | (attrib_func) VertexAttrib4uiv, |
| 596 | (attrib_func) VertexAttrib4fv, |
| 597 | (attrib_func) VertexAttrib4dv |
| 598 | } |
| 599 | }, |
| 600 | { |
| 601 | /* normalized (except for float/double) */ |
| 602 | { |
| 603 | /* size 1 */ |
| 604 | (attrib_func) VertexAttrib1Nbv, |
| 605 | (attrib_func) VertexAttrib1Nubv, |
| 606 | (attrib_func) VertexAttrib1Nsv, |
| 607 | (attrib_func) VertexAttrib1Nusv, |
| 608 | (attrib_func) VertexAttrib1Niv, |
| 609 | (attrib_func) VertexAttrib1Nuiv, |
| 610 | (attrib_func) VertexAttrib1fv, |
| 611 | (attrib_func) VertexAttrib1dv |
| 612 | }, |
| 613 | { |
| 614 | /* size 2 */ |
| 615 | (attrib_func) VertexAttrib2Nbv, |
| 616 | (attrib_func) VertexAttrib2Nubv, |
| 617 | (attrib_func) VertexAttrib2Nsv, |
| 618 | (attrib_func) VertexAttrib2Nusv, |
| 619 | (attrib_func) VertexAttrib2Niv, |
| 620 | (attrib_func) VertexAttrib2Nuiv, |
| 621 | (attrib_func) VertexAttrib2fv, |
| 622 | (attrib_func) VertexAttrib2dv |
| 623 | }, |
| 624 | { |
| 625 | /* size 3 */ |
| 626 | (attrib_func) VertexAttrib3Nbv, |
| 627 | (attrib_func) VertexAttrib3Nubv, |
| 628 | (attrib_func) VertexAttrib3Nsv, |
| 629 | (attrib_func) VertexAttrib3Nusv, |
| 630 | (attrib_func) VertexAttrib3Niv, |
| 631 | (attrib_func) VertexAttrib3Nuiv, |
| 632 | (attrib_func) VertexAttrib3fv, |
| 633 | (attrib_func) VertexAttrib3dv |
| 634 | }, |
| 635 | { |
| 636 | /* size 4 */ |
| 637 | (attrib_func) VertexAttrib4Nbv, |
| 638 | (attrib_func) VertexAttrib4Nubv, |
| 639 | (attrib_func) VertexAttrib4Nsv, |
| 640 | (attrib_func) VertexAttrib4Nusv, |
| 641 | (attrib_func) VertexAttrib4Niv, |
| 642 | (attrib_func) VertexAttrib4Nuiv, |
| 643 | (attrib_func) VertexAttrib4fv, |
| 644 | (attrib_func) VertexAttrib4dv |
| 645 | } |
| 646 | } |
| 647 | }; |
| 648 | |
| 649 | /**********************************************************************/ |
| 650 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 651 | |
| 652 | GLboolean _ae_create_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 653 | { |
Keith Whitwell | ae0eaf9 | 2003-11-24 15:23:18 +0000 | [diff] [blame] | 654 | if (ctx->aelt_context) |
| 655 | return GL_TRUE; |
| 656 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 657 | ctx->aelt_context = MALLOC( sizeof(AEcontext) ); |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 658 | if (!ctx->aelt_context) |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 659 | return GL_FALSE; |
| 660 | |
| 661 | AE_CONTEXT(ctx)->NewState = ~0; |
| 662 | return GL_TRUE; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 663 | } |
| 664 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 665 | |
| 666 | void _ae_destroy_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 667 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 668 | if ( AE_CONTEXT( ctx ) ) { |
| 669 | FREE( ctx->aelt_context ); |
| 670 | ctx->aelt_context = 0; |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 675 | /** |
| 676 | * Make a list of per-vertex functions to call for each glArrayElement call. |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 677 | * These functions access the array data (i.e. glVertex, glColor, glNormal, |
| 678 | * etc). |
| 679 | * Note: this may be called during display list construction. |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 680 | */ |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 681 | static void _ae_update_state( GLcontext *ctx ) |
| 682 | { |
| 683 | AEcontext *actx = AE_CONTEXT(ctx); |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 684 | AEarray *aa = actx->arrays; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 685 | AEattrib *at = actx->attribs; |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 686 | GLuint i; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 687 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 688 | /* conventional vertex arrays */ |
| 689 | if (ctx->Array.Index.Enabled) { |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 690 | aa->array = &ctx->Array.Index; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 691 | aa->func = IndexFuncs[TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 692 | aa++; |
| 693 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 694 | if (ctx->Array.EdgeFlag.Enabled) { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 695 | aa->array = &ctx->Array.EdgeFlag; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 696 | aa->func = (array_func) glEdgeFlagv; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 697 | aa++; |
| 698 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 699 | if (ctx->Array.Normal.Enabled) { |
| 700 | aa->array = &ctx->Array.Normal; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 701 | aa->func = NormalFuncs[TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 702 | aa++; |
| 703 | } |
| 704 | if (ctx->Array.Color.Enabled) { |
| 705 | aa->array = &ctx->Array.Color; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 706 | aa->func = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 707 | aa++; |
| 708 | } |
| 709 | if (ctx->Array.SecondaryColor.Enabled) { |
| 710 | aa->array = &ctx->Array.SecondaryColor; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 711 | aa->func = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 712 | aa++; |
| 713 | } |
| 714 | if (ctx->Array.FogCoord.Enabled) { |
| 715 | aa->array = &ctx->Array.FogCoord; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 716 | aa->func = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 717 | aa++; |
| 718 | } |
| 719 | for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { |
| 720 | if (ctx->Array.TexCoord[i].Enabled) { |
| 721 | /* NOTE: we use generic glVertexAttrib functions here. |
| 722 | * If we ever de-alias conventional/generic vertex attribs this |
| 723 | * will have to change. |
| 724 | */ |
| 725 | struct gl_client_array *attribArray = &ctx->Array.TexCoord[i]; |
| 726 | at->array = attribArray; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 727 | at->func = AttribFuncs[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; |
Brian Paul | 9d1ff8c | 2004-02-24 14:59:26 +0000 | [diff] [blame] | 728 | at->index = VERT_ATTRIB_TEX0 + i; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 729 | at++; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 730 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 731 | } |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 732 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 733 | /* generic vertex attribute arrays */ |
| 734 | for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ |
| 735 | if (ctx->Array.VertexAttrib[i].Enabled) { |
| 736 | struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i]; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 737 | at->array = attribArray; |
| 738 | /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV |
| 739 | * function pointer here (for float arrays) since the pointer may |
| 740 | * change from one execution of _ae_loopback_array_elt() to |
| 741 | * the next. Doing so caused UT to break. |
| 742 | */ |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 743 | at->func = AttribFuncs[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 744 | at->index = i; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 745 | at++; |
| 746 | } |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 747 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 748 | |
| 749 | /* finally, vertex position */ |
| 750 | if (ctx->Array.VertexAttrib[0].Enabled) { |
| 751 | /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's |
| 752 | * issued as the last (proviking) attribute). |
| 753 | */ |
| 754 | aa->array = &ctx->Array.VertexAttrib[0]; |
| 755 | assert(aa->array->Size >= 2); /* XXX fix someday? */ |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 756 | aa->func = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 757 | aa++; |
| 758 | } |
| 759 | else if (ctx->Array.Vertex.Enabled) { |
| 760 | aa->array = &ctx->Array.Vertex; |
Brian Paul | 2615e81 | 2004-02-24 14:47:01 +0000 | [diff] [blame] | 761 | aa->func = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 762 | aa++; |
| 763 | } |
| 764 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 765 | ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); |
| 766 | ASSERT(aa - actx->arrays < 32); |
| 767 | at->func = NULL; /* terminate the list */ |
| 768 | aa->func = NULL; /* terminate the list */ |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 769 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 770 | actx->NewState = 0; |
| 771 | } |
| 772 | |
| 773 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 774 | /** |
| 775 | * Called via glArrayElement() and glDrawArrays(). |
| 776 | * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions |
| 777 | * for all enabled vertex arrays (for elt-th element). |
| 778 | * Note: this may be called during display list construction. |
| 779 | */ |
Karl Schultz | d674569 | 2003-12-04 20:23:44 +0000 | [diff] [blame] | 780 | void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 781 | { |
| 782 | GET_CURRENT_CONTEXT(ctx); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 783 | const AEcontext *actx = AE_CONTEXT(ctx); |
| 784 | const AEarray *aa; |
| 785 | const AEattrib *at; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 786 | |
| 787 | if (actx->NewState) |
| 788 | _ae_update_state( ctx ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 789 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 790 | /* generic attributes */ |
| 791 | for (at = actx->attribs; at->func; at++) { |
| 792 | const GLubyte *src = at->array->BufferObj->Data |
Brian Paul | 79b372b | 2004-03-26 23:54:53 +0000 | [diff] [blame] | 793 | + (unsigned long) at->array->Ptr |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 794 | + elt * at->array->StrideB; |
| 795 | at->func( at->index, src ); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 796 | } |
| 797 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 798 | /* conventional arrays */ |
| 799 | for (aa = actx->arrays; aa->func ; aa++) { |
| 800 | const GLubyte *src = aa->array->BufferObj->Data |
Brian Paul | 79b372b | 2004-03-26 23:54:53 +0000 | [diff] [blame] | 801 | + (unsigned long) aa->array->Ptr |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 802 | + elt * aa->array->StrideB; |
Brian Paul | 0aa8a10 | 2004-02-08 02:03:41 +0000 | [diff] [blame] | 803 | aa->func( src ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 804 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 808 | |
| 809 | void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 810 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 811 | AE_CONTEXT(ctx)->NewState |= new_state; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 812 | } |