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