Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 3 | * Version: 6.3 |
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" |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 36 | #include "glapioffsets.h" |
| 37 | #include "dispatch.h" |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 38 | |
Karl Schultz | b72902e | 2004-01-28 22:24:12 +0000 | [diff] [blame] | 39 | typedef void (GLAPIENTRY *array_func)( const void * ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 40 | |
| 41 | typedef struct { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 42 | const struct gl_client_array *array; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 43 | int offset; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 44 | } AEarray; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 45 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 46 | typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data ); |
| 47 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 48 | typedef struct { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 49 | const struct gl_client_array *array; |
| 50 | attrib_func func; |
| 51 | GLuint index; |
| 52 | } AEattrib; |
| 53 | |
| 54 | typedef struct { |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 55 | AEarray arrays[32]; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 56 | AEattrib attribs[VERT_ATTRIB_MAX + 1]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 57 | GLuint NewState; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 58 | } AEcontext; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 59 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 60 | #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 61 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 62 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 63 | /* |
| 64 | * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer |
| 65 | * in the range [0, 7]. Luckily these type tokens are sequentially |
Brian Paul | f2f3350 | 2004-04-23 17:58:06 +0000 | [diff] [blame] | 66 | * numbered in gl.h, except for GL_DOUBLE. |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 67 | */ |
Brian Paul | f2f3350 | 2004-04-23 17:58:06 +0000 | [diff] [blame] | 68 | #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 69 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 70 | static const int ColorFuncs[2][8] = { |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 71 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 72 | _gloffset_Color3bv, |
| 73 | _gloffset_Color3ubv, |
| 74 | _gloffset_Color3sv, |
| 75 | _gloffset_Color3usv, |
| 76 | _gloffset_Color3iv, |
| 77 | _gloffset_Color3uiv, |
| 78 | _gloffset_Color3fv, |
| 79 | _gloffset_Color3dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 80 | }, |
| 81 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 82 | _gloffset_Color4bv, |
| 83 | _gloffset_Color4ubv, |
| 84 | _gloffset_Color4sv, |
| 85 | _gloffset_Color4usv, |
| 86 | _gloffset_Color4iv, |
| 87 | _gloffset_Color4uiv, |
| 88 | _gloffset_Color4fv, |
| 89 | _gloffset_Color4dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 90 | }, |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 93 | static const int VertexFuncs[3][8] = { |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 94 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 95 | -1, |
| 96 | -1, |
| 97 | _gloffset_Vertex2sv, |
| 98 | -1, |
| 99 | _gloffset_Vertex2iv, |
| 100 | -1, |
| 101 | _gloffset_Vertex2fv, |
| 102 | _gloffset_Vertex2dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 103 | }, |
| 104 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 105 | -1, |
| 106 | -1, |
| 107 | _gloffset_Vertex3sv, |
| 108 | -1, |
| 109 | _gloffset_Vertex3iv, |
| 110 | -1, |
| 111 | _gloffset_Vertex3fv, |
| 112 | _gloffset_Vertex3dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 113 | }, |
| 114 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 115 | -1, |
| 116 | -1, |
| 117 | _gloffset_Vertex4sv, |
| 118 | -1, |
| 119 | _gloffset_Vertex4iv, |
| 120 | -1, |
| 121 | _gloffset_Vertex4fv, |
| 122 | _gloffset_Vertex4dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 123 | }, |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 124 | }; |
| 125 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 126 | static const int IndexFuncs[8] = { |
| 127 | -1, |
| 128 | _gloffset_Indexubv, |
| 129 | _gloffset_Indexsv, |
| 130 | -1, |
| 131 | _gloffset_Indexiv, |
| 132 | -1, |
| 133 | _gloffset_Indexfv, |
| 134 | _gloffset_Indexdv, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 135 | }; |
| 136 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 137 | static const int NormalFuncs[8] = { |
| 138 | _gloffset_Normal3bv, |
| 139 | -1, |
| 140 | _gloffset_Normal3sv, |
| 141 | -1, |
| 142 | _gloffset_Normal3iv, |
| 143 | -1, |
| 144 | _gloffset_Normal3fv, |
| 145 | _gloffset_Normal3dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 146 | }; |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 147 | |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 148 | #if defined(IN_DRI_DRIVER) |
| 149 | static int SecondaryColorFuncs[8]; |
| 150 | static int FogCoordFuncs[8] = { |
| 151 | -1, |
| 152 | -1, |
| 153 | -1, |
| 154 | -1, |
| 155 | -1, |
| 156 | -1, |
| 157 | 0, |
| 158 | 0, |
| 159 | }; |
| 160 | #else |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 161 | static const int SecondaryColorFuncs[8] = { |
| 162 | _gloffset_SecondaryColor3bvEXT, |
| 163 | _gloffset_SecondaryColor3ubvEXT, |
| 164 | _gloffset_SecondaryColor3svEXT, |
| 165 | _gloffset_SecondaryColor3usvEXT, |
| 166 | _gloffset_SecondaryColor3ivEXT, |
| 167 | _gloffset_SecondaryColor3uivEXT, |
| 168 | _gloffset_SecondaryColor3fvEXT, |
| 169 | _gloffset_SecondaryColor3dvEXT, |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 170 | }; |
| 171 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 172 | static const int FogCoordFuncs[8] = { |
| 173 | -1, |
| 174 | -1, |
| 175 | -1, |
| 176 | -1, |
| 177 | -1, |
| 178 | -1, |
| 179 | _gloffset_FogCoordfvEXT, |
| 180 | _gloffset_FogCoorddvEXT |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 181 | }; |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 182 | #endif |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 183 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 184 | /**********************************************************************/ |
| 185 | |
| 186 | /* GL_BYTE attributes */ |
| 187 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 188 | static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 189 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 190 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 191 | } |
| 192 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 193 | static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 194 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 195 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 196 | } |
| 197 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 198 | static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 199 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 200 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 203 | static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 204 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 205 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 206 | } |
| 207 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 208 | static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 209 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 210 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), |
| 211 | BYTE_TO_FLOAT(v[1]), |
| 212 | BYTE_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 213 | } |
| 214 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 215 | static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 216 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 217 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 218 | } |
| 219 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 220 | static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 221 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 222 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), |
| 223 | BYTE_TO_FLOAT(v[1]), |
| 224 | BYTE_TO_FLOAT(v[2]), |
| 225 | BYTE_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 226 | } |
| 227 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 228 | static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 229 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 230 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | /* GL_UNSIGNED_BYTE attributes */ |
| 234 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 235 | static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 236 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 237 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 238 | } |
| 239 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 240 | static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 241 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 242 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 243 | } |
| 244 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 245 | static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 246 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 247 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 248 | UBYTE_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 249 | } |
| 250 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 251 | static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 252 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 253 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 256 | static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 257 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 258 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 259 | UBYTE_TO_FLOAT(v[1]), |
| 260 | UBYTE_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 261 | } |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 262 | static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 263 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 264 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 265 | } |
| 266 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 267 | static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 268 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 269 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 270 | UBYTE_TO_FLOAT(v[1]), |
| 271 | UBYTE_TO_FLOAT(v[2]), |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 272 | UBYTE_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 273 | } |
| 274 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 275 | static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 276 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 277 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | /* GL_SHORT attributes */ |
| 281 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 282 | static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 283 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 284 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 285 | } |
| 286 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 287 | static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 288 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 289 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 290 | } |
| 291 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 292 | static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 293 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 294 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
| 295 | SHORT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 296 | } |
| 297 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 298 | static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 299 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 300 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 301 | } |
| 302 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 303 | static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 304 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 305 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame] | 306 | SHORT_TO_FLOAT(v[1]), |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 307 | SHORT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 310 | static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 311 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 312 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 313 | } |
| 314 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 315 | static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 316 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 317 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame] | 318 | SHORT_TO_FLOAT(v[1]), |
| 319 | SHORT_TO_FLOAT(v[2]), |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 320 | SHORT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 321 | } |
| 322 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 323 | static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 324 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 325 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | /* GL_UNSIGNED_SHORT attributes */ |
| 329 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 330 | static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 331 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 332 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 335 | static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 336 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 337 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 338 | } |
| 339 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 340 | static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 341 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 342 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 343 | USHORT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 344 | } |
| 345 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 346 | static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 347 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 348 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 349 | } |
| 350 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 351 | static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 352 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 353 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 354 | USHORT_TO_FLOAT(v[1]), |
| 355 | USHORT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 356 | } |
| 357 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 358 | static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 359 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 360 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 361 | } |
| 362 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 363 | static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 364 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 365 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 366 | USHORT_TO_FLOAT(v[1]), |
| 367 | USHORT_TO_FLOAT(v[2]), |
| 368 | USHORT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 369 | } |
| 370 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 371 | static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 372 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 373 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | /* GL_INT attributes */ |
| 377 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 378 | static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 379 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 380 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 381 | } |
| 382 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 383 | static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 384 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 385 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 386 | } |
| 387 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 388 | static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 389 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 390 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 391 | INT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 392 | } |
| 393 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 394 | static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 395 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 396 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 397 | } |
| 398 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 399 | static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 400 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 401 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 402 | INT_TO_FLOAT(v[1]), |
| 403 | INT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 404 | } |
| 405 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 406 | static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 407 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 408 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 409 | } |
| 410 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 411 | static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 412 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 413 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 414 | INT_TO_FLOAT(v[1]), |
| 415 | INT_TO_FLOAT(v[2]), |
| 416 | INT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 417 | } |
| 418 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 419 | static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 420 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 421 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | /* GL_UNSIGNED_INT attributes */ |
| 425 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 426 | static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 427 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 428 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 429 | } |
| 430 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 431 | static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 432 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 433 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 434 | } |
| 435 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 436 | static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 437 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 438 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 439 | UINT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 440 | } |
| 441 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 442 | static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 443 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 444 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 445 | } |
| 446 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 447 | static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 448 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 449 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 450 | UINT_TO_FLOAT(v[1]), |
| 451 | UINT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 452 | } |
| 453 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 454 | static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 455 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 456 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 457 | } |
| 458 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 459 | static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 460 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 461 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 462 | UINT_TO_FLOAT(v[1]), |
| 463 | UINT_TO_FLOAT(v[2]), |
| 464 | UINT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 465 | } |
| 466 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 467 | static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 468 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 469 | CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | /* GL_FLOAT attributes */ |
| 473 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 474 | static void GLAPIENTRY VertexAttrib1fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 475 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 476 | CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 477 | } |
| 478 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 479 | static void GLAPIENTRY VertexAttrib2fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 480 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 481 | CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 482 | } |
| 483 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 484 | static void GLAPIENTRY VertexAttrib3fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 485 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 486 | CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 487 | } |
| 488 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 489 | static void GLAPIENTRY VertexAttrib4fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 490 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 491 | CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 492 | } |
| 493 | |
| 494 | /* GL_DOUBLE attributes */ |
| 495 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 496 | static void GLAPIENTRY VertexAttrib1dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 497 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 498 | CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 499 | } |
| 500 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 501 | static void GLAPIENTRY VertexAttrib2dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 502 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 503 | CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 504 | } |
| 505 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 506 | static void GLAPIENTRY VertexAttrib3dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 507 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 508 | CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 509 | } |
| 510 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 511 | static void GLAPIENTRY VertexAttrib4dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 512 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 513 | CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | |
| 517 | /* |
| 518 | * Array [size][type] of VertexAttrib functions |
| 519 | */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 520 | static attrib_func AttribFuncsNV[2][4][8] = { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 521 | { |
| 522 | /* non-normalized */ |
| 523 | { |
| 524 | /* size 1 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 525 | (attrib_func) VertexAttrib1bvNV, |
| 526 | (attrib_func) VertexAttrib1ubvNV, |
| 527 | (attrib_func) VertexAttrib1svNV, |
| 528 | (attrib_func) VertexAttrib1usvNV, |
| 529 | (attrib_func) VertexAttrib1ivNV, |
| 530 | (attrib_func) VertexAttrib1uivNV, |
| 531 | (attrib_func) VertexAttrib1fvNV, |
| 532 | (attrib_func) VertexAttrib1dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 533 | }, |
| 534 | { |
| 535 | /* size 2 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 536 | (attrib_func) VertexAttrib2bvNV, |
| 537 | (attrib_func) VertexAttrib2ubvNV, |
| 538 | (attrib_func) VertexAttrib2svNV, |
| 539 | (attrib_func) VertexAttrib2usvNV, |
| 540 | (attrib_func) VertexAttrib2ivNV, |
| 541 | (attrib_func) VertexAttrib2uivNV, |
| 542 | (attrib_func) VertexAttrib2fvNV, |
| 543 | (attrib_func) VertexAttrib2dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 544 | }, |
| 545 | { |
| 546 | /* size 3 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 547 | (attrib_func) VertexAttrib3bvNV, |
| 548 | (attrib_func) VertexAttrib3ubvNV, |
| 549 | (attrib_func) VertexAttrib3svNV, |
| 550 | (attrib_func) VertexAttrib3usvNV, |
| 551 | (attrib_func) VertexAttrib3ivNV, |
| 552 | (attrib_func) VertexAttrib3uivNV, |
| 553 | (attrib_func) VertexAttrib3fvNV, |
| 554 | (attrib_func) VertexAttrib3dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 555 | }, |
| 556 | { |
| 557 | /* size 4 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 558 | (attrib_func) VertexAttrib4bvNV, |
| 559 | (attrib_func) VertexAttrib4ubvNV, |
| 560 | (attrib_func) VertexAttrib4svNV, |
| 561 | (attrib_func) VertexAttrib4usvNV, |
| 562 | (attrib_func) VertexAttrib4ivNV, |
| 563 | (attrib_func) VertexAttrib4uivNV, |
| 564 | (attrib_func) VertexAttrib4fvNV, |
| 565 | (attrib_func) VertexAttrib4dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 566 | } |
| 567 | }, |
| 568 | { |
| 569 | /* normalized (except for float/double) */ |
| 570 | { |
| 571 | /* size 1 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 572 | (attrib_func) VertexAttrib1NbvNV, |
| 573 | (attrib_func) VertexAttrib1NubvNV, |
| 574 | (attrib_func) VertexAttrib1NsvNV, |
| 575 | (attrib_func) VertexAttrib1NusvNV, |
| 576 | (attrib_func) VertexAttrib1NivNV, |
| 577 | (attrib_func) VertexAttrib1NuivNV, |
| 578 | (attrib_func) VertexAttrib1fvNV, |
| 579 | (attrib_func) VertexAttrib1dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 580 | }, |
| 581 | { |
| 582 | /* size 2 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 583 | (attrib_func) VertexAttrib2NbvNV, |
| 584 | (attrib_func) VertexAttrib2NubvNV, |
| 585 | (attrib_func) VertexAttrib2NsvNV, |
| 586 | (attrib_func) VertexAttrib2NusvNV, |
| 587 | (attrib_func) VertexAttrib2NivNV, |
| 588 | (attrib_func) VertexAttrib2NuivNV, |
| 589 | (attrib_func) VertexAttrib2fvNV, |
| 590 | (attrib_func) VertexAttrib2dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 591 | }, |
| 592 | { |
| 593 | /* size 3 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 594 | (attrib_func) VertexAttrib3NbvNV, |
| 595 | (attrib_func) VertexAttrib3NubvNV, |
| 596 | (attrib_func) VertexAttrib3NsvNV, |
| 597 | (attrib_func) VertexAttrib3NusvNV, |
| 598 | (attrib_func) VertexAttrib3NivNV, |
| 599 | (attrib_func) VertexAttrib3NuivNV, |
| 600 | (attrib_func) VertexAttrib3fvNV, |
| 601 | (attrib_func) VertexAttrib3dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 602 | }, |
| 603 | { |
| 604 | /* size 4 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 605 | (attrib_func) VertexAttrib4NbvNV, |
| 606 | (attrib_func) VertexAttrib4NubvNV, |
| 607 | (attrib_func) VertexAttrib4NsvNV, |
| 608 | (attrib_func) VertexAttrib4NusvNV, |
| 609 | (attrib_func) VertexAttrib4NivNV, |
| 610 | (attrib_func) VertexAttrib4NuivNV, |
| 611 | (attrib_func) VertexAttrib4fvNV, |
| 612 | (attrib_func) VertexAttrib4dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 613 | } |
| 614 | } |
| 615 | }; |
| 616 | |
| 617 | /**********************************************************************/ |
| 618 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 619 | |
| 620 | GLboolean _ae_create_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 621 | { |
Keith Whitwell | ae0eaf9 | 2003-11-24 15:23:18 +0000 | [diff] [blame] | 622 | if (ctx->aelt_context) |
| 623 | return GL_TRUE; |
| 624 | |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 625 | #if defined(IN_DRI_DRIVER) |
| 626 | SecondaryColorFuncs[0] = _gloffset_SecondaryColor3bvEXT; |
| 627 | SecondaryColorFuncs[1] = _gloffset_SecondaryColor3ubvEXT; |
| 628 | SecondaryColorFuncs[2] = _gloffset_SecondaryColor3svEXT; |
| 629 | SecondaryColorFuncs[3] = _gloffset_SecondaryColor3usvEXT; |
| 630 | SecondaryColorFuncs[4] = _gloffset_SecondaryColor3ivEXT; |
| 631 | SecondaryColorFuncs[5] = _gloffset_SecondaryColor3uivEXT; |
| 632 | SecondaryColorFuncs[6] = _gloffset_SecondaryColor3fvEXT; |
| 633 | SecondaryColorFuncs[7] = _gloffset_SecondaryColor3dvEXT; |
| 634 | |
| 635 | FogCoordFuncs[6] = _gloffset_FogCoordfvEXT; |
| 636 | FogCoordFuncs[7] = _gloffset_FogCoorddvEXT; |
| 637 | #endif |
| 638 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 639 | ctx->aelt_context = MALLOC( sizeof(AEcontext) ); |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 640 | if (!ctx->aelt_context) |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 641 | return GL_FALSE; |
| 642 | |
| 643 | AE_CONTEXT(ctx)->NewState = ~0; |
| 644 | return GL_TRUE; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 645 | } |
| 646 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 647 | |
| 648 | void _ae_destroy_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 649 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 650 | if ( AE_CONTEXT( ctx ) ) { |
| 651 | FREE( ctx->aelt_context ); |
Keith Whitwell | a0c8524 | 2005-02-11 09:34:05 +0000 | [diff] [blame] | 652 | ctx->aelt_context = NULL; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 653 | } |
| 654 | } |
| 655 | |
| 656 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 657 | /** |
| 658 | * 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] | 659 | * These functions access the array data (i.e. glVertex, glColor, glNormal, |
| 660 | * etc). |
| 661 | * Note: this may be called during display list construction. |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 662 | */ |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 663 | static void _ae_update_state( GLcontext *ctx ) |
| 664 | { |
| 665 | AEcontext *actx = AE_CONTEXT(ctx); |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 666 | AEarray *aa = actx->arrays; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 667 | AEattrib *at = actx->attribs; |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 668 | GLuint i; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 669 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 670 | /* conventional vertex arrays */ |
| 671 | if (ctx->Array.Index.Enabled) { |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 672 | aa->array = &ctx->Array.Index; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 673 | aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 674 | aa++; |
| 675 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 676 | if (ctx->Array.EdgeFlag.Enabled) { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 677 | aa->array = &ctx->Array.EdgeFlag; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 678 | aa->offset = _gloffset_EdgeFlagv; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 679 | aa++; |
| 680 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 681 | if (ctx->Array.Normal.Enabled) { |
| 682 | aa->array = &ctx->Array.Normal; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 683 | aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 684 | aa++; |
| 685 | } |
| 686 | if (ctx->Array.Color.Enabled) { |
| 687 | aa->array = &ctx->Array.Color; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 688 | aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 689 | aa++; |
| 690 | } |
| 691 | if (ctx->Array.SecondaryColor.Enabled) { |
| 692 | aa->array = &ctx->Array.SecondaryColor; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 693 | aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 694 | aa++; |
| 695 | } |
| 696 | if (ctx->Array.FogCoord.Enabled) { |
| 697 | aa->array = &ctx->Array.FogCoord; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 698 | aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 699 | aa++; |
| 700 | } |
| 701 | for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { |
| 702 | if (ctx->Array.TexCoord[i].Enabled) { |
| 703 | /* NOTE: we use generic glVertexAttrib functions here. |
| 704 | * If we ever de-alias conventional/generic vertex attribs this |
| 705 | * will have to change. |
| 706 | */ |
| 707 | struct gl_client_array *attribArray = &ctx->Array.TexCoord[i]; |
| 708 | at->array = attribArray; |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 709 | at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; |
Brian Paul | 9d1ff8c | 2004-02-24 14:59:26 +0000 | [diff] [blame] | 710 | at->index = VERT_ATTRIB_TEX0 + i; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 711 | at++; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 712 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 713 | } |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 714 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 715 | /* generic vertex attribute arrays */ |
| 716 | for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ |
| 717 | if (ctx->Array.VertexAttrib[i].Enabled) { |
| 718 | struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i]; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 719 | at->array = attribArray; |
| 720 | /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV |
| 721 | * function pointer here (for float arrays) since the pointer may |
| 722 | * change from one execution of _ae_loopback_array_elt() to |
| 723 | * the next. Doing so caused UT to break. |
| 724 | */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 725 | at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 726 | at->index = i; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 727 | at++; |
| 728 | } |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 729 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 730 | |
| 731 | /* finally, vertex position */ |
| 732 | if (ctx->Array.VertexAttrib[0].Enabled) { |
| 733 | /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's |
| 734 | * issued as the last (proviking) attribute). |
| 735 | */ |
| 736 | aa->array = &ctx->Array.VertexAttrib[0]; |
| 737 | assert(aa->array->Size >= 2); /* XXX fix someday? */ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 738 | aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 739 | aa++; |
| 740 | } |
| 741 | else if (ctx->Array.Vertex.Enabled) { |
| 742 | aa->array = &ctx->Array.Vertex; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 743 | aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 744 | aa++; |
| 745 | } |
| 746 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 747 | ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); |
| 748 | ASSERT(aa - actx->arrays < 32); |
| 749 | at->func = NULL; /* terminate the list */ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 750 | aa->offset = -1; /* terminate the list */ |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 751 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 752 | actx->NewState = 0; |
| 753 | } |
| 754 | |
| 755 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 756 | /** |
| 757 | * Called via glArrayElement() and glDrawArrays(). |
| 758 | * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions |
| 759 | * for all enabled vertex arrays (for elt-th element). |
| 760 | * Note: this may be called during display list construction. |
| 761 | */ |
Karl Schultz | d674569 | 2003-12-04 20:23:44 +0000 | [diff] [blame] | 762 | void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 763 | { |
| 764 | GET_CURRENT_CONTEXT(ctx); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 765 | const AEcontext *actx = AE_CONTEXT(ctx); |
| 766 | const AEarray *aa; |
| 767 | const AEattrib *at; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 768 | const struct _glapi_table * const disp = GET_DISPATCH(); |
| 769 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 770 | |
| 771 | if (actx->NewState) |
| 772 | _ae_update_state( ctx ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 773 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 774 | /* generic attributes */ |
| 775 | for (at = actx->attribs; at->func; at++) { |
| 776 | const GLubyte *src = at->array->BufferObj->Data |
Karl Schultz | 6258b76 | 2005-05-05 21:08:07 +0000 | [diff] [blame] | 777 | + (uintptr_t) at->array->Ptr |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 778 | + elt * at->array->StrideB; |
| 779 | at->func( at->index, src ); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 780 | } |
| 781 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 782 | /* conventional arrays */ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 783 | for (aa = actx->arrays; aa->offset != -1 ; aa++) { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 784 | const GLubyte *src = aa->array->BufferObj->Data |
Karl Schultz | 6258b76 | 2005-05-05 21:08:07 +0000 | [diff] [blame] | 785 | + (uintptr_t) aa->array->Ptr |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 786 | + elt * aa->array->StrideB; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 787 | CALL_by_offset( disp, (array_func), aa->offset, |
| 788 | ((const void *) src) ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 789 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 793 | void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 794 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 795 | AE_CONTEXT(ctx)->NewState |= new_state; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 796 | } |