Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 3 | * Version: 6.5.1 |
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 | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 56 | |
| 57 | struct gl_buffer_object *vbo[VERT_ATTRIB_MAX]; |
| 58 | GLuint nr_vbos; |
| 59 | GLboolean mapped_vbos; |
| 60 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 61 | } AEcontext; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 62 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 63 | #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 64 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 65 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 66 | /* |
| 67 | * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer |
| 68 | * in the range [0, 7]. Luckily these type tokens are sequentially |
Brian Paul | f2f3350 | 2004-04-23 17:58:06 +0000 | [diff] [blame] | 69 | * numbered in gl.h, except for GL_DOUBLE. |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 70 | */ |
Brian Paul | f2f3350 | 2004-04-23 17:58:06 +0000 | [diff] [blame] | 71 | #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 72 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 73 | static const int ColorFuncs[2][8] = { |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 74 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 75 | _gloffset_Color3bv, |
| 76 | _gloffset_Color3ubv, |
| 77 | _gloffset_Color3sv, |
| 78 | _gloffset_Color3usv, |
| 79 | _gloffset_Color3iv, |
| 80 | _gloffset_Color3uiv, |
| 81 | _gloffset_Color3fv, |
| 82 | _gloffset_Color3dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 83 | }, |
| 84 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 85 | _gloffset_Color4bv, |
| 86 | _gloffset_Color4ubv, |
| 87 | _gloffset_Color4sv, |
| 88 | _gloffset_Color4usv, |
| 89 | _gloffset_Color4iv, |
| 90 | _gloffset_Color4uiv, |
| 91 | _gloffset_Color4fv, |
| 92 | _gloffset_Color4dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 93 | }, |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 94 | }; |
| 95 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 96 | static const int VertexFuncs[3][8] = { |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 97 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 98 | -1, |
| 99 | -1, |
| 100 | _gloffset_Vertex2sv, |
| 101 | -1, |
| 102 | _gloffset_Vertex2iv, |
| 103 | -1, |
| 104 | _gloffset_Vertex2fv, |
| 105 | _gloffset_Vertex2dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 106 | }, |
| 107 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 108 | -1, |
| 109 | -1, |
| 110 | _gloffset_Vertex3sv, |
| 111 | -1, |
| 112 | _gloffset_Vertex3iv, |
| 113 | -1, |
| 114 | _gloffset_Vertex3fv, |
| 115 | _gloffset_Vertex3dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 116 | }, |
| 117 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 118 | -1, |
| 119 | -1, |
| 120 | _gloffset_Vertex4sv, |
| 121 | -1, |
| 122 | _gloffset_Vertex4iv, |
| 123 | -1, |
| 124 | _gloffset_Vertex4fv, |
| 125 | _gloffset_Vertex4dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 126 | }, |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 127 | }; |
| 128 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 129 | static const int IndexFuncs[8] = { |
| 130 | -1, |
| 131 | _gloffset_Indexubv, |
| 132 | _gloffset_Indexsv, |
| 133 | -1, |
| 134 | _gloffset_Indexiv, |
| 135 | -1, |
| 136 | _gloffset_Indexfv, |
| 137 | _gloffset_Indexdv, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 138 | }; |
| 139 | |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 140 | static const int NormalFuncs[8] = { |
| 141 | _gloffset_Normal3bv, |
| 142 | -1, |
| 143 | _gloffset_Normal3sv, |
| 144 | -1, |
| 145 | _gloffset_Normal3iv, |
| 146 | -1, |
| 147 | _gloffset_Normal3fv, |
| 148 | _gloffset_Normal3dv, |
Adam Jackson | 94987be | 2004-10-24 02:05:40 +0000 | [diff] [blame] | 149 | }; |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 150 | |
Brian Paul | 0f1d98c | 2006-03-17 04:10:03 +0000 | [diff] [blame] | 151 | /* Note: _gloffset_* for these may not be a compile-time constant. */ |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 152 | static int SecondaryColorFuncs[8]; |
Brian Paul | 0f1d98c | 2006-03-17 04:10:03 +0000 | [diff] [blame] | 153 | static int FogCoordFuncs[8]; |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 154 | |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 155 | |
| 156 | /** |
| 157 | ** GL_NV_vertex_program |
| 158 | **/ |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 159 | |
| 160 | /* GL_BYTE attributes */ |
| 161 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 162 | static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 163 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 164 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 165 | } |
| 166 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 167 | static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 168 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 169 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 170 | } |
| 171 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 172 | static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 173 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 174 | 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] | 175 | } |
| 176 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 177 | static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 178 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 179 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 180 | } |
| 181 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 182 | static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 183 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 184 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), |
| 185 | BYTE_TO_FLOAT(v[1]), |
| 186 | BYTE_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 187 | } |
| 188 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 189 | static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 190 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 191 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
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 VertexAttrib4NbvNV(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, BYTE_TO_FLOAT(v[0]), |
| 197 | BYTE_TO_FLOAT(v[1]), |
| 198 | BYTE_TO_FLOAT(v[2]), |
| 199 | BYTE_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 200 | } |
| 201 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 202 | static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 203 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 204 | 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] | 205 | } |
| 206 | |
| 207 | /* GL_UNSIGNED_BYTE attributes */ |
| 208 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 209 | static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 210 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 211 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 214 | static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 215 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 216 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 217 | } |
| 218 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 219 | static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 220 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 221 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 222 | UBYTE_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 223 | } |
| 224 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 225 | static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 226 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 227 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 230 | static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 231 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 232 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 233 | UBYTE_TO_FLOAT(v[1]), |
| 234 | UBYTE_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 235 | } |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 236 | static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 237 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 238 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
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 VertexAttrib4NubvNV(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, UBYTE_TO_FLOAT(v[0]), |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 244 | UBYTE_TO_FLOAT(v[1]), |
| 245 | UBYTE_TO_FLOAT(v[2]), |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 246 | UBYTE_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 247 | } |
| 248 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 249 | static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 250 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 251 | 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] | 252 | } |
| 253 | |
| 254 | /* GL_SHORT attributes */ |
| 255 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 256 | static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *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_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 259 | } |
| 260 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 261 | static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 262 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 263 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 266 | static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 267 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 268 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
| 269 | SHORT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 270 | } |
| 271 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 272 | static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 273 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 274 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 275 | } |
| 276 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 277 | static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 278 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 279 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame] | 280 | SHORT_TO_FLOAT(v[1]), |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 281 | SHORT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 282 | } |
| 283 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 284 | static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 285 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 286 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
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 VertexAttrib4NsvNV(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, SHORT_TO_FLOAT(v[0]), |
Ian Romanick | c1d455f | 2004-05-27 00:03:53 +0000 | [diff] [blame] | 292 | SHORT_TO_FLOAT(v[1]), |
| 293 | SHORT_TO_FLOAT(v[2]), |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 294 | SHORT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 295 | } |
| 296 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 297 | static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 298 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 299 | 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] | 300 | } |
| 301 | |
| 302 | /* GL_UNSIGNED_SHORT attributes */ |
| 303 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 304 | static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 305 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 306 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 307 | } |
| 308 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 309 | static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 310 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 311 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 312 | } |
| 313 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 314 | static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 315 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 316 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 317 | USHORT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 320 | static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 321 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 322 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 323 | } |
| 324 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 325 | static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 326 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 327 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 328 | USHORT_TO_FLOAT(v[1]), |
| 329 | USHORT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 330 | } |
| 331 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 332 | static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 333 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 334 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
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 VertexAttrib4NusvNV(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, USHORT_TO_FLOAT(v[0]), |
| 340 | USHORT_TO_FLOAT(v[1]), |
| 341 | USHORT_TO_FLOAT(v[2]), |
| 342 | USHORT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 343 | } |
| 344 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 345 | static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 346 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 347 | 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] | 348 | } |
| 349 | |
| 350 | /* GL_INT attributes */ |
| 351 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 352 | static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 353 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 354 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 355 | } |
| 356 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 357 | static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 358 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 359 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 360 | } |
| 361 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 362 | static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 363 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 364 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 365 | INT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 366 | } |
| 367 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 368 | static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 369 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 370 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 371 | } |
| 372 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 373 | static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 374 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 375 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 376 | INT_TO_FLOAT(v[1]), |
| 377 | INT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 378 | } |
| 379 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 380 | static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 381 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 382 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
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 VertexAttrib4NivNV(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, INT_TO_FLOAT(v[0]), |
| 388 | INT_TO_FLOAT(v[1]), |
| 389 | INT_TO_FLOAT(v[2]), |
| 390 | INT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 391 | } |
| 392 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 393 | static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 394 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 395 | 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] | 396 | } |
| 397 | |
| 398 | /* GL_UNSIGNED_INT attributes */ |
| 399 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 400 | static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 401 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 402 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 403 | } |
| 404 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 405 | static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 406 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 407 | CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 408 | } |
| 409 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 410 | static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 411 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 412 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 413 | UINT_TO_FLOAT(v[1]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 414 | } |
| 415 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 416 | static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 417 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 418 | CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 419 | } |
| 420 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 421 | static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 422 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 423 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 424 | UINT_TO_FLOAT(v[1]), |
| 425 | UINT_TO_FLOAT(v[2]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 426 | } |
| 427 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 428 | static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 429 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 430 | CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
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 VertexAttrib4NuivNV(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, UINT_TO_FLOAT(v[0]), |
| 436 | UINT_TO_FLOAT(v[1]), |
| 437 | UINT_TO_FLOAT(v[2]), |
| 438 | UINT_TO_FLOAT(v[3]))); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 439 | } |
| 440 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 441 | static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 442 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 443 | 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] | 444 | } |
| 445 | |
| 446 | /* GL_FLOAT attributes */ |
| 447 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 448 | static void GLAPIENTRY VertexAttrib1fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 449 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 450 | CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 451 | } |
| 452 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 453 | static void GLAPIENTRY VertexAttrib2fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 454 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 455 | CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 456 | } |
| 457 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 458 | static void GLAPIENTRY VertexAttrib3fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 459 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 460 | CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 461 | } |
| 462 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 463 | static void GLAPIENTRY VertexAttrib4fvNV(GLuint index, const GLfloat *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 464 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 465 | CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | /* GL_DOUBLE attributes */ |
| 469 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 470 | static void GLAPIENTRY VertexAttrib1dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 471 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 472 | CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 473 | } |
| 474 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 475 | static void GLAPIENTRY VertexAttrib2dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 476 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 477 | CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 478 | } |
| 479 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 480 | static void GLAPIENTRY VertexAttrib3dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 481 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 482 | CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 483 | } |
| 484 | |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 485 | static void GLAPIENTRY VertexAttrib4dvNV(GLuint index, const GLdouble *v) |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 486 | { |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 487 | CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v)); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | |
| 491 | /* |
| 492 | * Array [size][type] of VertexAttrib functions |
| 493 | */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 494 | static attrib_func AttribFuncsNV[2][4][8] = { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 495 | { |
| 496 | /* non-normalized */ |
| 497 | { |
| 498 | /* size 1 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 499 | (attrib_func) VertexAttrib1bvNV, |
| 500 | (attrib_func) VertexAttrib1ubvNV, |
| 501 | (attrib_func) VertexAttrib1svNV, |
| 502 | (attrib_func) VertexAttrib1usvNV, |
| 503 | (attrib_func) VertexAttrib1ivNV, |
| 504 | (attrib_func) VertexAttrib1uivNV, |
| 505 | (attrib_func) VertexAttrib1fvNV, |
| 506 | (attrib_func) VertexAttrib1dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 507 | }, |
| 508 | { |
| 509 | /* size 2 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 510 | (attrib_func) VertexAttrib2bvNV, |
| 511 | (attrib_func) VertexAttrib2ubvNV, |
| 512 | (attrib_func) VertexAttrib2svNV, |
| 513 | (attrib_func) VertexAttrib2usvNV, |
| 514 | (attrib_func) VertexAttrib2ivNV, |
| 515 | (attrib_func) VertexAttrib2uivNV, |
| 516 | (attrib_func) VertexAttrib2fvNV, |
| 517 | (attrib_func) VertexAttrib2dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 518 | }, |
| 519 | { |
| 520 | /* size 3 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 521 | (attrib_func) VertexAttrib3bvNV, |
| 522 | (attrib_func) VertexAttrib3ubvNV, |
| 523 | (attrib_func) VertexAttrib3svNV, |
| 524 | (attrib_func) VertexAttrib3usvNV, |
| 525 | (attrib_func) VertexAttrib3ivNV, |
| 526 | (attrib_func) VertexAttrib3uivNV, |
| 527 | (attrib_func) VertexAttrib3fvNV, |
| 528 | (attrib_func) VertexAttrib3dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 529 | }, |
| 530 | { |
| 531 | /* size 4 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 532 | (attrib_func) VertexAttrib4bvNV, |
| 533 | (attrib_func) VertexAttrib4ubvNV, |
| 534 | (attrib_func) VertexAttrib4svNV, |
| 535 | (attrib_func) VertexAttrib4usvNV, |
| 536 | (attrib_func) VertexAttrib4ivNV, |
| 537 | (attrib_func) VertexAttrib4uivNV, |
| 538 | (attrib_func) VertexAttrib4fvNV, |
| 539 | (attrib_func) VertexAttrib4dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 540 | } |
| 541 | }, |
| 542 | { |
| 543 | /* normalized (except for float/double) */ |
| 544 | { |
| 545 | /* size 1 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 546 | (attrib_func) VertexAttrib1NbvNV, |
| 547 | (attrib_func) VertexAttrib1NubvNV, |
| 548 | (attrib_func) VertexAttrib1NsvNV, |
| 549 | (attrib_func) VertexAttrib1NusvNV, |
| 550 | (attrib_func) VertexAttrib1NivNV, |
| 551 | (attrib_func) VertexAttrib1NuivNV, |
| 552 | (attrib_func) VertexAttrib1fvNV, |
| 553 | (attrib_func) VertexAttrib1dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 554 | }, |
| 555 | { |
| 556 | /* size 2 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 557 | (attrib_func) VertexAttrib2NbvNV, |
| 558 | (attrib_func) VertexAttrib2NubvNV, |
| 559 | (attrib_func) VertexAttrib2NsvNV, |
| 560 | (attrib_func) VertexAttrib2NusvNV, |
| 561 | (attrib_func) VertexAttrib2NivNV, |
| 562 | (attrib_func) VertexAttrib2NuivNV, |
| 563 | (attrib_func) VertexAttrib2fvNV, |
| 564 | (attrib_func) VertexAttrib2dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 565 | }, |
| 566 | { |
| 567 | /* size 3 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 568 | (attrib_func) VertexAttrib3NbvNV, |
| 569 | (attrib_func) VertexAttrib3NubvNV, |
| 570 | (attrib_func) VertexAttrib3NsvNV, |
| 571 | (attrib_func) VertexAttrib3NusvNV, |
| 572 | (attrib_func) VertexAttrib3NivNV, |
| 573 | (attrib_func) VertexAttrib3NuivNV, |
| 574 | (attrib_func) VertexAttrib3fvNV, |
| 575 | (attrib_func) VertexAttrib3dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 576 | }, |
| 577 | { |
| 578 | /* size 4 */ |
Brian Paul | b5b8d22 | 2004-11-27 20:07:08 +0000 | [diff] [blame] | 579 | (attrib_func) VertexAttrib4NbvNV, |
| 580 | (attrib_func) VertexAttrib4NubvNV, |
| 581 | (attrib_func) VertexAttrib4NsvNV, |
| 582 | (attrib_func) VertexAttrib4NusvNV, |
| 583 | (attrib_func) VertexAttrib4NivNV, |
| 584 | (attrib_func) VertexAttrib4NuivNV, |
| 585 | (attrib_func) VertexAttrib4fvNV, |
| 586 | (attrib_func) VertexAttrib4dvNV |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 587 | } |
| 588 | } |
| 589 | }; |
| 590 | |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 591 | |
| 592 | /** |
| 593 | ** GL_ARB_vertex_program |
| 594 | **/ |
| 595 | |
| 596 | /* GL_BYTE attributes */ |
| 597 | |
| 598 | static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v) |
| 599 | { |
| 600 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); |
| 601 | } |
| 602 | |
| 603 | static void GLAPIENTRY VertexAttrib1bvARB(GLuint index, const GLbyte *v) |
| 604 | { |
| 605 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); |
| 606 | } |
| 607 | |
| 608 | static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v) |
| 609 | { |
| 610 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); |
| 611 | } |
| 612 | |
| 613 | static void GLAPIENTRY VertexAttrib2bvARB(GLuint index, const GLbyte *v) |
| 614 | { |
| 615 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); |
| 616 | } |
| 617 | |
| 618 | static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v) |
| 619 | { |
| 620 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), |
| 621 | BYTE_TO_FLOAT(v[1]), |
| 622 | BYTE_TO_FLOAT(v[2]))); |
| 623 | } |
| 624 | |
| 625 | static void GLAPIENTRY VertexAttrib3bvARB(GLuint index, const GLbyte *v) |
| 626 | { |
| 627 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
| 628 | } |
| 629 | |
| 630 | static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v) |
| 631 | { |
| 632 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), |
| 633 | BYTE_TO_FLOAT(v[1]), |
| 634 | BYTE_TO_FLOAT(v[2]), |
| 635 | BYTE_TO_FLOAT(v[3]))); |
| 636 | } |
| 637 | |
| 638 | static void GLAPIENTRY VertexAttrib4bvARB(GLuint index, const GLbyte *v) |
| 639 | { |
| 640 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
| 641 | } |
| 642 | |
| 643 | /* GL_UNSIGNED_BYTE attributes */ |
| 644 | |
| 645 | static void GLAPIENTRY VertexAttrib1NubvARB(GLuint index, const GLubyte *v) |
| 646 | { |
| 647 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); |
| 648 | } |
| 649 | |
| 650 | static void GLAPIENTRY VertexAttrib1ubvARB(GLuint index, const GLubyte *v) |
| 651 | { |
| 652 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); |
| 653 | } |
| 654 | |
| 655 | static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v) |
| 656 | { |
| 657 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 658 | UBYTE_TO_FLOAT(v[1]))); |
| 659 | } |
| 660 | |
| 661 | static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v) |
| 662 | { |
| 663 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); |
| 664 | } |
| 665 | |
| 666 | static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v) |
| 667 | { |
| 668 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 669 | UBYTE_TO_FLOAT(v[1]), |
| 670 | UBYTE_TO_FLOAT(v[2]))); |
| 671 | } |
| 672 | static void GLAPIENTRY VertexAttrib3ubvARB(GLuint index, const GLubyte *v) |
| 673 | { |
| 674 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
| 675 | } |
| 676 | |
| 677 | static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v) |
| 678 | { |
| 679 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), |
| 680 | UBYTE_TO_FLOAT(v[1]), |
| 681 | UBYTE_TO_FLOAT(v[2]), |
| 682 | UBYTE_TO_FLOAT(v[3]))); |
| 683 | } |
| 684 | |
| 685 | static void GLAPIENTRY VertexAttrib4ubvARB(GLuint index, const GLubyte *v) |
| 686 | { |
| 687 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
| 688 | } |
| 689 | |
| 690 | /* GL_SHORT attributes */ |
| 691 | |
| 692 | static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v) |
| 693 | { |
| 694 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); |
| 695 | } |
| 696 | |
| 697 | static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v) |
| 698 | { |
| 699 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); |
| 700 | } |
| 701 | |
| 702 | static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v) |
| 703 | { |
| 704 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
| 705 | SHORT_TO_FLOAT(v[1]))); |
| 706 | } |
| 707 | |
| 708 | static void GLAPIENTRY VertexAttrib2svARB(GLuint index, const GLshort *v) |
| 709 | { |
| 710 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); |
| 711 | } |
| 712 | |
| 713 | static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v) |
| 714 | { |
| 715 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
| 716 | SHORT_TO_FLOAT(v[1]), |
| 717 | SHORT_TO_FLOAT(v[2]))); |
| 718 | } |
| 719 | |
| 720 | static void GLAPIENTRY VertexAttrib3svARB(GLuint index, const GLshort *v) |
| 721 | { |
| 722 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
| 723 | } |
| 724 | |
| 725 | static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v) |
| 726 | { |
| 727 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), |
| 728 | SHORT_TO_FLOAT(v[1]), |
| 729 | SHORT_TO_FLOAT(v[2]), |
| 730 | SHORT_TO_FLOAT(v[3]))); |
| 731 | } |
| 732 | |
| 733 | static void GLAPIENTRY VertexAttrib4svARB(GLuint index, const GLshort *v) |
| 734 | { |
| 735 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
| 736 | } |
| 737 | |
| 738 | /* GL_UNSIGNED_SHORT attributes */ |
| 739 | |
| 740 | static void GLAPIENTRY VertexAttrib1NusvARB(GLuint index, const GLushort *v) |
| 741 | { |
| 742 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); |
| 743 | } |
| 744 | |
| 745 | static void GLAPIENTRY VertexAttrib1usvARB(GLuint index, const GLushort *v) |
| 746 | { |
| 747 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); |
| 748 | } |
| 749 | |
| 750 | static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v) |
| 751 | { |
| 752 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 753 | USHORT_TO_FLOAT(v[1]))); |
| 754 | } |
| 755 | |
| 756 | static void GLAPIENTRY VertexAttrib2usvARB(GLuint index, const GLushort *v) |
| 757 | { |
| 758 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); |
| 759 | } |
| 760 | |
| 761 | static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v) |
| 762 | { |
| 763 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 764 | USHORT_TO_FLOAT(v[1]), |
| 765 | USHORT_TO_FLOAT(v[2]))); |
| 766 | } |
| 767 | |
| 768 | static void GLAPIENTRY VertexAttrib3usvARB(GLuint index, const GLushort *v) |
| 769 | { |
| 770 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
| 771 | } |
| 772 | |
| 773 | static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v) |
| 774 | { |
| 775 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), |
| 776 | USHORT_TO_FLOAT(v[1]), |
| 777 | USHORT_TO_FLOAT(v[2]), |
| 778 | USHORT_TO_FLOAT(v[3]))); |
| 779 | } |
| 780 | |
| 781 | static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v) |
| 782 | { |
| 783 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
| 784 | } |
| 785 | |
| 786 | /* GL_INT attributes */ |
| 787 | |
| 788 | static void GLAPIENTRY VertexAttrib1NivARB(GLuint index, const GLint *v) |
| 789 | { |
| 790 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); |
| 791 | } |
| 792 | |
| 793 | static void GLAPIENTRY VertexAttrib1ivARB(GLuint index, const GLint *v) |
| 794 | { |
| 795 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); |
| 796 | } |
| 797 | |
| 798 | static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v) |
| 799 | { |
| 800 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 801 | INT_TO_FLOAT(v[1]))); |
| 802 | } |
| 803 | |
| 804 | static void GLAPIENTRY VertexAttrib2ivARB(GLuint index, const GLint *v) |
| 805 | { |
| 806 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); |
| 807 | } |
| 808 | |
| 809 | static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v) |
| 810 | { |
| 811 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 812 | INT_TO_FLOAT(v[1]), |
| 813 | INT_TO_FLOAT(v[2]))); |
| 814 | } |
| 815 | |
| 816 | static void GLAPIENTRY VertexAttrib3ivARB(GLuint index, const GLint *v) |
| 817 | { |
| 818 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
| 819 | } |
| 820 | |
| 821 | static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v) |
| 822 | { |
| 823 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), |
| 824 | INT_TO_FLOAT(v[1]), |
| 825 | INT_TO_FLOAT(v[2]), |
| 826 | INT_TO_FLOAT(v[3]))); |
| 827 | } |
| 828 | |
| 829 | static void GLAPIENTRY VertexAttrib4ivARB(GLuint index, const GLint *v) |
| 830 | { |
| 831 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
| 832 | } |
| 833 | |
| 834 | /* GL_UNSIGNED_INT attributes */ |
| 835 | |
| 836 | static void GLAPIENTRY VertexAttrib1NuivARB(GLuint index, const GLuint *v) |
| 837 | { |
| 838 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); |
| 839 | } |
| 840 | |
| 841 | static void GLAPIENTRY VertexAttrib1uivARB(GLuint index, const GLuint *v) |
| 842 | { |
| 843 | CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); |
| 844 | } |
| 845 | |
| 846 | static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v) |
| 847 | { |
| 848 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 849 | UINT_TO_FLOAT(v[1]))); |
| 850 | } |
| 851 | |
| 852 | static void GLAPIENTRY VertexAttrib2uivARB(GLuint index, const GLuint *v) |
| 853 | { |
| 854 | CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); |
| 855 | } |
| 856 | |
| 857 | static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v) |
| 858 | { |
| 859 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 860 | UINT_TO_FLOAT(v[1]), |
| 861 | UINT_TO_FLOAT(v[2]))); |
| 862 | } |
| 863 | |
| 864 | static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v) |
| 865 | { |
| 866 | CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); |
| 867 | } |
| 868 | |
| 869 | static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v) |
| 870 | { |
| 871 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), |
| 872 | UINT_TO_FLOAT(v[1]), |
| 873 | UINT_TO_FLOAT(v[2]), |
| 874 | UINT_TO_FLOAT(v[3]))); |
| 875 | } |
| 876 | |
| 877 | static void GLAPIENTRY VertexAttrib4uivARB(GLuint index, const GLuint *v) |
| 878 | { |
| 879 | CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); |
| 880 | } |
| 881 | |
| 882 | /* GL_FLOAT attributes */ |
| 883 | |
| 884 | static void GLAPIENTRY VertexAttrib1fvARB(GLuint index, const GLfloat *v) |
| 885 | { |
| 886 | CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index, v)); |
| 887 | } |
| 888 | |
| 889 | static void GLAPIENTRY VertexAttrib2fvARB(GLuint index, const GLfloat *v) |
| 890 | { |
| 891 | CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index, v)); |
| 892 | } |
| 893 | |
| 894 | static void GLAPIENTRY VertexAttrib3fvARB(GLuint index, const GLfloat *v) |
| 895 | { |
| 896 | CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index, v)); |
| 897 | } |
| 898 | |
| 899 | static void GLAPIENTRY VertexAttrib4fvARB(GLuint index, const GLfloat *v) |
| 900 | { |
| 901 | CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v)); |
| 902 | } |
| 903 | |
| 904 | /* GL_DOUBLE attributes */ |
| 905 | |
| 906 | static void GLAPIENTRY VertexAttrib1dvARB(GLuint index, const GLdouble *v) |
| 907 | { |
| 908 | CALL_VertexAttrib1dvARB(GET_DISPATCH(), (index, v)); |
| 909 | } |
| 910 | |
| 911 | static void GLAPIENTRY VertexAttrib2dvARB(GLuint index, const GLdouble *v) |
| 912 | { |
| 913 | CALL_VertexAttrib2dvARB(GET_DISPATCH(), (index, v)); |
| 914 | } |
| 915 | |
| 916 | static void GLAPIENTRY VertexAttrib3dvARB(GLuint index, const GLdouble *v) |
| 917 | { |
| 918 | CALL_VertexAttrib3dvARB(GET_DISPATCH(), (index, v)); |
| 919 | } |
| 920 | |
| 921 | static void GLAPIENTRY VertexAttrib4dvARB(GLuint index, const GLdouble *v) |
| 922 | { |
| 923 | CALL_VertexAttrib4dvARB(GET_DISPATCH(), (index, v)); |
| 924 | } |
| 925 | |
| 926 | |
| 927 | /* |
| 928 | * Array [size][type] of VertexAttrib functions |
| 929 | */ |
| 930 | static attrib_func AttribFuncsARB[2][4][8] = { |
| 931 | { |
| 932 | /* non-normalized */ |
| 933 | { |
| 934 | /* size 1 */ |
| 935 | (attrib_func) VertexAttrib1bvARB, |
| 936 | (attrib_func) VertexAttrib1ubvARB, |
| 937 | (attrib_func) VertexAttrib1svARB, |
| 938 | (attrib_func) VertexAttrib1usvARB, |
| 939 | (attrib_func) VertexAttrib1ivARB, |
| 940 | (attrib_func) VertexAttrib1uivARB, |
| 941 | (attrib_func) VertexAttrib1fvARB, |
| 942 | (attrib_func) VertexAttrib1dvARB |
| 943 | }, |
| 944 | { |
| 945 | /* size 2 */ |
| 946 | (attrib_func) VertexAttrib2bvARB, |
| 947 | (attrib_func) VertexAttrib2ubvARB, |
| 948 | (attrib_func) VertexAttrib2svARB, |
| 949 | (attrib_func) VertexAttrib2usvARB, |
| 950 | (attrib_func) VertexAttrib2ivARB, |
| 951 | (attrib_func) VertexAttrib2uivARB, |
| 952 | (attrib_func) VertexAttrib2fvARB, |
| 953 | (attrib_func) VertexAttrib2dvARB |
| 954 | }, |
| 955 | { |
| 956 | /* size 3 */ |
| 957 | (attrib_func) VertexAttrib3bvARB, |
| 958 | (attrib_func) VertexAttrib3ubvARB, |
| 959 | (attrib_func) VertexAttrib3svARB, |
| 960 | (attrib_func) VertexAttrib3usvARB, |
| 961 | (attrib_func) VertexAttrib3ivARB, |
| 962 | (attrib_func) VertexAttrib3uivARB, |
| 963 | (attrib_func) VertexAttrib3fvARB, |
| 964 | (attrib_func) VertexAttrib3dvARB |
| 965 | }, |
| 966 | { |
| 967 | /* size 4 */ |
| 968 | (attrib_func) VertexAttrib4bvARB, |
| 969 | (attrib_func) VertexAttrib4ubvARB, |
| 970 | (attrib_func) VertexAttrib4svARB, |
| 971 | (attrib_func) VertexAttrib4usvARB, |
| 972 | (attrib_func) VertexAttrib4ivARB, |
| 973 | (attrib_func) VertexAttrib4uivARB, |
| 974 | (attrib_func) VertexAttrib4fvARB, |
| 975 | (attrib_func) VertexAttrib4dvARB |
| 976 | } |
| 977 | }, |
| 978 | { |
| 979 | /* normalized (except for float/double) */ |
| 980 | { |
| 981 | /* size 1 */ |
| 982 | (attrib_func) VertexAttrib1NbvARB, |
| 983 | (attrib_func) VertexAttrib1NubvARB, |
| 984 | (attrib_func) VertexAttrib1NsvARB, |
| 985 | (attrib_func) VertexAttrib1NusvARB, |
| 986 | (attrib_func) VertexAttrib1NivARB, |
| 987 | (attrib_func) VertexAttrib1NuivARB, |
| 988 | (attrib_func) VertexAttrib1fvARB, |
| 989 | (attrib_func) VertexAttrib1dvARB |
| 990 | }, |
| 991 | { |
| 992 | /* size 2 */ |
| 993 | (attrib_func) VertexAttrib2NbvARB, |
| 994 | (attrib_func) VertexAttrib2NubvARB, |
| 995 | (attrib_func) VertexAttrib2NsvARB, |
| 996 | (attrib_func) VertexAttrib2NusvARB, |
| 997 | (attrib_func) VertexAttrib2NivARB, |
| 998 | (attrib_func) VertexAttrib2NuivARB, |
| 999 | (attrib_func) VertexAttrib2fvARB, |
| 1000 | (attrib_func) VertexAttrib2dvARB |
| 1001 | }, |
| 1002 | { |
| 1003 | /* size 3 */ |
| 1004 | (attrib_func) VertexAttrib3NbvARB, |
| 1005 | (attrib_func) VertexAttrib3NubvARB, |
| 1006 | (attrib_func) VertexAttrib3NsvARB, |
| 1007 | (attrib_func) VertexAttrib3NusvARB, |
| 1008 | (attrib_func) VertexAttrib3NivARB, |
| 1009 | (attrib_func) VertexAttrib3NuivARB, |
| 1010 | (attrib_func) VertexAttrib3fvARB, |
| 1011 | (attrib_func) VertexAttrib3dvARB |
| 1012 | }, |
| 1013 | { |
| 1014 | /* size 4 */ |
| 1015 | (attrib_func) VertexAttrib4NbvARB, |
| 1016 | (attrib_func) VertexAttrib4NubvARB, |
| 1017 | (attrib_func) VertexAttrib4NsvARB, |
| 1018 | (attrib_func) VertexAttrib4NusvARB, |
| 1019 | (attrib_func) VertexAttrib4NivARB, |
| 1020 | (attrib_func) VertexAttrib4NuivARB, |
| 1021 | (attrib_func) VertexAttrib4fvARB, |
| 1022 | (attrib_func) VertexAttrib4dvARB |
| 1023 | } |
| 1024 | } |
| 1025 | }; |
| 1026 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1027 | /**********************************************************************/ |
| 1028 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1029 | |
| 1030 | GLboolean _ae_create_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1031 | { |
Keith Whitwell | ae0eaf9 | 2003-11-24 15:23:18 +0000 | [diff] [blame] | 1032 | if (ctx->aelt_context) |
| 1033 | return GL_TRUE; |
| 1034 | |
Brian Paul | 0f1d98c | 2006-03-17 04:10:03 +0000 | [diff] [blame] | 1035 | /* These _gloffset_* values may not be compile-time constants */ |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 1036 | SecondaryColorFuncs[0] = _gloffset_SecondaryColor3bvEXT; |
| 1037 | SecondaryColorFuncs[1] = _gloffset_SecondaryColor3ubvEXT; |
| 1038 | SecondaryColorFuncs[2] = _gloffset_SecondaryColor3svEXT; |
| 1039 | SecondaryColorFuncs[3] = _gloffset_SecondaryColor3usvEXT; |
| 1040 | SecondaryColorFuncs[4] = _gloffset_SecondaryColor3ivEXT; |
| 1041 | SecondaryColorFuncs[5] = _gloffset_SecondaryColor3uivEXT; |
| 1042 | SecondaryColorFuncs[6] = _gloffset_SecondaryColor3fvEXT; |
| 1043 | SecondaryColorFuncs[7] = _gloffset_SecondaryColor3dvEXT; |
| 1044 | |
Brian Paul | eec33cc | 2006-03-17 04:13:29 +0000 | [diff] [blame] | 1045 | FogCoordFuncs[0] = -1; |
| 1046 | FogCoordFuncs[1] = -1; |
| 1047 | FogCoordFuncs[2] = -1; |
| 1048 | FogCoordFuncs[3] = -1; |
| 1049 | FogCoordFuncs[4] = -1; |
| 1050 | FogCoordFuncs[5] = -1; |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 1051 | FogCoordFuncs[6] = _gloffset_FogCoordfvEXT; |
| 1052 | FogCoordFuncs[7] = _gloffset_FogCoorddvEXT; |
Ian Romanick | 126c89e | 2005-08-05 18:13:37 +0000 | [diff] [blame] | 1053 | |
Keith Whitwell | b1c102d | 2006-11-21 13:22:34 +0000 | [diff] [blame^] | 1054 | ctx->aelt_context = CALLOC( sizeof(AEcontext) ); |
Gareth Hughes | 1fb0a43 | 2001-12-28 06:28:10 +0000 | [diff] [blame] | 1055 | if (!ctx->aelt_context) |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1056 | return GL_FALSE; |
| 1057 | |
| 1058 | AE_CONTEXT(ctx)->NewState = ~0; |
| 1059 | return GL_TRUE; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1060 | } |
| 1061 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1062 | |
| 1063 | void _ae_destroy_context( GLcontext *ctx ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1064 | { |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1065 | if ( AE_CONTEXT( ctx ) ) { |
| 1066 | FREE( ctx->aelt_context ); |
Keith Whitwell | a0c8524 | 2005-02-11 09:34:05 +0000 | [diff] [blame] | 1067 | ctx->aelt_context = NULL; |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1068 | } |
| 1069 | } |
| 1070 | |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1071 | static void check_vbo( AEcontext *actx, |
| 1072 | struct gl_buffer_object *vbo ) |
| 1073 | { |
| 1074 | if (vbo->Name && !vbo->Pointer) { |
| 1075 | GLuint i; |
| 1076 | for (i = 0; i < actx->nr_vbos; i++) |
| 1077 | if (actx->vbo[i] == vbo) |
| 1078 | return; |
| 1079 | actx->vbo[actx->nr_vbos++] = vbo; |
| 1080 | } |
| 1081 | } |
| 1082 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1083 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1084 | /** |
| 1085 | * 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] | 1086 | * These functions access the array data (i.e. glVertex, glColor, glNormal, |
| 1087 | * etc). |
| 1088 | * Note: this may be called during display list construction. |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1089 | */ |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1090 | static void _ae_update_state( GLcontext *ctx ) |
| 1091 | { |
| 1092 | AEcontext *actx = AE_CONTEXT(ctx); |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1093 | AEarray *aa = actx->arrays; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1094 | AEattrib *at = actx->attribs; |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 1095 | GLuint i; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1096 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1097 | /* conventional vertex arrays */ |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1098 | if (ctx->Array.ArrayObj->Index.Enabled) { |
| 1099 | aa->array = &ctx->Array.ArrayObj->Index; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1100 | aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1101 | check_vbo(actx, aa->array->BufferObj); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1102 | aa++; |
| 1103 | } |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1104 | if (ctx->Array.ArrayObj->EdgeFlag.Enabled) { |
| 1105 | aa->array = &ctx->Array.ArrayObj->EdgeFlag; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1106 | aa->offset = _gloffset_EdgeFlagv; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1107 | check_vbo(actx, aa->array->BufferObj); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1108 | aa++; |
| 1109 | } |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1110 | if (ctx->Array.ArrayObj->Normal.Enabled) { |
| 1111 | aa->array = &ctx->Array.ArrayObj->Normal; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1112 | aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1113 | check_vbo(actx, aa->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1114 | aa++; |
| 1115 | } |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1116 | if (ctx->Array.ArrayObj->Color.Enabled) { |
| 1117 | aa->array = &ctx->Array.ArrayObj->Color; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1118 | aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1119 | check_vbo(actx, aa->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1120 | aa++; |
| 1121 | } |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1122 | if (ctx->Array.ArrayObj->SecondaryColor.Enabled) { |
| 1123 | aa->array = &ctx->Array.ArrayObj->SecondaryColor; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1124 | aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1125 | check_vbo(actx, aa->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1126 | aa++; |
| 1127 | } |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1128 | if (ctx->Array.ArrayObj->FogCoord.Enabled) { |
| 1129 | aa->array = &ctx->Array.ArrayObj->FogCoord; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1130 | aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1131 | check_vbo(actx, aa->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1132 | aa++; |
| 1133 | } |
| 1134 | for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1135 | struct gl_client_array *attribArray = &ctx->Array.ArrayObj->TexCoord[i]; |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 1136 | if (attribArray->Enabled) { |
| 1137 | /* NOTE: we use generic glVertexAttribNV functions here. |
| 1138 | * If we ever remove GL_NV_vertex_program this will have to change. |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1139 | */ |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1140 | at->array = attribArray; |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 1141 | ASSERT(!at->array->Normalized); |
| 1142 | at->func = AttribFuncsNV[at->array->Normalized] |
| 1143 | [at->array->Size-1] |
| 1144 | [TYPE_IDX(at->array->Type)]; |
Brian Paul | 9d1ff8c | 2004-02-24 14:59:26 +0000 | [diff] [blame] | 1145 | at->index = VERT_ATTRIB_TEX0 + i; |
Keith Whitwell | 64920ed | 2006-11-21 10:50:01 +0000 | [diff] [blame] | 1146 | check_vbo(actx, at->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1147 | at++; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1148 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1149 | } |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 1150 | |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1151 | /* generic vertex attribute arrays */ |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1152 | for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1153 | struct gl_client_array *attribArray = &ctx->Array.ArrayObj->VertexAttrib[i]; |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 1154 | if (attribArray->Enabled) { |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1155 | at->array = attribArray; |
| 1156 | /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV |
| 1157 | * function pointer here (for float arrays) since the pointer may |
| 1158 | * change from one execution of _ae_loopback_array_elt() to |
| 1159 | * the next. Doing so caused UT to break. |
| 1160 | */ |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 1161 | if (ctx->VertexProgram._Enabled |
| 1162 | && ctx->VertexProgram.Current->IsNVProgram) { |
| 1163 | at->func = AttribFuncsNV[at->array->Normalized] |
| 1164 | [at->array->Size-1] |
| 1165 | [TYPE_IDX(at->array->Type)]; |
| 1166 | } |
| 1167 | else { |
| 1168 | at->func = AttribFuncsARB[at->array->Normalized] |
| 1169 | [at->array->Size-1] |
| 1170 | [TYPE_IDX(at->array->Type)]; |
| 1171 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1172 | at->index = i; |
Keith Whitwell | 64920ed | 2006-11-21 10:50:01 +0000 | [diff] [blame] | 1173 | check_vbo(actx, at->array->BufferObj); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1174 | at++; |
| 1175 | } |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 1176 | } |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1177 | |
| 1178 | /* finally, vertex position */ |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1179 | if (ctx->Array.ArrayObj->VertexAttrib[0].Enabled) { |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1180 | /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's |
Brian Paul | 095c669 | 2006-04-25 00:21:32 +0000 | [diff] [blame] | 1181 | * issued as the last (provoking) attribute). |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1182 | */ |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1183 | aa->array = &ctx->Array.ArrayObj->VertexAttrib[0]; |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1184 | assert(aa->array->Size >= 2); /* XXX fix someday? */ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1185 | aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1186 | check_vbo(actx, aa->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1187 | aa++; |
| 1188 | } |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1189 | else if (ctx->Array.ArrayObj->Vertex.Enabled) { |
| 1190 | aa->array = &ctx->Array.ArrayObj->Vertex; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1191 | aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1192 | check_vbo(actx, aa->array->BufferObj); |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1193 | aa++; |
| 1194 | } |
| 1195 | |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1196 | check_vbo(actx, ctx->Array.ElementArrayBufferObj); |
| 1197 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1198 | ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); |
| 1199 | ASSERT(aa - actx->arrays < 32); |
| 1200 | at->func = NULL; /* terminate the list */ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1201 | aa->offset = -1; /* terminate the list */ |
Roland Scheidegger | faaf78a | 2004-02-11 01:06:03 +0000 | [diff] [blame] | 1202 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1203 | actx->NewState = 0; |
| 1204 | } |
| 1205 | |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1206 | void _ae_map_vbos( GLcontext *ctx ) |
| 1207 | { |
| 1208 | AEcontext *actx = AE_CONTEXT(ctx); |
| 1209 | GLuint i; |
| 1210 | |
| 1211 | if (actx->mapped_vbos) |
| 1212 | return; |
| 1213 | |
| 1214 | if (actx->NewState) |
| 1215 | _ae_update_state(ctx); |
| 1216 | |
| 1217 | for (i = 0; i < actx->nr_vbos; i++) |
| 1218 | ctx->Driver.MapBuffer(ctx, |
| 1219 | GL_ARRAY_BUFFER_ARB, |
| 1220 | GL_DYNAMIC_DRAW_ARB, |
| 1221 | actx->vbo[i]); |
| 1222 | |
Keith Whitwell | b1c102d | 2006-11-21 13:22:34 +0000 | [diff] [blame^] | 1223 | if (actx->nr_vbos) |
| 1224 | actx->mapped_vbos = GL_TRUE; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | void _ae_unmap_vbos( GLcontext *ctx ) |
| 1228 | { |
| 1229 | AEcontext *actx = AE_CONTEXT(ctx); |
| 1230 | GLuint i; |
| 1231 | |
Keith Whitwell | 479aca6 | 2006-11-20 15:15:24 +0000 | [diff] [blame] | 1232 | if (!actx->mapped_vbos) |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1233 | return; |
| 1234 | |
Keith Whitwell | 479aca6 | 2006-11-20 15:15:24 +0000 | [diff] [blame] | 1235 | assert (!actx->NewState); |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1236 | |
| 1237 | for (i = 0; i < actx->nr_vbos; i++) |
| 1238 | ctx->Driver.UnmapBuffer(ctx, |
| 1239 | GL_ARRAY_BUFFER_ARB, |
| 1240 | actx->vbo[i]); |
| 1241 | |
Keith Whitwell | 479aca6 | 2006-11-20 15:15:24 +0000 | [diff] [blame] | 1242 | actx->mapped_vbos = GL_FALSE; |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1243 | } |
| 1244 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1245 | |
Brian Paul | 1e3d868 | 2004-02-24 02:49:43 +0000 | [diff] [blame] | 1246 | /** |
| 1247 | * Called via glArrayElement() and glDrawArrays(). |
| 1248 | * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions |
| 1249 | * for all enabled vertex arrays (for elt-th element). |
| 1250 | * Note: this may be called during display list construction. |
| 1251 | */ |
Karl Schultz | d674569 | 2003-12-04 20:23:44 +0000 | [diff] [blame] | 1252 | void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1253 | { |
| 1254 | GET_CURRENT_CONTEXT(ctx); |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1255 | const AEcontext *actx = AE_CONTEXT(ctx); |
| 1256 | const AEarray *aa; |
| 1257 | const AEattrib *at; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1258 | const struct _glapi_table * const disp = GET_DISPATCH(); |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1259 | GLboolean do_map; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1260 | |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1261 | if (actx->NewState) { |
| 1262 | assert(!actx->mapped_vbos); |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1263 | _ae_update_state( ctx ); |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1264 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1265 | |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1266 | do_map = actx->nr_vbos && !actx->mapped_vbos; |
| 1267 | |
| 1268 | /* |
| 1269 | */ |
| 1270 | if (do_map) |
| 1271 | _ae_map_vbos(ctx); |
| 1272 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1273 | /* generic attributes */ |
| 1274 | for (at = actx->attribs; at->func; at++) { |
Brian Paul | 024b589 | 2005-11-25 17:07:10 +0000 | [diff] [blame] | 1275 | const GLubyte *src |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1276 | = ADD_POINTERS(at->array->BufferObj->Pointer, at->array->Ptr) |
Brian Paul | 024b589 | 2005-11-25 17:07:10 +0000 | [diff] [blame] | 1277 | + elt * at->array->StrideB; |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1278 | at->func( at->index, src ); |
Brian Paul | 53ad036 | 2004-02-09 00:24:48 +0000 | [diff] [blame] | 1279 | } |
| 1280 | |
Brian Paul | 0d4393a | 2004-02-11 22:53:38 +0000 | [diff] [blame] | 1281 | /* conventional arrays */ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1282 | for (aa = actx->arrays; aa->offset != -1 ; aa++) { |
Brian Paul | 024b589 | 2005-11-25 17:07:10 +0000 | [diff] [blame] | 1283 | const GLubyte *src |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1284 | = ADD_POINTERS(aa->array->BufferObj->Pointer, aa->array->Ptr) |
Brian Paul | 024b589 | 2005-11-25 17:07:10 +0000 | [diff] [blame] | 1285 | + elt * aa->array->StrideB; |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 1286 | CALL_by_offset( disp, (array_func), aa->offset, |
| 1287 | ((const void *) src) ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1288 | } |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1289 | |
| 1290 | if (do_map) |
| 1291 | _ae_unmap_vbos(ctx); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1292 | } |
| 1293 | |
| 1294 | |
Keith Whitwell | 4b7d6f2 | 2001-06-01 22:22:10 +0000 | [diff] [blame] | 1295 | void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1296 | { |
Keith Whitwell | b979479 | 2006-11-16 02:33:38 +0000 | [diff] [blame] | 1297 | AEcontext *actx = AE_CONTEXT(ctx); |
| 1298 | |
| 1299 | assert(!actx->mapped_vbos); |
| 1300 | actx->NewState |= new_state; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 1301 | } |