Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxvsetup.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/3dfx/fxvsetup.c
r2938 r3598 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 61 61 { 62 62 fprintf(stderr, "%s: %d %s%s%s%s%s%s\n", 63 64 65 (flags & SETUP_XY) ? " xy," : "", 66 67 68 69 70 63 msg, 64 flags, 65 (flags & SETUP_XY) ? " xy," : "", 66 (flags & SETUP_Z) ? " z," : "", 67 (flags & SETUP_W) ? " w," : "", 68 (flags & SETUP_RGBA) ? " rgba," : "", 69 (flags & SETUP_TMU0) ? " tmu0," : "", 70 (flags & SETUP_TMU1) ? " tmu1," : ""); 71 71 } 72 72 73 73 static void project_texcoords( struct vertex_buffer *VB, 74 75 76 { 74 GLuint tmu_nr, GLuint tc_nr, 75 GLuint start, GLuint count ) 76 { 77 77 fxVertex *v = FX_DRIVER_DATA(VB)->verts + start; 78 78 GrTmuVertex *tmu = &(((GrVertex *)v->f)->tmuvtx[tmu_nr]); … … 86 86 tmu->oow = v->f[OOWCOORD] * data[3]; 87 87 tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex)); 88 } 88 } 89 89 } 90 90 91 91 92 92 static void copy_w( struct vertex_buffer *VB, 93 GLuint tmu_nr, 94 95 { 93 GLuint tmu_nr, 94 GLuint start, GLuint count ) 95 { 96 96 fxVertex *v = FX_DRIVER_DATA(VB)->verts + start; 97 97 GrTmuVertex *tmu = &(((GrVertex *)v->f)->tmuvtx[tmu_nr]); … … 101 101 tmu->oow = v->f[OOWCOORD]; 102 102 tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex)); 103 } 103 } 104 104 } 105 105 … … 303 303 setupindex |= SETUP_RGBA|SETUP_W; 304 304 305 if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D|TEXTURE0_3D)) == TEXTURE0_2D) 305 if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D|TEXTURE0_3D)) == TEXTURE0_2D) 306 306 { 307 if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) 308 307 if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) 308 setupindex &= ~SETUP_RGBA; 309 309 310 310 setupindex |= SETUP_TMU0|SETUP_W; … … 313 313 if ((ctx->Texture.ReallyEnabled & (TEXTURE1_2D|TEXTURE1_3D)) == TEXTURE1_2D) 314 314 { 315 if (setupindex & SETUP_TMU0) { 316 struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2]; 317 tfxTexInfo *ti=fxTMGetTexInfo(tObj); 318 319 setupindex |= SETUP_TMU1|SETUP_W; 320 321 if(ti->whichTMU!=FX_TMU0) { 322 fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0; 323 fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1; 324 } 325 } else { 326 setupindex |= SETUP_TMU0|SETUP_W; 327 fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0; 328 /* not used: */ 329 fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1; 330 } 315 setupindex |= SETUP_TMU1|SETUP_W; 316 if (setupindex & SETUP_TMU0) { /* both TMUs in use */ 317 struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2]; 318 tfxTexInfo *ti=fxTMGetTexInfo(tObj); 319 320 if (ti->whichTMU!=FX_TMU0) { /* TMU0 and TMU1 are swapped */ 321 fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0; 322 fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1; 323 } 324 } 331 325 } 332 326 … … 335 329 336 330 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE)) 337 fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); 331 fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); 338 332 339 333 fxMesa->setupindex = setupindex; … … 353 347 return; 354 348 } 355 356 if (VB->Type == VB_CVA_PRECALC) 349 350 if (VB->Type == VB_CVA_PRECALC) 357 351 fxDDPartialRasterSetup( VB ); 358 else 352 else 359 353 ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count ); 360 354 } … … 366 360 * we get a forbidden input in the elt pipeline - and therefore need to check 367 361 * whether we have one *now*. Similarly need to know if state changes cause 368 * size4 texcoords to be introduced. 362 * size4 texcoords to be introduced. 369 363 */ 370 364 void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) … … 375 369 d->type = 0; 376 370 d->pre_forbidden_inputs = 0; 377 fxMesa->setupdone = 0; 378 379 /* Indirect triangles must be rendered via the immediate pipeline. 380 * If all rasterization is software, no need to set up. 371 fxMesa->setupdone = 0; /* cleared if we return */ 372 373 /* Indirect triangles must be rendered via the immediate pipeline. 374 * If all rasterization is software, no need to set up. 381 375 */ 382 376 if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) 383 377 return; 384 378 385 379 if ((ctx->IndirectTriangles & DD_SW_SETUP) || 386 (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) 380 (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) 387 381 return; 388 382 … … 391 385 { 392 386 if (ctx->TextureMatrix[0].type == MATRIX_GENERAL || 393 394 395 387 ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE || 388 (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT)) 389 return; 396 390 397 391 d->pre_forbidden_inputs |= VERT_TEX0_4; … … 402 396 { 403 397 if (ctx->TextureMatrix[1].type == MATRIX_GENERAL || 404 405 406 398 ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE || 399 (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT)) 400 return; 407 401 408 402 d->pre_forbidden_inputs |= VERT_TEX1_4; 409 403 } 410 404 411 405 412 406 fxMesa->setupdone = tmp; 413 407 d->inputs = 0; … … 444 438 if ((newout & VERT_WIN) == 0) 445 439 ind &= ~(fxMesa->setupdone & SETUP_W); 446 440 447 441 fxMesa->setupdone &= ~ind; 448 442 ind &= fxMesa->setupindex; … … 451 445 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE)) { 452 446 gl_print_vert_flags("new outputs", VB->pipeline->new_outputs); 453 fxPrintSetupFlags("fxmesa: partial setup function", ind); 454 } 455 456 if (ind) 457 setupfuncs[ind]( VB, VB->Start, VB->Count ); 447 fxPrintSetupFlags("fxmesa: partial setup function", ind); 448 } 449 450 if (ind) 451 setupfuncs[ind]( VB, VB->Start, VB->Count ); 458 452 } 459 453 … … 472 466 FREE( fvb->vert_store ); 473 467 fvb->vert_store = MALLOC( sizeof(fxVertex) * fvb->size + 31); 474 if (!fvb->vert_store || !VB->ClipMask) 468 if (!fvb->vert_store || !VB->ClipMask) 475 469 { 476 470 fprintf(stderr,"fx Driver: out of memory !\n"); 477 471 fxCloseHardware(); 478 exit(-1);472 EXIT(-1); 479 473 } 480 474 fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31); … … 482 476 gl_vector1ui_free( &fvb->clipped_elements ); 483 477 gl_vector1ui_alloc( &fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32 ); 484 478 485 479 if (!fvb->clipped_elements.start) goto memerror; 486 480 487 481 return; 488 memerror: 482 memerror: 489 483 fprintf(stderr,"fx Driver: out of memory !\n"); 490 484 fxCloseHardware(); 491 exit(-1);485 EXIT(-1); 492 486 } 493 487 … … 507 501 fvb->vert_store = MALLOC( sizeof(fxVertex) * fvb->size + 31); 508 502 if (!fvb->vert_store) goto memerror; 509 #if defined(FX_GLIDE3) 503 #if defined(FX_GLIDE3) 510 504 fvb->triangle_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 511 505 if (!fvb->triangle_b) goto memerror; 512 506 fvb->strips_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 513 if (!fvb->strips_b ) goto memerror; 514 #endif 507 if (!fvb->strips_b ) goto memerror; 508 #endif 515 509 fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31); 516 510 gl_vector1ui_alloc( &fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32 ); … … 519 513 FREE( VB->ClipMask ); 520 514 VB->ClipMask = (GLubyte *)MALLOC(sizeof(GLubyte) * fvb->size); 521 515 if (!VB->ClipMask) goto memerror; 522 516 523 517 } else { 524 518 fvb->vert_store = MALLOC( sizeof(fxVertex) * (VB->Size + 12) + 31); 525 519 if (!fvb->vert_store) goto memerror; 526 #if defined(FX_GLIDE3) 520 #if defined(FX_GLIDE3) 527 521 fvb->triangle_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 528 522 if (!fvb->triangle_b) goto memerror; 529 523 fvb->strips_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 530 if (!fvb->strips_b ) goto memerror; 531 #endif 524 if (!fvb->strips_b ) goto memerror; 525 #endif 532 526 fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31); 533 527 fvb->size = VB->Size + 12; 534 528 } 535 529 536 530 537 531 VB->driver_data = fvb; 538 532 return; … … 540 534 fprintf(stderr,"fx Driver: out of memory !\n"); 541 535 fxCloseHardware(); 542 exit(-1);536 EXIT(-1); 543 537 } 544 538 … … 546 540 { 547 541 struct tfxMesaVertexBuffer *fvb = FX_DRIVER_DATA(VB); 548 542 549 543 if (fvb) { 550 544 if (fvb->vert_store) FREE(fvb->vert_store); … … 553 547 #if defined(FX_GLIDE3) 554 548 if (fvb->strips_b) 555 549 FREE(fvb->strips_b); 556 550 if (fvb->triangle_b) 557 551 FREE(fvb->triangle_b); 558 552 #endif 559 553 VB->driver_data = 0; 560 } 554 } 561 555 } 562 556
Note:
See TracChangeset
for help on using the changeset viewer.