Changeset 16035 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/array/arrayspu.c
- Timestamp:
- Jan 19, 2009 10:06:16 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/array/arrayspu.c
r15532 r16035 15 15 static void ARRAYSPU_APIENTRY arrayspu_ArrayElement( GLint index ) 16 16 { 17 18 19 20 21 22 23 24 25 26 27 #ifdef CR_ARB_vertex_buffer_object 28 29 30 31 32 #endif 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 #ifdef CR_ARB_vertex_buffer_object 51 52 53 54 55 #endif 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 #ifdef CR_ARB_vertex_buffer_object 112 113 114 115 116 #endif 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 #ifdef CR_ARB_vertex_buffer_object 164 165 166 167 168 #endif 169 170 171 172 173 174 175 176 177 178 179 180 181 182 #ifdef CR_ARB_vertex_buffer_object 183 184 185 186 187 #endif 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 #ifdef CR_ARB_vertex_buffer_object 254 255 256 257 258 #endif 259 260 261 262 263 264 265 266 267 268 17 const CRClientState *c = &(array_spu.ctx->client); 18 const CRVertexArrays *array = &(c->array); 19 const GLboolean vpEnabled = array_spu.ctx->program.vpEnabled; 20 unsigned char *p; 21 unsigned int unit, attr; 22 23 if (array->e.enabled) 24 { 25 p = array->e.p + index * array->e.stride; 26 27 #ifdef CR_ARB_vertex_buffer_object 28 if (array->e.buffer->data) 29 { 30 p = (unsigned char *)(array->e.buffer->data) + (unsigned long)p; 31 } 32 #endif 33 34 array_spu.self.EdgeFlagv(p); 35 } 36 37 /* 38 * Vertex attribute arrays (GL_NV_vertex_program) have priority over 39 * the conventional vertex arrays. 40 */ 41 if (vpEnabled) 42 { 43 for (attr = 1; attr < VERT_ATTRIB_MAX; attr++) 44 { 45 if (array->a[attr].enabled) 46 { 47 GLint *iPtr; 48 p = array->a[attr].p + index * array->a[attr].stride; 49 50 #ifdef CR_ARB_vertex_buffer_object 51 if (array->a[attr].buffer->data) 52 { 53 p = (unsigned char *)(array->a[attr].buffer->data) + (unsigned long)p; 54 } 55 #endif 56 57 switch (array->a[attr].type) 58 { 59 case GL_SHORT: 60 switch (array->a[attr].size) 61 { 62 case 1: array_spu.self.VertexAttrib1svARB(attr, (GLshort *)p); break; 63 case 2: array_spu.self.VertexAttrib2svARB(attr, (GLshort *)p); break; 64 case 3: array_spu.self.VertexAttrib3svARB(attr, (GLshort *)p); break; 65 case 4: array_spu.self.VertexAttrib4svARB(attr, (GLshort *)p); break; 66 } 67 break; 68 case GL_INT: 69 iPtr = (GLint *) p; 70 switch (array->a[attr].size) 71 { 72 case 1: array_spu.self.VertexAttrib1fARB(attr, p[0]); break; 73 case 2: array_spu.self.VertexAttrib2fARB(attr, p[0], p[1]); break; 74 case 3: array_spu.self.VertexAttrib3fARB(attr, p[0], p[1], p[2]); break; 75 case 4: array_spu.self.VertexAttrib4fARB(attr, p[0], p[1], p[2], p[3]); break; 76 } 77 break; 78 case GL_FLOAT: 79 switch (array->a[attr].size) 80 { 81 case 1: array_spu.self.VertexAttrib1fvARB(attr, (GLfloat *)p); break; 82 case 2: array_spu.self.VertexAttrib2fvARB(attr, (GLfloat *)p); break; 83 case 3: array_spu.self.VertexAttrib3fvARB(attr, (GLfloat *)p); break; 84 case 4: array_spu.self.VertexAttrib4fvARB(attr, (GLfloat *)p); break; 85 } 86 break; 87 case GL_DOUBLE: 88 switch (array->a[attr].size) 89 { 90 case 1: array_spu.self.VertexAttrib1dvARB(attr, (GLdouble *)p); break; 91 case 2: array_spu.self.VertexAttrib2dvARB(attr, (GLdouble *)p); break; 92 case 3: array_spu.self.VertexAttrib3dvARB(attr, (GLdouble *)p); break; 93 case 4: array_spu.self.VertexAttrib4dvARB(attr, (GLdouble *)p); break; 94 } 95 break; 96 default: 97 crWarning("Bad datatype for vertex attribute [%d] array: 0x%x\n", 98 attr, array->a[attr].type); 99 } 100 } 101 } 102 } 103 104 /* Now do conventional arrays, unless overriden by generic arrays above */ 105 for (unit = 0 ; unit < array_spu.ctx->limits.maxTextureUnits ; unit++) 106 { 107 if (array->t[unit].enabled && !(vpEnabled && array->a[VERT_ATTRIB_TEX0+unit].enabled)) 108 { 109 p = array->t[unit].p + index * array->t[unit].stride; 110 111 #ifdef CR_ARB_vertex_buffer_object 112 if (array->t[unit].buffer->data) 113 { 114 p = (unsigned char *)(array->t[unit].buffer->data) + (unsigned long)p; 115 } 116 #endif 117 118 switch (array->t[unit].type) 119 { 120 case GL_SHORT: 121 switch (array->t[unit].size) 122 { 123 case 1: array_spu.self.MultiTexCoord1svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break; 124 case 2: array_spu.self.MultiTexCoord2svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break; 125 case 3: array_spu.self.MultiTexCoord3svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break; 126 case 4: array_spu.self.MultiTexCoord4svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break; 127 } 128 break; 129 case GL_INT: 130 switch (array->t[unit].size) 131 { 132 case 1: array_spu.self.MultiTexCoord1ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break; 133 case 2: array_spu.self.MultiTexCoord2ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break; 134 case 3: array_spu.self.MultiTexCoord3ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break; 135 case 4: array_spu.self.MultiTexCoord4ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break; 136 } 137 break; 138 case GL_FLOAT: 139 switch (array->t[unit].size) 140 { 141 case 1: array_spu.self.MultiTexCoord1fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break; 142 case 2: array_spu.self.MultiTexCoord2fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break; 143 case 3: array_spu.self.MultiTexCoord3fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break; 144 case 4: array_spu.self.MultiTexCoord4fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break; 145 } 146 break; 147 case GL_DOUBLE: 148 switch (array->t[unit].size) 149 { 150 case 1: array_spu.self.MultiTexCoord1dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break; 151 case 2: array_spu.self.MultiTexCoord2dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break; 152 case 3: array_spu.self.MultiTexCoord3dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break; 153 case 4: array_spu.self.MultiTexCoord4dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break; 154 } 155 break; 156 } 157 } 158 } 159 if (array->i.enabled) 160 { 161 p = array->i.p + index * array->i.stride; 162 163 #ifdef CR_ARB_vertex_buffer_object 164 if (array->i.buffer->data) 165 { 166 p = (unsigned char *)(array->i.buffer->data) + (unsigned long)p; 167 } 168 #endif 169 170 switch (array->i.type) 171 { 172 case GL_SHORT: array_spu.self.Indexsv((GLshort *)p); break; 173 case GL_INT: array_spu.self.Indexiv((GLint *)p); break; 174 case GL_FLOAT: array_spu.self.Indexfv((GLfloat *)p); break; 175 case GL_DOUBLE: array_spu.self.Indexdv((GLdouble *)p); break; 176 } 177 } 178 if (array->c.enabled && !(vpEnabled && array->a[VERT_ATTRIB_COLOR0].enabled)) 179 { 180 p = array->c.p + index * array->c.stride; 181 182 #ifdef CR_ARB_vertex_buffer_object 183 if (array->c.buffer->data) 184 { 185 p = (unsigned char *)(array->c.buffer->data) + (unsigned long)p; 186 } 187 #endif 188 189 switch (array->c.type) 190 { 191 case GL_BYTE: 192 switch (array->c.size) 193 { 194 case 3: array_spu.self.Color3bv((GLbyte *)p); break; 195 case 4: array_spu.self.Color4bv((GLbyte *)p); break; 196 } 197 break; 198 case GL_UNSIGNED_BYTE: 199 switch (array->c.size) 200 { 201 case 3: array_spu.self.Color3ubv((GLubyte *)p); break; 202 case 4: array_spu.self.Color4ubv((GLubyte *)p); break; 203 } 204 break; 205 case GL_SHORT: 206 switch (array->c.size) 207 { 208 case 3: array_spu.self.Color3sv((GLshort *)p); break; 209 case 4: array_spu.self.Color4sv((GLshort *)p); break; 210 } 211 break; 212 case GL_UNSIGNED_SHORT: 213 switch (array->c.size) 214 { 215 case 3: array_spu.self.Color3usv((GLushort *)p); break; 216 case 4: array_spu.self.Color4usv((GLushort *)p); break; 217 } 218 break; 219 case GL_INT: 220 switch (array->c.size) 221 { 222 case 3: array_spu.self.Color3iv((GLint *)p); break; 223 case 4: array_spu.self.Color4iv((GLint *)p); break; 224 } 225 break; 226 case GL_UNSIGNED_INT: 227 switch (array->c.size) 228 { 229 case 3: array_spu.self.Color3uiv((GLuint *)p); break; 230 case 4: array_spu.self.Color4uiv((GLuint *)p); break; 231 } 232 break; 233 case GL_FLOAT: 234 switch (array->c.size) 235 { 236 case 3: array_spu.self.Color3fv((GLfloat *)p); break; 237 case 4: array_spu.self.Color4fv((GLfloat *)p); break; 238 } 239 break; 240 case GL_DOUBLE: 241 switch (array->c.size) 242 { 243 case 3: array_spu.self.Color3dv((GLdouble *)p); break; 244 case 4: array_spu.self.Color4dv((GLdouble *)p); break; 245 } 246 break; 247 } 248 } 249 if (array->n.enabled && !(vpEnabled && array->a[VERT_ATTRIB_NORMAL].enabled)) 250 { 251 p = array->n.p + index * array->n.stride; 252 253 #ifdef CR_ARB_vertex_buffer_object 254 if (array->n.buffer->data) 255 { 256 p = (unsigned char *)(array->n.buffer->data) + (unsigned long)p; 257 } 258 #endif 259 260 switch (array->n.type) 261 { 262 case GL_BYTE: array_spu.self.Normal3bv((GLbyte *)p); break; 263 case GL_SHORT: array_spu.self.Normal3sv((GLshort *)p); break; 264 case GL_INT: array_spu.self.Normal3iv((GLint *)p); break; 265 case GL_FLOAT: array_spu.self.Normal3fv((GLfloat *)p); break; 266 case GL_DOUBLE: array_spu.self.Normal3dv((GLdouble *)p); break; 267 } 268 } 269 269 #ifdef CR_EXT_secondary_color 270 271 272 273 274 #ifdef CR_ARB_vertex_buffer_object 275 276 277 278 279 #endif 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 270 if (array->s.enabled && !(vpEnabled && array->a[VERT_ATTRIB_COLOR1].enabled)) 271 { 272 p = array->s.p + index * array->s.stride; 273 274 #ifdef CR_ARB_vertex_buffer_object 275 if (array->s.buffer->data) 276 { 277 p = (unsigned char *)(array->s.buffer->data) + (unsigned long)p; 278 } 279 #endif 280 281 switch (array->s.type) 282 { 283 case GL_BYTE: 284 array_spu.self.SecondaryColor3bvEXT((GLbyte *)p); break; 285 case GL_UNSIGNED_BYTE: 286 array_spu.self.SecondaryColor3ubvEXT((GLubyte *)p); break; 287 case GL_SHORT: 288 array_spu.self.SecondaryColor3svEXT((GLshort *)p); break; 289 case GL_UNSIGNED_SHORT: 290 array_spu.self.SecondaryColor3usvEXT((GLushort *)p); break; 291 case GL_INT: 292 array_spu.self.SecondaryColor3ivEXT((GLint *)p); break; 293 case GL_UNSIGNED_INT: 294 array_spu.self.SecondaryColor3uivEXT((GLuint *)p); break; 295 case GL_FLOAT: 296 array_spu.self.SecondaryColor3fvEXT((GLfloat *)p); break; 297 case GL_DOUBLE: 298 array_spu.self.SecondaryColor3dvEXT((GLdouble *)p); break; 299 } 300 } 301 301 #endif // CR_EXT_secondary_color 302 302 #ifdef CR_EXT_fog_coord 303 304 305 306 307 #ifdef CR_ARB_vertex_buffer_object 308 309 310 311 312 #endif 313 314 315 303 if (array->f.enabled && !(vpEnabled && array->a[VERT_ATTRIB_FOG].enabled)) 304 { 305 p = array->f.p + index * array->f.stride; 306 307 #ifdef CR_ARB_vertex_buffer_object 308 if (array->f.buffer->data) 309 { 310 p = (unsigned char *)(array->f.buffer->data) + (unsigned long)p; 311 } 312 #endif 313 314 array_spu.self.FogCoordfEXT( *((GLfloat *) p) ); 315 } 316 316 #endif // CR_EXT_fog_coord 317 317 318 319 320 321 322 323 #ifdef CR_ARB_vertex_buffer_object 324 325 326 327 328 #endif 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 #ifdef CR_ARB_vertex_buffer_object 378 379 380 381 382 #endif 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 318 /* Need to do attrib[0] / vertex position last */ 319 if (array->a[VERT_ATTRIB_POS].enabled) { 320 GLint *iPtr; 321 p = array->a[VERT_ATTRIB_POS].p + index * array->a[VERT_ATTRIB_POS].stride; 322 323 #ifdef CR_ARB_vertex_buffer_object 324 if (array->a[VERT_ATTRIB_POS].buffer->data) 325 { 326 p = (unsigned char *)(array->a[VERT_ATTRIB_POS].buffer->data) + (unsigned long)p; 327 } 328 #endif 329 330 switch (array->a[VERT_ATTRIB_POS].type) 331 { 332 case GL_SHORT: 333 switch (array->a[VERT_ATTRIB_POS].size) 334 { 335 case 1: array_spu.self.VertexAttrib1svARB(0, (GLshort *)p); break; 336 case 2: array_spu.self.VertexAttrib2svARB(0, (GLshort *)p); break; 337 case 3: array_spu.self.VertexAttrib3svARB(0, (GLshort *)p); break; 338 case 4: array_spu.self.VertexAttrib4svARB(0, (GLshort *)p); break; 339 } 340 break; 341 case GL_INT: 342 iPtr = (GLint *) p; 343 switch (array->a[VERT_ATTRIB_POS].size) 344 { 345 case 1: array_spu.self.VertexAttrib1fARB(0, p[0]); break; 346 case 2: array_spu.self.VertexAttrib2fARB(0, p[0], p[1]); break; 347 case 3: array_spu.self.VertexAttrib3fARB(0, p[0], p[1], p[2]); break; 348 case 4: array_spu.self.VertexAttrib4fARB(0, p[0], p[1], p[2], p[3]); break; 349 } 350 break; 351 case GL_FLOAT: 352 switch (array->a[VERT_ATTRIB_POS].size) 353 { 354 case 1: array_spu.self.VertexAttrib1fvARB(0, (GLfloat *)p); break; 355 case 2: array_spu.self.VertexAttrib2fvARB(0, (GLfloat *)p); break; 356 case 3: array_spu.self.VertexAttrib3fvARB(0, (GLfloat *)p); break; 357 case 4: array_spu.self.VertexAttrib4fvARB(0, (GLfloat *)p); break; 358 } 359 break; 360 case GL_DOUBLE: 361 switch (array->a[VERT_ATTRIB_POS].size) 362 { 363 case 1: array_spu.self.VertexAttrib1dvARB(0, (GLdouble *)p); break; 364 case 2: array_spu.self.VertexAttrib2dvARB(0, (GLdouble *)p); break; 365 case 3: array_spu.self.VertexAttrib3dvARB(0, (GLdouble *)p); break; 366 case 4: array_spu.self.VertexAttrib4dvARB(0, (GLdouble *)p); break; 367 } 368 break; 369 default: 370 crWarning("Bad datatype for vertex attribute [0] array: 0x%x\n", array->a[0].type); 371 } 372 } 373 else if (array->v.enabled) 374 { 375 p = array->v.p + index * array->v.stride; 376 377 #ifdef CR_ARB_vertex_buffer_object 378 if (array->v.buffer->data) 379 { 380 p = (unsigned char *)(array->v.buffer->data) + (unsigned long)p; 381 } 382 #endif 383 384 switch (array->v.type) 385 { 386 case GL_SHORT: 387 switch (array->v.size) 388 { 389 case 2: array_spu.self.Vertex2sv((GLshort *)p); break; 390 case 3: array_spu.self.Vertex3sv((GLshort *)p); break; 391 case 4: array_spu.self.Vertex4sv((GLshort *)p); break; 392 } 393 break; 394 case GL_INT: 395 switch (array->v.size) 396 { 397 case 2: array_spu.self.Vertex2iv((GLint *)p); break; 398 case 3: array_spu.self.Vertex3iv((GLint *)p); break; 399 case 4: array_spu.self.Vertex4iv((GLint *)p); break; 400 } 401 break; 402 case GL_FLOAT: 403 switch (array->v.size) 404 { 405 case 2: array_spu.self.Vertex2fv((GLfloat *)p); break; 406 case 3: array_spu.self.Vertex3fv((GLfloat *)p); break; 407 case 4: array_spu.self.Vertex4fv((GLfloat *)p); break; 408 } 409 break; 410 case GL_DOUBLE: 411 switch (array->v.size) 412 { 413 case 2: array_spu.self.Vertex2dv((GLdouble *)p); break; 414 case 3: array_spu.self.Vertex3dv((GLdouble *)p); break; 415 case 4: array_spu.self.Vertex4dv((GLdouble *)p); break; 416 } 417 break; 418 default: 419 crWarning("Bad datatype for vertex array: 0x%x\n", array->v.type); 420 } 421 } 422 422 } 423 423 424 424 static void ARRAYSPU_APIENTRY arrayspu_DrawArrays(GLenum mode, GLint first, GLsizei count) 425 425 { 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 426 int i; 427 428 if (count < 0) 429 { 430 crError("array_spu.self.DrawArrays passed negative count: %d", count); 431 } 432 433 if (mode > GL_POLYGON) 434 { 435 crError("array_spu.self.DrawArrays called with invalid mode: %d", mode); 436 } 437 438 array_spu.self.Begin(mode); 439 for (i=0; i<count; i++) 440 { 441 array_spu.self.ArrayElement(first++); 442 } 443 array_spu.self.End(); 444 444 } 445 445 446 446 static void ARRAYSPU_APIENTRY arrayspu_DrawElements(GLenum mode, GLsizei count, 447 448 { 449 450 451 #ifdef CR_ARB_vertex_buffer_object 452 453 #endif 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 #ifdef CR_ARB_vertex_buffer_object 471 472 473 474 475 #endif 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 447 GLenum type, const GLvoid *indices) 448 { 449 int i; 450 GLubyte *p = (GLubyte *)indices; 451 #ifdef CR_ARB_vertex_buffer_object 452 CRBufferObject *elementsBuffer = array_spu.ctx->bufferobject.elementsBuffer; 453 #endif 454 455 if (count < 0) 456 { 457 crError("array_spu.self.DrawElements passed negative count: %d", count); 458 } 459 460 if (mode > GL_POLYGON) 461 { 462 crError("array_spu.self.DrawElements called with invalid mode: %d", mode); 463 } 464 465 if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT) 466 { 467 crError("array_spu.self.DrawElements called with invalid type: %d", type); 468 } 469 470 #ifdef CR_ARB_vertex_buffer_object 471 if (elementsBuffer->data) 472 { 473 p = (unsigned char *)(elementsBuffer->data) + (unsigned long)p; 474 } 475 #endif 476 477 array_spu.self.Begin(mode); 478 switch (type) 479 { 480 case GL_UNSIGNED_BYTE: 481 for (i=0; i<count; i++) 482 { 483 array_spu.self.ArrayElement((GLint) *p++); 484 } 485 break; 486 case GL_UNSIGNED_SHORT: 487 for (i=0; i<count; i++) 488 { 489 array_spu.self.ArrayElement((GLint) * (GLushort *) p); 490 p+=sizeof (GLushort); 491 } 492 break; 493 case GL_UNSIGNED_INT: 494 for (i=0; i<count; i++) 495 { 496 array_spu.self.ArrayElement((GLint) * (GLuint *) p); 497 p+=sizeof (GLuint); 498 } 499 break; 500 default: 501 crError( "this can't happen: array_spu.self.DrawElements" ); 502 break; 503 } 504 array_spu.self.End(); 505 505 } 506 506 507 507 static void ARRAYSPU_APIENTRY arrayspu_ColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) 508 508 { 509 509 crStateColorPointer( size, type, stride, pointer ); 510 510 } 511 511 512 512 static void ARRAYSPU_APIENTRY arrayspu_SecondaryColorPointerEXT( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) 513 513 { 514 514 crStateSecondaryColorPointerEXT( size, type, stride, pointer ); 515 515 } 516 516 517 517 static void ARRAYSPU_APIENTRY arrayspu_VertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) 518 518 { 519 519 crStateVertexPointer( size, type, stride, pointer ); 520 520 } 521 521 522 522 static void ARRAYSPU_APIENTRY arrayspu_TexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) 523 523 { 524 524 crStateTexCoordPointer( size, type, stride, pointer ); 525 525 } 526 526 527 527 static void ARRAYSPU_APIENTRY arrayspu_NormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer ) 528 528 { 529 529 crStateNormalPointer( type, stride, pointer ); 530 530 } 531 531 532 532 static void ARRAYSPU_APIENTRY arrayspu_IndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer ) 533 533 { 534 534 crStateIndexPointer( type, stride, pointer ); 535 535 } 536 536 537 537 static void ARRAYSPU_APIENTRY arrayspu_EdgeFlagPointer( GLsizei stride, const GLvoid *pointer ) 538 538 { 539 539 crStateEdgeFlagPointer( stride, pointer ); 540 540 } 541 541 542 542 static void ARRAYSPU_APIENTRY arrayspu_VertexAttribPointerNV( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer ) 543 543 { 544 544 crStateVertexAttribPointerNV( index, size, type, stride, pointer ); 545 545 } 546 546 547 547 static void ARRAYSPU_APIENTRY arrayspu_FogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid *pointer ) 548 548 { 549 549 crStateFogCoordPointerEXT( type, stride, pointer ); 550 550 } 551 551 552 552 static void ARRAYSPU_APIENTRY arrayspu_GetPointerv( GLenum pname, GLvoid **params ) 553 553 { 554 554 crStateGetPointerv( pname, params ); 555 555 } 556 556 557 557 static void ARRAYSPU_APIENTRY arrayspu_EnableClientState( GLenum array ) 558 558 { 559 559 crStateEnableClientState( array ); 560 560 } 561 561 562 562 static void ARRAYSPU_APIENTRY arrayspu_DisableClientState( GLenum array ) 563 563 { 564 564 crStateDisableClientState( array ); 565 565 } 566 566 567 567 static void ARRAYSPU_APIENTRY arrayspu_ClientActiveTextureARB( GLenum texture ) 568 568 { 569 569 crStateClientActiveTextureARB( texture ); 570 570 } 571 571 572 572 static void ARRAYSPU_APIENTRY arrayspu_MultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) 573 573 { 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 574 int i; 575 576 if (primcount < 0) 577 { 578 crError("array_spu.self.MultiDrawArraysEXT passed negative count: %d", primcount); 579 } 580 581 if (mode > GL_POLYGON) 582 { 583 crError("array_spu.self.MultiDrawArraysEXT called with invalid mode: %d", mode); 584 } 585 586 for (i = 0; i < primcount; i++) 587 { 588 array_spu.self.DrawArrays(mode, first[i], count[i]); 589 } 590 590 } 591 591 592 592 static void ARRAYSPU_APIENTRY arrayspu_MultiDrawElementsEXT(GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) 593 593 { 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 594 int i; 595 596 if (primcount < 0) 597 { 598 crError("array_spu.self.MultiDrawElementsEXT passed negative count: %d", primcount); 599 } 600 601 if (mode > GL_POLYGON) 602 { 603 crError("array_spu.self.MultiDrawElementsEXT called with invalid mode: %d", mode); 604 } 605 606 if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT) 607 { 608 crError("array_spu.self.MultiDrawElementsEXT called with invalid type: %d", type); 609 } 610 611 for (i = 0; i < primcount; i++) 612 { 613 array_spu.self.DrawElements(mode, count[i], type, indices[i]); 614 } 615 615 } 616 616 … … 621 621 static void ARRAYSPU_APIENTRY arrayspu_Enable(GLenum cap) 622 622 { 623 624 625 626 623 if (cap == GL_VERTEX_PROGRAM_NV) { 624 array_spu.ctx->program.vpEnabled = GL_TRUE; 625 } 626 array_spu.child.Enable(cap); 627 627 } 628 628 … … 630 630 static void ARRAYSPU_APIENTRY arrayspu_Disable(GLenum cap) 631 631 { 632 633 634 635 632 if (cap == GL_VERTEX_PROGRAM_NV) { 633 array_spu.ctx->program.vpEnabled = GL_FALSE; 634 } 635 array_spu.child.Disable(cap); 636 636 } 637 637 … … 640 640 static void ARRAYSPU_APIENTRY 641 641 arrayspu_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, 642 643 644 { 645 642 GLboolean normalized, GLsizei stride, 643 const GLvoid *pointer) 644 { 645 crStateVertexAttribPointerARB( index, size, type, normalized, stride, pointer ); 646 646 } 647 647 … … 650 650 arrayspu_EnableVertexAttribArrayARB(GLuint index) 651 651 { 652 652 crStateEnableVertexAttribArrayARB(index); 653 653 } 654 654 … … 657 657 arrayspu_DisableVertexAttribArrayARB(GLuint index) 658 658 { 659 659 crStateDisableVertexAttribArrayARB(index); 660 660 } 661 661 … … 668 668 arrayspu_PushClientAttrib( GLbitfield mask ) 669 669 { 670 671 670 crStatePushClientAttrib(mask); 671 array_spu.child.PushClientAttrib(mask); 672 672 } 673 673 … … 676 676 arrayspu_PopClientAttrib( void ) 677 677 { 678 679 678 crStatePopClientAttrib(); 679 array_spu.child.PopClientAttrib(); 680 680 } 681 681 … … 684 684 arrayspu_GenBuffersARB( GLsizei n, GLuint * buffers ) 685 685 { 686 686 crStateGenBuffersARB(n, buffers); 687 687 } 688 688 … … 690 690 arrayspu_DeleteBuffersARB( GLsizei n, const GLuint *buffers ) 691 691 { 692 692 crStateDeleteBuffersARB(n, buffers); 693 693 } 694 694 … … 696 696 arrayspu_BindBufferARB( GLenum target, GLuint buffer ) 697 697 { 698 698 crStateBindBufferARB(target, buffer); 699 699 } 700 700 … … 702 702 arrayspu_IsBufferARB (GLuint buffer) 703 703 { 704 704 return crStateIsBufferARB(buffer); 705 705 } 706 706 … … 708 708 arrayspu_BufferDataARB( GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage ) 709 709 { 710 710 crStateBufferDataARB(target, size, data, usage); 711 711 } 712 712 713 713 static void ARRAYSPU_APIENTRY 714 714 arrayspu_BufferSubDataARB( GLenum target, GLintptrARB offset, 715 716 { 717 715 GLsizeiptrARB size, const GLvoid * data ) 716 { 717 crStateBufferSubDataARB(target, offset, size, data); 718 718 } 719 719 … … 721 721 arrayspu_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data) 722 722 { 723 723 crStateGetBufferSubDataARB(target, offset, size, data); 724 724 } 725 725 … … 727 727 arrayspu_MapBufferARB(GLenum target, GLenum access) 728 728 { 729 729 return crStateMapBufferARB(target, access); 730 730 } 731 731 … … 733 733 arrayspu_UnmapBufferARB(GLenum target) 734 734 { 735 735 return crStateUnmapBufferARB(target); 736 736 } 737 737 … … 739 739 arrayspu_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) 740 740 { 741 741 crStateGetBufferParameterivARB(target, pname, params); 742 742 } 743 743 … … 745 745 arrayspu_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) 746 746 { 747 747 crStateGetBufferPointervARB(target, pname, params); 748 748 } 749 749 … … 751 751 arrayspu_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *p) 752 752 { 753 753 crStateInterleavedArrays(format, stride, p); 754 754 } 755 755 756 756 757 757 SPUNamedFunctionTable _cr_array_table[] = { 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 758 { "ArrayElement", (SPUGenericFunction) arrayspu_ArrayElement }, 759 { "DrawArrays", (SPUGenericFunction) arrayspu_DrawArrays}, 760 { "DrawElements", (SPUGenericFunction) arrayspu_DrawElements}, 761 { "ColorPointer", (SPUGenericFunction) arrayspu_ColorPointer}, 762 { "SecondaryColorPointerEXT", (SPUGenericFunction) arrayspu_SecondaryColorPointerEXT}, 763 { "VertexPointer", (SPUGenericFunction) arrayspu_VertexPointer}, 764 { "TexCoordPointer", (SPUGenericFunction) arrayspu_TexCoordPointer}, 765 { "NormalPointer", (SPUGenericFunction) arrayspu_NormalPointer}, 766 { "IndexPointer", (SPUGenericFunction) arrayspu_IndexPointer}, 767 { "EdgeFlagPointer", (SPUGenericFunction) arrayspu_EdgeFlagPointer}, 768 { "VertexAttribPointerNV", (SPUGenericFunction) arrayspu_VertexAttribPointerNV}, 769 { "FogCoordPointerEXT", (SPUGenericFunction) arrayspu_FogCoordPointerEXT}, 770 { "GetPointerv", (SPUGenericFunction) arrayspu_GetPointerv}, 771 { "EnableClientState", (SPUGenericFunction) arrayspu_EnableClientState}, 772 { "DisableClientState", (SPUGenericFunction) arrayspu_DisableClientState}, 773 { "ClientActiveTextureARB", (SPUGenericFunction) arrayspu_ClientActiveTextureARB }, 774 { "MultiDrawArraysEXT", (SPUGenericFunction) arrayspu_MultiDrawArraysEXT }, 775 { "MultiDrawElementsEXT", (SPUGenericFunction) arrayspu_MultiDrawElementsEXT }, 776 { "Enable", (SPUGenericFunction) arrayspu_Enable }, 777 { "Disable", (SPUGenericFunction) arrayspu_Disable }, 778 { "PushClientAttrib", (SPUGenericFunction) arrayspu_PushClientAttrib }, 779 { "PopClientAttrib", (SPUGenericFunction) arrayspu_PopClientAttrib }, 780 { "VertexAttribPointerARB", (SPUGenericFunction) arrayspu_VertexAttribPointerARB }, 781 { "EnableVertexAttribArrayARB", (SPUGenericFunction) arrayspu_EnableVertexAttribArrayARB }, 782 { "DisableVertexAttribArrayARB", (SPUGenericFunction) arrayspu_DisableVertexAttribArrayARB }, 783 { "GenBuffersARB", (SPUGenericFunction) arrayspu_GenBuffersARB }, 784 { "DeleteBuffersARB", (SPUGenericFunction) arrayspu_DeleteBuffersARB }, 785 { "BindBufferARB", (SPUGenericFunction) arrayspu_BindBufferARB }, 786 { "IsBufferARB", (SPUGenericFunction) arrayspu_IsBufferARB }, 787 { "BufferDataARB", (SPUGenericFunction) arrayspu_BufferDataARB }, 788 { "BufferSubDataARB", (SPUGenericFunction) arrayspu_BufferSubDataARB }, 789 { "GetBufferSubDataARB", (SPUGenericFunction) arrayspu_GetBufferSubDataARB }, 790 { "MapBufferARB", (SPUGenericFunction) arrayspu_MapBufferARB }, 791 { "UnmapBufferARB", (SPUGenericFunction) arrayspu_UnmapBufferARB }, 792 { "GetBufferParameterivARB", (SPUGenericFunction) arrayspu_GetBufferParameterivARB}, 793 { "GetBufferPointervARB", (SPUGenericFunction) arrayspu_GetBufferPointervARB}, 794 { "InterleavedArrays", (SPUGenericFunction) arrayspu_InterleavedArrays}, 795 { NULL, NULL } 796 796 };
Note:
See TracChangeset
for help on using the changeset viewer.