1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg/** 26848b8605Smrg * This file implements the glArrayElement() function. 27848b8605Smrg * It involves looking at the format/type of all the enabled vertex arrays 28848b8605Smrg * and emitting a list of pointers to functions which set the per-vertex 29848b8605Smrg * state for the element/index. 30848b8605Smrg */ 31848b8605Smrg 32848b8605Smrg 33848b8605Smrg/* Author: 34848b8605Smrg * Keith Whitwell <keithw@vmware.com> 35848b8605Smrg */ 36848b8605Smrg 37848b8605Smrg#include "glheader.h" 38848b8605Smrg#include "arrayobj.h" 39848b8605Smrg#include "api_arrayelt.h" 40848b8605Smrg#include "bufferobj.h" 41848b8605Smrg#include "context.h" 42848b8605Smrg#include "imports.h" 43848b8605Smrg#include "macros.h" 44848b8605Smrg#include "mtypes.h" 45848b8605Smrg#include "main/dispatch.h" 46848b8605Smrg#include "varray.h" 47848b8605Smrg 48848b8605Smrgtypedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data ); 49848b8605Smrg 50848b8605Smrg/* 51848b8605Smrg * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer 52848b8605Smrg * in the range [0, 7]. Luckily these type tokens are sequentially 53848b8605Smrg * numbered in gl.h, except for GL_DOUBLE. 54848b8605Smrg */ 55b8e80941Smrgstatic inline int 56848b8605SmrgTYPE_IDX(GLenum t) 57848b8605Smrg{ 58848b8605Smrg return t == GL_DOUBLE ? 7 : t & 7; 59848b8605Smrg} 60848b8605Smrg 61848b8605Smrg 62b8e80941Smrg/* 63b8e80941Smrg * Convert normalized/integer/double to the range [0, 3]. 64b8e80941Smrg */ 65b8e80941Smrgstatic inline int 66b8e80941Smrgvertex_format_to_index(const struct gl_vertex_format *vformat) 67b8e80941Smrg{ 68b8e80941Smrg if (vformat->Doubles) 69b8e80941Smrg return 3; 70b8e80941Smrg else if (vformat->Integer) 71b8e80941Smrg return 2; 72b8e80941Smrg else if (vformat->Normalized) 73b8e80941Smrg return 1; 74b8e80941Smrg else 75b8e80941Smrg return 0; 76b8e80941Smrg} 77848b8605Smrg 78848b8605Smrg 79b8e80941Smrg#define NUM_TYPES 8 80848b8605Smrg 81848b8605Smrg 82848b8605Smrg/** 83848b8605Smrg ** GL_NV_vertex_program 84848b8605Smrg **/ 85848b8605Smrg 86848b8605Smrg/* GL_BYTE attributes */ 87848b8605Smrg 88848b8605Smrgstatic void GLAPIENTRY 89848b8605SmrgVertexAttrib1NbvNV(GLuint index, const GLbyte *v) 90848b8605Smrg{ 91848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); 92848b8605Smrg} 93848b8605Smrg 94848b8605Smrgstatic void GLAPIENTRY 95848b8605SmrgVertexAttrib1bvNV(GLuint index, const GLbyte *v) 96848b8605Smrg{ 97848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); 98848b8605Smrg} 99848b8605Smrg 100848b8605Smrgstatic void GLAPIENTRY 101848b8605SmrgVertexAttrib2NbvNV(GLuint index, const GLbyte *v) 102848b8605Smrg{ 103848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); 104848b8605Smrg} 105848b8605Smrg 106848b8605Smrgstatic void GLAPIENTRY 107848b8605SmrgVertexAttrib2bvNV(GLuint index, const GLbyte *v) 108848b8605Smrg{ 109848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); 110848b8605Smrg} 111848b8605Smrg 112848b8605Smrgstatic void GLAPIENTRY 113848b8605SmrgVertexAttrib3NbvNV(GLuint index, const GLbyte *v) 114848b8605Smrg{ 115848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), 116848b8605Smrg BYTE_TO_FLOAT(v[1]), 117848b8605Smrg BYTE_TO_FLOAT(v[2]))); 118848b8605Smrg} 119848b8605Smrg 120848b8605Smrgstatic void GLAPIENTRY 121848b8605SmrgVertexAttrib3bvNV(GLuint index, const GLbyte *v) 122848b8605Smrg{ 123848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); 124848b8605Smrg} 125848b8605Smrg 126848b8605Smrgstatic void GLAPIENTRY 127848b8605SmrgVertexAttrib4NbvNV(GLuint index, const GLbyte *v) 128848b8605Smrg{ 129848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), 130848b8605Smrg BYTE_TO_FLOAT(v[1]), 131848b8605Smrg BYTE_TO_FLOAT(v[2]), 132848b8605Smrg BYTE_TO_FLOAT(v[3]))); 133848b8605Smrg} 134848b8605Smrg 135848b8605Smrgstatic void GLAPIENTRY 136848b8605SmrgVertexAttrib4bvNV(GLuint index, const GLbyte *v) 137848b8605Smrg{ 138848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); 139848b8605Smrg} 140848b8605Smrg 141848b8605Smrg/* GL_UNSIGNED_BYTE attributes */ 142848b8605Smrg 143848b8605Smrgstatic void GLAPIENTRY 144848b8605SmrgVertexAttrib1NubvNV(GLuint index, const GLubyte *v) 145848b8605Smrg{ 146848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); 147848b8605Smrg} 148848b8605Smrg 149848b8605Smrgstatic void GLAPIENTRY 150848b8605SmrgVertexAttrib1ubvNV(GLuint index, const GLubyte *v) 151848b8605Smrg{ 152848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); 153848b8605Smrg} 154848b8605Smrg 155848b8605Smrgstatic void GLAPIENTRY 156848b8605SmrgVertexAttrib2NubvNV(GLuint index, const GLubyte *v) 157848b8605Smrg{ 158848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), 159848b8605Smrg UBYTE_TO_FLOAT(v[1]))); 160848b8605Smrg} 161848b8605Smrg 162848b8605Smrgstatic void GLAPIENTRY 163848b8605SmrgVertexAttrib2ubvNV(GLuint index, const GLubyte *v) 164848b8605Smrg{ 165848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); 166848b8605Smrg} 167848b8605Smrg 168848b8605Smrgstatic void GLAPIENTRY 169848b8605SmrgVertexAttrib3NubvNV(GLuint index, const GLubyte *v) 170848b8605Smrg{ 171848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), 172848b8605Smrg UBYTE_TO_FLOAT(v[1]), 173848b8605Smrg UBYTE_TO_FLOAT(v[2]))); 174848b8605Smrg} 175848b8605Smrgstatic void GLAPIENTRY 176848b8605SmrgVertexAttrib3ubvNV(GLuint index, const GLubyte *v) 177848b8605Smrg{ 178848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], 179848b8605Smrg (GLfloat)v[1], (GLfloat)v[2])); 180848b8605Smrg} 181848b8605Smrg 182848b8605Smrgstatic void GLAPIENTRY 183848b8605SmrgVertexAttrib4NubvNV(GLuint index, const GLubyte *v) 184848b8605Smrg{ 185848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), 186848b8605Smrg UBYTE_TO_FLOAT(v[1]), 187848b8605Smrg UBYTE_TO_FLOAT(v[2]), 188848b8605Smrg UBYTE_TO_FLOAT(v[3]))); 189848b8605Smrg} 190848b8605Smrg 191848b8605Smrgstatic void GLAPIENTRY 192848b8605SmrgVertexAttrib4ubvNV(GLuint index, const GLubyte *v) 193848b8605Smrg{ 194848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], 195848b8605Smrg (GLfloat)v[1], (GLfloat)v[2], 196848b8605Smrg (GLfloat)v[3])); 197848b8605Smrg} 198848b8605Smrg 199848b8605Smrg/* GL_SHORT attributes */ 200848b8605Smrg 201848b8605Smrgstatic void GLAPIENTRY 202848b8605SmrgVertexAttrib1NsvNV(GLuint index, const GLshort *v) 203848b8605Smrg{ 204848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); 205848b8605Smrg} 206848b8605Smrg 207848b8605Smrgstatic void GLAPIENTRY 208848b8605SmrgVertexAttrib1svNV(GLuint index, const GLshort *v) 209848b8605Smrg{ 210848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); 211848b8605Smrg} 212848b8605Smrg 213848b8605Smrgstatic void GLAPIENTRY 214848b8605SmrgVertexAttrib2NsvNV(GLuint index, const GLshort *v) 215848b8605Smrg{ 216848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), 217848b8605Smrg SHORT_TO_FLOAT(v[1]))); 218848b8605Smrg} 219848b8605Smrg 220848b8605Smrgstatic void GLAPIENTRY 221848b8605SmrgVertexAttrib2svNV(GLuint index, const GLshort *v) 222848b8605Smrg{ 223848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); 224848b8605Smrg} 225848b8605Smrg 226848b8605Smrgstatic void GLAPIENTRY 227848b8605SmrgVertexAttrib3NsvNV(GLuint index, const GLshort *v) 228848b8605Smrg{ 229848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), 230848b8605Smrg SHORT_TO_FLOAT(v[1]), 231848b8605Smrg SHORT_TO_FLOAT(v[2]))); 232848b8605Smrg} 233848b8605Smrg 234848b8605Smrgstatic void GLAPIENTRY 235848b8605SmrgVertexAttrib3svNV(GLuint index, const GLshort *v) 236848b8605Smrg{ 237848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 238848b8605Smrg (GLfloat)v[2])); 239848b8605Smrg} 240848b8605Smrg 241848b8605Smrgstatic void GLAPIENTRY 242848b8605SmrgVertexAttrib4NsvNV(GLuint index, const GLshort *v) 243848b8605Smrg{ 244848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), 245848b8605Smrg SHORT_TO_FLOAT(v[1]), 246848b8605Smrg SHORT_TO_FLOAT(v[2]), 247848b8605Smrg SHORT_TO_FLOAT(v[3]))); 248848b8605Smrg} 249848b8605Smrg 250848b8605Smrgstatic void GLAPIENTRY 251848b8605SmrgVertexAttrib4svNV(GLuint index, const GLshort *v) 252848b8605Smrg{ 253848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 254848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 255848b8605Smrg} 256848b8605Smrg 257848b8605Smrg/* GL_UNSIGNED_SHORT attributes */ 258848b8605Smrg 259848b8605Smrgstatic void GLAPIENTRY 260848b8605SmrgVertexAttrib1NusvNV(GLuint index, const GLushort *v) 261848b8605Smrg{ 262848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); 263848b8605Smrg} 264848b8605Smrg 265848b8605Smrgstatic void GLAPIENTRY 266848b8605SmrgVertexAttrib1usvNV(GLuint index, const GLushort *v) 267848b8605Smrg{ 268848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); 269848b8605Smrg} 270848b8605Smrg 271848b8605Smrgstatic void GLAPIENTRY 272848b8605SmrgVertexAttrib2NusvNV(GLuint index, const GLushort *v) 273848b8605Smrg{ 274848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), 275848b8605Smrg USHORT_TO_FLOAT(v[1]))); 276848b8605Smrg} 277848b8605Smrg 278848b8605Smrgstatic void GLAPIENTRY 279848b8605SmrgVertexAttrib2usvNV(GLuint index, const GLushort *v) 280848b8605Smrg{ 281848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], 282848b8605Smrg (GLfloat)v[1])); 283848b8605Smrg} 284848b8605Smrg 285848b8605Smrgstatic void GLAPIENTRY 286848b8605SmrgVertexAttrib3NusvNV(GLuint index, const GLushort *v) 287848b8605Smrg{ 288848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), 289848b8605Smrg USHORT_TO_FLOAT(v[1]), 290848b8605Smrg USHORT_TO_FLOAT(v[2]))); 291848b8605Smrg} 292848b8605Smrg 293848b8605Smrgstatic void GLAPIENTRY 294848b8605SmrgVertexAttrib3usvNV(GLuint index, const GLushort *v) 295848b8605Smrg{ 296848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 297848b8605Smrg (GLfloat)v[2])); 298848b8605Smrg} 299848b8605Smrg 300848b8605Smrgstatic void GLAPIENTRY 301848b8605SmrgVertexAttrib4NusvNV(GLuint index, const GLushort *v) 302848b8605Smrg{ 303848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), 304848b8605Smrg USHORT_TO_FLOAT(v[1]), 305848b8605Smrg USHORT_TO_FLOAT(v[2]), 306848b8605Smrg USHORT_TO_FLOAT(v[3]))); 307848b8605Smrg} 308848b8605Smrg 309848b8605Smrgstatic void GLAPIENTRY 310848b8605SmrgVertexAttrib4usvNV(GLuint index, const GLushort *v) 311848b8605Smrg{ 312848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 313848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 314848b8605Smrg} 315848b8605Smrg 316848b8605Smrg/* GL_INT attributes */ 317848b8605Smrg 318848b8605Smrgstatic void GLAPIENTRY 319848b8605SmrgVertexAttrib1NivNV(GLuint index, const GLint *v) 320848b8605Smrg{ 321848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); 322848b8605Smrg} 323848b8605Smrg 324848b8605Smrgstatic void GLAPIENTRY 325848b8605SmrgVertexAttrib1ivNV(GLuint index, const GLint *v) 326848b8605Smrg{ 327848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); 328848b8605Smrg} 329848b8605Smrg 330848b8605Smrgstatic void GLAPIENTRY 331848b8605SmrgVertexAttrib2NivNV(GLuint index, const GLint *v) 332848b8605Smrg{ 333848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), 334848b8605Smrg INT_TO_FLOAT(v[1]))); 335848b8605Smrg} 336848b8605Smrg 337848b8605Smrgstatic void GLAPIENTRY 338848b8605SmrgVertexAttrib2ivNV(GLuint index, const GLint *v) 339848b8605Smrg{ 340848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); 341848b8605Smrg} 342848b8605Smrg 343848b8605Smrgstatic void GLAPIENTRY 344848b8605SmrgVertexAttrib3NivNV(GLuint index, const GLint *v) 345848b8605Smrg{ 346848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), 347848b8605Smrg INT_TO_FLOAT(v[1]), 348848b8605Smrg INT_TO_FLOAT(v[2]))); 349848b8605Smrg} 350848b8605Smrg 351848b8605Smrgstatic void GLAPIENTRY 352848b8605SmrgVertexAttrib3ivNV(GLuint index, const GLint *v) 353848b8605Smrg{ 354848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 355848b8605Smrg (GLfloat)v[2])); 356848b8605Smrg} 357848b8605Smrg 358848b8605Smrgstatic void GLAPIENTRY 359848b8605SmrgVertexAttrib4NivNV(GLuint index, const GLint *v) 360848b8605Smrg{ 361848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), 362848b8605Smrg INT_TO_FLOAT(v[1]), 363848b8605Smrg INT_TO_FLOAT(v[2]), 364848b8605Smrg INT_TO_FLOAT(v[3]))); 365848b8605Smrg} 366848b8605Smrg 367848b8605Smrgstatic void GLAPIENTRY 368848b8605SmrgVertexAttrib4ivNV(GLuint index, const GLint *v) 369848b8605Smrg{ 370848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 371848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 372848b8605Smrg} 373848b8605Smrg 374848b8605Smrg/* GL_UNSIGNED_INT attributes */ 375848b8605Smrg 376848b8605Smrgstatic void GLAPIENTRY 377848b8605SmrgVertexAttrib1NuivNV(GLuint index, const GLuint *v) 378848b8605Smrg{ 379848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); 380848b8605Smrg} 381848b8605Smrg 382848b8605Smrgstatic void GLAPIENTRY 383848b8605SmrgVertexAttrib1uivNV(GLuint index, const GLuint *v) 384848b8605Smrg{ 385848b8605Smrg CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); 386848b8605Smrg} 387848b8605Smrg 388848b8605Smrgstatic void GLAPIENTRY 389848b8605SmrgVertexAttrib2NuivNV(GLuint index, const GLuint *v) 390848b8605Smrg{ 391848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), 392848b8605Smrg UINT_TO_FLOAT(v[1]))); 393848b8605Smrg} 394848b8605Smrg 395848b8605Smrgstatic void GLAPIENTRY 396848b8605SmrgVertexAttrib2uivNV(GLuint index, const GLuint *v) 397848b8605Smrg{ 398848b8605Smrg CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], 399848b8605Smrg (GLfloat)v[1])); 400848b8605Smrg} 401848b8605Smrg 402848b8605Smrgstatic void GLAPIENTRY 403848b8605SmrgVertexAttrib3NuivNV(GLuint index, const GLuint *v) 404848b8605Smrg{ 405848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), 406848b8605Smrg UINT_TO_FLOAT(v[1]), 407848b8605Smrg UINT_TO_FLOAT(v[2]))); 408848b8605Smrg} 409848b8605Smrg 410848b8605Smrgstatic void GLAPIENTRY 411848b8605SmrgVertexAttrib3uivNV(GLuint index, const GLuint *v) 412848b8605Smrg{ 413848b8605Smrg CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 414848b8605Smrg (GLfloat)v[2])); 415848b8605Smrg} 416848b8605Smrg 417848b8605Smrgstatic void GLAPIENTRY 418848b8605SmrgVertexAttrib4NuivNV(GLuint index, const GLuint *v) 419848b8605Smrg{ 420848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), 421848b8605Smrg UINT_TO_FLOAT(v[1]), 422848b8605Smrg UINT_TO_FLOAT(v[2]), 423848b8605Smrg UINT_TO_FLOAT(v[3]))); 424848b8605Smrg} 425848b8605Smrg 426848b8605Smrgstatic void GLAPIENTRY 427848b8605SmrgVertexAttrib4uivNV(GLuint index, const GLuint *v) 428848b8605Smrg{ 429848b8605Smrg CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 430848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 431848b8605Smrg} 432848b8605Smrg 433848b8605Smrg/* GL_FLOAT attributes */ 434848b8605Smrg 435848b8605Smrgstatic void GLAPIENTRY 436848b8605SmrgVertexAttrib1fvNV(GLuint index, const GLfloat *v) 437848b8605Smrg{ 438848b8605Smrg CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v)); 439848b8605Smrg} 440848b8605Smrg 441848b8605Smrgstatic void GLAPIENTRY 442848b8605SmrgVertexAttrib2fvNV(GLuint index, const GLfloat *v) 443848b8605Smrg{ 444848b8605Smrg CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v)); 445848b8605Smrg} 446848b8605Smrg 447848b8605Smrgstatic void GLAPIENTRY 448848b8605SmrgVertexAttrib3fvNV(GLuint index, const GLfloat *v) 449848b8605Smrg{ 450848b8605Smrg CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v)); 451848b8605Smrg} 452848b8605Smrg 453848b8605Smrgstatic void GLAPIENTRY 454848b8605SmrgVertexAttrib4fvNV(GLuint index, const GLfloat *v) 455848b8605Smrg{ 456848b8605Smrg CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v)); 457848b8605Smrg} 458848b8605Smrg 459848b8605Smrg/* GL_DOUBLE attributes */ 460848b8605Smrg 461848b8605Smrgstatic void GLAPIENTRY 462848b8605SmrgVertexAttrib1dvNV(GLuint index, const GLdouble *v) 463848b8605Smrg{ 464848b8605Smrg CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v)); 465848b8605Smrg} 466848b8605Smrg 467848b8605Smrgstatic void GLAPIENTRY 468848b8605SmrgVertexAttrib2dvNV(GLuint index, const GLdouble *v) 469848b8605Smrg{ 470848b8605Smrg CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v)); 471848b8605Smrg} 472848b8605Smrg 473848b8605Smrgstatic void GLAPIENTRY 474848b8605SmrgVertexAttrib3dvNV(GLuint index, const GLdouble *v) 475848b8605Smrg{ 476848b8605Smrg CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v)); 477848b8605Smrg} 478848b8605Smrg 479848b8605Smrgstatic void GLAPIENTRY 480848b8605SmrgVertexAttrib4dvNV(GLuint index, const GLdouble *v) 481848b8605Smrg{ 482848b8605Smrg CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v)); 483848b8605Smrg} 484848b8605Smrg 485848b8605Smrg 486848b8605Smrg/* 487848b8605Smrg * Array [size][type] of VertexAttrib functions 488848b8605Smrg */ 489b8e80941Smrgstatic const attrib_func AttribFuncsNV[2][4][NUM_TYPES] = { 490848b8605Smrg { 491848b8605Smrg /* non-normalized */ 492848b8605Smrg { 493848b8605Smrg /* size 1 */ 494848b8605Smrg (attrib_func) VertexAttrib1bvNV, 495848b8605Smrg (attrib_func) VertexAttrib1ubvNV, 496848b8605Smrg (attrib_func) VertexAttrib1svNV, 497848b8605Smrg (attrib_func) VertexAttrib1usvNV, 498848b8605Smrg (attrib_func) VertexAttrib1ivNV, 499848b8605Smrg (attrib_func) VertexAttrib1uivNV, 500848b8605Smrg (attrib_func) VertexAttrib1fvNV, 501848b8605Smrg (attrib_func) VertexAttrib1dvNV 502848b8605Smrg }, 503848b8605Smrg { 504848b8605Smrg /* size 2 */ 505848b8605Smrg (attrib_func) VertexAttrib2bvNV, 506848b8605Smrg (attrib_func) VertexAttrib2ubvNV, 507848b8605Smrg (attrib_func) VertexAttrib2svNV, 508848b8605Smrg (attrib_func) VertexAttrib2usvNV, 509848b8605Smrg (attrib_func) VertexAttrib2ivNV, 510848b8605Smrg (attrib_func) VertexAttrib2uivNV, 511848b8605Smrg (attrib_func) VertexAttrib2fvNV, 512848b8605Smrg (attrib_func) VertexAttrib2dvNV 513848b8605Smrg }, 514848b8605Smrg { 515848b8605Smrg /* size 3 */ 516848b8605Smrg (attrib_func) VertexAttrib3bvNV, 517848b8605Smrg (attrib_func) VertexAttrib3ubvNV, 518848b8605Smrg (attrib_func) VertexAttrib3svNV, 519848b8605Smrg (attrib_func) VertexAttrib3usvNV, 520848b8605Smrg (attrib_func) VertexAttrib3ivNV, 521848b8605Smrg (attrib_func) VertexAttrib3uivNV, 522848b8605Smrg (attrib_func) VertexAttrib3fvNV, 523848b8605Smrg (attrib_func) VertexAttrib3dvNV 524848b8605Smrg }, 525848b8605Smrg { 526848b8605Smrg /* size 4 */ 527848b8605Smrg (attrib_func) VertexAttrib4bvNV, 528848b8605Smrg (attrib_func) VertexAttrib4ubvNV, 529848b8605Smrg (attrib_func) VertexAttrib4svNV, 530848b8605Smrg (attrib_func) VertexAttrib4usvNV, 531848b8605Smrg (attrib_func) VertexAttrib4ivNV, 532848b8605Smrg (attrib_func) VertexAttrib4uivNV, 533848b8605Smrg (attrib_func) VertexAttrib4fvNV, 534848b8605Smrg (attrib_func) VertexAttrib4dvNV 535848b8605Smrg } 536848b8605Smrg }, 537848b8605Smrg { 538848b8605Smrg /* normalized (except for float/double) */ 539848b8605Smrg { 540848b8605Smrg /* size 1 */ 541848b8605Smrg (attrib_func) VertexAttrib1NbvNV, 542848b8605Smrg (attrib_func) VertexAttrib1NubvNV, 543848b8605Smrg (attrib_func) VertexAttrib1NsvNV, 544848b8605Smrg (attrib_func) VertexAttrib1NusvNV, 545848b8605Smrg (attrib_func) VertexAttrib1NivNV, 546848b8605Smrg (attrib_func) VertexAttrib1NuivNV, 547848b8605Smrg (attrib_func) VertexAttrib1fvNV, 548848b8605Smrg (attrib_func) VertexAttrib1dvNV 549848b8605Smrg }, 550848b8605Smrg { 551848b8605Smrg /* size 2 */ 552848b8605Smrg (attrib_func) VertexAttrib2NbvNV, 553848b8605Smrg (attrib_func) VertexAttrib2NubvNV, 554848b8605Smrg (attrib_func) VertexAttrib2NsvNV, 555848b8605Smrg (attrib_func) VertexAttrib2NusvNV, 556848b8605Smrg (attrib_func) VertexAttrib2NivNV, 557848b8605Smrg (attrib_func) VertexAttrib2NuivNV, 558848b8605Smrg (attrib_func) VertexAttrib2fvNV, 559848b8605Smrg (attrib_func) VertexAttrib2dvNV 560848b8605Smrg }, 561848b8605Smrg { 562848b8605Smrg /* size 3 */ 563848b8605Smrg (attrib_func) VertexAttrib3NbvNV, 564848b8605Smrg (attrib_func) VertexAttrib3NubvNV, 565848b8605Smrg (attrib_func) VertexAttrib3NsvNV, 566848b8605Smrg (attrib_func) VertexAttrib3NusvNV, 567848b8605Smrg (attrib_func) VertexAttrib3NivNV, 568848b8605Smrg (attrib_func) VertexAttrib3NuivNV, 569848b8605Smrg (attrib_func) VertexAttrib3fvNV, 570848b8605Smrg (attrib_func) VertexAttrib3dvNV 571848b8605Smrg }, 572848b8605Smrg { 573848b8605Smrg /* size 4 */ 574848b8605Smrg (attrib_func) VertexAttrib4NbvNV, 575848b8605Smrg (attrib_func) VertexAttrib4NubvNV, 576848b8605Smrg (attrib_func) VertexAttrib4NsvNV, 577848b8605Smrg (attrib_func) VertexAttrib4NusvNV, 578848b8605Smrg (attrib_func) VertexAttrib4NivNV, 579848b8605Smrg (attrib_func) VertexAttrib4NuivNV, 580848b8605Smrg (attrib_func) VertexAttrib4fvNV, 581848b8605Smrg (attrib_func) VertexAttrib4dvNV 582848b8605Smrg } 583848b8605Smrg } 584848b8605Smrg}; 585848b8605Smrg 586848b8605Smrg 587848b8605Smrg/** 588848b8605Smrg ** GL_ARB_vertex_program 589848b8605Smrg **/ 590848b8605Smrg 591848b8605Smrg/* GL_BYTE attributes */ 592848b8605Smrg 593848b8605Smrgstatic void GLAPIENTRY 594848b8605SmrgVertexAttrib1NbvARB(GLuint index, const GLbyte *v) 595848b8605Smrg{ 596848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); 597848b8605Smrg} 598848b8605Smrg 599848b8605Smrgstatic void GLAPIENTRY 600848b8605SmrgVertexAttrib1bvARB(GLuint index, const GLbyte *v) 601848b8605Smrg{ 602848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); 603848b8605Smrg} 604848b8605Smrg 605848b8605Smrgstatic void GLAPIENTRY 606848b8605SmrgVertexAttrib2NbvARB(GLuint index, const GLbyte *v) 607848b8605Smrg{ 608848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); 609848b8605Smrg} 610848b8605Smrg 611848b8605Smrgstatic void GLAPIENTRY 612848b8605SmrgVertexAttrib2bvARB(GLuint index, const GLbyte *v) 613848b8605Smrg{ 614848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); 615848b8605Smrg} 616848b8605Smrg 617848b8605Smrgstatic void GLAPIENTRY 618848b8605SmrgVertexAttrib3NbvARB(GLuint index, const GLbyte *v) 619848b8605Smrg{ 620848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), 621848b8605Smrg BYTE_TO_FLOAT(v[1]), 622848b8605Smrg BYTE_TO_FLOAT(v[2]))); 623848b8605Smrg} 624848b8605Smrg 625848b8605Smrgstatic void GLAPIENTRY 626848b8605SmrgVertexAttrib3bvARB(GLuint index, const GLbyte *v) 627848b8605Smrg{ 628848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); 629848b8605Smrg} 630848b8605Smrg 631848b8605Smrgstatic void GLAPIENTRY 632848b8605SmrgVertexAttrib4NbvARB(GLuint index, const GLbyte *v) 633848b8605Smrg{ 634848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), 635848b8605Smrg BYTE_TO_FLOAT(v[1]), 636848b8605Smrg BYTE_TO_FLOAT(v[2]), 637848b8605Smrg BYTE_TO_FLOAT(v[3]))); 638848b8605Smrg} 639848b8605Smrg 640848b8605Smrgstatic void GLAPIENTRY 641848b8605SmrgVertexAttrib4bvARB(GLuint index, const GLbyte *v) 642848b8605Smrg{ 643848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); 644848b8605Smrg} 645848b8605Smrg 646848b8605Smrg/* GL_UNSIGNED_BYTE attributes */ 647848b8605Smrg 648848b8605Smrgstatic void GLAPIENTRY 649848b8605SmrgVertexAttrib1NubvARB(GLuint index, const GLubyte *v) 650848b8605Smrg{ 651848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); 652848b8605Smrg} 653848b8605Smrg 654848b8605Smrgstatic void GLAPIENTRY 655848b8605SmrgVertexAttrib1ubvARB(GLuint index, const GLubyte *v) 656848b8605Smrg{ 657848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); 658848b8605Smrg} 659848b8605Smrg 660848b8605Smrgstatic void GLAPIENTRY 661848b8605SmrgVertexAttrib2NubvARB(GLuint index, const GLubyte *v) 662848b8605Smrg{ 663848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, 664848b8605Smrg UBYTE_TO_FLOAT(v[0]), 665848b8605Smrg UBYTE_TO_FLOAT(v[1]))); 666848b8605Smrg} 667848b8605Smrg 668848b8605Smrgstatic void GLAPIENTRY 669848b8605SmrgVertexAttrib2ubvARB(GLuint index, const GLubyte *v) 670848b8605Smrg{ 671848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, 672848b8605Smrg (GLfloat)v[0], (GLfloat)v[1])); 673848b8605Smrg} 674848b8605Smrg 675848b8605Smrgstatic void GLAPIENTRY 676848b8605SmrgVertexAttrib3NubvARB(GLuint index, const GLubyte *v) 677848b8605Smrg{ 678848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, 679848b8605Smrg UBYTE_TO_FLOAT(v[0]), 680848b8605Smrg UBYTE_TO_FLOAT(v[1]), 681848b8605Smrg UBYTE_TO_FLOAT(v[2]))); 682848b8605Smrg} 683848b8605Smrgstatic void GLAPIENTRY 684848b8605SmrgVertexAttrib3ubvARB(GLuint index, const GLubyte *v) 685848b8605Smrg{ 686848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, 687848b8605Smrg (GLfloat)v[0], 688848b8605Smrg (GLfloat)v[1], 689848b8605Smrg (GLfloat)v[2])); 690848b8605Smrg} 691848b8605Smrg 692848b8605Smrgstatic void GLAPIENTRY 693848b8605SmrgVertexAttrib4NubvARB(GLuint index, const GLubyte *v) 694848b8605Smrg{ 695848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), 696848b8605Smrg (index, 697848b8605Smrg UBYTE_TO_FLOAT(v[0]), 698848b8605Smrg UBYTE_TO_FLOAT(v[1]), 699848b8605Smrg UBYTE_TO_FLOAT(v[2]), 700848b8605Smrg UBYTE_TO_FLOAT(v[3]))); 701848b8605Smrg} 702848b8605Smrg 703848b8605Smrgstatic void GLAPIENTRY 704848b8605SmrgVertexAttrib4ubvARB(GLuint index, const GLubyte *v) 705848b8605Smrg{ 706848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), 707848b8605Smrg (index, 708848b8605Smrg (GLfloat)v[0], (GLfloat)v[1], 709848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 710848b8605Smrg} 711848b8605Smrg 712848b8605Smrg/* GL_SHORT attributes */ 713848b8605Smrg 714848b8605Smrgstatic void GLAPIENTRY 715848b8605SmrgVertexAttrib1NsvARB(GLuint index, const GLshort *v) 716848b8605Smrg{ 717848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); 718848b8605Smrg} 719848b8605Smrg 720848b8605Smrgstatic void GLAPIENTRY 721848b8605SmrgVertexAttrib1svARB(GLuint index, const GLshort *v) 722848b8605Smrg{ 723848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); 724848b8605Smrg} 725848b8605Smrg 726848b8605Smrgstatic void GLAPIENTRY 727848b8605SmrgVertexAttrib2NsvARB(GLuint index, const GLshort *v) 728848b8605Smrg{ 729848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), 730848b8605Smrg (index, SHORT_TO_FLOAT(v[0]), 731848b8605Smrg SHORT_TO_FLOAT(v[1]))); 732848b8605Smrg} 733848b8605Smrg 734848b8605Smrgstatic void GLAPIENTRY 735848b8605SmrgVertexAttrib2svARB(GLuint index, const GLshort *v) 736848b8605Smrg{ 737848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), 738848b8605Smrg (index, (GLfloat)v[0], (GLfloat)v[1])); 739848b8605Smrg} 740848b8605Smrg 741848b8605Smrgstatic void GLAPIENTRY 742848b8605SmrgVertexAttrib3NsvARB(GLuint index, const GLshort *v) 743848b8605Smrg{ 744848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), 745848b8605Smrg (index, 746848b8605Smrg SHORT_TO_FLOAT(v[0]), 747848b8605Smrg SHORT_TO_FLOAT(v[1]), 748848b8605Smrg SHORT_TO_FLOAT(v[2]))); 749848b8605Smrg} 750848b8605Smrg 751848b8605Smrgstatic void GLAPIENTRY 752848b8605SmrgVertexAttrib3svARB(GLuint index, const GLshort *v) 753848b8605Smrg{ 754848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), 755848b8605Smrg (index, 756848b8605Smrg (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); 757848b8605Smrg} 758848b8605Smrg 759848b8605Smrgstatic void GLAPIENTRY 760848b8605SmrgVertexAttrib4NsvARB(GLuint index, const GLshort *v) 761848b8605Smrg{ 762848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), 763848b8605Smrg (index, 764848b8605Smrg SHORT_TO_FLOAT(v[0]), 765848b8605Smrg SHORT_TO_FLOAT(v[1]), 766848b8605Smrg SHORT_TO_FLOAT(v[2]), 767848b8605Smrg SHORT_TO_FLOAT(v[3]))); 768848b8605Smrg} 769848b8605Smrg 770848b8605Smrgstatic void GLAPIENTRY 771848b8605SmrgVertexAttrib4svARB(GLuint index, const GLshort *v) 772848b8605Smrg{ 773848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 774848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 775848b8605Smrg} 776848b8605Smrg 777848b8605Smrg/* GL_UNSIGNED_SHORT attributes */ 778848b8605Smrg 779848b8605Smrgstatic void GLAPIENTRY 780848b8605SmrgVertexAttrib1NusvARB(GLuint index, const GLushort *v) 781848b8605Smrg{ 782848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); 783848b8605Smrg} 784848b8605Smrg 785848b8605Smrgstatic void GLAPIENTRY 786848b8605SmrgVertexAttrib1usvARB(GLuint index, const GLushort *v) 787848b8605Smrg{ 788848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); 789848b8605Smrg} 790848b8605Smrg 791848b8605Smrgstatic void GLAPIENTRY 792848b8605SmrgVertexAttrib2NusvARB(GLuint index, const GLushort *v) 793848b8605Smrg{ 794848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), 795848b8605Smrg USHORT_TO_FLOAT(v[1]))); 796848b8605Smrg} 797848b8605Smrg 798848b8605Smrgstatic void GLAPIENTRY 799848b8605SmrgVertexAttrib2usvARB(GLuint index, const GLushort *v) 800848b8605Smrg{ 801848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], 802848b8605Smrg (GLfloat)v[1])); 803848b8605Smrg} 804848b8605Smrg 805848b8605Smrgstatic void GLAPIENTRY 806848b8605SmrgVertexAttrib3NusvARB(GLuint index, const GLushort *v) 807848b8605Smrg{ 808848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), 809848b8605Smrg USHORT_TO_FLOAT(v[1]), 810848b8605Smrg USHORT_TO_FLOAT(v[2]))); 811848b8605Smrg} 812848b8605Smrg 813848b8605Smrgstatic void GLAPIENTRY 814848b8605SmrgVertexAttrib3usvARB(GLuint index, const GLushort *v) 815848b8605Smrg{ 816848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], 817848b8605Smrg (GLfloat)v[1], (GLfloat)v[2])); 818848b8605Smrg} 819848b8605Smrg 820848b8605Smrgstatic void GLAPIENTRY 821848b8605SmrgVertexAttrib4NusvARB(GLuint index, const GLushort *v) 822848b8605Smrg{ 823848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), 824848b8605Smrg USHORT_TO_FLOAT(v[1]), 825848b8605Smrg USHORT_TO_FLOAT(v[2]), 826848b8605Smrg USHORT_TO_FLOAT(v[3]))); 827848b8605Smrg} 828848b8605Smrg 829848b8605Smrgstatic void GLAPIENTRY 830848b8605SmrgVertexAttrib4usvARB(GLuint index, const GLushort *v) 831848b8605Smrg{ 832848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); 833848b8605Smrg} 834848b8605Smrg 835848b8605Smrg/* GL_INT attributes */ 836848b8605Smrg 837848b8605Smrgstatic void GLAPIENTRY 838848b8605SmrgVertexAttrib1NivARB(GLuint index, const GLint *v) 839848b8605Smrg{ 840848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); 841848b8605Smrg} 842848b8605Smrg 843848b8605Smrgstatic void GLAPIENTRY 844848b8605SmrgVertexAttrib1ivARB(GLuint index, const GLint *v) 845848b8605Smrg{ 846848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); 847848b8605Smrg} 848848b8605Smrg 849848b8605Smrgstatic void GLAPIENTRY 850848b8605SmrgVertexAttrib2NivARB(GLuint index, const GLint *v) 851848b8605Smrg{ 852848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), 853848b8605Smrg INT_TO_FLOAT(v[1]))); 854848b8605Smrg} 855848b8605Smrg 856848b8605Smrgstatic void GLAPIENTRY 857848b8605SmrgVertexAttrib2ivARB(GLuint index, const GLint *v) 858848b8605Smrg{ 859848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], 860848b8605Smrg (GLfloat)v[1])); 861848b8605Smrg} 862848b8605Smrg 863848b8605Smrgstatic void GLAPIENTRY 864848b8605SmrgVertexAttrib3NivARB(GLuint index, const GLint *v) 865848b8605Smrg{ 866848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), 867848b8605Smrg INT_TO_FLOAT(v[1]), 868848b8605Smrg INT_TO_FLOAT(v[2]))); 869848b8605Smrg} 870848b8605Smrg 871848b8605Smrgstatic void GLAPIENTRY 872848b8605SmrgVertexAttrib3ivARB(GLuint index, const GLint *v) 873848b8605Smrg{ 874848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], 875848b8605Smrg (GLfloat)v[1], (GLfloat)v[2])); 876848b8605Smrg} 877848b8605Smrg 878848b8605Smrgstatic void GLAPIENTRY 879848b8605SmrgVertexAttrib4NivARB(GLuint index, const GLint *v) 880848b8605Smrg{ 881848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), 882848b8605Smrg INT_TO_FLOAT(v[1]), 883848b8605Smrg INT_TO_FLOAT(v[2]), 884848b8605Smrg INT_TO_FLOAT(v[3]))); 885848b8605Smrg} 886848b8605Smrg 887848b8605Smrgstatic void GLAPIENTRY 888848b8605SmrgVertexAttrib4ivARB(GLuint index, const GLint *v) 889848b8605Smrg{ 890848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 891848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 892848b8605Smrg} 893848b8605Smrg 894848b8605Smrg/* GL_UNSIGNED_INT attributes */ 895848b8605Smrg 896848b8605Smrgstatic void GLAPIENTRY 897848b8605SmrgVertexAttrib1NuivARB(GLuint index, const GLuint *v) 898848b8605Smrg{ 899848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); 900848b8605Smrg} 901848b8605Smrg 902848b8605Smrgstatic void GLAPIENTRY 903848b8605SmrgVertexAttrib1uivARB(GLuint index, const GLuint *v) 904848b8605Smrg{ 905848b8605Smrg CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); 906848b8605Smrg} 907848b8605Smrg 908848b8605Smrgstatic void GLAPIENTRY 909848b8605SmrgVertexAttrib2NuivARB(GLuint index, const GLuint *v) 910848b8605Smrg{ 911848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), 912848b8605Smrg UINT_TO_FLOAT(v[1]))); 913848b8605Smrg} 914848b8605Smrg 915848b8605Smrgstatic void GLAPIENTRY 916848b8605SmrgVertexAttrib2uivARB(GLuint index, const GLuint *v) 917848b8605Smrg{ 918848b8605Smrg CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], 919848b8605Smrg (GLfloat)v[1])); 920848b8605Smrg} 921848b8605Smrg 922848b8605Smrgstatic void GLAPIENTRY 923848b8605SmrgVertexAttrib3NuivARB(GLuint index, const GLuint *v) 924848b8605Smrg{ 925848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), 926848b8605Smrg UINT_TO_FLOAT(v[1]), 927848b8605Smrg UINT_TO_FLOAT(v[2]))); 928848b8605Smrg} 929848b8605Smrg 930848b8605Smrgstatic void GLAPIENTRY 931848b8605SmrgVertexAttrib3uivARB(GLuint index, const GLuint *v) 932848b8605Smrg{ 933848b8605Smrg CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], 934848b8605Smrg (GLfloat)v[1], (GLfloat)v[2])); 935848b8605Smrg} 936848b8605Smrg 937848b8605Smrgstatic void GLAPIENTRY 938848b8605SmrgVertexAttrib4NuivARB(GLuint index, const GLuint *v) 939848b8605Smrg{ 940848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), 941848b8605Smrg UINT_TO_FLOAT(v[1]), 942848b8605Smrg UINT_TO_FLOAT(v[2]), 943848b8605Smrg UINT_TO_FLOAT(v[3]))); 944848b8605Smrg} 945848b8605Smrg 946848b8605Smrgstatic void GLAPIENTRY 947848b8605SmrgVertexAttrib4uivARB(GLuint index, const GLuint *v) 948848b8605Smrg{ 949848b8605Smrg CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], 950848b8605Smrg (GLfloat)v[2], (GLfloat)v[3])); 951848b8605Smrg} 952848b8605Smrg 953848b8605Smrg/* GL_FLOAT attributes */ 954848b8605Smrg 955848b8605Smrgstatic void GLAPIENTRY 956848b8605SmrgVertexAttrib1fvARB(GLuint index, const GLfloat *v) 957848b8605Smrg{ 958848b8605Smrg CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index, v)); 959848b8605Smrg} 960848b8605Smrg 961848b8605Smrgstatic void GLAPIENTRY 962848b8605SmrgVertexAttrib2fvARB(GLuint index, const GLfloat *v) 963848b8605Smrg{ 964848b8605Smrg CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index, v)); 965848b8605Smrg} 966848b8605Smrg 967848b8605Smrgstatic void GLAPIENTRY 968848b8605SmrgVertexAttrib3fvARB(GLuint index, const GLfloat *v) 969848b8605Smrg{ 970848b8605Smrg CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index, v)); 971848b8605Smrg} 972848b8605Smrg 973848b8605Smrgstatic void GLAPIENTRY 974848b8605SmrgVertexAttrib4fvARB(GLuint index, const GLfloat *v) 975848b8605Smrg{ 976848b8605Smrg CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v)); 977848b8605Smrg} 978848b8605Smrg 979848b8605Smrg/* GL_DOUBLE attributes */ 980848b8605Smrg 981848b8605Smrgstatic void GLAPIENTRY 982848b8605SmrgVertexAttrib1dvARB(GLuint index, const GLdouble *v) 983848b8605Smrg{ 984848b8605Smrg CALL_VertexAttrib1dv(GET_DISPATCH(), (index, v)); 985848b8605Smrg} 986848b8605Smrg 987848b8605Smrgstatic void GLAPIENTRY 988848b8605SmrgVertexAttrib2dvARB(GLuint index, const GLdouble *v) 989848b8605Smrg{ 990848b8605Smrg CALL_VertexAttrib2dv(GET_DISPATCH(), (index, v)); 991848b8605Smrg} 992848b8605Smrg 993848b8605Smrgstatic void GLAPIENTRY 994848b8605SmrgVertexAttrib3dvARB(GLuint index, const GLdouble *v) 995848b8605Smrg{ 996848b8605Smrg CALL_VertexAttrib3dv(GET_DISPATCH(), (index, v)); 997848b8605Smrg} 998848b8605Smrg 999848b8605Smrgstatic void GLAPIENTRY 1000848b8605SmrgVertexAttrib4dvARB(GLuint index, const GLdouble *v) 1001848b8605Smrg{ 1002848b8605Smrg CALL_VertexAttrib4dv(GET_DISPATCH(), (index, v)); 1003848b8605Smrg} 1004848b8605Smrg 1005848b8605Smrg 1006848b8605Smrg/** 1007848b8605Smrg * Integer-valued attributes 1008848b8605Smrg */ 1009848b8605Smrgstatic void GLAPIENTRY 1010848b8605SmrgVertexAttribI1bv(GLuint index, const GLbyte *v) 1011848b8605Smrg{ 1012848b8605Smrg CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0])); 1013848b8605Smrg} 1014848b8605Smrg 1015848b8605Smrgstatic void GLAPIENTRY 1016848b8605SmrgVertexAttribI2bv(GLuint index, const GLbyte *v) 1017848b8605Smrg{ 1018848b8605Smrg CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index, v[0], v[1])); 1019848b8605Smrg} 1020848b8605Smrg 1021848b8605Smrgstatic void GLAPIENTRY 1022848b8605SmrgVertexAttribI3bv(GLuint index, const GLbyte *v) 1023848b8605Smrg{ 1024848b8605Smrg CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index, v[0], v[1], v[2])); 1025848b8605Smrg} 1026848b8605Smrg 1027848b8605Smrgstatic void GLAPIENTRY 1028848b8605SmrgVertexAttribI4bv(GLuint index, const GLbyte *v) 1029848b8605Smrg{ 1030848b8605Smrg CALL_VertexAttribI4bv(GET_DISPATCH(), (index, v)); 1031848b8605Smrg} 1032848b8605Smrg 1033848b8605Smrg 1034848b8605Smrgstatic void GLAPIENTRY 1035848b8605SmrgVertexAttribI1ubv(GLuint index, const GLubyte *v) 1036848b8605Smrg{ 1037848b8605Smrg CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index, v[0])); 1038848b8605Smrg} 1039848b8605Smrg 1040848b8605Smrgstatic void GLAPIENTRY 1041848b8605SmrgVertexAttribI2ubv(GLuint index, const GLubyte *v) 1042848b8605Smrg{ 1043848b8605Smrg CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index, v[0], v[1])); 1044848b8605Smrg} 1045848b8605Smrg 1046848b8605Smrgstatic void GLAPIENTRY 1047848b8605SmrgVertexAttribI3ubv(GLuint index, const GLubyte *v) 1048848b8605Smrg{ 1049848b8605Smrg CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2])); 1050848b8605Smrg} 1051848b8605Smrg 1052848b8605Smrgstatic void GLAPIENTRY 1053848b8605SmrgVertexAttribI4ubv(GLuint index, const GLubyte *v) 1054848b8605Smrg{ 1055848b8605Smrg CALL_VertexAttribI4ubv(GET_DISPATCH(), (index, v)); 1056848b8605Smrg} 1057848b8605Smrg 1058848b8605Smrg 1059848b8605Smrg 1060848b8605Smrgstatic void GLAPIENTRY 1061848b8605SmrgVertexAttribI1sv(GLuint index, const GLshort *v) 1062848b8605Smrg{ 1063848b8605Smrg CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0])); 1064848b8605Smrg} 1065848b8605Smrg 1066848b8605Smrgstatic void GLAPIENTRY 1067848b8605SmrgVertexAttribI2sv(GLuint index, const GLshort *v) 1068848b8605Smrg{ 1069848b8605Smrg CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index, v[0], v[1])); 1070848b8605Smrg} 1071848b8605Smrg 1072848b8605Smrgstatic void GLAPIENTRY 1073848b8605SmrgVertexAttribI3sv(GLuint index, const GLshort *v) 1074848b8605Smrg{ 1075848b8605Smrg CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index, v[0], v[1], v[2])); 1076848b8605Smrg} 1077848b8605Smrg 1078848b8605Smrgstatic void GLAPIENTRY 1079848b8605SmrgVertexAttribI4sv(GLuint index, const GLshort *v) 1080848b8605Smrg{ 1081848b8605Smrg CALL_VertexAttribI4sv(GET_DISPATCH(), (index, v)); 1082848b8605Smrg} 1083848b8605Smrg 1084848b8605Smrg 1085848b8605Smrgstatic void GLAPIENTRY 1086848b8605SmrgVertexAttribI1usv(GLuint index, const GLushort *v) 1087848b8605Smrg{ 1088848b8605Smrg CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index, v[0])); 1089848b8605Smrg} 1090848b8605Smrg 1091848b8605Smrgstatic void GLAPIENTRY 1092848b8605SmrgVertexAttribI2usv(GLuint index, const GLushort *v) 1093848b8605Smrg{ 1094848b8605Smrg CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index, v[0], v[1])); 1095848b8605Smrg} 1096848b8605Smrg 1097848b8605Smrgstatic void GLAPIENTRY 1098848b8605SmrgVertexAttribI3usv(GLuint index, const GLushort *v) 1099848b8605Smrg{ 1100848b8605Smrg CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2])); 1101848b8605Smrg} 1102848b8605Smrg 1103848b8605Smrgstatic void GLAPIENTRY 1104848b8605SmrgVertexAttribI4usv(GLuint index, const GLushort *v) 1105848b8605Smrg{ 1106848b8605Smrg CALL_VertexAttribI4usv(GET_DISPATCH(), (index, v)); 1107848b8605Smrg} 1108848b8605Smrg 1109848b8605Smrg 1110848b8605Smrg 1111848b8605Smrgstatic void GLAPIENTRY 1112848b8605SmrgVertexAttribI1iv(GLuint index, const GLint *v) 1113848b8605Smrg{ 1114848b8605Smrg CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0])); 1115848b8605Smrg} 1116848b8605Smrg 1117848b8605Smrgstatic void GLAPIENTRY 1118848b8605SmrgVertexAttribI2iv(GLuint index, const GLint *v) 1119848b8605Smrg{ 1120848b8605Smrg CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index, v[0], v[1])); 1121848b8605Smrg} 1122848b8605Smrg 1123848b8605Smrgstatic void GLAPIENTRY 1124848b8605SmrgVertexAttribI3iv(GLuint index, const GLint *v) 1125848b8605Smrg{ 1126848b8605Smrg CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index, v[0], v[1], v[2])); 1127848b8605Smrg} 1128848b8605Smrg 1129848b8605Smrgstatic void GLAPIENTRY 1130848b8605SmrgVertexAttribI4iv(GLuint index, const GLint *v) 1131848b8605Smrg{ 1132848b8605Smrg CALL_VertexAttribI4ivEXT(GET_DISPATCH(), (index, v)); 1133848b8605Smrg} 1134848b8605Smrg 1135848b8605Smrg 1136848b8605Smrgstatic void GLAPIENTRY 1137848b8605SmrgVertexAttribI1uiv(GLuint index, const GLuint *v) 1138848b8605Smrg{ 1139848b8605Smrg CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index, v[0])); 1140848b8605Smrg} 1141848b8605Smrg 1142848b8605Smrgstatic void GLAPIENTRY 1143848b8605SmrgVertexAttribI2uiv(GLuint index, const GLuint *v) 1144848b8605Smrg{ 1145848b8605Smrg CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index, v[0], v[1])); 1146848b8605Smrg} 1147848b8605Smrg 1148848b8605Smrgstatic void GLAPIENTRY 1149848b8605SmrgVertexAttribI3uiv(GLuint index, const GLuint *v) 1150848b8605Smrg{ 1151848b8605Smrg CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2])); 1152848b8605Smrg} 1153848b8605Smrg 1154848b8605Smrgstatic void GLAPIENTRY 1155848b8605SmrgVertexAttribI4uiv(GLuint index, const GLuint *v) 1156848b8605Smrg{ 1157848b8605Smrg CALL_VertexAttribI4uivEXT(GET_DISPATCH(), (index, v)); 1158848b8605Smrg} 1159848b8605Smrg 1160b8e80941Smrg/* GL_DOUBLE unconverted attributes */ 1161b8e80941Smrg 1162b8e80941Smrgstatic void GLAPIENTRY 1163b8e80941SmrgVertexAttribL1dv(GLuint index, const GLdouble *v) 1164b8e80941Smrg{ 1165b8e80941Smrg CALL_VertexAttribL1dv(GET_DISPATCH(), (index, v)); 1166b8e80941Smrg} 1167b8e80941Smrg 1168b8e80941Smrgstatic void GLAPIENTRY 1169b8e80941SmrgVertexAttribL2dv(GLuint index, const GLdouble *v) 1170b8e80941Smrg{ 1171b8e80941Smrg CALL_VertexAttribL2dv(GET_DISPATCH(), (index, v)); 1172b8e80941Smrg} 1173b8e80941Smrg 1174b8e80941Smrgstatic void GLAPIENTRY 1175b8e80941SmrgVertexAttribL3dv(GLuint index, const GLdouble *v) 1176b8e80941Smrg{ 1177b8e80941Smrg CALL_VertexAttribL3dv(GET_DISPATCH(), (index, v)); 1178b8e80941Smrg} 1179b8e80941Smrg 1180b8e80941Smrgstatic void GLAPIENTRY 1181b8e80941SmrgVertexAttribL4dv(GLuint index, const GLdouble *v) 1182b8e80941Smrg{ 1183b8e80941Smrg CALL_VertexAttribL4dv(GET_DISPATCH(), (index, v)); 1184b8e80941Smrg} 1185848b8605Smrg 1186848b8605Smrg/* 1187848b8605Smrg * Array [unnormalized/normalized/integer][size][type] of VertexAttrib 1188848b8605Smrg * functions 1189848b8605Smrg */ 1190b8e80941Smrgstatic const attrib_func AttribFuncsARB[4][4][NUM_TYPES] = { 1191848b8605Smrg { 1192848b8605Smrg /* non-normalized */ 1193848b8605Smrg { 1194848b8605Smrg /* size 1 */ 1195848b8605Smrg (attrib_func) VertexAttrib1bvARB, 1196848b8605Smrg (attrib_func) VertexAttrib1ubvARB, 1197848b8605Smrg (attrib_func) VertexAttrib1svARB, 1198848b8605Smrg (attrib_func) VertexAttrib1usvARB, 1199848b8605Smrg (attrib_func) VertexAttrib1ivARB, 1200848b8605Smrg (attrib_func) VertexAttrib1uivARB, 1201848b8605Smrg (attrib_func) VertexAttrib1fvARB, 1202848b8605Smrg (attrib_func) VertexAttrib1dvARB 1203848b8605Smrg }, 1204848b8605Smrg { 1205848b8605Smrg /* size 2 */ 1206848b8605Smrg (attrib_func) VertexAttrib2bvARB, 1207848b8605Smrg (attrib_func) VertexAttrib2ubvARB, 1208848b8605Smrg (attrib_func) VertexAttrib2svARB, 1209848b8605Smrg (attrib_func) VertexAttrib2usvARB, 1210848b8605Smrg (attrib_func) VertexAttrib2ivARB, 1211848b8605Smrg (attrib_func) VertexAttrib2uivARB, 1212848b8605Smrg (attrib_func) VertexAttrib2fvARB, 1213848b8605Smrg (attrib_func) VertexAttrib2dvARB 1214848b8605Smrg }, 1215848b8605Smrg { 1216848b8605Smrg /* size 3 */ 1217848b8605Smrg (attrib_func) VertexAttrib3bvARB, 1218848b8605Smrg (attrib_func) VertexAttrib3ubvARB, 1219848b8605Smrg (attrib_func) VertexAttrib3svARB, 1220848b8605Smrg (attrib_func) VertexAttrib3usvARB, 1221848b8605Smrg (attrib_func) VertexAttrib3ivARB, 1222848b8605Smrg (attrib_func) VertexAttrib3uivARB, 1223848b8605Smrg (attrib_func) VertexAttrib3fvARB, 1224848b8605Smrg (attrib_func) VertexAttrib3dvARB 1225848b8605Smrg }, 1226848b8605Smrg { 1227848b8605Smrg /* size 4 */ 1228848b8605Smrg (attrib_func) VertexAttrib4bvARB, 1229848b8605Smrg (attrib_func) VertexAttrib4ubvARB, 1230848b8605Smrg (attrib_func) VertexAttrib4svARB, 1231848b8605Smrg (attrib_func) VertexAttrib4usvARB, 1232848b8605Smrg (attrib_func) VertexAttrib4ivARB, 1233848b8605Smrg (attrib_func) VertexAttrib4uivARB, 1234848b8605Smrg (attrib_func) VertexAttrib4fvARB, 1235848b8605Smrg (attrib_func) VertexAttrib4dvARB 1236848b8605Smrg } 1237848b8605Smrg }, 1238848b8605Smrg { 1239848b8605Smrg /* normalized (except for float/double) */ 1240848b8605Smrg { 1241848b8605Smrg /* size 1 */ 1242848b8605Smrg (attrib_func) VertexAttrib1NbvARB, 1243848b8605Smrg (attrib_func) VertexAttrib1NubvARB, 1244848b8605Smrg (attrib_func) VertexAttrib1NsvARB, 1245848b8605Smrg (attrib_func) VertexAttrib1NusvARB, 1246848b8605Smrg (attrib_func) VertexAttrib1NivARB, 1247848b8605Smrg (attrib_func) VertexAttrib1NuivARB, 1248848b8605Smrg (attrib_func) VertexAttrib1fvARB, 1249848b8605Smrg (attrib_func) VertexAttrib1dvARB 1250848b8605Smrg }, 1251848b8605Smrg { 1252848b8605Smrg /* size 2 */ 1253848b8605Smrg (attrib_func) VertexAttrib2NbvARB, 1254848b8605Smrg (attrib_func) VertexAttrib2NubvARB, 1255848b8605Smrg (attrib_func) VertexAttrib2NsvARB, 1256848b8605Smrg (attrib_func) VertexAttrib2NusvARB, 1257848b8605Smrg (attrib_func) VertexAttrib2NivARB, 1258848b8605Smrg (attrib_func) VertexAttrib2NuivARB, 1259848b8605Smrg (attrib_func) VertexAttrib2fvARB, 1260848b8605Smrg (attrib_func) VertexAttrib2dvARB 1261848b8605Smrg }, 1262848b8605Smrg { 1263848b8605Smrg /* size 3 */ 1264848b8605Smrg (attrib_func) VertexAttrib3NbvARB, 1265848b8605Smrg (attrib_func) VertexAttrib3NubvARB, 1266848b8605Smrg (attrib_func) VertexAttrib3NsvARB, 1267848b8605Smrg (attrib_func) VertexAttrib3NusvARB, 1268848b8605Smrg (attrib_func) VertexAttrib3NivARB, 1269848b8605Smrg (attrib_func) VertexAttrib3NuivARB, 1270848b8605Smrg (attrib_func) VertexAttrib3fvARB, 1271848b8605Smrg (attrib_func) VertexAttrib3dvARB 1272848b8605Smrg }, 1273848b8605Smrg { 1274848b8605Smrg /* size 4 */ 1275848b8605Smrg (attrib_func) VertexAttrib4NbvARB, 1276848b8605Smrg (attrib_func) VertexAttrib4NubvARB, 1277848b8605Smrg (attrib_func) VertexAttrib4NsvARB, 1278848b8605Smrg (attrib_func) VertexAttrib4NusvARB, 1279848b8605Smrg (attrib_func) VertexAttrib4NivARB, 1280848b8605Smrg (attrib_func) VertexAttrib4NuivARB, 1281848b8605Smrg (attrib_func) VertexAttrib4fvARB, 1282848b8605Smrg (attrib_func) VertexAttrib4dvARB 1283848b8605Smrg } 1284848b8605Smrg }, 1285848b8605Smrg 1286848b8605Smrg { 1287848b8605Smrg /* integer-valued */ 1288848b8605Smrg { 1289848b8605Smrg /* size 1 */ 1290848b8605Smrg (attrib_func) VertexAttribI1bv, 1291848b8605Smrg (attrib_func) VertexAttribI1ubv, 1292848b8605Smrg (attrib_func) VertexAttribI1sv, 1293848b8605Smrg (attrib_func) VertexAttribI1usv, 1294848b8605Smrg (attrib_func) VertexAttribI1iv, 1295848b8605Smrg (attrib_func) VertexAttribI1uiv, 1296848b8605Smrg NULL, /* GL_FLOAT */ 1297848b8605Smrg NULL /* GL_DOUBLE */ 1298848b8605Smrg }, 1299848b8605Smrg { 1300848b8605Smrg /* size 2 */ 1301848b8605Smrg (attrib_func) VertexAttribI2bv, 1302848b8605Smrg (attrib_func) VertexAttribI2ubv, 1303848b8605Smrg (attrib_func) VertexAttribI2sv, 1304848b8605Smrg (attrib_func) VertexAttribI2usv, 1305848b8605Smrg (attrib_func) VertexAttribI2iv, 1306848b8605Smrg (attrib_func) VertexAttribI2uiv, 1307848b8605Smrg NULL, /* GL_FLOAT */ 1308848b8605Smrg NULL /* GL_DOUBLE */ 1309848b8605Smrg }, 1310848b8605Smrg { 1311848b8605Smrg /* size 3 */ 1312848b8605Smrg (attrib_func) VertexAttribI3bv, 1313848b8605Smrg (attrib_func) VertexAttribI3ubv, 1314848b8605Smrg (attrib_func) VertexAttribI3sv, 1315848b8605Smrg (attrib_func) VertexAttribI3usv, 1316848b8605Smrg (attrib_func) VertexAttribI3iv, 1317848b8605Smrg (attrib_func) VertexAttribI3uiv, 1318848b8605Smrg NULL, /* GL_FLOAT */ 1319848b8605Smrg NULL /* GL_DOUBLE */ 1320848b8605Smrg }, 1321848b8605Smrg { 1322848b8605Smrg /* size 4 */ 1323848b8605Smrg (attrib_func) VertexAttribI4bv, 1324848b8605Smrg (attrib_func) VertexAttribI4ubv, 1325848b8605Smrg (attrib_func) VertexAttribI4sv, 1326848b8605Smrg (attrib_func) VertexAttribI4usv, 1327848b8605Smrg (attrib_func) VertexAttribI4iv, 1328848b8605Smrg (attrib_func) VertexAttribI4uiv, 1329848b8605Smrg NULL, /* GL_FLOAT */ 1330848b8605Smrg NULL /* GL_DOUBLE */ 1331848b8605Smrg } 1332b8e80941Smrg }, 1333b8e80941Smrg { 1334b8e80941Smrg /* double-valued */ 1335b8e80941Smrg { 1336b8e80941Smrg /* size 1 */ 1337b8e80941Smrg NULL, 1338b8e80941Smrg NULL, 1339b8e80941Smrg NULL, 1340b8e80941Smrg NULL, 1341b8e80941Smrg NULL, 1342b8e80941Smrg NULL, 1343b8e80941Smrg NULL, 1344b8e80941Smrg (attrib_func) VertexAttribL1dv, 1345b8e80941Smrg }, 1346b8e80941Smrg { 1347b8e80941Smrg /* size 2 */ 1348b8e80941Smrg NULL, 1349b8e80941Smrg NULL, 1350b8e80941Smrg NULL, 1351b8e80941Smrg NULL, 1352b8e80941Smrg NULL, 1353b8e80941Smrg NULL, 1354b8e80941Smrg NULL, 1355b8e80941Smrg (attrib_func) VertexAttribL2dv, 1356b8e80941Smrg }, 1357b8e80941Smrg { 1358b8e80941Smrg /* size 3 */ 1359b8e80941Smrg NULL, 1360b8e80941Smrg NULL, 1361b8e80941Smrg NULL, 1362b8e80941Smrg NULL, 1363b8e80941Smrg NULL, 1364b8e80941Smrg NULL, 1365b8e80941Smrg NULL, 1366b8e80941Smrg (attrib_func) VertexAttribL3dv, 1367b8e80941Smrg }, 1368b8e80941Smrg { 1369b8e80941Smrg /* size 4 */ 1370b8e80941Smrg NULL, 1371b8e80941Smrg NULL, 1372b8e80941Smrg NULL, 1373b8e80941Smrg NULL, 1374b8e80941Smrg NULL, 1375b8e80941Smrg NULL, 1376b8e80941Smrg NULL, 1377b8e80941Smrg (attrib_func) VertexAttribL4dv, 1378b8e80941Smrg } 1379848b8605Smrg } 1380848b8605Smrg 1381b8e80941Smrg}; 1382848b8605Smrg 1383848b8605Smrg 1384b8e80941Smrg/* 1385b8e80941Smrg * Return VertexAttrib*NV function pointer matching the provided vertex format. 1386848b8605Smrg */ 1387b8e80941Smrgstatic inline attrib_func 1388b8e80941Smrgfunc_nv(const struct gl_vertex_format *vformat) 1389b8e80941Smrg{ 1390b8e80941Smrg return AttribFuncsNV[vformat->Normalized][vformat->Size-1] 1391b8e80941Smrg [TYPE_IDX(vformat->Type)]; 1392848b8605Smrg} 1393848b8605Smrg 1394848b8605Smrg 1395b8e80941Smrg/* 1396b8e80941Smrg * Return VertexAttrib*ARB function pointer matching the provided vertex format. 1397848b8605Smrg */ 1398b8e80941Smrgstatic inline attrib_func 1399b8e80941Smrgfunc_arb(const struct gl_vertex_format *vformat) 1400b8e80941Smrg{ 1401b8e80941Smrg return AttribFuncsARB[vertex_format_to_index(vformat)][vformat->Size-1] 1402b8e80941Smrg [TYPE_IDX(vformat->Type)]; 1403848b8605Smrg} 1404848b8605Smrg 1405848b8605Smrg 1406b8e80941Smrg/* 1407b8e80941Smrg * Return the address of the array attribute array at elt in the 1408b8e80941Smrg * vertex array object vao. 1409848b8605Smrg */ 1410b8e80941Smrgstatic inline const void * 1411b8e80941Smrgattrib_src(const struct gl_vertex_array_object *vao, 1412b8e80941Smrg const struct gl_array_attributes *array, GLint elt) 1413848b8605Smrg{ 1414b8e80941Smrg const struct gl_vertex_buffer_binding *binding = 1415b8e80941Smrg &vao->BufferBinding[array->BufferBindingIndex]; 1416b8e80941Smrg const GLubyte *src 1417b8e80941Smrg = ADD_POINTERS(binding->BufferObj->Mappings[MAP_INTERNAL].Pointer, 1418b8e80941Smrg _mesa_vertex_attrib_address(array, binding)) 1419b8e80941Smrg + elt * binding->Stride; 1420b8e80941Smrg return src; 1421848b8605Smrg} 1422848b8605Smrg 1423848b8605Smrg 1424848b8605Smrgvoid 1425b8e80941Smrg_mesa_array_element(struct gl_context *ctx, GLint elt) 1426848b8605Smrg{ 1427b8e80941Smrg const struct gl_vertex_array_object *vao = ctx->Array.VAO; 1428b8e80941Smrg GLbitfield mask; 1429848b8605Smrg 1430b8e80941Smrg /* emit conventional arrays elements */ 1431b8e80941Smrg mask = (VERT_BIT_FF_ALL & ~VERT_BIT_POS) & vao->Enabled; 1432b8e80941Smrg while (mask) { 1433b8e80941Smrg const gl_vert_attrib attrib = u_bit_scan(&mask); 1434b8e80941Smrg const struct gl_array_attributes *array = &vao->VertexAttrib[attrib]; 1435b8e80941Smrg const void *src = attrib_src(vao, array, elt); 1436b8e80941Smrg func_nv(&array->Format)(attrib, src); 1437b8e80941Smrg } 1438848b8605Smrg 1439b8e80941Smrg /* emit generic attribute elements */ 1440b8e80941Smrg mask = (VERT_BIT_GENERIC_ALL & ~VERT_BIT_GENERIC0) & vao->Enabled; 1441b8e80941Smrg while (mask) { 1442b8e80941Smrg const gl_vert_attrib attrib = u_bit_scan(&mask); 1443b8e80941Smrg const struct gl_array_attributes *array = &vao->VertexAttrib[attrib]; 1444b8e80941Smrg const void *src = attrib_src(vao, array, elt); 1445b8e80941Smrg func_arb(&array->Format)(attrib - VERT_ATTRIB_GENERIC0, src); 1446b8e80941Smrg } 1447848b8605Smrg 1448b8e80941Smrg /* finally, vertex position */ 1449b8e80941Smrg if (vao->Enabled & VERT_BIT_GENERIC0) { 1450b8e80941Smrg const gl_vert_attrib attrib = VERT_ATTRIB_GENERIC0; 1451b8e80941Smrg const struct gl_array_attributes *array = &vao->VertexAttrib[attrib]; 1452b8e80941Smrg const void *src = attrib_src(vao, array, elt); 1453b8e80941Smrg func_arb(&array->Format)(0, src); 1454b8e80941Smrg } else if (vao->Enabled & VERT_BIT_POS) { 1455b8e80941Smrg const gl_vert_attrib attrib = VERT_ATTRIB_POS; 1456b8e80941Smrg const struct gl_array_attributes *array = &vao->VertexAttrib[attrib]; 1457b8e80941Smrg const void *src = attrib_src(vao, array, elt); 1458b8e80941Smrg func_nv(&array->Format)(0, src); 1459b8e80941Smrg } 1460848b8605Smrg} 1461848b8605Smrg 1462848b8605Smrg 1463848b8605Smrg/** 1464848b8605Smrg * Called via glArrayElement() and glDrawArrays(). 1465848b8605Smrg * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions 1466848b8605Smrg * for all enabled vertex arrays (for elt-th element). 1467848b8605Smrg * Note: this may be called during display list construction. 1468848b8605Smrg */ 1469848b8605Smrgvoid GLAPIENTRY 1470848b8605Smrg_ae_ArrayElement(GLint elt) 1471848b8605Smrg{ 1472848b8605Smrg GET_CURRENT_CONTEXT(ctx); 1473b8e80941Smrg struct gl_vertex_array_object *vao; 1474848b8605Smrg 1475848b8605Smrg /* If PrimitiveRestart is enabled and the index is the RestartIndex 1476848b8605Smrg * then we call PrimitiveRestartNV and return. 1477848b8605Smrg */ 1478848b8605Smrg if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) { 1479b8e80941Smrg CALL_PrimitiveRestartNV(GET_DISPATCH(), ()); 1480848b8605Smrg return; 1481848b8605Smrg } 1482848b8605Smrg 1483b8e80941Smrg vao = ctx->Array.VAO; 1484b8e80941Smrg _mesa_vao_map_arrays(ctx, vao, GL_MAP_READ_BIT); 1485848b8605Smrg 1486b8e80941Smrg _mesa_array_element(ctx, elt); 1487848b8605Smrg 1488b8e80941Smrg _mesa_vao_unmap_arrays(ctx, vao); 1489848b8605Smrg} 1490848b8605Smrg 1491848b8605Smrg 1492848b8605Smrgvoid 1493848b8605Smrg_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, 1494848b8605Smrg const GLvertexformat *vfmt) 1495848b8605Smrg{ 1496848b8605Smrg SET_ArrayElement(disp, vfmt->ArrayElement); 1497848b8605Smrg} 1498