Changeset 6653 for trunk/src/opengl/glide/cvg
- Timestamp:
- Sep 5, 2001, 4:31:14 PM (24 years ago)
- Location:
- trunk/src/opengl/glide/cvg
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/glide/cvg/glide/cpudetect.c
r2888 r6653 1 /* $Id: cpudetect.c,v 1.2 2001-09-05 14:30:19 bird Exp $ */ 1 2 /* 2 3 * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 * FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 * 10 * FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 * 11 12 * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 * THE UNITED STATES. 17 * 17 * THE UNITED STATES. 18 * 18 19 * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 */ -
trunk/src/opengl/glide/cvg/glide/ddgump.c
r2888 r6653 1 /* $Id: ddgump.c,v 1.2 2001-09-05 14:30:20 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/ddgump.c,v 1. 1 2000-02-25 00:37:34 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/ddgump.c,v 1.2 2001-09-05 14:30:20 bird Exp $ 21 22 ** $Log: ddgump.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:34 sandervl 23 ** Revision 1.2 2001-09-05 14:30:20 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:34 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 16 2/20/98 11:00a Peter 27 31 ** removed glide3 from glid2 tree 28 * 32 * 29 33 * 15 12/17/97 4:45p Peter 30 34 * groundwork for CrybabyGlide 31 * 35 * 32 36 * 14 12/15/97 5:51p Atai 33 37 * disable obsolete glide2 api for glide3 34 * 38 * 35 39 * 13 12/08/97 12:06p Atai 36 40 * change prototype for grDrawPoint, grDrawLine, grDrawTriangel 37 * 41 * 38 42 * 12 11/18/97 4:36p Peter 39 43 * chipfield stuff cleanup and w/ direct writes 40 * 44 * 41 45 * 11 11/17/97 4:55p Peter 42 46 * watcom warnings/chipfield stuff 43 * 47 * 44 48 * 10 11/03/97 3:43p Peter 45 49 * h3/cvg cataclysm 46 * 50 * 47 51 * 9 10/27/97 1:16p Peter 48 52 * fixed silliness 49 * 53 * 50 54 * 8 10/27/97 11:10a Peter 51 55 * starting cleanup 52 * 56 * 53 57 * 7 9/15/97 7:31p Peter 54 58 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 55 59 * place, lfb's are on, Hmmmm.. probably more 56 * 60 * 57 61 * 6 9/04/97 3:32p Peter 58 62 * starting grouping serial reg writes 59 * 63 * 60 64 * 5 6/06/97 10:47a Peter 61 65 * texture downloading, fixed 640x480 dimension, changed cvg dep to be the 62 66 * same as sst1 63 * 67 * 64 68 * 4 5/27/97 1:16p Peter 65 * Basic cvg, w/o cmd fifo stuff. 66 * 69 * Basic cvg, w/o cmd fifo stuff. 70 * 67 71 * 3 5/21/97 6:04a Peter 68 * 72 * 69 73 * 2 3/04/97 9:08p Dow 70 * 74 * 71 75 * 1 12/23/96 1:39p Dow 72 76 * Changes for multiplatform … … 92 96 /* 93 97 ** _gumpTexCombineFunction 94 ** 98 ** 95 99 ** Sets the texture combine function. For a dual TMU system this function 96 100 ** will configure the TEXTUREMODE registers as appropriate. For a … … 135 139 } 136 140 break; 137 141 138 142 case GR_MPTEXTURECOMBINE_DETAIL0: 139 143 /* tmu0: (other - local) * lod + local */ … … 150 154 texmode |= (SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD | 151 155 SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND | 152 SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER); 156 SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER); 153 157 } 154 158 break; … … 211 215 case GR_MPTEXTURECOMBINE_SUBTRACT: 212 216 /* 213 tmu0: other - local 217 tmu0: other - local 214 218 tmu1: local 215 219 doesn't work, alpha blender can't subtract … … 228 232 { 229 233 SstRegs* tmuRegs = SST_TMU(hw, 0); 230 234 231 235 GR_SET(eChipTMU0, tmuRegs, textureMode, texmode); 232 236 } … … 325 329 /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 326 330 does not work, you need to do this instead of below. 327 331 328 332 if (gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA) 329 333 { … … 331 335 } 332 336 */ 333 337 334 338 fbzcolorpath &= ~(SST_CC_ADD_CLOCAL | SST_CC_ADD_ALOCAL | SST_CC_SUB_CLOCAL); 335 339 REG_GROUP_SET(hw, fbzColorPath, fbzcolorpath); … … 357 361 if (depthP) { 358 362 fbzmode = fbzmode_orig = gc->state.fbi_config.fbzMode; 359 363 360 364 fbzmode &= ~(SST_ZAWRMASK | SST_ZFUNC); 361 365 fbzmode |= GR_CMP_EQUAL; … … 380 384 /* restore alpha blending state */ 381 385 REG_GROUP_SET(hw, alphaMode, alphamode_orig); 382 386 383 387 /* restore depth buffer state */ 384 388 if (depthP) REG_GROUP_SET(hw, fbzMode, fbzmode_orig); … … 386 390 REG_GROUP_END(); 387 391 } 388 392 389 393 goto all_done; 390 394 } else if (_gumpState.tc_fnc == GR_MPTEXTURECOMBINE_MULTIPLY) { … … 434 438 /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 435 439 does not work, you need to do this instead of below. 436 440 437 441 if (gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA) 438 442 { … … 454 458 } 455 459 REG_GROUP_END(); 456 460 457 461 /* render first pass */ 458 462 grDrawTriangle(a, b, c); 459 463 460 464 /* second pass */ 461 465 /* xxx may sometimes need to copy texture coordinates */ 462 466 463 467 /* tmu setup */ 464 468 guTexSource(_gumpState.mmid[1]); … … 481 485 SST_CC_INVERT_OUTPUT | 482 486 SST_CC_REVERSE_BLEND ); 483 487 484 488 /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 485 489 does not work, you need to do this instead of below. 486 490 487 491 if ( gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA ) 488 492 { … … 498 502 /* disable fog */ 499 503 if (fogP) REG_GROUP_SET(hw, fogMode, 0); 500 504 501 505 /* enable alpha blend to multiply to destination buffers */ 502 506 /* xxx alpha component blender can only handle factors of … … 510 514 511 515 REG_GROUP_SET(hw, alphaMode, alphamode); 512 516 513 517 /* if depth buffering, set to z= mode and disable writes */ 514 518 if (depthP) { … … 516 520 fbzmode &= ~(SST_ZAWRMASK | SST_ZFUNC); 517 521 fbzmode |= GR_CMP_EQUAL; 518 522 519 523 REG_GROUP_SET(hw, fbzMode, fbzmode); 520 524 } … … 524 528 /* render second pass */ 525 529 grDrawTriangle(a, b, c); 526 530 527 531 /* if bias, third pass */ 528 532 if (fogP) { … … 535 539 fogmode |= SST_FOGMULT; 536 540 REG_GROUP_SET(hw, fogMode, fogmode); 537 541 538 542 alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT); 539 543 alphamode |= (SST_ENALPHABLEND | … … 545 549 } 546 550 REG_GROUP_END(); 547 551 548 552 /* render third pass */ 549 553 grDrawTriangle(a, b, c); … … 560 564 /* restore alpha blending state */ 561 565 REG_GROUP_SET(hw, alphaMode, alphamode_orig); 562 566 563 567 /* restore depth buffer state */ 564 568 if (depthP) REG_GROUP_SET(hw, fbzMode, fbzmode_orig); -
trunk/src/opengl/glide/cvg/glide/diglide.c
r2888 r6653 1 /* $Id: diglide.c,v 1.2 2001-09-05 14:30:20 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/diglide.c,v 1. 1 2000-02-25 00:37:34 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/diglide.c,v 1.2 2001-09-05 14:30:20 bird Exp $ 21 22 ** $Log: diglide.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:34 sandervl 23 ** Revision 1.2 2001-09-05 14:30:20 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:34 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 40 6/23/98 5:38p Peter 27 31 ** lfb hinting 28 ** 32 ** 29 33 ** 39 3/17/98 3:00p Peter 30 34 ** removed unused stats 31 ** 35 ** 32 36 ** 38 3/02/98 7:22p Peter 33 37 ** moved internal function to where it is used 34 ** 38 ** 35 39 ** 37 2/20/98 11:00a Peter 36 40 ** removed glide3 from glid2 tree 37 ** 41 ** 38 42 ** 36 2/20/98 9:05a Peter 39 43 ** removed remnants of comdex grot 40 ** 44 ** 41 45 ** 35 1/30/98 4:31p Peter 42 46 ** general clenaup 43 ** 47 ** 44 48 ** 34 1/20/98 10:48a Atai 45 49 ** validate state in grGlideGetState 46 * 50 * 47 51 * 33 1/07/98 10:22a Peter 48 52 * lod dithering env var 49 * 53 * 50 54 * 32 1/06/98 3:53p Atai 51 55 * remove grHint, modify grLfbWriteRegion and grGet 52 * 56 * 53 57 * 31 12/17/97 4:05p Atai 54 58 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet() 55 59 * functions 56 * 60 * 57 61 * 30 12/09/97 12:20p Peter 58 62 * mac glide port 59 * 63 * 60 64 * 29 12/01/97 5:46p Peter 61 65 * fixed variable names in swizzle 62 * 66 * 63 67 * 28 12/01/97 5:17p Peter 64 * 68 * 65 69 * 27 11/18/97 4:36p Peter 66 70 * chipfield stuff cleanup and w/ direct writes 67 * 71 * 68 72 * 26 11/14/97 5:02p Peter 69 73 * more comdex stuff 70 * 74 * 71 75 * 25 11/14/97 12:09a Peter 72 76 * comdex thing and some other stuff 73 * 77 * 74 78 * 24 11/12/97 2:27p Peter 75 * 79 * 76 80 * 23 11/12/97 11:39a Dow 77 81 * H3 Stuff 78 * 82 * 79 83 * 22 11/12/97 9:21a Dow 80 84 * Changed CVG_FIFO to USE_PACKET_FIFO 81 * 85 * 82 86 * 21 11/04/97 4:00p Dow 83 87 * Banshee Mods 84 * 88 * 85 89 * 20 11/03/97 3:43p Peter 86 90 * h3/cvg cataclysm 87 * 91 * 88 92 * 19 10/16/97 3:40p Peter 89 93 * packed rgb 90 * 94 * 91 95 * 18 9/20/97 10:53a Peter 92 96 * keep track of palette stats 93 * 97 * 94 98 * 17 9/15/97 7:31p Peter 95 99 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 96 100 * place, lfb's are on, Hmmmm.. probably more 97 * 101 * 98 102 * 16 9/10/97 10:13p Peter 99 103 * fifo logic from GaryT, non-normalized fp first cut 100 * 104 * 101 105 * 15 7/25/97 11:40a Peter 102 106 * removed dHalf, change field name to match real use for cvg 103 * 107 * 104 108 * 14 7/08/97 2:48p Peter 105 * 109 * 106 110 * 13 6/30/97 3:20p Peter 107 111 * error callback 108 * 112 * 109 113 * 12 6/23/97 4:43p Peter 110 114 * cleaned up #defines etc for a nicer tree 111 * 115 * 112 116 ** 113 117 */ … … 160 164 gdbg_info(80,"\t\tWraps: %ld\n", _GlideRoot.stats.fifoWraps); 161 165 if (_GlideRoot.stats.fifoWraps > 0) { 162 gdbg_info(80,"\t\tAvg Drain Depth: %g\n", 166 gdbg_info(80,"\t\tAvg Drain Depth: %g\n", 163 167 (double)_GlideRoot.stats.fifoWrapDepth / _GlideRoot.stats.fifoWraps); 164 168 } 165 169 gdbg_info(80,"\t\tStalls: %ld\n", _GlideRoot.stats.fifoStalls); 166 170 if (_GlideRoot.stats.fifoStalls > 0) { 167 gdbg_info(80,"\t\tAvg Stall Depth: %g\n", 171 gdbg_info(80,"\t\tAvg Stall Depth: %g\n", 168 172 (double)_GlideRoot.stats.fifoStallDepth / _GlideRoot.stats.fifoStalls); 169 173 } … … 205 209 ** 206 210 */ 207 void 211 void 208 212 _grSwizzleColor(GrColor_t *color) 209 213 { 210 214 GR_DCL_GC; 211 215 FxU32 red, green, blue, alpha; 212 216 213 217 switch(gc->state.color_format) { 214 218 case GR_COLORFORMAT_ARGB: … … 286 290 287 291 case GR_HINT_FIFOCHECKHINT: 288 /* swFifoLWM is kept internally in bytes, hints are in fifo entries */ 292 /* swFifoLWM is kept internally in bytes, hints are in fifo entries */ 289 293 gc->state.checkFifo = hints; 290 294 break; … … 296 300 case GR_HINT_ALLOW_MIPMAP_DITHER: 297 301 /* Regardless of the game hint, force the user selection */ 298 gc->state.allowLODdither = ((_GlideRoot.environment.texLodDither != 0) || 302 gc->state.allowLODdither = ((_GlideRoot.environment.texLodDither != 0) || 299 303 hints); 300 304 break; … … 302 306 case GR_HINT_LFB_WRITE: 303 307 { 304 const FxU32 lfbRange = (((hints * gc->state.screen_height) + 0x1000UL) & 308 const FxU32 lfbRange = (((hints * gc->state.screen_height) + 0x1000UL) & 305 309 ~(0x1000UL - 1)); 306 310 307 311 pciLinearRangeSetPermission((const FxU32)((const FxU8*)gc->base_ptr + 0x200000UL), 308 312 0x200000UL, … … 331 335 FXTRUE); 332 336 break; 333 337 334 338 default: 335 339 GR_CHECK_F(myName, 1, "invalid hints type"); … … 345 349 { 346 350 GDBG_INIT(); 347 351 348 352 GDBG_INFO(80,"grGlideInit()\n"); 349 353 _GlideInitEnvironment(); /* the main init code */ -
trunk/src/opengl/glide/cvg/glide/digutex.c
r2888 r6653 1 /* $Id: digutex.c,v 1.2 2001-09-05 14:30:20 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/digutex.c,v 1. 1 2000-02-25 00:37:34 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/digutex.c,v 1.2 2001-09-05 14:30:20 bird Exp $ 21 22 ** $Log: digutex.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:34 sandervl 23 ** Revision 1.2 2001-09-05 14:30:20 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:34 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 11 2/20/98 5:31p Peter 27 31 ** crybaby glide 28 ** 32 ** 29 33 ** 10 2/20/98 11:00a Peter 30 34 ** removed glide3 from glid2 tree 31 * 35 * 32 36 * 9 1/08/98 7:09p Peter 33 37 * real hw stuff modulo makefile change 34 * 38 * 35 39 * 8 1/06/98 6:47p Atai 36 40 * undo grSplash and remove gu routines 37 * 41 * 38 42 * 7 12/15/97 5:51p Atai 39 43 * disable obsolete glide2 api for glide3 40 * 44 * 41 45 * 6 5/27/97 1:16p Peter 42 * Basic cvg, w/o cmd fifo stuff. 43 * 46 * Basic cvg, w/o cmd fifo stuff. 47 * 44 48 * 5 5/21/97 6:04a Peter 45 * 49 * 46 50 * 4 5/05/97 4:24p Pgj 47 51 * Neuter guTexDownloadMipMap error message 48 * 52 * 49 53 * 3 3/18/97 9:07p Dow 50 54 * Got rid of #$#%#$ // comments 51 * 55 * 52 56 * 2 3/09/97 10:31a Dow 53 57 * Added GR_DIENTRY for di glide functions 54 * 58 * 55 59 * 1 12/23/96 1:39p Dow 56 60 * Changes for multiplatform … … 115 119 */ 116 120 GR_CHECK_F(myName, small_lod < large_lod, "smallest_lod is larger than large_lod"); 117 121 118 122 info.smallLod = small_lod; 119 123 info.largeLod = large_lod; … … 128 132 (gc->tmu_state[tmu].freemem_base + memrequired > 0x200000)) 129 133 gc->tmu_state[tmu].freemem_base = 0x200000; 130 134 131 135 /* 132 136 ** If we have enough memory and a free mip map handle then go for it 133 137 */ 134 138 memavail = guTexMemQueryAvail( tmu ); 135 139 136 140 if ( memavail < memrequired ) 137 141 return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE; 138 142 139 143 if (gc->mm_table.free_mmid >= MAX_MIPMAPS_PER_SST ) 140 144 return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE; 141 145 142 146 /* 143 147 ** Allocate the mip map id … … 148 152 ** calculate baseAddress (where LOD 0 would go) 149 153 */ 150 baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base, 151 large_lod, 152 aspect_ratio, 153 format, 154 baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base, 155 large_lod, 156 aspect_ratio, 157 format, 154 158 odd_even_mask ); 155 159 156 160 GDBG_INFO(gc->myLevel," baseAddress = 0x%x (in bytes)\n",baseAddress); 157 161 158 162 /* 159 163 ** reduce available memory to reflect allocation … … 174 178 (magfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0) 175 179 ); 176 180 177 181 clampMode = ( 178 182 (s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) | 179 183 (t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0) 180 ); 181 184 ); 185 182 186 /* 183 187 ** Create the tTextureMode register value for this mip map … … 188 192 texturemode |= filterMode; 189 193 texturemode |= clampMode; 190 194 191 195 if ( mipmap_mode == GR_MIPMAP_NEAREST_DITHER ) 192 196 texturemode |= SST_TLODDITHER; 193 197 194 198 if ( trilinear ) { 195 199 texturemode |= SST_TRILINEAR; … … 201 205 tLod |= SST_LOD_TSPLIT; 202 206 } 203 207 204 208 /* 205 209 ** Fill in the mm_table data for this mip map … … 227 231 gc->mm_table.data[mmid].width = width; 228 232 gc->mm_table.data[mmid].height = height; 229 233 230 234 GR_RETURN(mmid); 231 235 } /* guTexAllocateMemory */ … … 238 242 int texturemode = 0; 239 243 int tLod = 0; 240 FxU32 244 FxU32 241 245 filterMode, /* filter mode bits of texturemode */ 242 246 clampMode; /* clamp mode bits of texturemode */ … … 251 255 (mminfo->t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0) 252 256 ); 253 257 254 258 /* 255 259 ** build up tTextureMode … … 285 289 286 290 /*--------------------------------------------------------------------------- 287 ** guTexChangeAttributes 291 ** guTexChangeAttributes 288 292 */ 289 293 GR_DIENTRY(guTexChangeAttributes, FxBool, ( GrMipMapId_t mmid, … … 349 353 /*--------------------------------------------------------------------------- 350 354 ** grTexCombineFunction - obsolete 351 ** 355 ** 352 356 */ 353 357 GR_DIENTRY(grTexCombineFunction, void, 354 (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 358 (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 355 359 { 356 360 guTexCombineFunction( tmu, tc ); … … 359 363 /*--------------------------------------------------------------------------- 360 364 ** guTexCombineFunction 361 ** 365 ** 362 366 ** Sets the texture combine function. For a dual TMU system this function 363 367 ** will configure the TEXTUREMODE registers as appropriate. For a … … 438 442 ** to be in row major order from largest mip map to smallest mip map. 439 443 */ 440 GR_DIENTRY(guTexDownloadMipMap, void, 444 GR_DIENTRY(guTexDownloadMipMap, void, 441 445 (GrMipMapId_t mmid, const void *src, const GuNccTable 442 446 *ncc_table ) ) … … 487 491 const GrMipMapInfo *mminfo; 488 492 GR_DCL_GC; 489 493 490 494 GDBG_INFO(99,"guTexDownloadMipMapLevel(%d,%d,0x%x)\n",mmid,lod,src_base); 491 495 GR_ASSERT(src_base != NULL); … … 565 569 { 566 570 int i; 567 571 568 572 GR_BEGIN_NOFIFOCHECK("guTexMemReset",99); 569 573 GDBG_INFO_MORE(gc->myLevel,"()\n"); … … 571 575 memset( gc->mm_table.data, 0, sizeof( gc->mm_table.data ) ); 572 576 gc->mm_table.free_mmid = 0; 573 577 574 578 for ( i = 0; i < gc->num_tmu; i++ ) { 575 579 gc->state.current_mm[i] = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE; 576 580 gc->tmu_state[i].freemem_base = 0; 577 gc->tmu_state[i].ncc_mmids[0] = 578 gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE; 579 gc->tmu_state[i].ncc_table[0] = 581 gc->tmu_state[i].ncc_mmids[0] = 582 gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE; 583 gc->tmu_state[i].ncc_table[0] = 580 584 gc->tmu_state[i].ncc_table[1] = 0; 581 585 } -
trunk/src/opengl/glide/cvg/glide/disst.c
r2888 r6653 1 /* $Id: disst.c,v 1.2 2001-09-05 14:30:21 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/disst.c,v 1. 1 2000-02-25 00:37:35 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/disst.c,v 1.2 2001-09-05 14:30:21 bird Exp $ 21 22 ** $Log: disst.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:35 sandervl 23 ** Revision 1.2 2001-09-05 14:30:21 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:35 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 22 4/21/98 10:05a Peter 27 31 ** grSstSelect cleanup (Thanks John/Rufus) 28 ** 32 ** 29 33 ** 21 3/17/98 6:50p Peter 30 34 ** sli paired vs active 31 ** 35 ** 32 36 ** 20 2/24/98 10:15a Peter 33 37 ** oem dll muckage 34 ** 38 ** 35 39 ** 19 2/20/98 11:00a Peter 36 40 ** removed glide3 from glid2 tree 37 * 41 * 38 42 * 18 12/17/97 4:05p Atai 39 43 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet() 40 44 * functions 41 * 45 * 42 46 * 17 12/09/97 12:20p Peter 43 47 * mac glide port 44 * 48 * 45 49 * 16 11/19/97 2:49p Peter 46 50 * env vars in registry for win32 47 * 51 * 48 52 * 15 11/18/97 4:36p Peter 49 53 * chipfield stuff cleanup and w/ direct writes 50 * 54 * 51 55 * 14 10/31/97 9:15a Peter 52 56 * only lie about v2 boards 53 * 57 * 54 58 * 13 10/31/97 8:53a Peter 55 59 * last lying change, really 56 * 60 * 57 61 * 12 9/05/97 5:29p Peter 58 62 * changes for direct hw 59 * 63 * 60 64 * 11 6/20/97 9:56a Peter 61 65 * better lines/pts, hopefully 62 * 66 * 63 67 * 10 6/02/97 4:09p Peter 64 68 * Compile w/ gcc for Dural 65 * 69 * 66 70 * 9 5/27/97 1:16p Peter 67 * Basic cvg, w/o cmd fifo stuff. 68 * 71 * Basic cvg, w/o cmd fifo stuff. 72 * 69 73 * 8 5/21/97 6:04a Peter 70 * 74 * 71 75 * 7 5/02/97 2:07p Pgj 72 76 * grSstScreenWidth/Height now FxU32 73 * 77 * 74 78 * 6 3/17/97 6:25a Jdt 75 79 * Added initDeviceSelect to grSstSelect() 76 * 80 * 77 81 * 5 3/09/97 10:31a Dow 78 82 * Added GR_DIENTRY for di glide functions 79 * 83 * 80 84 * 4 3/04/97 9:08p Dow 81 * 85 * 82 86 * 3 1/18/97 11:39p Dow 83 87 * Changed location of _curGCFuncs 84 * 88 * 85 89 * 2 1/16/97 3:39p Dow 86 90 * Added ref to _curGCFuncs during grSstSelect() 87 * 91 * 88 92 * 1 12/23/96 1:39p Dow 89 93 * Changes for multiplatform … … 213 217 #endif 214 218 215 _GlideRoot.GCs[whichSst].vidTimings = vidTimings; 219 _GlideRoot.GCs[whichSst].vidTimings = vidTimings; 216 220 } /* grSstVidMode */ -
trunk/src/opengl/glide/cvg/glide/distate.c
r2888 r6653 1 /* $Id: distate.c,v 1.2 2001-09-05 14:30:21 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/distate.c,v 1. 1 2000-02-25 00:37:35 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/distate.c,v 1.2 2001-09-05 14:30:21 bird Exp $ 21 22 ** $Log: distate.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:35 sandervl 23 ** Revision 1.2 2001-09-05 14:30:21 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:35 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 17 1/13/98 12:42p Atai 27 31 * fixed grtexinfo, grVertexLayout, and draw triangle 28 * 32 * 29 33 * 16 1/10/98 4:01p Atai 30 34 * inititialize vertex layout, viewport, added defines 31 * 35 * 32 36 * 15 1/05/98 6:06p Atai 33 37 * glide extension stuff 34 * 38 * 35 39 * 14 12/17/97 4:05p Atai 36 40 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet() 37 41 * functions 38 * 42 * 39 43 * 13 12/16/97 11:38a Atai 40 44 * added grChromaRange() 41 * 45 * 42 46 * 12 12/15/97 5:52p Atai 43 47 * disable obsolete glide2 api for glide3 44 * 48 * 45 49 * 10 12/12/97 1:30p Atai 46 50 * remove fp z buffer 47 * 51 * 48 52 * 8 12/08/97 10:44a Atai 49 53 * added entry point for grCoordinateSpace(), grDepthRange(), and 50 54 * grViewport() 51 * 55 * 52 56 * 7 11/13/97 4:38p Atai 53 57 * invalidate lfbMode and c0c1 54 * 58 * 55 59 * 6 11/10/97 5:20p Atai 56 60 * added factor for grAlphaCombine and remove extra _grChromakeyMode 57 * 61 * 58 62 * 5 11/07/97 11:22a Atai 59 63 * remove GR_*_SMOOTH. use GR_SMOOTH 60 * 64 * 61 65 * 4 10/15/97 7:33a Dow 62 66 * Made _grValidateState use central routine for writing data 63 * 67 * 64 68 * 3 10/14/97 4:18p Atai 65 69 * added grEnable and grDisable 66 * 70 * 67 71 * 2 10/10/97 2:57p Dow 68 72 * Minor adjustments 69 * 73 * 70 74 * 1 10/09/97 5:19p Dow 71 75 * State Monster file … … 123 127 Inform Glide that the Alpha Blend Function has been modified. 124 128 Arguments: 125 129 126 130 Return: 127 131 -------------------------------------------------------------------*/ … … 147 151 Implementor(s): dow 148 152 Description: 149 150 Arguments: 151 153 154 Arguments: 155 152 156 Return: 153 157 -------------------------------------------------------------------*/ … … 170 174 Implementor(s): dow 171 175 Description: 172 173 Arguments: 174 176 177 Arguments: 178 175 179 Return: 176 180 -------------------------------------------------------------------*/ … … 192 196 Implementor(s): dow 193 197 Description: 194 195 Arguments: 196 198 199 Arguments: 200 197 201 Return: 198 202 -------------------------------------------------------------------*/ 199 203 GR_DIENTRY(grAlphaCombine, void , 200 (GrCombineFunction_t function, GrCombineFactor_t factor, 204 (GrCombineFunction_t function, GrCombineFactor_t factor, 201 205 GrCombineLocal_t local, GrCombineOther_t other, FxBool invert) ) 202 206 { … … 220 224 Implementor(s): dow 221 225 Description: 222 223 Arguments: 224 226 227 Arguments: 228 225 229 Return: 226 230 -------------------------------------------------------------------*/ … … 242 246 Implementor(s): dow 243 247 Description: 244 245 Arguments: 246 248 249 Arguments: 250 247 251 Return: 248 252 -------------------------------------------------------------------*/ … … 272 276 Implementor(s): dow 273 277 Description: 274 275 Arguments: 276 278 279 Arguments: 280 277 281 Return: 278 282 -------------------------------------------------------------------*/ … … 295 299 Implementor(s): atai 296 300 Description: 297 298 Arguments: 299 301 302 Arguments: 303 300 304 Return: 301 305 -------------------------------------------------------------------*/ … … 317 321 Implementor(s): atai 318 322 Description: 319 320 Arguments: 321 323 324 Arguments: 325 322 326 Return: 323 327 -------------------------------------------------------------------*/ … … 346 350 Implementor(s): dow 347 351 Description: 348 349 Arguments: 350 352 353 Arguments: 354 351 355 Return: 352 356 -------------------------------------------------------------------*/ … … 368 372 Implementor(s): dow 369 373 Description: 370 371 Arguments: 372 374 375 Arguments: 376 373 377 Return: 374 378 -------------------------------------------------------------------*/ … … 392 396 Implementor(s): dow 393 397 Description: 394 395 Arguments: 396 398 399 Arguments: 400 397 401 Return: 398 402 -------------------------------------------------------------------*/ … … 415 419 Implementor(s): dow 416 420 Description: 417 418 Arguments: 419 421 422 Arguments: 423 420 424 Return: 421 425 -------------------------------------------------------------------*/ … … 439 443 Implementor(s): dow 440 444 Description: 441 442 Arguments: 443 445 446 Arguments: 447 444 448 Return: 445 449 -------------------------------------------------------------------*/ … … 462 466 Implementor(s): dow 463 467 Description: 464 465 Arguments: 466 468 469 Arguments: 470 467 471 Return: 468 472 -------------------------------------------------------------------*/ … … 485 489 Implementor(s): dow 486 490 Description: 487 488 Arguments: 489 491 492 Arguments: 493 490 494 Return: 491 495 -------------------------------------------------------------------*/ … … 510 514 Implementor(s): dow 511 515 Description: 512 513 Arguments: 514 516 517 Arguments: 518 515 519 Return: 516 520 -------------------------------------------------------------------*/ … … 532 536 Implementor(s): dow 533 537 Description: 534 535 Arguments: 536 538 539 Arguments: 540 537 541 Return: 538 542 -------------------------------------------------------------------*/ 539 543 GR_DIENTRY(grClipWindow, void , (FxU32 minx, FxU32 miny, FxU32 maxx, 540 FxU32 maxy) ) 544 FxU32 maxy) ) 541 545 { 542 546 #define FN_NAME "grClipWindow" … … 559 563 Implementor(s): dow 560 564 Description: 561 562 Arguments: 563 565 566 Arguments: 567 564 568 Return: 565 569 -------------------------------------------------------------------*/ … … 583 587 Implementor(s): dow 584 588 Description: 585 586 Arguments: 587 589 590 Arguments: 591 588 592 Return: 589 593 -------------------------------------------------------------------*/ … … 607 611 Implementor(s): dow 608 612 Description: 609 610 Arguments: 611 613 614 Arguments: 615 612 616 Return: 613 617 -------------------------------------------------------------------*/ … … 629 633 Implementor(s): dow 630 634 Description: 631 632 Arguments: 633 635 636 Arguments: 637 634 638 Return: 635 639 -------------------------------------------------------------------*/ … … 652 656 Implementor(s): dow 653 657 Description: 654 655 Arguments: 656 658 659 Arguments: 660 657 661 Return: 658 662 -------------------------------------------------------------------*/ 659 663 GR_DIENTRY(grLfbWriteColorSwizzle, void , (FxBool swizzleBytes, FxBool 660 swapWords) ) 664 swapWords) ) 661 665 { 662 666 #define FN_NAME "grLfbWriteColorSwizzle" … … 677 681 Implementor(s): dow 678 682 Description: 679 680 Arguments: 681 683 684 Arguments: 685 682 686 Return: 683 687 -------------------------------------------------------------------*/ … … 733 737 LOADARG(grAlphaCombine, invert)); 734 738 _grAlphaControlsITRGBLighting(LOADARG(grAlphaControlsITRGBLighting, 735 enable)); 736 _grColorCombine(LOADARG(grColorCombine, function), 739 enable)); 740 _grColorCombine(LOADARG(grColorCombine, function), 737 741 LOADARG(grColorCombine, factor), 738 742 LOADARG(grColorCombine, local), … … 809 813 Implementor(s): atai 810 814 Description: 811 812 Arguments: 813 815 816 Arguments: 817 814 818 Return: 815 819 -------------------------------------------------------------------*/ … … 843 847 Implementor(s): atai 844 848 Description: 845 846 Arguments: 847 849 850 Arguments: 851 848 852 Return: 849 853 -------------------------------------------------------------------*/ … … 876 880 Implementor(s): atai 877 881 Description: 878 879 Arguments: 880 882 883 Arguments: 884 881 885 Return: 882 886 -------------------------------------------------------------------*/ … … 903 907 Implementor(s): atai 904 908 Description: 905 906 Arguments: 907 909 910 Arguments: 911 908 912 Return: 909 913 -------------------------------------------------------------------*/ … … 926 930 Implementor(s): atai 927 931 Description: 928 929 Arguments: 930 932 933 Arguments: 934 931 935 Return: 932 936 -------------------------------------------------------------------*/ -
trunk/src/opengl/glide/cvg/glide/distrip.c
r2888 r6653 1 /* $Id: distrip.c,v 1.2 2001-09-05 14:30:21 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/distrip.c,v 1. 1 2000-02-25 00:37:35 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/distrip.c,v 1.2 2001-09-05 14:30:21 bird Exp $ 21 22 ** $Log: distrip.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:35 sandervl 23 ** Revision 1.2 2001-09-05 14:30:21 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:35 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 14 1/08/98 4:58p Atai 27 31 * tex table broadcast, grVertexLayout enable/disable, stq, and some 28 32 * defines 29 * 33 * 30 34 * 13 12/12/97 10:59a Atai 31 35 * clip space and viewport 32 * 36 * 33 37 * 12 12/08/97 10:42a Atai 34 38 * added grDrawVertexArrayLinear() 35 * 39 * 36 40 * 11 11/21/97 6:05p Atai 37 41 * use one datalist (tsuDataList) in glide3 38 * 42 * 39 43 * 10 11/18/97 6:11p Peter 40 44 * fixed glide3 muckage 41 * 45 * 42 46 * 9 11/18/97 3:24p Atai 43 47 * change grParameterData to grVertexLayout 44 48 * define GR_PARAM_* 45 * 49 * 46 50 * 8 11/07/97 11:22a Atai 47 51 * remove GR_*_SMOOTH. use GR_SMOOTH 48 * 52 * 49 53 * 7 11/06/97 6:10p Atai 50 54 * update GrState size 51 55 * rename grDrawArray to grDrawVertexArray 52 56 * update _grDrawPoint and _grDrawVertexList 53 * 57 * 54 58 * 6 10/21/97 8:36p Atai 55 59 * added gr_lines routines 56 60 * use dword offset 57 * 61 * 58 62 * 5 10/17/97 2:11p Atai 59 63 * added grContinueArray. We only support non aa mode for now. 60 * 64 * 61 65 * 4 10/14/97 4:34p Atai 62 66 * filled out the calls to different drawarray routines 63 * 67 * 64 68 * 3 9/29/97 1:26p Dow 65 69 * Fixed packed color strips/fans 66 * 70 * 67 71 * 2 9/26/97 10:24a Dow 68 72 * Fixed state muckage in Glide3 parameter data 69 * 73 * 70 74 * 1 9/23/97 2:04p Dow 71 75 * DI code for strips … … 86 90 Date: 17-Sep-97 87 91 Implementor(s): dow 88 Library: Init Code for 92 Library: Init Code for 89 93 Description: 90 94 This routine defines the format for vertex arrays. … … 98 102 99 103 So, this table summarizes the legal combinations: 100 Param Type Size Description 104 Param Type Size Description 101 105 ======================================================================================================= 102 106 GR_PARAM_XY FxFloat 8 X and Y coordinates. Offset must be zero. … … 106 110 GR_PARAM_PARGB FxU32 4 Packed ARGB. High-order byte is A, followed by R, G, and B. 107 111 GR_PARAM_STn FxFloat 8 S and T coordinates for TMU , where n is in the range [0, TBD] 108 GR_PARAM_Wn FxFloat 4 112 GR_PARAM_Wn FxFloat 4 109 113 110 114 Return: … … 123 127 case GR_PARAM_XY: 124 128 GR_CHECK_F(myName, 125 (offset != 0), 129 (offset != 0), 126 130 "Offset must be zero."); 127 131 … … 202 206 GR_CHECK_F(myName, 203 207 !((components == GR_VERTEX_XYZ) || 204 (components == GR_VERTEX_XYZW)), 208 (components == GR_VERTEX_XYZW)), 205 209 "Bad Component for Vertex Parameter"); 206 210 gc->state.vData.vertexInfo.components = components; 207 211 208 GR_CHECK_F(myName, !(type == GR_FLOAT), "Bad Type for Vertex Parameter"); 212 GR_CHECK_F(myName, !(type == GR_FLOAT), "Bad Type for Vertex Parameter"); 209 213 gc->state.vData.vertexInfo.type = type; 210 214 … … 213 217 GDBG_INFO(gc->myLevel, "%s: Vertex Offset = %d\n", FN_NAME, 214 218 gc->state.vData.vertexInfo.offset); 215 219 216 220 break; 217 221 … … 222 226 gc->state.vData.colorInfo.components = components; 223 227 224 GR_CHECK_F(myName, !((type == GR_FLOAT) || (type == GR_U8)), 228 GR_CHECK_F(myName, !((type == GR_FLOAT) || (type == GR_U8)), 225 229 "Bad Type for Color Parameter"); 226 230 gc->state.vData.colorInfo.type = type; … … 229 233 GDBG_INFO(gc->myLevel, "%s: Color Offset = %d\n", FN_NAME, 230 234 gc->state.vData.colorInfo.offset); 231 232 break; 233 235 236 break; 237 234 238 case GR_TEXTURE0: 235 239 GR_CHECK_F(myName, … … 245 249 GDBG_INFO(gc->myLevel, "%s: Tex0 Offset = %d\n", FN_NAME, 246 250 gc->state.vData.tex0Info.offset); 247 251 248 252 break; 249 253 … … 262 266 gc->state.vData.tex1Info.offset); 263 267 break; 264 268 265 269 default: 266 270 GR_CHECK_F(myName, 0, "Invalid Parameter"); … … 281 285 Implementor(s): dow 282 286 Description: 283 287 284 288 Arguments: 285 289 mode: GR_POINTS, GR_LINE_STRIP, GR_POLYGON, GR_TRIANLGE_STRIP, 286 290 GR_TRIANGLE_FAN, GR_TRIANGLES 287 291 288 292 Return: 289 293 Nothing ever … … 331 335 _grDrawVertexList(kSetupFan, GR_VTX_PTR_ARRAY, Count, pointers); 332 336 break; 333 337 334 338 case GR_TRIANGLE_STRIP: 335 339 if (gc->state.grEnableArgs.primitive_smooth_mode) … … 345 349 _grDrawVertexList(kSetupFan, GR_VTX_PTR_ARRAY, Count, pointers); 346 350 break; 347 351 348 352 case GR_TRIANGLES: 349 353 if (gc->state.grEnableArgs.primitive_smooth_mode) … … 352 356 else 353 357 _grAAVpDrawTriangles(GR_VTX_PTR_ARRAY, GR_TRIANGLES, Count, pointers); 354 else 358 else 355 359 _grDrawTriangles(GR_VTX_PTR_ARRAY, Count, pointers); 356 360 break; … … 366 370 Implementor(s): atai 367 371 Description: 368 372 369 373 Arguments: 370 374 mode: GR_POINTS, GR_LINE_STRIP, GR_POLYGON, GR_TRIANLGE_STRIP, 371 375 GR_TRIANGLE_FAN, GR_TRIANGLES 372 376 373 377 Return: 374 378 Nothing ever … … 417 421 _grDrawVertexList(kSetupFan, GR_VTX_PTR, Count, pointers); 418 422 break; 419 423 420 424 case GR_TRIANGLE_STRIP: 421 425 if (gc->state.grEnableArgs.primitive_smooth_mode) … … 431 435 _grDrawVertexList(kSetupFan, GR_VTX_PTR, Count, pointers); 432 436 break; 433 437 434 438 case GR_TRIANGLES: 435 439 if (gc->state.grEnableArgs.primitive_smooth_mode) … … 438 442 else 439 443 _grAAVpDrawTriangles(GR_VTX_PTR, GR_TRIANGLES, Count, pointers); 440 else 444 else 441 445 _grDrawTriangles(GR_VTX_PTR, Count, pointers); 442 446 break; … … 446 450 } /* grDrawVertexArrayLinear */ 447 451 448 #endif /* GLIDE3 */ 452 #endif /* GLIDE3 */ -
trunk/src/opengl/glide/cvg/glide/ditex.c
r2888 r6653 1 /* $Id: ditex.c,v 1.2 2001-09-05 14:30:22 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/ditex.c,v 1. 1 2000-02-25 00:37:35 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/ditex.c,v 1.2 2001-09-05 14:30:22 bird Exp $ 21 22 ** $Log: ditex.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:35 sandervl 23 ** Revision 1.2 2001-09-05 14:30:22 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:35 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 20 6/06/98 12:06p Peter 27 31 ** gmt's trilinear hell bug 28 ** 32 ** 29 33 ** 19 2/20/98 5:31p Peter 30 34 ** crybaby glide 31 ** 35 ** 32 36 ** 18 2/20/98 11:00a Peter 33 37 ** removed glide3 from glid2 tree 34 ** 38 ** 35 39 ** 17 1/30/98 4:31p Peter 36 40 ** general clenaup 37 * 41 * 38 42 * 16 1/13/98 12:42p Atai 39 43 * fixed grtexinfo, grVertexLayout, and draw triangle 40 * 44 * 41 45 * 15 1/09/98 6:48p Atai 42 46 * grTexInfo, GR_LOD_* and GR_ASPECT_* 43 * 47 * 44 48 * 13 12/09/97 12:20p Peter 45 49 * mac glide port 46 * 50 * 47 51 * 12 12/02/97 9:49a Dow 48 52 * Got rid of Texelfx rev 0 warning 49 * 53 * 50 54 * 11 11/20/97 6:58p Dow 51 55 * Marked _grTexTextureMemRequired for movement 52 * 56 * 53 57 * 10 8/18/97 3:52p Peter 54 58 * pre-hw arrival fixes/cleanup 55 * 59 * 56 60 * 9 6/02/97 4:09p Peter 57 61 * Compile w/ gcc for Dural 58 * 62 * 59 63 * 8 5/27/97 1:16p Peter 60 * Basic cvg, w/o cmd fifo stuff. 61 * 64 * Basic cvg, w/o cmd fifo stuff. 65 * 62 66 * 7 5/21/97 6:04a Peter 63 * 67 * 64 68 * 6 3/15/97 8:09p Jdt 65 69 * Remove grTexDownloadTable from this file because I added SST-1 only 66 70 * code to it 67 * 71 * 68 72 * 5 3/09/97 10:31a Dow 69 73 * Added GR_DIENTRY for di glide functions 70 * 74 * 71 75 * 4 2/12/97 2:09p Hanson 72 * Hopefully removed the rest of my muckage. 73 * 76 * Hopefully removed the rest of my muckage. 77 * 74 78 * 3 2/12/97 12:34p Dow 75 79 * Fixed Hanson muckage 76 * 80 * 77 81 * 2 1/18/97 11:41p Dow 78 82 * Fixed Gary's "Last C Bug" analog 79 83 * Fixed usage of _grMipMapOffset_Tsplit 80 * 84 * 81 85 * 1 12/23/96 1:39p Dow 82 86 * Changes for multiplatform … … 103 107 104 108 /* size in texels */ 105 const FxU32 _grMipMapHostSize[4][16] = 109 const FxU32 _grMipMapHostSize[4][16] = 106 110 { 107 111 { /* 1:1 aspect ratio */ … … 153 157 const int _grMipMapHostWH[GR_ASPECT_1x8 + 1][GR_LOD_1 + 1][2] = 154 158 { 155 { 156 { 256 , 32 }, 157 { 128 , 16 }, 158 { 64 , 8 }, 159 { 32 , 4 }, 160 { 16 , 2 }, 161 { 8 , 1 }, 162 { 4 , 1 }, 163 { 2 , 1 }, 159 { 160 { 256 , 32 }, 161 { 128 , 16 }, 162 { 64 , 8 }, 163 { 32 , 4 }, 164 { 16 , 2 }, 165 { 8 , 1 }, 166 { 4 , 1 }, 167 { 2 , 1 }, 164 168 { 1 , 1 } 165 169 }, 166 { 167 { 256 , 64 }, 168 { 128 , 32 }, 169 { 64 , 16 }, 170 { 32 , 8 }, 171 { 16 , 4 }, 170 { 171 { 256 , 64 }, 172 { 128 , 32 }, 173 { 64 , 16 }, 174 { 32 , 8 }, 175 { 16 , 4 }, 172 176 { 8 , 2 }, 173 { 4 , 1 }, 174 { 2 , 1 }, 177 { 4 , 1 }, 178 { 2 , 1 }, 175 179 { 1 , 1 } 176 180 } , 177 { 178 { 256 , 128 }, 179 { 128 , 64 }, 180 { 64 , 32 }, 181 { 182 { 256 , 128 }, 183 { 128 , 64 }, 184 { 64 , 32 }, 181 185 { 32 , 16 }, 182 186 { 16 , 8 }, 183 { 8 , 4 }, 184 { 4 , 2 }, 185 { 2 , 1 }, 187 { 8 , 4 }, 188 { 4 , 2 }, 189 { 2 , 1 }, 186 190 { 1 , 1 } 187 191 }, 188 { 189 { 256 , 256 }, 190 { 128 , 128 }, 192 { 193 { 256 , 256 }, 194 { 128 , 128 }, 191 195 { 64 , 64 }, 192 196 { 32 , 32 }, 193 197 { 16 , 16 }, 194 { 8 , 8 }, 195 { 4 , 4 }, 196 { 2 , 2 }, 198 { 8 , 8 }, 199 { 4 , 4 }, 200 { 2 , 2 }, 197 201 { 1 , 1 } 198 202 }, 199 { 203 { 200 204 { 128, 256 }, 201 205 { 64, 128 }, 202 206 { 32, 64 }, 203 207 { 16, 32 }, 204 { 8, 16 }, 205 { 4, 8 }, 206 { 2, 4 }, 207 { 1, 2 }, 208 { 8, 16 }, 209 { 4, 8 }, 210 { 2, 4 }, 211 { 1, 2 }, 208 212 { 1, 1 } 209 213 }, … … 214 218 { 8, 32 }, 215 219 { 4, 16 }, 216 { 2, 8 }, 217 { 1, 4 }, 218 { 1, 2 }, 220 { 2, 8 }, 221 { 1, 4 }, 222 { 1, 2 }, 219 223 { 1, 1 } 220 224 }, 221 { 225 { 222 226 { 32, 256 }, 223 227 { 16, 128 }, … … 225 229 { 4, 32 }, 226 230 { 2, 16 }, 227 { 1, 8 }, 228 { 1, 4 }, 231 { 1, 8 }, 232 { 1, 4 }, 229 233 { 1, 2 }, 230 234 { 1, 1 } … … 244 248 }; 245 249 246 const FxU32 _gr_evenOdd_xlate_table[] = 250 const FxU32 _gr_evenOdd_xlate_table[] = 247 251 { 248 252 0xFFFFFFFF, /* invalid */ … … 333 337 */ 334 338 FxU32 335 _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 339 _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 336 340 GrAspectRatio_t aspect, GrTextureFormat_t format, 337 341 FxU32 evenOdd ) … … 341 345 GR_CHECK_W("_grTexTextureMemRequired", small_lod < large_lod, 342 346 "small_lod bigger than large_lod" ); 343 GR_CHECK_F( "_grTexTextureMemRequired", evenOdd > GR_MIPMAPLEVELMASK_BOTH || evenOdd == 0, 347 GR_CHECK_F( "_grTexTextureMemRequired", evenOdd > GR_MIPMAPLEVELMASK_BOTH || evenOdd == 0, 344 348 "invalid evenOdd mask" ); 345 349 … … 404 408 sum_of_lod_sizes = _grMipMapOffset_Tsplit[aspect][large_lod]; 405 409 } 406 410 407 411 if ( format >= GR_TEXFMT_16BIT ) sum_of_lod_sizes <<= 1; 408 412 … … 414 418 */ 415 419 GR_DIENTRY(grTexCalcMemRequired, FxU32, 416 ( GrLOD_t small_lod, GrLOD_t large_lod, 420 ( GrLOD_t small_lod, GrLOD_t large_lod, 417 421 GrAspectRatio_t aspect, GrTextureFormat_t format )) 418 422 { 419 const FxU32 memrequired = _grTexTextureMemRequired(small_lod, large_lod, 423 const FxU32 memrequired = _grTexTextureMemRequired(small_lod, large_lod, 420 424 aspect, format, 421 425 GR_MIPMAPLEVELMASK_BOTH ); … … 439 443 FxU32 dmax = ( FxU32 ) ( detail_max * _GlideRoot.pool.f255 ); 440 444 FxU32 dscale = detail_scale; 441 445 442 446 GR_BEGIN_NOFIFOCHECK("grTexDetailControl",88); 443 447 GDBG_INFO_MORE(gc->myLevel,"(%d,%d,%g)\n",tmu,detail_scale,detail_max); … … 450 454 tDetail |= ( ( dmax << SST_DETAIL_MAX_SHIFT ) & SST_DETAIL_MAX ); 451 455 tDetail |= ( ( dscale << SST_DETAIL_SCALE_SHIFT ) & SST_DETAIL_SCALE ); 452 456 453 457 /* MULTIPLAT */ 454 458 _grTexDetailControl( tmu, tDetail ); … … 498 502 Library: glide 499 503 Description: 500 Returns the tmu memory required to store the specified mipmap 501 ( Gary and I don't like the name of this function, but are 502 a little backed into a corner because of the existence 504 Returns the tmu memory required to store the specified mipmap 505 ( Gary and I don't like the name of this function, but are 506 a little backed into a corner because of the existence 503 507 of grTexMemRequired() which does not imply any distinction 504 508 between texture memory and system ram ) … … 506 510 evenOdd - which set of mipmap levels are to be stored 507 511 One of: 508 GR_MIPMAPLEVELMASK_EVEN 512 GR_MIPMAPLEVELMASK_EVEN 509 513 GR_MIPMAPLEVELMASK_ODD 510 514 GR_MIPMAPLEVELMASK_BOTH … … 512 516 of texture 513 517 Return: 514 offset to be added to current texture base address to calculate next 518 offset to be added to current texture base address to calculate next 515 519 valid texture memory download location 516 520 -------------------------------------------------------------------*/ … … 526 530 info->format, 527 531 evenOdd ); 528 532 529 533 GDBG_INFO(88,"grTexTextureMemRequired(%d,0x%x) => 0x%x(%d)\n", 530 534 evenOdd,info,memrequired,memrequired); … … 555 559 none 556 560 -------------------------------------------------------------------*/ 557 GR_DIENTRY(grTexDownloadMipMap, void, 561 GR_DIENTRY(grTexDownloadMipMap, void, 558 562 ( GrChipID_t tmu, FxU32 startAddress, FxU32 559 563 evenOdd, GrTexInfo *info )) … … 568 572 GDBG_INFO(89,"grTexDownloadMipMap(%d,0x%x,%d,0x%x\n",tmu,startAddress,evenOdd,info); 569 573 GR_CHECK_TMU( "grTexDownloadMipMap", tmu ); 570 GR_CHECK_COMPATABILITY("grTexDownloadMipMap", 574 GR_CHECK_COMPATABILITY("grTexDownloadMipMap", 571 575 startAddress + size > gc->tmu_state[tmu].total_mem, 572 576 "insufficient texture ram at startAddress" ); 573 577 GR_CHECK_F( "grTexDownloadMipMap", evenOdd > 0x3, "evenOdd mask invalid" ); 574 578 GR_CHECK_F( "grTexDownloadMipMap", !info, "info invalid" ); 575 579 576 580 if ((startAddress < 0x200000) && (startAddress + size > 0x200000)) { 577 581 GR_CHECK_COMPATABILITY("grTexDownloadMipMap", … … 582 586 583 587 src_base = (char *)info->data; 584 588 585 589 /*--------------------------------------------------------------- 586 590 Download one mipmap level at a time 587 591 ---------------------------------------------------------------*/ 588 592 for(lod = info->largeLod; lod <= info->smallLod; lod++ ) { 589 grTexDownloadMipMapLevel( tmu, 590 startAddress, 593 grTexDownloadMipMapLevel( tmu, 594 startAddress, 591 595 lod, 592 596 info->largeLod, … … 595 599 evenOdd, 596 600 src_base ); 597 598 src_base += (_grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod] << 601 602 src_base += (_grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod] << 599 603 (info->format >= GR_TEXFMT_16BIT)); 600 604 } … … 621 625 -------------------------------------------------------------------*/ 622 626 GR_DIENTRY(grTexDownloadTablePartial, void, 623 ( GrChipID_t tmu, GrTexTable_t type, 627 ( GrChipID_t tmu, GrTexTable_t type, 624 628 void *data, int start, int end )) 625 629 { … … 636 640 _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end ); 637 641 /* Removed redundant call 638 * _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end ); 642 * _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end ); 639 643 */ 640 644 } … … 646 650 ** grTexDownloadMipMapLevel 647 651 */ 648 GR_DIENTRY(grTexDownloadMipMapLevel, void, 652 GR_DIENTRY(grTexDownloadMipMapLevel, void, 649 653 ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, 650 654 GrLOD_t largeLod, GrAspectRatio_t aspectRatio, 651 GrTextureFormat_t format, FxU32 evenOdd, void *data )) 655 GrTextureFormat_t format, FxU32 evenOdd, void *data )) 652 656 { 653 657 GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevel",89); … … 657 661 /* 658 662 ** note for glide3 lod translation: 659 ** we are calling gr* routine so the lod data should remain the same 663 ** we are calling gr* routine so the lod data should remain the same 660 664 */ 661 665 grTexDownloadMipMapLevelPartial( tmu, startAddress, 662 thisLod, largeLod, 666 thisLod, largeLod, 663 667 aspectRatio, format, 664 668 evenOdd, data, -
trunk/src/opengl/glide/cvg/glide/fifo.c
r2888 r6653 1 /* $Id: fifo.c,v 1.2 2001-09-05 14:30:22 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/fifo.c,v 1. 1 2000-02-25 00:37:36 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/fifo.c,v 1.2 2001-09-05 14:30:22 bird Exp $ 21 22 ** $Log: fifo.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:36 sandervl 23 ** Revision 1.2 2001-09-05 14:30:22 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:36 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 22 3/14/98 1:07p Peter 27 31 ** mac port happiness 28 ** 32 ** 29 33 ** 21 2/20/98 9:05a Peter 30 34 ** removed remnants of comdex grot 31 ** 35 ** 32 36 ** 20 2/11/98 5:22p Peter 33 37 ** added fifo get stuff for hanson 34 ** 38 ** 35 39 ** 19 2/01/98 7:44p Peter 36 40 ** parameter dumping level 37 * 41 * 38 42 * 18 12/17/97 4:45p Peter 39 43 * groundwork for CrybabyGlide 40 * 44 * 41 45 * 17 12/09/97 12:20p Peter 42 46 * mac glide port 43 * 47 * 44 48 * 16 12/09/97 10:28a Peter 45 49 * cleaned up some frofanity 46 * 50 * 47 51 * 15 12/05/97 4:26p Peter 48 52 * watcom warnings 49 * 53 * 50 54 * 14 12/03/97 11:34a Peter 51 55 * dos debugging 52 * 56 * 53 57 * 13 11/21/97 3:53p Peter 54 58 * reset messages are controlled by gdbg_level 55 * 59 * 56 60 * 12 11/19/97 6:04p Peter 57 61 * actually exit if not reset 58 * 62 * 59 63 * 11 11/18/97 4:36p Peter 60 64 * chipfield stuff cleanup and w/ direct writes 61 * 65 * 62 66 * 10 11/17/97 4:55p Peter 63 67 * watcom warnings/chipfield stuff 64 * 68 * 65 69 * 9 11/15/97 9:20p Peter 66 70 * I am the sorriest f*cker on the face of the planet 67 * 71 * 68 72 ** 69 73 */ … … 344 348 "reserved0FD", /* 0xfd */ 345 349 "reserved0FE", /* 0xfe */ 346 "reserved0FF", /* 0xff */ 350 "reserved0FF", /* 0xff */ 347 351 }; 348 352 … … 356 360 357 361 GDBG_INFO(gc->myLevel + 199, "Storing to FIFO:\n"); 358 GDBG_INFO(gc->myLevel + 199, " FIFO Ptr: 0x%x : 0x%X\n", fifoPtr, gc->cmdTransportInfo.fifoRoom); 359 if (index <= 0xff) { 362 GDBG_INFO(gc->myLevel + 199, " FIFO Ptr: 0x%x : 0x%X\n", fifoPtr, gc->cmdTransportInfo.fifoRoom); 363 if (index <= 0xff) { 360 364 GDBG_INFO(gc->myLevel + 199, " Reg Name: %s\n", cvgRegNames[index]); 361 365 GDBG_INFO(gc->myLevel + 199, " Reg Num: 0x%X\n", index); … … 363 367 const char* strP; 364 368 const FxU32 offset = (addr - (FxU32)gc->reg_ptr); 365 369 366 370 if (offset >= HW_TEXTURE_OFFSET) { 367 371 strP = "Texture"; … … 380 384 381 385 GDBG_INFO(120, " SET(0x%X, %ld(0x%X)) 0 %s (0x%X)\n", 382 0x10000000UL + (FxU32)(index << 2), val, val, 386 0x10000000UL + (FxU32)(index << 2), val, val, 383 387 cvgRegNames[index & 0xFF], fifoPtr); 384 388 } /* _grFifoWriteDebug */ … … 398 402 GDBG_INFO(gc->myLevel + 200, " Value: %4.2f\n", val); 399 403 400 GDBG_INFO(120, " SET(0x%X, %4.2f (0x%X)) 0 %s\n", 401 0x10000000UL + (FxU32)(index << 2), val, *(const FxU32*)&val, 404 GDBG_INFO(120, " SET(0x%X, %4.2f (0x%X)) 0 %s\n", 405 0x10000000UL + (FxU32)(index << 2), val, *(const FxU32*)&val, 402 406 cvgRegNames[index & 0xFF]); 403 407 } /* _grFifoFWriteDebug */ … … 410 414 /* Dump Packet Header */ 411 415 GDBG_INFO(gc->myLevel + 200, "CMD Fifo Triangle Packet (0x%X)\n", hdrVal); 412 GDBG_INFO(gc->myLevel + 200, " # Vertex: 0x%X\n", 416 GDBG_INFO(gc->myLevel + 200, " # Vertex: 0x%X\n", 413 417 (hdrVal & SSTCP_PKT3_NUMVERTEX) >> SSTCP_PKT3_NUMVERTEX_SHIFT); 414 418 GDBG_INFO(gc->myLevel + 200, " RGB: %s\n", … … 426 430 GDBG_INFO(gc->myLevel + 200, " PingPongSign: %s\n", 427 431 (((hdrVal & (0x01 << 25)) == 0) ? "Normal" : "Disable")); 428 432 429 433 if (GDBG_GET_DEBUGLEVEL(gc->myLevel + 200)) { 430 434 const FxU32 temp = (hdrVal & SSTCP_PKT3_PMASK); … … 435 439 for(i = 10; i <= 17; i++) { 436 440 static const char* paramSel[] = { "RGB", "Alpha", "Z", "Wb", "W0", "ST[0]", "W1", "ST[1]" }; 437 441 438 442 if ((temp & (0x01UL << i)) != 0) GDBG_PRINTF("%s ", paramSel[i - 10]); 439 443 } … … 470 474 if (!inProcP) { 471 475 static char errMsgBuf[1024]; 472 476 473 477 inProcP = FXTRUE; 474 478 { … … 508 512 _grGet32(volatile FxU32* const sstAddr) 509 513 { 510 return GR_GET(*sstAddr); 514 return GR_GET(*sstAddr); 511 515 } 512 516 … … 528 532 529 533 /* Update the roomToXXX values w/ the # of writes since the last 530 * fifo stall/wrap. 534 * fifo stall/wrap. 531 535 */ 532 536 { 533 537 const FxI32 writes = (MIN(gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd) - 534 538 gc->cmdTransportInfo.fifoRoom); 535 539 536 540 gc->cmdTransportInfo.roomToReadPtr -= writes; 537 541 gc->cmdTransportInfo.roomToEnd -= writes; … … 544 548 ((fName == NULL) ? "Unknown" : fName), fLine, 545 549 (FxU32)gc->cmdTransportInfo.fifoPtr, blockSize, 546 gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 550 gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 547 551 gc->cmdTransportInfo.fifoRoom, writes, 548 552 HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead); … … 553 557 554 558 GDBG_INFO_MORE(gc->myLevel, "\tsli: 0x%X : (0x%X : 0x%X : 0x%X)\n", 555 HW_FIFO_PTR(FXFALSE), 556 GR_GET(slaveHw->cmdFifoDepth), 557 GR_GET(slaveHw->cmdFifoHoles), 559 HW_FIFO_PTR(FXFALSE), 560 GR_GET(slaveHw->cmdFifoDepth), 561 GR_GET(slaveHw->cmdFifoHoles), 558 562 GR_GET(slaveHw->status)); 559 563 } … … 561 565 #endif /* GDBG_INFO_ON */ 562 566 563 ASSERT_FAULT_IMMED((gc->cmdTransportInfo.roomToReadPtr >= 0) && 567 ASSERT_FAULT_IMMED((gc->cmdTransportInfo.roomToReadPtr >= 0) && 564 568 (gc->cmdTransportInfo.roomToEnd >= 0)); 565 569 } … … 597 601 /* Is the slave closer than the master? */ 598 602 if (distSlave < distMaster) { 599 #if GDBG_INFO_ON 603 #if GDBG_INFO_ON 600 604 { 601 SstRegs* slaveHw = (SstRegs*)gc->slave_ptr; 605 SstRegs* slaveHw = (SstRegs*)gc->slave_ptr; 602 606 GDBG_INFO(gc->myLevel, " Wait sli: 0x%X : (0x%X : 0x%X : 0x%X)\n" 603 607 "\tMaster: 0x%X : 0x%X\n" 604 608 "\tSlave : 0x%X : 0x%X\n", 605 HW_FIFO_PTR(FXFALSE), 606 GR_GET(slaveHw->cmdFifoDepth), 607 GR_GET(slaveHw->cmdFifoHoles), 609 HW_FIFO_PTR(FXFALSE), 610 GR_GET(slaveHw->cmdFifoDepth), 611 GR_GET(slaveHw->cmdFifoHoles), 608 612 GR_GET(slaveHw->status), 609 613 curReadPtr, curReadDist, … … 636 640 gc->cmdTransportInfo.roomToReadPtr = roomToReadPtr; 637 641 638 GDBG_INFO(gc->myLevel, " Wait: (0x%X : 0x%X) : 0x%X\n", 642 GDBG_INFO(gc->myLevel, " Wait: (0x%X : 0x%X) : 0x%X\n", 639 643 gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 640 644 gc->cmdTransportInfo.fifoRead); 641 645 } 642 646 643 647 /* Do we need to wrap to front? */ 644 648 if (gc->cmdTransportInfo.roomToEnd <= blockSize) { 645 GDBG_INFO(gc->myLevel + 10, " Pre-Wrap: (0x%X : 0x%X) : 0x%X\n", 649 GDBG_INFO(gc->myLevel + 10, " Pre-Wrap: (0x%X : 0x%X) : 0x%X\n", 646 650 gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 647 651 gc->cmdTransportInfo.fifoRead); 648 652 649 /* Set the jsr packet. 653 /* Set the jsr packet. 650 654 * NB: This command must be fenced. 651 655 */ … … 656 660 } 657 661 FIFO_ASSERT(); 658 662 659 663 wrapAddr = (FxU32)gc->cmdTransportInfo.fifoPtr; 660 664 … … 668 672 #endif 669 673 670 /* Reset fifo ptr to start */ 674 /* Reset fifo ptr to start */ 671 675 gc->cmdTransportInfo.fifoPtr = gc->cmdTransportInfo.fifoStart; 672 676 … … 675 679 FxU32* fifoPtr = gc->cmdTransportInfo.fifoShadowPtr; 676 680 677 while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2)) 681 while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2)) 678 682 *fifoPtr++ = 0x00UL; 679 683 gc->cmdTransportInfo.fifoShadowPtr = gc->cmdTransportInfo.fifoShadowBase; … … 681 685 #endif /* GLIDE_USE_SHADOW_FIFO */ 682 686 683 GDBG_INFO(gc->myLevel + 10, " Post-Wrap: (0x%X : 0x%X) : 0x%X\n", 687 GDBG_INFO(gc->myLevel + 10, " Post-Wrap: (0x%X : 0x%X) : 0x%X\n", 684 688 gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 685 689 gc->cmdTransportInfo.fifoRead); … … 687 691 goto again; 688 692 } 689 693 690 694 /* compute room left */ 691 695 gc->cmdTransportInfo.fifoRoom = MIN(gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd); 692 696 693 #if GDBG_INFO_ON 697 #if GDBG_INFO_ON 694 698 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 695 699 GDBG_INFO(gc->myLevel, FN_NAME"_Done:\n" … … 698 702 "\tfifo hw: (0x%X : 0x%X) : (0x%X : 0x%X : 0x%X)\n", 699 703 (FxU32)gc->cmdTransportInfo.fifoPtr, blockSize, 700 gc->cmdTransportInfo.roomToReadPtr, 704 gc->cmdTransportInfo.roomToReadPtr, 701 705 gc->cmdTransportInfo.roomToEnd, gc->cmdTransportInfo.fifoRoom, 702 HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead, 706 HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead, 703 707 GR_GET(hw->cmdFifoDepth), GR_GET(hw->cmdFifoHoles), GR_GET(hw->status)); 704 708 #endif … … 707 711 if (gc->scanline_interleaved) { 708 712 SstRegs* slaveHw = (SstRegs*)gc->slave_ptr; 709 713 710 714 GDBG_INFO_MORE(gc->myLevel, "\tsli: 0x%X : (0x%X : 0x%X : 0x%X)\n", 711 HW_FIFO_PTR(FXFALSE), 712 GR_GET(slaveHw->cmdFifoDepth), 713 GR_GET(slaveHw->cmdFifoHoles), 715 HW_FIFO_PTR(FXFALSE), 716 GR_GET(slaveHw->cmdFifoDepth), 717 GR_GET(slaveHw->cmdFifoHoles), 714 718 GR_GET(slaveHw->status)); 715 719 } 716 720 #endif /* !GLIDE_INIT_HAL */ 717 721 #endif /* GDBG_INFO_ON */ 718 722 719 723 FIFO_ASSERT(); 720 724 GR_TRACE_EXIT(FN_NAME); -
trunk/src/opengl/glide/cvg/glide/fxbldno.c
r2888 r6653 1 /* $Id: fxbldno.c,v 1.2 2001-09-05 14:30:22 bird Exp $ */ 1 2 /* 2 3 * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 * FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 * 10 * FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 * 11 12 * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 * THE UNITED STATES. 17 * 17 * THE UNITED STATES. 18 * 18 19 * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 * 20 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/fxbldno.c,v 1. 1 2000-02-25 00:37:36 sandervlExp $21 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/fxbldno.c,v 1.2 2001-09-05 14:30:22 bird Exp $ 21 22 * $Log: fxbldno.c,v $ 22 * Revision 1.1 2000-02-25 00:37:36 sandervl 23 * Revision 1.2 2001-09-05 14:30:22 bird 24 * Added $Id:$ keyword. 25 * 26 * Revision 1.1 2000/02/25 00:37:36 sandervl 23 27 * Created Voodoo 2 dir 24 28 * 25 * 29 * 26 30 * 1 7/25/97 9:05a Pgj 27 31 * generate fxbldno.h which defines BUILD_NUMBER … … 35 39 main(int argc, char **argv) 36 40 { 37 struct tm 38 time_t 39 char 41 struct tm locTime; 42 time_t sysTime; 43 char *build; 40 44 41 45 time(&sysTime); … … 43 47 44 48 if (build = getenv("BUILD_NUMBER")) { 45 printf("#define BUILD_NUMBER%s\n", build);49 printf("#define BUILD_NUMBER %s\n", build); 46 50 } else { 47 48 49 50 51 printf("#define BUILD_NUMBER%d\n", magic);51 unsigned short magic; 52 magic = (locTime.tm_yday << 7) | 53 (locTime.tm_hour << 2) | 54 (locTime.tm_min / 15); 55 printf("#define BUILD_NUMBER %d\n", magic); 52 56 } 53 57 return 0; -
trunk/src/opengl/glide/cvg/glide/fxgasm.c
r2888 r6653 1 /* $Id: fxgasm.c,v 1.2 2001-09-05 14:30:23 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Revision: 1. 1$21 ** $Date: 200 0-02-25 00:37:36$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:30:23 $ 22 23 */ 23 24 … … 62 63 #define NEWLINE printf("\n"); 63 64 #define COMMENT printf("#----------------------------------------------------------------------\n") 64 65 65 66 #define HEADER(str) NEWLINE; COMMENT; \ 66 67 printf("# Assembler offsets for %s struct\n",str);\ … … 113 114 offsetof(struct GrGC_s, cmdTransportInfo.triSetupProc)); 114 115 #endif /* GLIDE_DISPATCH_SETUP */ 115 116 116 117 printf("/* The # of 2-byte entries in the hw fog table */\n"); 117 118 printf("#define kInternalFogTableEntryCount 0x%XUL\n", -
trunk/src/opengl/glide/cvg/glide/g3df.c
r2888 r6653 1 /* $Id: g3df.c,v 1.2 2001-09-05 14:30:23 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/g3df.c,v 1. 1 2000-02-25 00:37:37 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/g3df.c,v 1.2 2001-09-05 14:30:23 bird Exp $ 21 22 ** $Log: g3df.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:37 sandervl 23 ** Revision 1.2 2001-09-05 14:30:23 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:37 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 17 2/20/98 11:00a Peter 27 31 ** removed glide3 from glid2 tree 28 * 32 * 29 33 * 16 1/13/98 7:48p Atai 30 34 * fixed gu3dfGetInfo, grBufferClear, and GrState size 31 * 35 * 32 36 * 15 1/13/98 12:42p Atai 33 37 * fixed grtexinfo, grVertexLayout, and draw triangle 34 * 38 * 35 39 * 14 1/09/98 6:48p Atai 36 40 * grTexInfo, GR_LOD_* and GR_ASPECT_* 37 * 41 * 38 42 * 12 12/17/97 4:45p Peter 39 43 * groundwork for CrybabyGlide 40 * 44 * 41 45 * 11 12/09/97 12:20p Peter 42 46 * mac glide port 43 * 47 * 44 48 * 10 6/06/97 5:56p Peter 45 49 * fixed gcc/dural compilation things 46 * 50 * 47 51 * 9 6/02/97 4:09p Peter 48 52 * Compile w/ gcc for Dural 49 * 53 * 50 54 * 8 5/27/97 1:16p Peter 51 * Basic cvg, w/o cmd fifo stuff. 52 * 55 * Basic cvg, w/o cmd fifo stuff. 56 * 53 57 * 7 5/21/97 6:05a Peter 54 * 58 * 55 59 * 6 3/09/97 10:31a Dow 56 60 * Added GR_DIENTRY for di glide functions … … 93 97 94 98 95 static FxBool 99 static FxBool 96 100 _grGet3dfHeader(FILE* stream, char* const buffer, const FxU32 bufSize) 97 101 { 98 102 int numLines = 0; 99 103 FxU32 bufPos = 0; 100 104 101 105 while(numLines < 4) { 102 106 /* Handle stream errors */ 103 107 if (fgets(buffer + bufPos, bufSize - bufPos, stream) == NULL) break; 104 108 bufPos += strlen(buffer + bufPos); 105 109 106 110 /* fgets includes the '\n' in the buffer. If this is not there 107 111 * then the buffer is too small so fail. … … 143 147 GR_ASPECT_8x1 144 148 }; 145 CfTableEntry cftable[] = 149 CfTableEntry cftable[] = 146 150 { 147 151 { "I8", GR_TEXFMT_INTENSITY_8, FXTRUE }, … … 398 402 packedvalue |= ((FxU32) info->table.nccTable.yRGB[index*4+2]) << 16; 399 403 packedvalue |= ((FxU32) info->table.nccTable.yRGB[index*4+3]) << 24; 400 404 401 405 info->table.nccTable.packed_data[index] = packedvalue; 402 406 } … … 450 454 case GR_TEXFMT_RGB_332: 451 455 case GR_TEXFMT_P_8: 452 Read8Bit(info->data, image_file, 453 info->header.small_lod, 454 info->header.large_lod, 456 Read8Bit(info->data, image_file, 457 info->header.small_lod, 458 info->header.large_lod, 455 459 info->header.aspect_ratio); 456 460 break; … … 463 467 case GR_TEXFMT_ALPHA_INTENSITY_88: 464 468 case GR_TEXFMT_AP_88: 465 Read16Bit(info->data, image_file, 469 Read16Bit(info->data, image_file, 466 470 info->header.small_lod, 467 471 info->header.large_lod, … … 486 490 ** Read in an 8-bit texture map, unpacked. 487 491 */ 488 static void 489 Read8Bit(FxU8 *data, FILE *image_file, 490 int small_lod, int large_lod, 492 static void 493 Read8Bit(FxU8 *data, FILE *image_file, 494 int small_lod, int large_lod, 491 495 GrAspectRatio_t aspect_ratio) 492 496 { … … 508 512 ** Read in a 16-bit texture map, unpacked. 509 513 */ 510 static void Read16Bit(FxU16 *data, FILE *image_file, 511 int small_lod, int large_lod, 514 static void Read16Bit(FxU16 *data, FILE *image_file, 515 int small_lod, int large_lod, 512 516 GrAspectRatio_t aspect_ratio) 513 517 { … … 534 538 FxU16 b1 = (FxU16)getc(fp); 535 539 FxU16 b2 = (FxU16)getc(fp); 536 540 537 541 #define kShiftB1 8 538 542 #define kShiftB2 0 -
trunk/src/opengl/glide/cvg/glide/gaa.c
r2888 r6653 1 /* $Id: gaa.c,v 1.2 2001-09-05 14:30:23 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gaa.c,v 1. 1 2000-02-25 00:37:37 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gaa.c,v 1.2 2001-09-05 14:30:23 bird Exp $ 21 22 ** $Log: gaa.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:37 sandervl 23 ** Revision 1.2 2001-09-05 14:30:23 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:37 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 64 5/18/98 12:15p Peter 27 31 ** crybaby check for alpha enable 28 ** 32 ** 29 33 ** 63 4/22/98 6:18p Jdt 30 34 ** Optimized AA Lines. 31 ** 35 ** 32 36 ** 62 2/20/98 11:00a Peter 33 37 ** removed glide3 from glid2 tree 34 * 38 * 35 39 * 61 1/15/98 2:46p Atai 36 40 * fixed grDrawPoint and grDrawLine in aa mode 37 * 41 * 38 42 * 60 12/17/97 4:45p Peter 39 43 * groundwork for CrybabyGlide 40 * 44 * 41 45 * 59 12/12/97 12:43p Atai 42 46 * move i and dateElem into the set up loop 43 * 47 * 44 48 * 57 12/08/97 10:40a Atai 45 49 * modify draw vertex primitive routines to do grDrawVertexArrayLinear() 46 * 50 * 47 51 * 56 12/05/97 4:26p Peter 48 52 * watcom warnings 49 * 53 * 50 54 * 55 11/24/97 4:40p Peter 51 55 * aa prims vs packing 52 * 56 * 53 57 * 54 11/21/97 6:05p Atai 54 58 * use one datalist (tsuDataList) in glide3 55 * 59 * 56 60 * 53 11/21/97 3:20p Peter 57 61 * direct writes tsu registers 58 * 62 * 59 63 * 52 11/18/97 6:11p Peter 60 64 * fixed glide3 muckage 61 * 65 * 62 66 * 51 11/18/97 4:36p Peter 63 67 * chipfield stuff cleanup and w/ direct writes 64 * 68 * 65 69 * 50 11/18/97 3:26p Atai 66 * update vData 70 * update vData 67 71 * optimize state monster 68 * 72 * 69 73 * 49 11/17/97 4:55p Peter 70 74 * watcom warnings/chipfield stuff 71 * 75 * 72 76 * 48 11/06/97 6:10p Atai 73 77 * update GrState size 74 78 * rename grDrawArray to grDrawVertexArray 75 79 * update _grDrawPoint and _grDrawVertexList 76 * 80 * 77 81 * 47 11/04/97 6:35p Atai 78 82 * 1. sync with data structure changes 79 83 * 2. break up aa triangle routine 80 * 84 * 81 85 * 46 11/04/97 5:04p Peter 82 86 * cataclysm part deux 83 * 87 * 84 88 * 45 11/04/97 4:57p Atai 85 89 * use byte offset 86 * 90 * 87 91 * 44 11/03/97 3:43p Peter 88 92 * h3/cvg cataclysm 89 * 93 * 90 94 * 43 11/03/97 3:19p Atai 91 95 * optimization 92 * 96 * 93 97 * 42 10/29/97 2:45p Peter 94 98 * C version of Taco's packing code 95 * 99 * 96 100 * 41 10/29/97 2:24p Atai 97 101 * re-work aa draw routines to increase sbench number 98 * 102 * 99 103 * 40 10/21/97 8:38p Atai 100 104 * added lines routine for grDrawArray 101 * 105 * 102 106 * 39 10/21/97 3:22p Peter 103 107 * hand pack rgb 104 * 108 * 105 109 * 38 10/19/97 12:51p Peter 106 110 * no tsu happiness 107 * 111 * 108 112 * 37 10/17/97 3:15p Peter 109 113 * removed unused addr field from datalist 110 * 114 * 111 115 * 36 10/17/97 10:15a Peter 112 116 * packed rgb state cleanup 113 * 117 * 114 118 * 35 10/16/97 5:33p Peter 115 119 * argb != rgba 116 * 120 * 117 121 * 34 10/16/97 3:40p Peter 118 122 * packed rgb 119 * 123 * 120 124 * 33 10/16/97 1:50p Atai 121 125 * fix drawarray bugs 122 * 126 * 123 127 * 32 10/14/97 7:33p Atai 124 128 * fix compiler error 125 * 129 * 126 130 * 31 10/14/97 5:40p Atai 127 131 * added grculltest 128 * 132 * 129 133 * 30 10/14/97 4:36p Atai 130 134 * added aa points, strip line and trianlges for drawarray 131 * 135 * 132 136 * 29 10/09/97 8:02p Dow 133 137 * State Monster 1st Cut 134 * 138 * 135 139 * 28 10/08/97 5:19p Peter 136 140 * optinally clamp only texture params 137 * 141 * 138 142 * 27 10/08/97 11:32a Peter 139 143 * pre-computed packet headers for packet 3 140 * 144 * 141 145 * 26 9/20/97 4:42p Peter 142 146 * tri_setf fixup/big fifo 143 * 147 * 144 148 * 25 9/16/97 2:49p Peter 145 149 * fixed watcom unhappiness w/ static initializers 146 * 150 * 147 151 * 24 9/15/97 7:31p Peter 148 152 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 149 153 * place, lfb's are on, Hmmmm.. probably more 150 * 154 * 151 155 * 23 9/10/97 10:13p Peter 152 156 * fifo logic from GaryT, non-normalized fp first cut 153 * 157 * 154 158 * 22 8/30/97 5:58p Tarolli 155 159 * cleanups 156 * 160 * 157 161 * 21 7/29/97 4:31p Atai 158 162 * replace old edge sense routine 159 * 163 * 160 164 * 19 7/28/97 2:42p Peter 161 165 * aa points? 162 * 166 * 163 167 * 18 7/26/97 3:04p Peter 164 168 * cleanup 165 * 169 * 166 170 * 17 7/25/97 11:40a Peter 167 171 * removed dHalf, change field name to match real use for cvg 168 * 172 * 169 173 * 16 6/30/97 3:21p Peter 170 174 * more aa through cmd fifo 171 * 175 * 172 176 * 15 6/20/97 1:17p Peter 173 177 * changes for new CVG_TRI macros … … 200 204 ** w = h = 2pixels 201 205 */ 202 GR_ENTRY(grAADrawPoint, void, (const GrVertex *e)) 206 GR_ENTRY(grAADrawPoint, void, (const GrVertex *e)) 203 207 { 204 208 #define FN_NAME "grAADrawPoint" 205 209 GR_DCL_GC; 206 210 GrCullMode_t cullSave; 207 211 208 212 #if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP 209 213 const FxU32 vertexParamOffset = _GlideRoot.curVertexSize; … … 223 227 /* We draw this as a 4 triangle fan centered around E. */ 224 228 GR_SET_EXPECTED_SIZE(vertexParamOffset * 6, 1); 225 TRI_STRIP_BEGIN(kSetupFan, 226 0x06UL, vertexParamOffset, 229 TRI_STRIP_BEGIN(kSetupFan, 230 0x06UL, vertexParamOffset, 227 231 SSTCP_PKT3_BDDDDD); 228 232 … … 242 246 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 243 247 FxU32 packedColor = 0x00; 244 248 245 249 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 246 250 packedColor = (RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_B_OFFSET << 2)), B) | 247 251 RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_G_OFFSET << 2)), G) | 248 252 RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_R_OFFSET << 2)), R)); 249 253 250 254 dataList++; 251 255 } 252 256 253 257 packedColor |= RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_A_OFFSET << 2)), A); 254 258 TRI_SET(packedColor); … … 267 271 dataList++; 268 272 #endif /* GLIDE_FP_CLAMP_TEX */ 269 273 270 274 while(*dataList != 0) { 271 275 TRI_SETF_CLAMP(FARRAY(fp, *dataList)); … … 283 287 static const float xAdjust[] = { 1.0f, -1.0f, -1.0f, 1.0f, 1.0f }; 284 288 static const float yAdjust[] = { -1.0f, -1.0f, 1.0f, 1.0f, -1.0f }; 285 289 286 290 ASSERT(ArraySize(xAdjust) == ArraySize(yAdjust)); 287 291 288 292 for(v = 0; v < ArraySize(xAdjust); v++) { 289 293 TRI_SETF(ptX + xAdjust[v]); 290 294 TRI_SETF(ptY + yAdjust[v]); 291 295 292 296 { 293 297 const int* dataList = gc->tsuDataList; … … 296 300 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 297 301 FxU32 packedColor = 0x00; 298 302 299 303 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 300 304 packedColor = (RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_B_OFFSET << 2)), B) | 301 305 RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_G_OFFSET << 2)), G) | 302 306 RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_R_OFFSET << 2)), R)); 303 307 304 308 dataList++; 305 309 } 306 310 307 311 TRI_SET(packedColor); 308 312 } else { … … 319 323 dataList++; 320 324 } 321 325 322 326 /* Send constant Alpha == 0.0f */ 323 327 TRI_SETF(0.0f); … … 335 339 dataList++; 336 340 #endif /* GLIDE_FP_CLAMP_TEX */ 337 341 338 342 /* Anything else in the dataList */ 339 while(*dataList != 0) { 343 while(*dataList != 0) { 340 344 TRI_SETF_CLAMP(FARRAY(fp, *dataList)); 341 345 dataList++; … … 345 349 } 346 350 } 347 351 348 352 TRI_END; 349 353 GR_CHECK_SIZE(); 350 354 #else 351 355 { 352 GrVertex a, b; 356 GrVertex a, b; 353 357 354 358 /* 355 359 ** make corners of a square 356 360 */ 357 a = 361 a = 358 362 b = *e; 359 363 360 364 a.tmuvtx[0].oow = 361 365 b.tmuvtx[0].oow = _GlideRoot.pool.f1; 362 366 363 367 a.x -= _GlideRoot.pool.f1; 364 368 a.y -= _GlideRoot.pool.f1; … … 367 371 b.y -= _GlideRoot.pool.f1; 368 372 369 a.a = 373 a.a = 370 374 b.a = _GlideRoot.pool.f0; 371 375 372 376 grDrawTriangle(&a, &b, e); /* A B E */ 373 377 374 378 b.x -= 2.0F; /* compute point D */ 375 379 b.y += 2.0F; 376 380 grDrawTriangle(&a, e, &b); /* A E D */ 377 381 378 382 a.x += 2.0F; /* compute point C */ 379 383 a.y += 2.0F; 380 384 grDrawTriangle(&b, e, &a); /* D E C */ 381 385 382 386 b.x += 2.0F; 383 387 b.y -= 2.0F; … … 385 389 } 386 390 #endif /* GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP */ 387 391 388 392 /* Restore culling mode */ 389 393 gc->state.cull_mode = cullSave; … … 397 401 #define FN_NAME "grAADrawStrip" 398 402 const FxU32 vertexParamOffset = _GlideRoot.curVertexSize; 399 403 400 404 GR_BEGIN_NOFIFOCHECK(FN_NAME, gc->myLevel); 401 405 GDBG_INFO_MORE(gc->myLevel, "(): 0x%X\n", vectorNum); … … 405 409 GR_SET_EXPECTED_SIZE(vertexParamOffset * vectorNum, 1); 406 410 TRI_PACKET_BEGIN(cullMode, gc->cmdTransportInfo.paramMask, 407 vectorNum, vertexParamOffset, 411 vectorNum, vertexParamOffset, 408 412 SSTCP_PKT3_BDDDDD); 409 413 { … … 412 416 for(v = 0; v < vectorNum; v++) { 413 417 const float* const vector = vectorList[v]; 414 418 415 419 TRI_SETF(vector[GR_VERTEX_X_OFFSET]); 416 420 TRI_SETF(vector[GR_VERTEX_Y_OFFSET]); … … 422 426 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 423 427 FxU32 packedColor = 0x00; 424 428 425 429 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 426 430 packedColor = (RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_B_OFFSET << 2)), B) | 427 431 RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_G_OFFSET << 2)), G) | 428 432 RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_R_OFFSET << 2)), R)); 429 433 430 434 dataList++; 431 435 } 432 436 433 437 packedColor |= RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_A_OFFSET << 2)), A); 434 438 TRI_SET(packedColor); … … 438 442 dataList++; 439 443 #endif /* GLIDE_PACKED_RGB */ 440 444 441 445 #if GLIDE_FP_CLAMP_TEX 442 446 while(*dataList != 0) { … … 447 451 dataList++; 448 452 #endif /* GLIDE_FP_CLAMP_TEX */ 449 453 450 454 while(*dataList != 0) { 451 455 TRI_SETF_CLAMP(FARRAY(vector, *dataList)); … … 476 480 ooa, dxAB, dxBC, dyAB, dyBC; 477 481 float negateArea = -1.f; 478 482 479 483 GR_BEGIN_NOFIFOCHECK("grAADrawEdgeTriangle",gc->myLevel); 480 484 GDBG_INFO_MORE(gc->myLevel,"()\n"); … … 486 490 ** clockwise), we need to change the area of the triangle. Note 487 491 ** that we know the first two elements are X & Y by looking at the 488 ** grVertex structure. 492 ** grVertex structure. 489 493 */ 490 494 if (va[1] < vb[1]) { … … 544 548 dyBC *= ooa; 545 549 546 GR_SET_EXPECTED_SIZE(((10 + (_GlideRoot.paramCount - 1)) << 2), 550 GR_SET_EXPECTED_SIZE(((10 + (_GlideRoot.paramCount - 1)) << 2), 547 551 10 + (_GlideRoot.paramCount - 1)); 548 552 … … 570 574 571 575 { 572 const struct dataList_s* dlp = gc->regDataList; 576 const struct dataList_s* dlp = gc->regDataList; 573 577 int i = dlp->i; 574 578 575 579 /* We already put the alpha out, and this is guaranteed to 576 580 * be included in the dataList via convention. … … 581 585 i = dlp->i; 582 586 } 583 587 584 588 dlp++; 585 589 i = dlp->i; 586 590 587 591 while (i != 0) { 588 592 GR_SETF_INDEX(BROADCAST_ID, hw, ((FxU32*)dlp->addr - (FxU32*)hw), FARRAY(fa, i)); … … 590 594 i = dlp->i; 591 595 } 592 596 593 597 /* Draw the triangle by writing the area to the triangleCMD register */ 594 598 GR_SETF(BROADCAST_ID, hw, FtriangleCMD, area); … … 604 608 #define FUCAST( X ) (*(unsigned long*)&(X)) 605 609 #define FN_NAME "grAADrawLine" 606 GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) 610 GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) 607 611 { 608 612 GR_DCL_GC; 609 613 GrVertex *_v1, *_v2; 610 const FxU32 vertexParamOffset = _GlideRoot.curVertexSize; 614 const FxU32 vertexParamOffset = _GlideRoot.curVertexSize; 611 615 const int* datalist; 612 616 float xoff, yoff; … … 620 624 621 625 GR_SET_EXPECTED_SIZE( vertexParamOffset * 6, 1 ); 622 TRI_PACKET_BEGIN( 0, 626 TRI_PACKET_BEGIN( 0, 623 627 gc->cmdTransportInfo.paramMask, 624 6, 625 vertexParamOffset, 628 6, 629 vertexParamOffset, 626 630 SSTCP_PKT3_BDDDDD ); 627 631 628 632 /* y sort*/ 629 633 if (v2->y < v1->y) { … … 637 641 #define v2 _v2 638 642 /* compute deltas and absolute deltas */ 639 643 640 644 dx = v2->x - v1->x; 641 645 dy = v2->y - v1->y; 642 646 643 647 adx = (float)(FUCAST( dx ) & 0x7fffffff); 644 648 ady = (float)(FUCAST( dy ) & 0x7fffffff); 645 649 646 650 if ( adx >= ady ) { 647 651 xoff = 0.0f; … … 651 655 yoff = 0.0f; 652 656 } 653 657 654 658 /* A---B Alpha = 0.0 655 | \ | 659 | \ | 656 660 V1-V2 Alpha = 1.0 ( user ) 657 | \ | 661 | \ | 658 662 E---F Alpha = 0.0 659 663 */ 660 664 661 665 /* B Vertex */ 662 666 TRI_SETF( v2->x + xoff ); … … 690 694 691 695 v1->a = alpha; 692 696 693 697 /* V2 Vertex */ 694 698 datalist = gc->tsuDataList; … … 696 700 TRI_SETF( v2->x ); 697 701 TRI_SETF( v2->y ); 698 702 699 703 while( *datalist != 0 ) { 700 704 TRI_SETF(FARRAY(v2, *datalist)); 701 705 datalist++; 702 706 } 703 707 704 708 /* V1 Vertex */ 705 709 datalist = gc->tsuDataList; … … 707 711 TRI_SETF( v1->x ); 708 712 TRI_SETF( v1->y ); 709 713 710 714 while( *datalist != 0 ) { 711 715 TRI_SETF(FARRAY(v1, *datalist)); 712 716 datalist++; 713 717 } 714 718 715 719 /* F Vertex */ 716 720 datalist = gc->tsuDataList; … … 746 750 } 747 751 v1->a = alpha; 748 752 749 753 #undef v1 750 754 #undef v2 … … 754 758 #undef FN_NAME 755 759 #else /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP */ 756 GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) 760 GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) 757 761 { 758 762 float dx, dy; /* delta X and Y */ … … 767 771 GrCullMode_t cullSave = gc->state.cull_mode; 768 772 gc->state.cull_mode = GR_CULL_DISABLE; 769 773 770 774 GDBG_INFO(95, "grAADrawLine (%f %f) -> (%f %f)\n", 771 775 v1->x, v1->y, v2->x, v2->y); … … 777 781 const GrVertex* tv = v1; v1 = v2; v2 = tv; 778 782 } 779 783 780 784 /* compute deltas and absolute deltas */ 781 785 dx = adx = v2->x - v1->x; … … 785 789 if (ady < 0) 786 790 ady = -ady; 787 791 788 792 a = *v1; 789 793 e = *v1; … … 870 874 * the inner triangle. 871 875 */ 872 GR_DCL_GC; 876 GR_DCL_GC; 873 877 const FxU32 cullMode = gc->state.cull_mode; 874 878 const FxU32 sMode = ((cullMode != GR_CULL_DISABLE) … … 900 904 901 905 #define DXSQUARED(i,j) ((i->x - j->x) * (i->x - j->x)) 902 #define DYSQUARED(i,j) ((i->y - j->y) * (i->y - j->y)) 903 906 #define DYSQUARED(i,j) ((i->y - j->y) * (i->y - j->y)) 907 904 908 /* 905 909 ** … … 954 958 void, 955 959 (const GrVertex *a, const GrVertex *b, const GrVertex *c, 956 FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias)) 960 FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias)) 957 961 { 958 962 #define FN_NAME "grAADrawTriangle" … … 970 974 ((gc->cmdTransportInfo.paramMask & (SST_SETUP_A << SSTCP_PKT3_PMASK_SHIFT)) == 0), 971 975 "Antialiasing require enabling alpha"); 972 976 973 977 GR_FLUSH_STATE(); 974 978 975 979 fbzModeOld = gc->state.fbi_config.fbzMode; 976 980 977 981 /* backfaced or zero area */ 978 982 if (TRISETUP(a, b, c) <= 0) return; 979 983 980 984 /* Disable depth buffer writes for edge triangles */ 981 985 fbzMode = fbzModeOld; … … 990 994 grAADrawTriEdge(a, b, sense); 991 995 } 992 996 993 997 if (bc_antialias) { 994 998 sense = aaCalcEdgeSense(b, c, a); 995 999 grAADrawTriEdge(b, c, sense); 996 1000 } 997 1001 998 1002 if (ca_antialias) { 999 1003 sense = aaCalcEdgeSense(c, a, b); … … 1013 1017 */ 1014 1018 1015 GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 1019 GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 1016 1020 { 1017 1021 #define FN_NAME "grAADrawPolygon" … … 1051 1055 sense = aaCalcEdgeSense(c, a, b); 1052 1056 grAADrawTriEdge(c, a, sense); 1053 } 1057 } 1054 1058 1055 1059 sense = aaCalcEdgeSense(b, c, a); … … 1066 1070 */ 1067 1071 1068 GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 1072 GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 1069 1073 { 1070 1074 #define FN_NAME "grAADrawPolygonVertexList" … … 1108 1112 sense = aaCalcEdgeSense(c, a, b); 1109 1113 grAADrawTriEdge(c, a, sense); 1110 } 1114 } 1111 1115 1112 1116 sense = aaCalcEdgeSense(b, c, a); -
trunk/src/opengl/glide/cvg/glide/gbanner.c
r2888 r6653 1 /* $Id: gbanner.c,v 1.2 2001-09-05 14:30:24 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gbanner.c,v 1. 1 2000-02-25 00:37:37 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gbanner.c,v 1.2 2001-09-05 14:30:24 bird Exp $ 21 22 ** $Log: gbanner.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:37 sandervl 23 ** Revision 1.2 2001-09-05 14:30:24 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:37 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 17 1/05/98 6:06p Atai 27 31 * glide extension stuff 28 * 32 * 29 33 * 16 12/15/97 5:52p Atai 30 34 * disable obsolete glide2 api for glide3 31 * 35 * 32 36 * 15 11/18/97 4:36p Peter 33 37 * make thing more translucent 34 * 38 * 35 39 * 14 9/15/97 7:31p Peter 36 40 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 37 41 * place, lfb's are on, Hmmmm.. probably more 38 * 42 * 39 43 * 13 7/26/97 3:04p Peter 40 44 * gratuitous plug is translucent 41 * 45 * 42 46 * 12 7/08/97 2:48p Peter 43 47 * shameless plug just uses lfb routines 44 * 48 * 45 49 * 11 5/27/97 1:16p Peter 46 * Basic cvg, w/o cmd fifo stuff. 47 * 50 * Basic cvg, w/o cmd fifo stuff. 51 * 48 52 * 10 5/21/97 6:05a Peter 49 * 53 * 50 54 * 9 5/02/97 2:08p Pgj 51 55 * screen_width/height now FxU32 52 * 56 * 53 57 * 8 3/16/97 2:24a Jdt 54 58 * Fixed bug. Didn't initialize info. 55 * 59 * 56 60 * 7 3/12/97 11:51p Jdt 57 61 * Watcom warning. 58 * 62 * 59 63 * 6 3/12/97 4:20p Jdt 60 64 * Fixed for VG96 and optimized SST-1 61 * 65 * 62 66 * 5 2/26/97 11:55a Jdt 63 67 * Updated banner for new lfb api 64 * 68 * 65 69 * 4 12/23/96 1:37p Dow 66 70 * chagnes for multiplatform glide … … 106 110 grClipWindow(0, 0, 107 111 gc->state.screen_width - 1, 108 gc->state.screen_height - 1); 112 gc->state.screen_height - 1); 109 113 grDepthMask(FXFALSE); 110 114 grDepthBufferFunction(GR_CMP_ALWAYS); 111 115 grDepthBufferMode(GR_DEPTHBUFFER_DISABLE); 112 116 113 117 #if defined(GLIDE3) && defined(GLIDE3_ALPHA) 114 118 _grChromaRangeExt(0x0000, 0x0000, GR_CHROMARANGE_RGB_ALL); … … 126 130 */ 127 131 _grLfbWriteRegion(FXTRUE, GR_BUFFER_BACKBUFFER, 128 gc->state.screen_width - (banner_width + 1), 132 gc->state.screen_width - (banner_width + 1), 129 133 gc->state.screen_height - (banner_height + 1), 130 134 GR_LFBWRITEMODE_565, 131 135 banner_width, banner_height, 132 136 -(banner_width << 1), 133 banner_data + (banner_width * (banner_height - 1))); 137 banner_data + (banner_width * (banner_height - 1))); 134 138 #else 135 139 { -
trunk/src/opengl/glide/cvg/glide/gdraw.c
r2888 r6653 1 /* $Id: gdraw.c,v 1.2 2001-09-05 14:30:24 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gdraw.c,v 1. 1 2000-02-25 00:37:38 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gdraw.c,v 1.2 2001-09-05 14:30:24 bird Exp $ 21 22 ** $Log: gdraw.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:38 sandervl 23 ** Revision 1.2 2001-09-05 14:30:24 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:38 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 98 6/02/98 8:03p Peter 27 31 ** Mmmmm.... points 28 ** 32 ** 29 33 ** 97 6/01/98 6:44p Peter 30 34 ** snapped/unsnapped points 31 ** 35 ** 32 36 ** 96 5/20/98 3:51p Peter 33 37 ** no fifo glide 34 ** 38 ** 35 39 ** 95 5/18/98 12:14p Peter 36 40 ** better point code 37 ** 41 ** 38 42 ** 94 2/20/98 11:00a Peter 39 43 ** removed glide3 from glid2 tree 40 ** 44 ** 41 45 ** 93 2/11/98 5:23p Peter 42 46 ** workaround for tombraider rgb > 255.0 43 * 47 * 44 48 * 92 1/15/98 2:46p Atai 45 49 * fixed grDrawPoint and grDrawLine in aa mode 46 * 50 * 47 51 * 90 12/17/97 4:45p Peter 48 52 * groundwork for CrybabyGlide 49 * 53 * 50 54 * 89 12/15/97 5:52p Atai 51 55 * disable obsolete glide2 api for glide3 52 * 56 * 53 57 * 85 12/08/97 12:06p Atai 54 58 * change prototype for grDrawPoint, grDrawLine, grDrawTriangel 55 * 59 * 56 60 * 83 11/21/97 6:05p Atai 57 61 * use one datalist (tsuDataList) in glide3 58 * 62 * 59 63 * 82 11/21/97 3:20p Peter 60 64 * direct writes tsu registers 61 * 65 * 62 66 * 81 11/19/97 4:33p Atai 63 67 * make vSize debug variable 64 * 68 * 65 69 * 80 11/18/97 4:36p Peter 66 70 * chipfield stuff cleanup and w/ direct writes 67 * 71 * 68 72 * 79 11/17/97 4:55p Peter 69 73 * watcom warnings/chipfield stuff 70 * 74 * 71 75 * 78 11/16/97 2:20p Peter 72 76 * cleanup 73 * 77 * 74 78 * 77 11/15/97 7:43p Peter 75 79 * more comdex silliness 76 * 80 * 77 81 ** 78 82 */ … … 115 119 * can change the rounding mode so that it is difficult to get the 116 120 * correct truncation/ceiling operation w/ a simple adjustment to 117 * the bias. 121 * the bias. 118 122 * 119 123 * NB: The constant kNumMantissaBits defines how many bits of … … 170 174 171 175 /* Packet w/ actual point coordinate and parameter data */ 172 TRI_PACKET_BEGIN(kSetupStrip | kSetupCullDisable, gc->cmdTransportInfo.paramMask, 176 TRI_PACKET_BEGIN(kSetupStrip | kSetupCullDisable, gc->cmdTransportInfo.paramMask, 173 177 1, _GlideRoot.curVertexSize, SSTCP_PKT3_DDDDDD); 174 178 { 175 179 TRI_SET(x); 176 180 TRI_SET(y); 177 181 178 182 /* Vertex parameters */ 179 183 { … … 183 187 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 184 188 FxU32 packedColor = 0x00; 185 189 186 190 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 187 packedColor = (RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_B_OFFSET << 2)), B) | 191 packedColor = (RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_B_OFFSET << 2)), B) | 188 192 RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_G_OFFSET << 2)), G) | 189 193 RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_R_OFFSET << 2)), R)); 190 194 191 195 dataList++; 192 196 } 193 197 194 198 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 195 199 packedColor |= RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_A_OFFSET << 2)), A); 196 200 dataList++; 197 201 } 198 202 199 203 TRI_SET(packedColor); 200 204 } … … 209 213 dataList++; 210 214 #endif /* GLIDE_FP_CLAMP_TEX */ 211 215 212 216 while(*dataList != 0) { 213 217 TRI_SETF_CLAMP(FARRAY(p, *dataList)); … … 218 222 TRI_END; 219 223 GR_CHECK_SIZE(); 220 224 221 225 _GlideRoot.stats.pointsDrawn++; 222 226 #else /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP) */ 223 /* GMT: gross overestimate of fifo requirements */ 227 /* GMT: gross overestimate of fifo requirements */ 224 228 GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize, _GlideRoot.curTriSize >> 2); 225 229 { 226 230 const struct dataList_s* dlp = gc->regDataList; 227 231 int i; 228 232 229 233 #ifdef GLIDE_USE_ALT_REGMAP 230 234 hw = SST_WRAP(hw,128); /* use alternate register mapping */ 231 235 #endif 232 236 233 237 GR_SET(BROADCAST_ID, hw, FvA.x, x); 234 238 GR_SET(BROADCAST_ID, hw, FvA.y, y); 235 239 236 240 x += (0x01UL << (22UL - kNumMantissaBits)); 237 241 GR_SET(BROADCAST_ID, hw, FvB.x, x); … … 244 248 i = _GlideRoot.stats.pointsDrawn++; 245 249 _GlideRoot.stats.pointsDrawn = ++i; 246 250 247 251 dlp = gc->regDataList; 248 i = dlp->i; 249 252 i = dlp->i; 253 250 254 /* we don't care what the slopes are because the pixel center that is drawn */ 251 255 /* is exactly at vertex A - isn't that wonderful */ … … 260 264 GR_CHECK_SIZE(); 261 265 #endif /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP) */ 262 266 263 267 GR_END(); 264 268 #undef FN_NAME … … 298 302 299 303 GR_BEGIN_NOFIFOCHECK("grDrawLine", 91); 300 GDBG_INFO_MORE(gc->myLevel, "A: (%f %f) B: (%f %f)\n", 304 GDBG_INFO_MORE(gc->myLevel, "A: (%f %f) B: (%f %f)\n", 301 305 a->x, a->y, b->x, b->y); 302 306 … … 320 324 j ^= 0x80000000; /* adx = -adx; */ 321 325 } 322 326 323 327 /* check for zero-length lines */ 324 328 if ((j >= i) && (j == 0)) goto all_done; … … 330 334 const float* const fa = (float*)a; 331 335 const float* const fb = (float*)b; 332 336 333 337 /* Draw the triangle pair as a strip of 4 vertices. 334 338 * We can skip all of the gradient calculation stuff. … … 356 360 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 357 361 FxU32 packedColor = 0x00; 358 362 359 363 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 360 packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) | 364 packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) | 361 365 RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_G_OFFSET << 2)), G) | 362 366 RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_R_OFFSET << 2)), R)); 363 364 dataList++; 365 } 366 367 368 dataList++; 369 } 370 367 371 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 368 372 packedColor |= RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_A_OFFSET << 2)), A); 369 373 dataList++; 370 374 } 371 375 372 376 TRI_SET(packedColor); 373 377 } … … 375 379 376 380 #if GLIDE_FP_CLAMP_TEX 377 while(*dataList != 0) { 381 while(*dataList != 0) { 378 382 TRI_SETF(FARRAY(fb, *dataList)); 379 383 dataList++; 380 384 } 381 385 382 386 dataList++; 383 387 #endif /* GLIDE_FP_CLAMP_TEX */ 384 388 385 389 while(*dataList != 0) { 386 390 TRI_SETF_CLAMP(FARRAY(fb, *dataList)); … … 398 402 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 399 403 FxU32 packedColor = 0x00; 400 404 401 405 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 402 packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) | 406 packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) | 403 407 RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_G_OFFSET << 2)), G) | 404 408 RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_R_OFFSET << 2)), R)); 405 406 dataList++; 407 } 408 409 410 dataList++; 411 } 412 409 413 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 410 414 packedColor |= RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_A_OFFSET << 2)), A); 411 415 dataList++; 412 416 } 413 417 414 418 TRI_SET(packedColor); 415 419 } … … 417 421 418 422 #if GLIDE_FP_CLAMP_TEX 419 while(*dataList != 0) { 423 while(*dataList != 0) { 420 424 TRI_SETF(FARRAY(fa, *dataList)); 421 425 dataList++; … … 424 428 dataList++; 425 429 #endif /* GLIDE_FP_CLAMP_TEX */ 426 430 427 431 while (*dataList != 0) { 428 432 TRI_SETF_CLAMP(FARRAY(fa, *dataList)); … … 431 435 } 432 436 433 fBias *= -1.0f; 437 fBias *= -1.0f; 434 438 } 435 439 } else { /* y major */ … … 444 448 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 445 449 FxU32 packedColor = 0x00; 446 450 447 451 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 448 packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) | 452 packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) | 449 453 RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_G_OFFSET << 2)), G) | 450 454 RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_R_OFFSET << 2)), R)); 451 452 dataList++; 453 } 454 455 456 dataList++; 457 } 458 455 459 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 456 460 packedColor |= RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_A_OFFSET << 2)), A); 457 461 dataList++; 458 462 } 459 463 460 464 TRI_SET(packedColor); 461 465 } … … 463 467 464 468 #if GLIDE_FP_CLAMP_TEX 465 while(*dataList != 0) { 469 while(*dataList != 0) { 466 470 TRI_SETF(FARRAY(fb, *dataList)); 467 471 dataList++; … … 470 474 dataList++; 471 475 #endif /* GLIDE_FP_CLAMP_TEX */ 472 476 473 477 while (*dataList != 0) { 474 478 TRI_SETF_CLAMP(FARRAY(fb, *dataList)); … … 476 480 } 477 481 } 478 482 479 483 TRI_SETF(fa[GR_VERTEX_X_OFFSET] + fBias); 480 484 TRI_SETF(fa[GR_VERTEX_Y_OFFSET]); … … 486 490 if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) { 487 491 FxU32 packedColor = 0x00; 488 492 489 493 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 490 packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) | 494 packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) | 491 495 RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_G_OFFSET << 2)), G) | 492 496 RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_R_OFFSET << 2)), R)); 493 494 dataList++; 495 } 496 497 498 dataList++; 499 } 500 497 501 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 498 502 packedColor |= RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_A_OFFSET << 2)), A); 499 503 dataList++; 500 504 } 501 505 502 506 TRI_SET(packedColor); 503 507 } … … 505 509 506 510 #if GLIDE_FP_CLAMP_TEX 507 while(*dataList != 0) { 511 while(*dataList != 0) { 508 512 TRI_SETF(FARRAY(fa, *dataList)); 509 513 dataList++; … … 512 516 dataList++; 513 517 #endif /* GLIDE_FP_CLAMP_TEX */ 514 518 515 519 while (*dataList != 0) { 516 520 TRI_SETF_CLAMP(FARRAY(fa, *dataList)); … … 518 522 } 519 523 } 520 524 521 525 fBias *= -1.0f; 522 526 } … … 531 535 #endif 532 536 533 GR_SET_EXPECTED_SIZE(12 + _GlideRoot.curTriSize, (_GlideRoot.curTriSize + 12) >> 2); 537 GR_SET_EXPECTED_SIZE(12 + _GlideRoot.curTriSize, (_GlideRoot.curTriSize + 12) >> 2); 534 538 { 535 539 float m, dp; … … 548 552 GR_SETF(BROADCAST_ID, hw, FvB.x, dp); 549 553 GR_SETF(BROADCAST_ID, hw, FvC.x, dp); 550 554 551 555 GR_SETF(BROADCAST_ID, hw, FvA.y, a->y - _GlideRoot.pool.fHalf); 552 556 … … 559 563 while (i) { 560 564 dp = FARRAY(a,i); 561 GR_SETF_INDEX(BROADCAST_ID, hw, 565 GR_SETF_INDEX(BROADCAST_ID, hw, 562 566 ((FxU32*)dlp->addr - (FxU32*)hw), dp); 563 567 564 568 dp = FARRAY(b,i) - dp; 565 GR_SETF_INDEX(BROADCAST_ID, hw, 569 GR_SETF_INDEX(BROADCAST_ID, hw, 566 570 ((FxU32*)&dlp->addr[DPDX_OFFSET >> 2] - (FxU32*)hw), dp * m); 567 571 568 572 dlp++; 569 573 i = dlp->i; 570 GR_SETF_INDEX(BROADCAST_ID, hw, 574 GR_SETF_INDEX(BROADCAST_ID, hw, 571 575 ((FxU32*)&dlp->addr[DPDY_OFFSET >> 2] - (FxU32*)hw), _GlideRoot.pool.f0); 572 576 } … … 588 592 GR_SETF(BROADCAST_ID, hw, FvB.y,dp); 589 593 GR_SETF(BROADCAST_ID, hw, FvC.y,dp); 590 594 591 595 GR_SETF(BROADCAST_ID, hw, FvA.x,a->x - _GlideRoot.pool.fHalf); 592 596 … … 596 600 i = dlp->i; 597 601 GR_SETF(BROADCAST_ID, hw, FvC.x,dp + _GlideRoot.pool.fHalf); 598 602 599 603 while (i) { 600 604 dp = FARRAY(a,i); … … 607 611 dlp++; 608 612 i = dlp->i; 609 GR_SETF_INDEX(BROADCAST_ID, hw, 613 GR_SETF_INDEX(BROADCAST_ID, hw, 610 614 ((FxU32*)&dlp->addr[DPDY_OFFSET >> 2] - (FxU32*)hw), dp * m); 611 615 } 612 616 GR_SET(BROADCAST_ID, hw, triangleCMD, 0xFFFFFFFF); 613 617 614 618 GR_SETF(BROADCAST_ID, hw, FvB.x, a->x + _GlideRoot.pool.fHalf); 615 619 GR_SETF(BROADCAST_ID, hw, FvB.y, a->y); … … 657 661 #endif /* GLIDE_DEBUG */ 658 662 659 /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 663 /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 660 664 #if GLIDE_DEBUG && !GLIDE_USE_C_TRISETUP 661 665 /* HackAlert: Nuke the fifo ptr checking stuff here if we're just … … 688 692 asm( "popl %%ebp" : /* no outputs*/ : /* no inputs */ : "ebp"); 689 693 #endif 690 asm( "jmp %0" 691 : /* no outputs */ 694 asm( "jmp %0" 695 : /* no outputs */ 692 696 : "m" (_GlideRoot.curGC->cmdTransportInfo.triSetupProc) 693 697 ); … … 747 751 GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x)\n",nVerts,vList); 748 752 GR_CHECK_F(myName, !vList, "NULL pointer passed"); 749 753 750 754 GR_FLUSH_STATE(); 751 755 … … 756 760 int n,i = nVerts-2; 757 761 const GrVertex *firstv = &vList[0]; 758 762 759 763 for (i = 1; i < nVerts - 1; i++) { 760 764 n = TRISETUP(firstv, &vList[i], &vList[i+1]); … … 767 771 _trisetup_nogradients(firstv, &vList[i], &vList[i+1]); 768 772 } 769 773 770 774 all_done: 771 775 ; … … 780 784 781 785 /* Packet 3 requires at least one vertex, if there isn't enough room 782 * in the fifo then force a wrap now and write up to the max. 786 * in the fifo then force a wrap now and write up to the max. 783 787 */ 784 788 #define FIFO_VERT(__vertSize, __polyVerts) \ … … 809 813 */ 810 814 if (nVerts <= 0) goto __exitNoVerts; 811 815 812 816 #if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP 813 817 { … … 832 836 for(vertexOffset = 0; vertexOffset < packSize; vertexOffset += vertexParamOffset) { 833 837 const float* vertex = (const float*)(vList + *vertexIndexP++); 834 838 835 839 TRI_SETF(vertex[GR_VERTEX_X_OFFSET]); 836 840 TRI_SETF(vertex[GR_VERTEX_Y_OFFSET]); … … 843 847 FxBool doColorP = FXFALSE; 844 848 FxU32 packedColor = 0x00; 845 849 846 850 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 847 packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | 851 packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | 848 852 RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_G_OFFSET << 2)), G) | 849 853 RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_R_OFFSET << 2)), R)); … … 851 855 dataList++; 852 856 } 853 857 854 858 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 855 859 packedColor |= RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_A_OFFSET << 2)), A); … … 857 861 dataList++; 858 862 } 859 863 860 864 if (doColorP) TRI_SET(packedColor); 861 865 } … … 863 867 864 868 #if GLIDE_FP_CLAMP_TEX 865 while(*dataList != 0) { 869 while(*dataList != 0) { 866 870 TRI_SETF(FARRAY(vertex, *dataList)); 867 871 dataList++; … … 870 874 dataList++; 871 875 #endif /* GLIDE_FP_CLAMP_TEX */ 872 876 873 877 while (*dataList != 0) { 874 878 TRI_SETF_CLAMP(FARRAY(vertex, *dataList)); … … 893 897 894 898 packType = SSTCP_PKT3_DDDDDD; 895 899 896 900 GDBG_INFO(120, "\tSending continueing polygon data (0x%X : 0x%X)\n", nVerts, packVerts); 897 901 898 902 goto __doPolyVertexSend; 899 903 } … … 932 936 */ 933 937 if (nVerts <= 0) goto __exitNoVerts; 934 938 935 939 #if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP 936 940 { … … 948 952 const FxU32 packSize = packVerts * vertexParamOffset; 949 953 FxU32 vertexOffset; 950 954 951 955 GR_SET_EXPECTED_SIZE(packSize, 1); 952 956 TRI_STRIP_BEGIN(kSetupFan, packVerts, vertexParamOffset, packType); … … 954 958 for(vertexOffset = 0; vertexOffset < packSize; vertexOffset += vertexParamOffset) { 955 959 const float* vertex = (const float*)vertexListP++; 956 960 957 961 TRI_SETF(vertex[GR_VERTEX_X_OFFSET]); 958 962 TRI_SETF(vertex[GR_VERTEX_Y_OFFSET]); … … 977 981 FxBool doColorP = FXFALSE; 978 982 FxU32 packedColor = 0x00; 979 983 980 984 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 981 packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | 985 packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | 982 986 RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_G_OFFSET << 2)), G) | 983 987 RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_R_OFFSET << 2)), R)); … … 985 989 dataList++; 986 990 } 987 991 988 992 if (*dataList == (GR_VERTEX_A_OFFSET << 2)) { 989 993 packedColor |= RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_A_OFFSET << 2)), A); … … 991 995 dataList++; 992 996 } 993 997 994 998 if (doColorP) TRI_SET(packedColor); 995 999 } … … 1004 1008 dataList++; 1005 1009 #endif /* GLIDE_FP_CLAMP_TEX */ 1006 1010 1007 1011 while (*dataList != 0) { 1008 1012 TRI_SETF_CLAMP(FARRAY(vertex, *dataList)); … … 1026 1030 /* Packet type to continue strip */ 1027 1031 packType = SSTCP_PKT3_DDDDDD; 1028 1032 1029 1033 GDBG_INFO(120, "\tSending continueing polygon data (0x%X : 0x%X)\n", packVerts, nVerts); 1030 1034 1031 1035 goto __doPolyVertexSend; 1032 1036 } … … 1035 1039 { 1036 1040 int i; 1037 1041 1038 1042 for (i = 1; i < nVerts - 1; i++) { 1039 1043 grDrawTriangle(&vList[0], &vList[i], &vList[i+1]); … … 1074 1078 GR_SET(BROADCAST_ID, hw, dbdx, 0); 1075 1079 GR_SET(BROADCAST_ID, hw, dbdy, 0); 1076 } 1080 } 1077 1081 GR_CHECK_SIZE(); 1078 1082 } -
trunk/src/opengl/glide/cvg/glide/gerror.c
r2888 r6653 1 /* $Id: gerror.c,v 1.2 2001-09-05 14:30:25 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 21 ** 21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gerror.c,v 1. 1 2000-02-25 00:37:39 sandervlExp $22 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gerror.c,v 1.2 2001-09-05 14:30:25 bird Exp $ 22 23 ** $Log: gerror.c,v $ 23 ** Revision 1.1 2000-02-25 00:37:39 sandervl 24 ** Revision 1.2 2001-09-05 14:30:25 bird 25 ** Added $Id:$ keyword. 26 ** 27 ** Revision 1.1 2000/02/25 00:37:39 sandervl 24 28 ** Created Voodoo 2 dir 25 29 ** 26 ** 30 ** 27 31 ** 28 3/14/98 1:07p Peter 28 32 ** mac port happiness 29 ** 33 ** 30 34 ** 27 2/11/98 5:23p Peter 31 35 ** no more infinite recursion 32 * 36 * 33 37 * 26 12/18/97 2:13p Peter 34 38 * cleaned up the error code 35 * 39 * 36 40 * 25 12/09/97 12:20p Peter 37 41 * mac glide port 38 * 42 * 39 43 * 24 12/05/97 4:38p Peter 40 44 * sli vs assertions 41 * 45 * 42 46 * 23 12/03/97 11:34a Peter 43 47 * dos debugging 44 * 48 * 45 49 * 22 11/17/97 4:55p Peter 46 50 * watcom warnings/chipfield stuff 47 * 51 * 48 52 * 21 11/15/97 8:55p Peter 49 53 * Removed OutputDebugString 50 * 54 * 51 55 * 20 11/15/97 7:43p Peter 52 56 * more comdex silliness 53 * 57 * 54 58 * 19 11/12/97 2:27p Peter 55 * 59 * 56 60 * 18 11/12/97 11:16a Peter 57 61 * cleaned up assertions 58 * 62 * 59 63 * 17 11/04/97 5:04p Peter 60 64 * cataclysm part deux 61 * 65 * 62 66 * 16 11/03/97 4:02p Peter 63 67 * cataclysm fix 64 * 68 * 65 69 * 15 11/03/97 3:43p Peter 66 70 * h3/cvg cataclysm 67 * 71 * 68 72 * 14 10/23/97 5:28p Peter 69 73 * sli fifo thing 70 * 74 * 71 75 * 13 9/24/97 1:29p Peter 72 76 * more assertion spewage 73 * 77 * 74 78 * 12 9/05/97 5:29p Peter 75 79 * changes for direct hw 76 * 80 * 77 81 * 11 5/30/97 5:44p Peter 78 82 * Version that does basic triangles/registers w/ command fifo. Does not 79 83 * currently download textures correctly. 80 * 84 * 81 85 * 10 5/28/97 9:05a Peter 82 86 * Merge w/ latest glide changes 83 * 87 * 84 88 * 9 5/27/97 1:16p Peter 85 * Basic cvg, w/o cmd fifo stuff. 86 * 89 * Basic cvg, w/o cmd fifo stuff. 90 * 87 91 * 8 5/21/97 6:05a Peter 88 * 92 * 89 93 * 7 5/20/97 9:47a Pgj 90 94 * Use OutputDebugString for non-fatal errors under windows 91 * 95 * 92 96 * 6 5/19/97 7:35p Pgj 93 97 * Print cogent error message if h/w not found 94 * 98 * 95 99 * 5 3/09/97 10:31a Dow 96 100 * Added GR_DIENTRY for di glide functions 97 * 101 * 98 102 * 4 12/23/96 1:37p Dow 99 103 * chagnes for multiplatform glide … … 171 175 172 176 #if (GLIDE_PLATFORM & GLIDE_OS_MACOS) 173 174 175 176 177 178 177 { 178 Str255 errBuf; 179 180 errBuf[0] = sprintf((char*)(errBuf + 1), "%s", s); 181 DebugStr(errBuf); 182 } 179 183 #endif /* (GLIDE_PLATFORM * GLIDE_OS_MACOS) */ 180 184 } … … 223 227 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && USE_PACKET_FIFO 224 228 /* Spew about the state of the fifo since that's what most of the 225 * assertions are about anyway. 229 * assertions are about anyway. 226 230 */ 227 { 231 { 228 232 gdbg_printf("Command Fifo:\n"); 229 233 gdbg_printf("\tfifoPtr: 0x%X\n" … … 234 238 gc->cmdTransportInfo.fifoPtr, 235 239 gc->cmdTransportInfo.fifoStart, gc->cmdTransportInfo.fifoEnd, 236 gc->cmdTransportInfo.fifoSize, 237 gc->cmdTransportInfo.fifoRoom, 240 gc->cmdTransportInfo.fifoSize, 241 gc->cmdTransportInfo.fifoRoom, 238 242 gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 239 HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead, 243 HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead, 240 244 GR_GET(hw->cmdFifoDepth), GR_GET(hw->cmdFifoHoles), GR_GET(hw->cmdFifoBase), 241 245 GR_GET(hw->status)); … … 244 248 if (gc->scanline_interleaved) { 245 249 SstRegs* slaveHw = (SstRegs*)gc->slave_ptr; 246 250 247 251 GDBG_INFO_MORE(gc->myLevel, "\tsli: 0x%X : (0x%X : 0x%X : 0x%X)\n", 248 HW_FIFO_PTR(FXFALSE), 249 GR_GET(slaveHw->cmdFifoDepth), 250 GR_GET(slaveHw->cmdFifoHoles), 252 HW_FIFO_PTR(FXFALSE), 253 GR_GET(slaveHw->cmdFifoDepth), 254 GR_GET(slaveHw->cmdFifoHoles), 251 255 GR_GET(slaveHw->status)); 252 256 } … … 264 268 265 269 GDBG_PRINTF("Up to fifo wrap: \n"); 266 while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2)) 270 while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2)) 267 271 GDBG_PRINTF("0x%X\n", *fifoPtr++); 268 272 #endif -
trunk/src/opengl/glide/cvg/glide/gglide.c
r2888 r6653 1 /* $Id: gglide.c,v 1.2 2001-09-05 14:30:25 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gglide.c,v 1. 1 2000-02-25 00:37:39 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gglide.c,v 1.2 2001-09-05 14:30:25 bird Exp $ 21 22 ** $Log: gglide.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:39 sandervl 23 ** Revision 1.2 2001-09-05 14:30:25 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:39 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 168 7/02/98 6:59p Peter 27 31 ** Fixed merge problem from previous checkin 28 ** 32 ** 29 33 ** 167 6/30/98 6:08p Jeske 30 34 ** fixed bug where we tried to setup MTRRs on old (<p6) systems which 31 ** didn't have them. 32 ** 35 ** didn't have them. 36 ** 33 37 ** 165 6/11/98 3:59p Peter 34 38 ** sli buffer swap needs to be max of app setting vs forcing sync 35 ** 39 ** 36 40 ** 164 6/03/98 6:31p Peter 37 41 ** clearing single scanlines 38 ** 42 ** 39 43 ** 163 5/28/98 2:52p Peter 40 44 ** fixed wrong checking w/ h3 41 ** 45 ** 42 46 ** 162 5/27/98 9:41a Peter 43 47 ** grBufferClear is constrained by clipping 44 ** 48 ** 45 49 ** 161 5/18/98 12:16p Peter 46 50 ** culling enabling 47 ** 51 ** 48 52 ** 160 4/16/98 3:54p Peter 49 53 ** 1x1 lod fix, sorry John 50 ** 54 ** 51 55 ** 159 4/08/98 3:52p Peter 52 56 ** fixed resetting of unused tmu to small lod 53 ** 57 ** 54 58 ** 158 4/01/98 1:51p Peter 55 59 ** fixed resetting unused tmu muckage/sli origin thing vs grRenderBuffer 56 ** 60 ** 57 61 ** 157 3/31/98 6:09p Peter 58 62 ** sli origin everywhere (I think) and grLfbReadRegion/grRenderBuffer vs 59 63 ** triple buffering 60 ** 64 ** 61 65 ** 156 3/30/98 4:56p Peter 62 66 ** fog table monotonicity 63 ** 67 ** 64 68 ** 155 3/29/98 1:07p Peter 65 69 ** removed shutdown cruft and yet another sli origin thing 66 ** 70 ** 67 71 ** 154 3/23/98 4:21p Jdt 68 72 ** Fixed texture state validation bug in grColorCombine 69 ** 73 ** 70 74 ** 153 3/20/98 11:02a Peter 71 75 ** inactive tmu reset 72 ** 76 ** 73 77 ** 152 3/04/98 9:10p Peter 74 78 ** properly restore fbzMode for the sli swapping thing 75 ** 79 ** 76 80 ** 151 3/03/98 9:37p Peter 77 81 ** more sli origin fun 78 ** 82 ** 79 83 ** 150 3/02/98 7:22p Peter 80 84 ** more crybaby stuff 81 ** 85 ** 82 86 ** 149 2/21/98 8:33a Peter 83 87 ** mixed case ini vars 84 ** 88 ** 85 89 ** 148 2/20/98 5:31p Peter 86 90 ** crybaby glide 87 ** 91 ** 88 92 ** 147 2/20/98 2:16p Peter 89 93 ** shutting down hw should clear hwInit and open 90 ** 94 ** 91 95 ** 146 2/20/98 11:00a Peter 92 96 ** removed glide3 from glid2 tree 93 ** 97 ** 94 98 ** 145 2/20/98 9:05a Peter 95 99 ** removed remnants of comdex grot 96 ** 100 ** 97 101 ** 144 2/17/98 12:40p Peter 98 102 ** fog table fix 99 ** 103 ** 100 104 ** 143 2/12/98 3:40p Peter 101 105 ** single buffering for opengl 102 ** 106 ** 103 107 ** 142 2/11/98 5:23p Peter 104 108 ** fixed grRenderBuffer vs blit clear 105 ** 109 ** 106 110 ** 141 1/30/98 4:19p Peter 107 111 ** sli/y-origin blit clear 108 ** 112 ** 109 113 ** 140 1/23/98 3:02p Peter 110 114 ** uswc nightmare 111 ** 115 ** 112 116 ** 139 1/19/98 1:43p Atai 113 117 ** fixed non-debug mode assignement 114 ** 118 ** 115 119 ** 138 1/19/98 11:00a Atai 116 120 ** remove assignment before validate the state 117 * 121 * 118 122 * 137 1/15/98 1:12p Peter 119 123 * only one culler please 120 * 124 * 121 125 * 136 1/13/98 7:48p Atai 122 126 * fixed gu3dfGetInfo, grBufferClear, and GrState size 123 * 127 * 124 128 * 135 1/13/98 12:42p Atai 125 129 * fixed grtexinfo, grVertexLayout, and draw triangle 126 * 130 * 127 131 * 134 1/09/98 7:29p Atai 128 132 * fixed grBufferSwap for glide3 129 * 133 * 130 134 * 133 1/08/98 9:25p Peter 131 135 * infinite recurrsion in debugging assert 132 * 136 * 133 137 * 132 1/08/98 9:23p Peter 134 138 * fixed macro muckage 135 * 139 * 136 140 * 131 1/08/98 7:09p Peter 137 141 * real hw stuff modulo makefile change 138 * 142 * 139 143 ** 140 144 */ … … 156 160 #if GLIDE_HW_TRI_SETUP 157 161 static void 158 _grUpdateTriPacketHdr(FxU32 paramMask, 162 _grUpdateTriPacketHdr(FxU32 paramMask, 159 163 const GrCullMode_t mode); 160 164 #endif /* GLIDE_HW_TRI_SETUP */ … … 167 171 */ 168 172 169 GR_STATE_ENTRY(grAlphaBlendFunction, void, 170 (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, 173 GR_STATE_ENTRY(grAlphaBlendFunction, void, 174 (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, 171 175 GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df)) 172 176 { … … 196 200 else 197 201 alphamode |= SST_ENALPHABLEND; 198 202 199 203 alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT); 200 204 201 205 alphamode |= ((((FxU32) rgb_sf) << SST_RGBSRCFACT_SHIFT) | 202 206 (((FxU32) rgb_df) << SST_RGBDSTFACT_SHIFT) | … … 216 220 */ 217 221 218 GR_STATE_ENTRY(grAlphaCombine, void, 219 (GrCombineFunction_t function, GrCombineFactor_t factor, 222 GR_STATE_ENTRY(grAlphaCombine, void, 223 (GrCombineFunction_t function, GrCombineFactor_t factor, 220 224 GrCombineLocal_t local, GrCombineOther_t other, FxBool invert)) 221 225 { … … 255 259 SST_CCA_ADD_ALOCAL | 256 260 SST_CCA_INVERT_OUTPUT); 257 261 258 262 /* setup reverse blending first, then strip off the the high bit */ 259 263 if ((factor & 0x8) == 0) … … 266 270 gc->state.ac_requires_it_alpha = ((local == GR_COMBINE_LOCAL_ITERATED) | 267 271 (other == GR_COMBINE_OTHER_ITERATED)); 268 272 269 273 /* setup scale factor bits */ 270 274 fbzColorPath |= factor << SST_CCA_MSELECT_SHIFT; … … 272 276 /* setup local color bits */ 273 277 fbzColorPath |= local << SST_ALOCALSELECT_SHIFT; 274 278 275 279 /* setup other color bits */ 276 280 fbzColorPath |= other << SST_ASELECT_SHIFT; 277 278 281 282 279 283 /* setup invert output bits */ 280 284 if (invert) 281 285 fbzColorPath |= SST_CCA_INVERT_OUTPUT; 282 286 283 287 /* setup core color combine unit bits */ 284 288 switch (function) { … … 286 290 fbzColorPath |= SST_CCA_ZERO_OTHER; 287 291 break; 288 292 289 293 case GR_COMBINE_FUNCTION_LOCAL: 290 294 case GR_COMBINE_FUNCTION_LOCAL_ALPHA: 291 295 fbzColorPath |= SST_CCA_ZERO_OTHER | SST_CCA_ADD_ALOCAL; 292 296 break; 293 297 294 298 case GR_COMBINE_FUNCTION_SCALE_OTHER: 295 299 break; 296 300 297 301 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: 298 302 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: 299 303 fbzColorPath |= SST_CCA_ADD_ALOCAL; 300 304 break; 301 305 302 306 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: 303 307 fbzColorPath |= SST_CCA_SUB_CLOCAL; 304 308 break; 305 309 306 310 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: 307 311 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: 308 312 fbzColorPath |= SST_CCA_SUB_CLOCAL | SST_CCA_ADD_ALOCAL; 309 313 break; 310 314 311 315 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: 312 316 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: … … 339 343 /*--------------------------------------------------------------------------- 340 344 ** grAlphaControlsITRGBLighting 341 ** 345 ** 342 346 ** Determines whether the LSB of alpha controls what lighting is used-- 343 347 ** Specifically whether grConstantColorValu or the interated RGB values are used 344 348 ** during TEXTURE_TIMES_itrgb & TEXTURE_TIMES_ITRGB_DELTA0 color combine modes. 345 349 ** 346 */ 350 */ 347 351 348 352 GR_STATE_ENTRY(grAlphaControlsITRGBLighting, void, (FxBool enable)) … … 463 467 * then we can use the sgram fill rect to clear the page aligned 464 468 * region, and then use the fastFillCmd to clear the remainder. 465 * 469 * 466 470 * NB: The test really does check against (clipLeft == 0) && 467 471 * (clipright == screenWidth) since screenWidth should have 0 … … 501 505 502 506 /* If they're both in the same tile then just clear using a 503 * fastFillCmd 507 * fastFillCmd 504 508 */ 505 509 if (tileHi <= tileLow) goto __skipBlitClear; 506 510 507 511 /* Column size is always a full page size divided by the # 508 * of points in a tile row (2 tiles). 512 * of points in a tile row (2 tiles). 509 513 * 510 514 * NB: This set is 'lifted' out of the groupings below because … … 513 517 { 514 518 GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1); 515 GR_SET(BROADCAST_ID, hw, bltSize, 519 GR_SET(BROADCAST_ID, hw, bltSize, 516 520 (((((tileHi - tileLow) * gc->hwDep.cvgDep.xTilePages) - 1) << 16) | (0x1000 >> 3) - 1)); 517 521 GR_CHECK_SIZE(); … … 525 529 { 526 530 /* Starting point of the blit. We always do a full page in x. */ 527 REG_GROUP_SET(hw, bltDstXY, 531 REG_GROUP_SET(hw, bltDstXY, 528 532 (((tileBuffer + (tileLow * gc->hwDep.cvgDep.xTilePages)) << 16) | 0x00UL)); 529 533 … … 545 549 if (doAuxP) { 546 550 const FxU32 tileBuffer = (gc->hwDep.cvgDep.numBufferPages * gc->state.num_buffers); 547 551 548 552 REG_GROUP_BEGIN(BROADCAST_ID, bltDstXY, 3, 0x29); 549 553 { … … 560 564 /* Did we round off crap to page align the top part of 561 565 * clipping? If so then reset the hw clipping and use 562 * the normal fastFillCmd on this region. 566 * the normal fastFillCmd on this region. 563 567 */ 564 568 didClipP = ((tileLow << yTileShift) > clipLow); … … 572 576 REG_GROUP_END(); 573 577 574 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 578 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 575 579 2 + bottomOriginP, (bottomOriginP | 0x28UL)); 576 580 { … … 583 587 REG_GROUP_SET(hw, clipBottomTop, ((clipLow << SST_CLIPBOTTOM_SHIFT) | 584 588 MIN(((tileLow << yTileShift) << SST_CLIPTOP_SHIFT), clipHi))); 585 589 586 590 /* Execute the FASTFILL command */ 587 591 REG_GROUP_SET(hw, fastfillCMD, 1); 588 592 } 589 593 REG_GROUP_END(); 590 } 591 594 } 595 592 596 /* If we're done then we have to restore the color registers. 593 597 * Otherwise, leave them set for the next fastFillCmd, and … … 621 625 * time sending them again, and always set the clip flag. 622 626 */ 623 doColorP = 627 doColorP = 624 628 doAuxP = FXFALSE; 625 629 didClipP = FXTRUE; … … 627 631 } 628 632 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR */ 629 633 630 634 if (!doneP) { 631 635 REG_GROUP_BEGIN(BROADCAST_ID, zaColor, 2, 0x41); … … 635 639 } 636 640 REG_GROUP_END(); 637 641 638 642 REG_GROUP_BEGIN(BROADCAST_ID, fastfillCMD, 3, 0x209); 639 643 { 640 644 /* Execute the FASTFILL command */ 641 645 REG_GROUP_SET(hw, fastfillCMD, 1); 642 646 643 647 /* Restore C1 and ZACOLOR */ 644 648 REG_GROUP_SET(hw, zaColor, oldzacolor); … … 651 655 /* Restore clipping */ 652 656 if (didClipP) { 653 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 657 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 654 658 bottomOriginP + 1, (bottomOriginP | 0x8UL)); 655 659 { … … 694 698 } 695 699 REG_GROUP_END(); 696 700 697 701 /* Do the clear */ 698 702 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 2, 0x21UL); 699 703 { 700 REG_GROUP_SET(hw, fbzMode, 701 ((gc->state.fbi_config.fbzMode & ~SST_YORIGIN) | 704 REG_GROUP_SET(hw, fbzMode, 705 ((gc->state.fbi_config.fbzMode & ~SST_YORIGIN) | 702 706 (~gc->state.fbi_config.fbzMode & SST_YORIGIN) | 703 707 SST_RGBWRMASK)); … … 708 712 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 2, 0x21UL); 709 713 { 710 REG_GROUP_SET(hw, fbzMode, 714 REG_GROUP_SET(hw, fbzMode, 711 715 (gc->state.fbi_config.fbzMode | SST_RGBWRMASK)); 712 716 REG_GROUP_SET(hw, fastfillCMD, 0x01UL); 713 717 } 714 718 REG_GROUP_END(); 715 719 716 720 /* Restore the initial glide state. 717 721 * NB: Cannot be done in one packet. Wah! … … 756 760 /* optionally display the 3Dfx powerfield logo overlay */ 757 761 if (_GlideRoot.environment.shamelessPlug) _grShamelessPlug(); 758 762 759 763 /* check for environmental override. 760 * 764 * 761 765 * NB: If we are sli, the application passes in 0, and the user has 762 766 * elected to not sync to retrace then we honor the user's 763 767 * choice. Otherwise we force syncing because most apps don't know 764 768 * any better. If, however, the user has not chosen, but the app 765 * wants something other than 0 then we need to honor their choice. 769 * wants something other than 0 then we need to honor their choice. 766 770 */ 767 771 swapInterval = ((_GlideRoot.environment.swapInterval >= 0) 768 772 ? _GlideRoot.environment.swapInterval 769 773 : (gc->scanline_interleaved ? MAX(swapInterval, 1) : swapInterval)); 770 774 771 775 GR_CHECK_F(myName, 772 776 (swapInterval > 255) || (swapInterval < 0), … … 779 783 while (grBufferNumPending() > 6) 780 784 ; 781 785 782 786 /* if the interval is non-zero turn on VSYNC waiting */ 783 787 vSync = (swapInterval > 0); 784 788 785 789 if (swapInterval > 0) swapInterval--; 786 790 787 791 /* NOTE: we need a PCI read before and after the swap command */ 788 792 /* but since we already called grBufferNumPending() we've done a read */ … … 809 813 GR_CHECK_SIZE(); 810 814 } 811 815 812 816 #ifdef GLIDE_DEBUG 813 817 { … … 815 819 static char saveDBG[GDBG_MAX_LEVELS]; 816 820 int i; 817 821 818 822 /* turn off tracing after frame 0 and the snapshot frame */ 819 if ((_GlideRoot.stats.bufferSwaps == 0) || 823 if ((_GlideRoot.stats.bufferSwaps == 0) || 820 824 (_GlideRoot.stats.bufferSwaps == _GlideRoot.environment.snapshot + 3)) { 821 825 GDBG_PRINTF(FN_NAME": FX_SNAPSHOT (%ld)\n", _GlideRoot.stats.bufferSwaps); … … 854 858 } 855 859 856 GDBG_INFO(gc->myLevel, 860 GDBG_INFO(gc->myLevel, 857 861 "\trenderBuf: 0x%X\n", 858 862 gc->hwDep.cvgDep.renderBuf); … … 863 867 grSstStatus(); /* special bug workaround */ 864 868 #else 865 # error "Need to implement swap." 869 # error "Need to implement swap." 866 870 #endif /* GLIDE_PLATFORM & GLIDE_HW_SST1 */ 867 871 868 872 _GlideRoot.stats.bufferSwaps++; 869 873 870 874 GR_END(); 871 #undef FN_NAME 875 #undef FN_NAME 872 876 } /* grBufferSwap */ 873 877 … … 882 886 { 883 887 FxU32 status = grSstStatus(); 884 888 885 889 #if ((GLIDE_PLATFORM & GLIDE_HW_CVG) || (GLIDE_PLATFORM & GLIDE_HW_H3)) 886 890 pend = ((status & SST_SWAPBUFPENDING) >> SST_SWAPBUFPENDING_SHIFT); … … 985 989 FN_NAME, minx, maxx, miny, maxy); 986 990 987 GR_CHECK_COMPATABILITY(FN_NAME, 991 GR_CHECK_COMPATABILITY(FN_NAME, 988 992 ((maxx > gc->state.screen_width) || (maxy > gc->state.screen_height)), 989 993 "Max clip coordinate > screen size"); … … 1001 1005 FN_NAME, minx, maxx, miny, maxy); 1002 1006 1003 *clipLeftRight = (minx << SST_CLIPLEFT_SHIFT) | (maxx << SST_CLIPRIGHT_SHIFT); 1007 *clipLeftRight = (minx << SST_CLIPLEFT_SHIFT) | (maxx << SST_CLIPRIGHT_SHIFT); 1004 1008 *clipBottomTop = (miny << SST_CLIPBOTTOM_SHIFT) | (maxy << SST_CLIPTOP_SHIFT); 1005 1009 … … 1007 1011 FN_NAME, clipLeftRight, clipBottomTop); 1008 1012 1009 #undef FN_NAME 1013 #undef FN_NAME 1010 1014 } /* _grClipNormalizeAndGenerateRegValues */ 1011 1015 … … 1013 1017 ** grClipWindow 1014 1018 */ 1015 GR_STATE_ENTRY(grClipWindow, void, (FxU32 minx, FxU32 miny, 1016 FxU32 maxx, FxU32 maxy)) 1019 GR_STATE_ENTRY(grClipWindow, void, (FxU32 minx, FxU32 miny, 1020 FxU32 maxx, FxU32 maxy)) 1017 1021 { 1018 1022 #define FN_NAME "grClipWindow" … … 1050 1054 */ 1051 1055 1052 GR_STATE_ENTRY(grColorCombine, void, 1056 GR_STATE_ENTRY(grColorCombine, void, 1053 1057 (GrCombineFunction_t function, GrCombineFactor_t factor, 1054 1058 GrCombineLocal_t local, GrCombineOther_t other, FxBool invert)) … … 1176 1180 GR_SET_EXPECTED_SIZE(sizeof(FxU32) + (texTransP ? sizeof(FxU32) : 0), 1177 1181 1 + texTransP); 1178 1182 1179 1183 /* transition into/out of texturing ... add nopCMD */ 1180 1184 if (texTransP) GR_SET(BROADCAST_ID, hw, nopCMD, 0); … … 1382 1386 /* turn off all the bits and then turn them back on selectively */ 1383 1387 fbzMode = gc->state.fbi_config.fbzMode; 1384 fbzMode &= ~(SST_ENDEPTHBUFFER | 1385 SST_WBUFFER | 1386 SST_ENZBIAS | 1388 fbzMode &= ~(SST_ENDEPTHBUFFER | 1389 SST_WBUFFER | 1390 SST_ENZBIAS | 1387 1391 SST_ZCOMPARE_TO_ZACOLOR); 1388 1392 … … 1390 1394 case GR_DEPTHBUFFER_DISABLE: 1391 1395 break; 1392 1396 1393 1397 case GR_DEPTHBUFFER_ZBUFFER: 1394 1398 fbzMode |= SST_ENDEPTHBUFFER | SST_ENZBIAS; … … 1499 1503 1500 1504 fbzMode = gc->state.fbi_config.fbzMode; 1501 if (_GlideRoot.environment.disableDitherSub == FXTRUE) 1505 if (_GlideRoot.environment.disableDitherSub == FXTRUE) 1502 1506 fbzMode &= ~(SST_ENDITHER | SST_DITHER2x2); 1503 1507 else … … 1507 1511 case GR_DITHER_DISABLE: 1508 1512 break; 1509 1513 1510 1514 case GR_DITHER_2x2: 1511 1515 fbzMode |= (SST_ENDITHER | SST_DITHER2x2); … … 1537 1541 1538 1542 fogmode = gc->state.fbi_config.fogMode; 1539 fogmode &= ~(SST_ENFOGGING | 1540 SST_FOGADD | 1541 SST_FOGMULT | 1542 SST_FOG_ALPHA | 1543 SST_FOG_Z | 1543 fogmode &= ~(SST_ENFOGGING | 1544 SST_FOGADD | 1545 SST_FOGMULT | 1546 SST_FOG_ALPHA | 1547 SST_FOG_Z | 1544 1548 SST_FOG_CONSTANT); 1545 1549 … … 1564 1568 1565 1569 /* GMT says that this should be enabled for CVG. It is always safe 1566 * to enable these even when fogging is not enabled. 1570 * to enable these even when fogging is not enabled. 1567 1571 */ 1568 1572 fogmode |= (SST_FOG_DITHER | SST_FOG_ZONES); … … 1618 1622 { 1619 1623 int j; 1620 1624 1621 1625 for (j = 0; j < iend; j++) { 1622 1626 FxU32 e0, e1, d0, d1; 1623 1627 1624 1628 e0 = locTable[0]; /* lower entry */ 1625 1629 e1 = locTable[1]; /* upper entry */ 1626 1630 1627 GR_CHECK_COMPATABILITY(FN_NAME, 1628 (e1 < e0), 1631 GR_CHECK_COMPATABILITY(FN_NAME, 1632 (e1 < e0), 1629 1633 "Invalid fog table entry. (Must be monotonically increasing)"); 1630 GR_CHECK_COMPATABILITY(FN_NAME, 1634 GR_CHECK_COMPATABILITY(FN_NAME, 1631 1635 ((j > 0) ? (e0 < locTable[-1]) : 0), 1632 1636 "Invalid fog table entry. (Must be monotonically increasing)"); 1633 1637 1634 1638 /* del0 in .2 format */ 1635 d0 = ((e1 - e0) << 2); 1639 d0 = ((e1 - e0) << 2); 1636 1640 1637 1641 /* del1 in .2 format - don't access beyond end of table */ 1638 1642 d1 = ((j == (iend - 1)) ? e1 : locTable[2]); 1639 1643 d1 = (d1 - e1) << 2; 1640 1641 REG_GROUP_SET(hw, fogTable[j], 1644 1645 REG_GROUP_SET(hw, fogTable[j], 1642 1646 ((e1 << 24) | (d1 << 16) | (e0 << 8) | d0)); 1643 1647 GDBG_INFO(gc->myLevel + 200, "fogTable[%ld]: 0x%X\n", … … 1658 1662 Library: Glide 1659 1663 Description: 1660 Shutdown the Glide Library. Iterate through all hardware and 1664 Shutdown the Glide Library. Iterate through all hardware and 1661 1665 call grSstWinClose(). Call InitShutdown() which unmaps all 1662 1666 hardware from linear memory. … … 1695 1699 /* dpc - 5 sep 1997 - FixMe! 1696 1700 * Move this to the new initCode world some time. 1697 * 1701 * 1698 1702 * initClose(); 1699 1703 * … … 1701 1705 * if the application never called grSstWinOpen because they are 1702 1706 * doing some sort of hw/dll detection before trying to run w/ 1703 * glide. 1707 * glide. 1704 1708 */ 1705 1709 for(i = 0; i < _GlideRoot.hwConfig.num_sst; i++) { 1706 1710 if (_GlideRoot.GCs[i].hwInitP) { 1707 1711 if (_GlideRoot.CPUType >= 6) { 1708 1709 1712 sst1InitCaching(_GlideRoot.GCs[i].base_ptr, FXFALSE); 1713 } 1710 1714 sst1InitShutdown(_GlideRoot.GCs[i].base_ptr); 1711 1715 … … 1730 1734 then it's still used by grGlideSetState() 1731 1735 Arguments: 1732 1736 1733 1737 Return: 1734 1738 -------------------------------------------------------------------*/ … … 1750 1754 REG_GROUP_SET(hw, alphaMode, gc->state.fbi_config.alphaMode); 1751 1755 REG_GROUP_SET(hw, fbzMode, gc->state.fbi_config.fbzMode); 1752 1756 1753 1757 REG_GROUP_SET(hw, lfbMode, gc->state.fbi_config.lfbMode); 1754 1758 REG_GROUP_SET(hw, clipLeftRight, gc->state.fbi_config.clipLeftRight); 1755 1759 REG_GROUP_SET(hw, clipBottomTop, gc->state.fbi_config.clipBottomTop); 1756 1760 1757 1761 REG_GROUP_SET(hw, fogColor, gc->state.fbi_config.fogColor); 1758 1762 REG_GROUP_SET(hw, zaColor, gc->state.fbi_config.zaColor); … … 1760 1764 } 1761 1765 REG_GROUP_NO_CHECK_END(); 1762 1766 1763 1767 REG_GROUP_NO_CHECK_BEGIN(BROADCAST_ID, stipple, 3, 0x07); 1764 1768 { … … 1785 1789 1786 1790 GR_ASSERT(state != NULL); 1787 1791 1788 1792 /* if texture mapping changed then we need to issue a NOP command*/ 1789 1793 { 1790 const FxBool texChangeP = (((gc->state.fbi_config.fbzColorPath ^ state->fbi_config.fbzColorPath) & 1794 const FxBool texChangeP = (((gc->state.fbi_config.fbzColorPath ^ state->fbi_config.fbzColorPath) & 1791 1795 SST_ENTEXTUREMAP) != 0); 1792 1796 if (texChangeP) { … … 1799 1803 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 1800 1804 /* If we're on sli and the new state includes changing the origin 1801 * that we clear the slop lines at the bottom of the screen. 1805 * that we clear the slop lines at the bottom of the screen. 1802 1806 */ 1803 1807 if (gc->scanline_interleaved) gc->hwDep.cvgDep.sliOriginBufCount = gc->grColBuf; … … 1809 1813 /* Update the hardware state from the saved state. */ 1810 1814 _grFlushCommonStateRegs(); 1811 1815 1812 1816 GR_SET_EXPECTED_SIZE((7 * sizeof(FxU32)) * gc->num_tmu, gc->num_tmu); 1813 1817 { 1814 1818 int tmu; 1815 1819 1816 1820 for (tmu = 0; tmu < gc->num_tmu; tmu++) { 1817 1821 SstRegs* tmuregs = SST_TMU(hw, tmu); 1818 1822 const FifoChipField chipField = (FifoChipField)(0x02UL << tmu); 1819 1823 1820 1824 REG_GROUP_NO_CHECK_BEGIN(chipField, textureMode, 7, 0x7F); 1821 1825 { … … 1824 1828 REG_GROUP_SET(tmuregs, tDetail, gc->state.tmu_config[tmu].tDetail); 1825 1829 REG_GROUP_SET(tmuregs, texBaseAddr, gc->state.tmu_config[tmu].texBaseAddr); 1826 1830 1827 1831 REG_GROUP_SET(tmuregs, texBaseAddr1, gc->state.tmu_config[tmu].texBaseAddr_1); 1828 1832 REG_GROUP_SET(tmuregs, texBaseAddr2, gc->state.tmu_config[tmu].texBaseAddr_2); … … 1836 1840 /* NOTE: since glide state includes things like hints and all cached 1837 1841 * variables like paramIndex we needn't recompute these, BUT: we do 1838 * need to rebuild stuff that depends on them!!! 1842 * need to rebuild stuff that depends on them!!! 1839 1843 */ 1840 1844 _grUpdateParamIndex(); … … 1861 1865 { 1862 1866 FxU32 fbzMode; 1863 1867 1864 1868 fbzMode = gc->state.fbi_config.fbzMode; 1865 1869 fbzMode &= ~(SST_DRAWBUFFER); 1866 1870 fbzMode |= ((buffer == GR_BUFFER_FRONTBUFFER) 1867 ? SST_DRAWBUFFER_FRONT 1871 ? SST_DRAWBUFFER_FRONT 1868 1872 : SST_DRAWBUFFER_BACK); 1869 1873 … … 1875 1879 } 1876 1880 1877 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR 1881 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR 1878 1882 /* Setting the render buffer means we need to adjust 1879 1883 * our current pointer to the render buffer's physical … … 1882 1886 { 1883 1887 const FxU32 oldRenderBuf = gc->hwDep.cvgDep.renderBuf; 1884 1888 1885 1889 gc->hwDep.cvgDep.renderBuf = ((buffer == GR_BUFFER_FRONTBUFFER) 1886 1890 ? gc->hwDep.cvgDep.frontBuf … … 1890 1894 } 1891 1895 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR */ 1892 1896 1893 1897 GR_END(); 1894 1898 #undef FN_NAME … … 1932 1936 /* 0 */ 1933 1937 STATE_REQUIRES_OOW_FBI, 1934 1938 1935 1939 /* 1 */ 1936 STATE_REQUIRES_OOW_FBI | 1940 STATE_REQUIRES_OOW_FBI | 1937 1941 STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0, 1938 1942 1939 1943 /* 2 */ 1940 STATE_REQUIRES_OOW_FBI | 1944 STATE_REQUIRES_OOW_FBI | 1941 1945 STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1, 1942 1946 1943 1947 /* 3 */ 1944 STATE_REQUIRES_OOW_FBI | 1945 STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 | 1948 STATE_REQUIRES_OOW_FBI | 1949 STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 | 1946 1950 STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1, 1947 1951 1948 1952 /* 4 */ 1949 STATE_REQUIRES_OOW_FBI | 1953 STATE_REQUIRES_OOW_FBI | 1950 1954 STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2, 1951 1955 1952 1956 /* 5 */ 1953 STATE_REQUIRES_OOW_FBI | 1957 STATE_REQUIRES_OOW_FBI | 1954 1958 STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 | 1955 1959 STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2, 1956 1960 1957 1961 /* 6 */ 1958 STATE_REQUIRES_OOW_FBI | 1962 STATE_REQUIRES_OOW_FBI | 1959 1963 STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1 | 1960 1964 STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2, 1961 1965 1962 1966 /* 7 */ 1963 STATE_REQUIRES_OOW_FBI | 1967 STATE_REQUIRES_OOW_FBI | 1964 1968 STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 | 1965 1969 STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1 | … … 1969 1973 GR_ASSERT(gc->state.tmuMask < sizeof(paramI_array)/sizeof(paramI_array[0])); 1970 1974 paramIndex |= paramI_array[gc->state.tmuMask]; 1971 } 1975 } 1972 1976 1973 1977 /* See if we need iterated RGB */ … … 1977 1981 1978 1982 /* See if we need to iterate alpha based on the value of 1979 ac_requires_it_alpha */ 1983 ac_requires_it_alpha */ 1980 1984 if (gc->state.ac_requires_it_alpha) { 1981 1985 paramIndex |= STATE_REQUIRES_IT_ALPHA; … … 2022 2026 paramIndex &= ~STATE_REQUIRES_W_TMU0; 2023 2027 } 2024 2028 2025 2029 /* Turn off ST for TMU1 if TMU0 is active and TMU1 is not different */ 2026 2030 if (((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQUIRES_ST_TMU1)) == … … 2028 2032 !(hints & GR_STWHINT_ST_DIFF_TMU1)) 2029 2033 paramIndex &= ~STATE_REQUIRES_ST_TMU1; 2030 2031 /* Turn off W for TMU1 if we have a previous W, and don't have a hint */ 2034 2035 /* Turn off W for TMU1 if we have a previous W, and don't have a hint */ 2032 2036 if ((paramIndex & STATE_REQUIRES_W_TMU1) && !(hints & GR_STWHINT_W_DIFF_TMU1)) 2033 2037 paramIndex &= ~STATE_REQUIRES_W_TMU1; 2034 2038 2035 2039 #if (GLIDE_NUM_TMU > 2) 2036 /* Turn off ST for TMU1 if it's not different & any other is set up. */ 2040 /* Turn off ST for TMU1 if it's not different & any other is set up. */ 2037 2041 if ((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQURES_ST_TMU1)) && 2038 2042 (paramIndex & STATE_REQUIRES_ST_TMU2) && 2039 2043 !(hints & GR_STWHINT_ST_DIFF_TMU2)) 2040 2044 paramIndex &= ~STATE_REQUIRES_ST_TMU2; 2041 2042 /* Turn off W for TMU2 if we have a previous W, and don't have a hint */ 2045 2046 /* Turn off W for TMU2 if we have a previous W, and don't have a hint */ 2043 2047 if ((paramIndex & STATE_REQUIRES_W_TMU2) && !(hints & GR_STWHINT_W_DIFF_TMU2)) 2044 2048 paramIndex &= ~STATE_REQUIRES_W_TMU2; 2045 2049 #endif 2046 2050 2047 2051 gc->state.paramIndex = paramIndex; 2048 2052 … … 2105 2109 #if GLIDE_HW_TRI_SETUP 2106 2110 static void 2107 _grUpdateTriPacketHdr(FxU32 paramMask, 2111 _grUpdateTriPacketHdr(FxU32 paramMask, 2108 2112 const GrCullMode_t cullMode) 2109 2113 { 2110 2114 GR_DCL_GC; 2111 FxU32 sMode = ((cullMode != GR_CULL_DISABLE) 2112 ? kSetupCullEnable 2115 FxU32 sMode = ((cullMode != GR_CULL_DISABLE) 2116 ? kSetupCullEnable 2113 2117 : kSetupPingPongDisable); 2114 if (sMode != kSetupPingPongDisable) sMode |= ((cullMode == GR_CULL_POSITIVE) 2115 ? kSetupCullPositive 2118 if (sMode != kSetupPingPongDisable) sMode |= ((cullMode == GR_CULL_POSITIVE) 2119 ? kSetupCullPositive 2116 2120 : kSetupCullNegative); 2117 2121 … … 2119 2123 #define COLOR_COMP_ARGB ((SST_SETUP_RGB | SST_SETUP_A) << SSTCP_PKT3_PMASK_SHIFT) 2120 2124 #define COLOR_COMP_RGB (SST_SETUP_RGB << SSTCP_PKT3_PMASK_SHIFT) 2121 #define COLOR_COMP_MASK COLOR_COMP_ARGB 2125 #define COLOR_COMP_MASK COLOR_COMP_ARGB 2122 2126 2123 2127 /* Setup custom triangle/strip procs. … … 2162 2166 paramMask | 2163 2167 SSTCP_PKT3); 2164 2168 2165 2169 /* Independent triangle hdr for grDrawTriangle */ 2166 2170 gc->cmdTransportInfo.triPacketHdr = (gc->cmdTransportInfo.cullStripHdr | … … 2200 2204 FxBool packedRGB = FXFALSE; 2201 2205 #endif /* GLIDE_PACKED_RGB */ 2202 2206 2203 2207 #ifdef GLIDE_DEBUG 2204 2208 static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow", 2205 2209 "s0","t0","w0","s1","t1","w1","s2","t2","w2"}; 2206 2210 #endif /* GLIDE_DEBUG */ 2207 2211 2208 2212 GDBG_INFO(85,"(s) paramHints=0x%x paramIndex=0x%x\n", FN_NAME, 2209 2213 gc->state.paramHints,gc->state.paramIndex); 2210 2214 2211 2215 curTriSize = params = 0; 2212 2216 i = gc->state.paramIndex; … … 2229 2233 /* When using packed color we only add *ONE* item to the data list 2230 2234 * and this signals the entire color set since it is not possible 2231 * to specify a single color component in any packet. 2235 * to specify a single color component in any packet. 2232 2236 */ 2233 2237 #if !GLIDE_PACKED_RGB … … 2274 2278 { 2275 2279 /* Only increment the parameter packet size if we have not already 2276 * added the rgb fields. 2280 * added the rgb fields. 2277 2281 */ 2278 2282 if ((i & STATE_REQUIRES_IT_DRGB) == 0) params += 1; … … 2283 2287 #endif /* !GLIDE_PACKED_RGB */ 2284 2288 } 2285 2289 2286 2290 if (i & STATE_REQUIRES_OOZ) { 2287 2291 #if GLIDE_HW_TRI_SETUP … … 2329 2333 gc->tsuDataList[curTriSize++] = 0; 2330 2334 #endif /* GLIDE_FP_CLAMP_TEX */ 2331 2335 2332 2336 /* NOTE: this is the first */ 2333 2337 if (i & STATE_REQUIRES_W_TMU0) { … … 2345 2349 params += 1; 2346 2350 } 2347 2351 2348 2352 /* TMU0 --------------------------------- */ 2349 2353 /* always output to ALL chips, saves from having to change CHIP field */ … … 2365 2369 params += 2; 2366 2370 } 2367 2371 2368 2372 /* TMU1 --------------------------------- */ 2369 2373 if (i & STATE_REQUIRES_W_TMU1) { … … 2400 2404 params += 2; 2401 2405 } 2402 2406 2403 2407 #if (GLIDE_NUM_TMU > 2) 2404 2408 #error "GLIDE_NUM_TMU > 2: Write this code." … … 2452 2456 gc->tsuDataList[++curTriSize] = 0; 2453 2457 #endif /* GLIDE_FP_CLAMP_TEX */ 2454 2458 2455 2459 #ifdef GDBG_INFO_ON 2456 2460 #if GLIDE_HW_TRI_SETUP … … 2480 2484 GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc)) 2481 2485 { 2482 2486 2483 2487 gc->gcFuncs._grColorCombineDelta0Mode = (void *) 2484 GR_DDNAME(_grColorCombineDelta0Mode); 2488 GR_DDNAME(_grColorCombineDelta0Mode); 2485 2489 gc->gcFuncs._grRebuildDataList = (void *) GR_DDNAME(_grRebuildDataList); 2486 2490 gc->gcFuncs._grTexDetailControl = (void *) GR_DDNAME(_grTexDetailControl); 2487 2491 gc->gcFuncs._grTexDownloadNccTable = (void *) 2488 GR_DDNAME(_grTexDownloadNccTable); 2492 GR_DDNAME(_grTexDownloadNccTable); 2489 2493 gc->gcFuncs._grTexDownloadPalette = (void *) 2490 GR_DDNAME(_grTexDownloadPalette); 2494 GR_DDNAME(_grTexDownloadPalette); 2491 2495 gc->gcFuncs._gumpTexCombineFunction = (void *) 2492 GR_DDNAME(_gumpTexCombineFunction); 2496 GR_DDNAME(_gumpTexCombineFunction); 2493 2497 gc->gcFuncs._grUpdateParamIndex = (void *) 2494 GR_DDNAME(_grUpdateParamIndex); 2495 gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup); 2498 GR_DDNAME(_grUpdateParamIndex); 2499 gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup); 2496 2500 gc->gcFuncs._trisetup_nogradients = (void *) 2497 GR_DDNAME(_trisetup_nogradients); 2498 gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine); 2499 gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint); 2500 gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon); 2501 GR_DDNAME(_trisetup_nogradients); 2502 gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine); 2503 gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint); 2504 gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon); 2501 2505 gc->gcFuncs.grAADrawPolygonVertexList = (void *) 2502 GR_DDNAME(grAADrawPolygonVertexList); 2503 gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle); 2506 GR_DDNAME(grAADrawPolygonVertexList); 2507 gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle); 2504 2508 gc->gcFuncs.grAlphaBlendFunction = (void *) 2505 GR_DDNAME(grAlphaBlendFunction); 2506 gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine); 2509 GR_DDNAME(grAlphaBlendFunction); 2510 gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine); 2507 2511 gc->gcFuncs.grAlphaControlsITRGBLighting = (void *) 2508 GR_DDNAME(grAlphaControlsITRGBLighting); 2512 GR_DDNAME(grAlphaControlsITRGBLighting); 2509 2513 gc->gcFuncs.grAlphaTestFunction = (void *) 2510 GR_DDNAME(grAlphaTestFunction); 2514 GR_DDNAME(grAlphaTestFunction); 2511 2515 gc->gcFuncs.grAlphaTestReferenceValue = (void *) 2512 GR_DDNAME(grAlphaTestReferenceValue); 2513 gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear); 2516 GR_DDNAME(grAlphaTestReferenceValue); 2517 gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear); 2514 2518 gc->gcFuncs.grBufferNumPending = (void *) 2515 GR_DDNAME(grBufferNumPending); 2516 gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap); 2517 gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode); 2518 gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue); 2519 gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow); 2520 gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine); 2521 gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask); 2519 GR_DDNAME(grBufferNumPending); 2520 gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap); 2521 gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode); 2522 gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue); 2523 gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow); 2524 gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine); 2525 gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask); 2522 2526 gc->gcFuncs.grConstantColorValue = (void *) 2523 GR_DDNAME(grConstantColorValue); 2527 GR_DDNAME(grConstantColorValue); 2524 2528 gc->gcFuncs.grConstantColorValue4 = (void *) 2525 GR_DDNAME(grConstantColorValue4); 2526 gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode); 2527 gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel); 2529 GR_DDNAME(grConstantColorValue4); 2530 gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode); 2531 gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel); 2528 2532 gc->gcFuncs.grDepthBufferFunction = (void *) 2529 GR_DDNAME(grDepthBufferFunction); 2533 GR_DDNAME(grDepthBufferFunction); 2530 2534 gc->gcFuncs.grDepthBufferMode = (void *) GR_DDNAME(grDepthBufferMode); 2531 2532 gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask); 2535 2536 gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask); 2533 2537 gc->gcFuncs.grDisableAllEffects = (void *) 2534 GR_DDNAME(grDisableAllEffects); 2535 gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode); 2536 gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine); 2538 GR_DDNAME(grDisableAllEffects); 2539 gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode); 2540 gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine); 2537 2541 gc->gcFuncs.grDrawPlanarPolygon = (void *) 2538 GR_DDNAME(grDrawPlanarPolygon); 2542 GR_DDNAME(grDrawPlanarPolygon); 2539 2543 gc->gcFuncs.grDrawPlanarPolygonVertexList = (void *) 2540 GR_DDNAME(grDrawPlanarPolygonVertexList); 2541 gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint); 2542 gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon); 2544 GR_DDNAME(grDrawPlanarPolygonVertexList); 2545 gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint); 2546 gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon); 2543 2547 gc->gcFuncs.grDrawPolygonVertexList = (void *) 2544 GR_DDNAME(grDrawPolygonVertexList); 2545 gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle); 2546 gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue); 2547 gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode); 2548 gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable); 2548 GR_DDNAME(grDrawPolygonVertexList); 2549 gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle); 2550 gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue); 2551 gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode); 2552 gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable); 2549 2553 gc->gcFuncs.grGammaCorrectionValue = (void *) 2550 GR_DDNAME(grGammaCorrectionValue); 2551 gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState); 2552 gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown); 2554 GR_DDNAME(grGammaCorrectionValue); 2555 gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState); 2556 gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown); 2553 2557 gc->gcFuncs.grLfbConstantAlpha = (void *) 2554 GR_DDNAME(grLfbConstantAlpha); 2558 GR_DDNAME(grLfbConstantAlpha); 2555 2559 gc->gcFuncs.grLfbConstantDepth = (void *) 2556 GR_DDNAME(grLfbConstantDepth); 2560 GR_DDNAME(grLfbConstantDepth); 2557 2561 gc->gcFuncs.grLfbLock = (void *)GR_DDNAME(grLfbLock); 2558 2562 gc->gcFuncs.grLfbUnlock = (void*)GR_DDNAME(grLfbUnlock); 2559 2563 gc->gcFuncs.grLfbWriteColorFormat = (void *) 2560 GR_DDNAME(grLfbWriteColorFormat); 2564 GR_DDNAME(grLfbWriteColorFormat); 2561 2565 gc->gcFuncs.grLfbWriteColorSwizzle = (void *) 2562 GR_DDNAME(grLfbWriteColorSwizzle); 2563 gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer); 2566 GR_DDNAME(grLfbWriteColorSwizzle); 2567 gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer); 2564 2568 gc->gcFuncs.grSstConfigPipeline = (void *) 2565 GR_DDNAME(grSstConfigPipeline); 2566 gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle); 2567 gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy); 2568 gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen); 2569 gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin); 2569 GR_DDNAME(grSstConfigPipeline); 2570 gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle); 2571 gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy); 2572 gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen); 2573 gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin); 2570 2574 gc->gcFuncs.grSstPassthruMode = (void *) GR_DDNAME(grSstPassthruMode); 2571 2572 gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats); 2575 2576 gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats); 2573 2577 gc->gcFuncs.grSstResetPerfStats = (void *) GR_DDNAME(grSstResetPerfStats); 2574 gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus); 2575 gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn); 2576 gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine); 2577 gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode); 2578 gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine); 2578 gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus); 2579 gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn); 2580 gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine); 2581 gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode); 2582 gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine); 2579 2583 gc->gcFuncs.grTexDownloadMipMapLevelPartial = (void *) 2580 GR_DDNAME(grTexDownloadMipMapLevelPartial); 2581 gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode); 2584 GR_DDNAME(grTexDownloadMipMapLevelPartial); 2585 gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode); 2582 2586 gc->gcFuncs.grTexLodBiasValue = (void *) GR_DDNAME(grTexLodBiasValue); 2583 2587 gc->gcFuncs.grTexMipMapMode = (void *) GR_DDNAME(grTexMipMapMode); 2584 gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 2588 gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 2585 2589 gc->gcFuncs.grTexMultibaseAddress = (void *) 2586 GR_DDNAME(grTexMultibaseAddress); 2587 gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable); 2588 gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource); 2589 gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle); 2590 GR_DDNAME(grTexMultibaseAddress); 2591 gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable); 2592 gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource); 2593 gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle); 2590 2594 gc->gcFuncs.guTexSource = (void *) GR_DDNAME(guTexSource); 2591 gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle); 2592 gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom); 2595 gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle); 2596 gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom); 2593 2597 } /* _grInitializeGCFuncs */ 2594 2598 #endif -
trunk/src/opengl/glide/cvg/glide/glfb.c
r2888 r6653 1 /* $Id: glfb.c,v 1.2 2001-09-05 14:30:26 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/glfb.c,v 1. 1 2000-02-25 00:37:39 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/glfb.c,v 1.2 2001-09-05 14:30:26 bird Exp $ 21 22 ** $Log: glfb.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:39 sandervl 23 ** Revision 1.2 2001-09-05 14:30:26 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:39 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 75 6/23/98 5:38p Peter 27 31 ** lfb hinting 28 ** 32 ** 29 33 ** 74 4/29/98 2:49p Peter 30 34 ** fixed debug build 31 ** 35 ** 32 36 ** 73 4/16/98 3:54p Peter 33 37 ** removed cruft 34 ** 38 ** 35 39 ** 72 4/01/98 1:51p Peter 36 40 ** sli origin thing vs grRenderBuffer 37 ** 41 ** 38 42 ** 71 3/31/98 6:09p Peter 39 43 ** sli origin everywhere (I think) and grLfbReadRegion/grRenderBuffer vs 40 44 ** triple buffering 41 ** 45 ** 42 46 ** 70 3/29/98 1:07p Peter 43 47 ** yet another sli origin thing 44 ** 48 ** 45 49 ** 69 3/23/98 5:57p Peter 46 50 ** warning cleanup 47 ** 51 ** 48 52 ** 68 3/18/98 3:04p Peter 49 53 ** cleaner origin swapping hacks 50 ** 54 ** 51 55 ** 67 3/13/98 1:56p Peter 52 56 ** more sli origin swapping 53 ** 57 ** 54 58 ** 66 3/13/98 1:27p Peter 55 59 ** grLfbReadRegion vs triple buffering 56 ** 60 ** 57 61 ** 65 3/09/98 2:24p Peter 58 62 ** change for new pci passthrough interface 59 ** 63 ** 60 64 ** 63 3/02/98 7:23p Peter 61 65 ** clear slop on sli systems when changing y origin 62 ** 66 ** 63 67 ** 62 2/20/98 11:00a Peter 64 68 ** removed glide3 from glid2 tree 65 ** 69 ** 66 70 ** 61 2/11/98 5:26p Peter 67 71 ** new write edge stuff 68 ** 72 ** 69 73 ** 60 2/01/98 7:52p Peter 70 74 ** grLfbWriteRegion byte count problems 71 ** 75 ** 72 76 ** 59 1/30/98 4:31p Peter 73 77 ** general clenaup 74 * 78 * 75 79 * 58 1/16/98 4:18p Atai 76 80 * fixed lfb and grLoadGammaTable 77 * 81 * 78 82 * 57 1/06/98 3:53p Atai 79 83 * remove grHint, modify grLfbWriteRegion and grGet 80 * 84 * 81 85 * 56 12/17/97 4:45p Peter 82 86 * groundwork for CrybabyGlide 83 * 87 * 84 88 * 55 12/15/97 6:04p Atai 85 89 * disable obsolete glide2 api for glide3 86 * 90 * 87 91 * 54 12/15/97 5:54p Peter 88 92 * swizzle reads too 89 * 93 * 90 94 * 53 12/11/97 4:15p Peter 91 95 * mac lfb write region 92 * 96 * 93 97 * 52 12/01/97 5:18p Peter 94 * 98 * 95 99 * 51 11/25/97 12:09p Peter 96 100 * nested calls to grLfbLock vs init code locking on v2 97 * 101 * 98 102 * 50 11/18/97 4:36p Peter 99 103 * chipfield stuff cleanup and w/ direct writes 100 * 104 * 101 105 * 49 11/17/97 4:55p Peter 102 106 * watcom warnings/chipfield stuff 103 * 107 * 104 108 * 48 11/06/97 3:38p Dow 105 109 * More banshee stuff 106 * 110 * 107 111 * 47 11/04/97 5:04p Peter 108 112 * cataclysm part deux 109 * 113 * 110 114 * 46 11/03/97 3:43p Peter 111 115 * h3/cvg cataclysm 112 * 116 * 113 117 * 45 10/27/97 11:10a Peter 114 118 * starting cleanup 115 * 119 * 116 120 * 44 10/09/97 8:02p Dow 117 121 * State Monster 1st Cut 118 * 122 * 119 123 * 43 10/08/97 5:18p Peter 120 124 * fixed grLfbLock wrt writemode_any 121 * 125 * 122 126 * 42 10/08/97 11:33a Peter 123 127 * hmmmm.... 124 * 128 * 125 129 * 41 9/30/97 1:03p Peter 126 130 * more debugging code 127 * 131 * 128 132 * 40 9/25/97 1:35p Peter 129 * 133 * 130 134 * 39 9/24/97 4:09p Peter 131 135 * lfb/idle fixes 132 * 136 * 133 137 * 38 9/24/97 1:31p Peter 134 138 * assert if grXX call inside lock/unlock 135 * 139 * 136 140 * 37 9/20/97 10:54a Peter 137 141 * naked lfb writes 138 * 142 * 139 143 * 36 9/15/97 7:31p Peter 140 144 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 141 145 * place, lfb's are on, Hmmmm.. probably more 142 * 146 * 143 147 * 35 9/10/97 10:13p Peter 144 148 * fifo logic from GaryT, non-normalized fp first cut 145 * 149 * 146 150 ** 147 151 */ … … 204 208 -------------------------------------------------------------------*/ 205 209 206 GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer, 207 GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, 208 FxBool pixelPipeline, GrLfbInfo_t *info)) 210 GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer, 211 GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, 212 FxBool pixelPipeline, GrLfbInfo_t *info)) 209 213 { 210 214 #define FN_NAME "grLfbLock" … … 215 219 FxBool swizzleByteP = FXFALSE; 216 220 #endif /* (GLIDE_PLATFORM & GLIDE_OS_MACOS) && SET_BSWAP */ 217 221 218 222 GR_BEGIN_NOFIFOCHECK("grLfbLock", 87); 219 GDBG_INFO_MORE(gc->myLevel,"(%d, %d, %d, %d, %d)\n", 223 GDBG_INFO_MORE(gc->myLevel,"(%d, %d, %d, %d, %d)\n", 220 224 type, buffer, writeMode, origin, pixelPipeline); 221 225 … … 235 239 } else { 236 240 lfbMode = gc->state.fbi_config.lfbMode; 237 lfbMode &= ~(SST_LFB_READBUFSELECT | 241 lfbMode &= ~(SST_LFB_READBUFSELECT | 238 242 SST_LFB_YORIGIN); 239 243 240 244 switch(buffer) { 241 245 case GR_BUFFER_FRONTBUFFER: … … 252 256 253 257 default: 254 GR_CHECK_F(myName, 255 1, 258 GR_CHECK_F(myName, 259 1, 256 260 "illegal buffer parameter passed"); 257 261 rv = FXFALSE; … … 275 279 276 280 case GR_LFB_WRITE_ONLY: 277 { 281 { 278 282 if (gc->lockPtrs[type] != (FxU32)-1) { 279 283 GDBG_INFO(83, "Write failure due to existing lock"); … … 282 286 /* Set up the constant depth register because it may have 283 287 * been trashed by a call to grDepthBiasLevel 284 * (depthbiaslevel and constant depth use the same register) 288 * (depthbiaslevel and constant depth use the same register) 285 289 */ 286 290 zaColor = gc->state.fbi_config.zaColor; … … 291 295 fbzMode = gc->state.fbi_config.fbzMode; 292 296 fbzMode &= ~(SST_ENZBIAS); 293 297 294 298 lfbMode = gc->state.fbi_config.lfbMode; 295 299 lfbMode &= ~(SST_LFB_WRITEBUFSELECT | … … 297 301 SST_LFB_FORMAT | 298 302 SST_LFB_ENPIXPIPE); 299 303 300 304 switch(writeMode) { 301 305 case GR_LFBWRITEMODE_RESERVED1: … … 315 319 : GR_LFBWRITEMODE_565); 316 320 } 317 321 318 322 switch(buffer) { 319 323 case GR_BUFFER_FRONTBUFFER: … … 353 357 } 354 358 gc->state.fbi_config.lfbMode = lfbMode; 355 359 356 360 info->origin = origin; 357 361 info->writeMode = writeMode; … … 368 372 if (!gc->cmdTransportInfo.fifoLfbP) lfbMode |= SST_LFB_WRITE_SWAP16; 369 373 #endif /* (GLIDE_PLATFORM & GLIDE_OS_MACOS) */ 370 374 371 375 switch(lfbMode & SST_LFB_FORMAT) { 372 376 case SST_LFB_565: … … 407 411 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && !GLIDE_INIT_HAL 408 412 /* If the cmd fifo has been turned off before then make sure its 409 * on again before trying to dork w/ the modes etc. 413 * on again before trying to dork w/ the modes etc. 410 414 */ 411 415 if (lfbLockCount > 0) { … … 437 441 case GR_LFB_WRITE_ONLY: 438 442 REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 3, 0x103); 439 { 443 { 440 444 REG_GROUP_SET(hw, fbzMode, fbzMode); 441 445 REG_GROUP_SET(hw, lfbMode, lfbMode); … … 478 482 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && !GLIDE_INIT_HAL 479 483 sst1InitLfbLock((FxU32*)hw); 480 484 481 485 #if GLIDE_DEBUG || GLIDE_CHECK_COMPATABILITY 482 486 grHints(GR_HINT_LFB_PROTECT, info->strideInBytes); 483 487 #endif /* GLIDE_DEBUG || GLIDE_CHECK_COMPATABILITY */ 484 488 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && !GLIDE_INIT_HAL */ 485 489 486 490 /* Increment lock count */ 487 491 gc->cmdTransportInfo.lfbLockCount = lfbLockCount + 1; … … 492 496 #undef FN_NAME 493 497 } /* grLfbLock */ 494 498 495 499 /*------------------------------------------------------------------- 496 500 Function: grLfbUnlock … … 502 506 Arguments: 503 507 type - type of lock (read only/write only) 504 buffer - which buffer to unlock 508 buffer - which buffer to unlock 505 509 Return: 506 510 FXTRUE - success … … 512 516 #define FN_NAME "grLfbUnlock" 513 517 FxBool rval = FXFALSE; 514 518 515 519 GR_BEGIN_NOFIFOCHECK("grLfbUnLock", 87); 516 520 GDBG_INFO_MORE(gc->myLevel,"(%d, %d)\n", type, buffer); 517 521 518 522 type = type & ~(GR_LFB_NOIDLE); 519 520 GR_CHECK_COMPATABILITY(FN_NAME, 523 524 GR_CHECK_COMPATABILITY(FN_NAME, 521 525 type != GR_LFB_WRITE_ONLY && 522 526 type != GR_LFB_READ_ONLY, 523 527 "Bad type"); 524 525 GR_CHECK_COMPATABILITY(FN_NAME, 528 529 GR_CHECK_COMPATABILITY(FN_NAME, 526 530 buffer != GR_BUFFER_FRONTBUFFER && 527 531 buffer != GR_BUFFER_BACKBUFFER && … … 529 533 "Bad buffer"); 530 534 531 #if ((GLIDE_PLATFORM & GLIDE_HW_SST1) || (GLIDE_PLATFORM & GLIDE_HW_CVG)) 535 #if ((GLIDE_PLATFORM & GLIDE_HW_SST1) || (GLIDE_PLATFORM & GLIDE_HW_CVG)) 532 536 if (gc->lockPtrs[type] == (FxU32)buffer) { 533 537 rval = FXTRUE; … … 541 545 /* If there are no more outstanding lfb locks, then turn the 542 546 * fifo back on before we do anything else otherwise just 543 * return w/ the new lock count. 547 * return w/ the new lock count. 544 548 */ 545 549 gc->cmdTransportInfo.lfbLockCount--; … … 556 560 } 557 561 } 558 562 559 563 GR_SET_EXPECTED_SIZE(8 + MaskSelect(gc->scanline_interleaved, sizeof(FxU32)), 560 564 2 + gc->scanline_interleaved); … … 562 566 /* Restore depth bias level */ 563 567 GR_SET(BROADCAST_ID, hw, zaColor, gc->state.fbi_config.zaColor); 564 568 565 569 /* turn back on depth biasing */ 566 570 GR_SET(BROADCAST_ID, hw, fbzMode, gc->state.fbi_config.fbzMode); 567 571 568 572 if (gc->scanline_interleaved) GR_SET(BROADCAST_ID, hw, nopCMD, 0x0); 569 573 } … … 609 613 GR_SET(BROADCAST_ID, hw, lfbMode, lfbMode); 610 614 gc->state.fbi_config.lfbMode = lfbMode; 611 615 612 616 if (sliP) GR_SET(BROADCAST_ID, hw, nopCMD, 0x0); 613 617 } … … 654 658 GR_SET(BROADCAST_ID, hw, lfbMode, lfbMode); 655 659 gc->state.fbi_config.lfbMode = lfbMode; 656 660 657 661 if (sliP) GR_SET(BROADCAST_ID, hw, nopCMD, 0x0); 658 662 } … … 666 670 FxBool 667 671 _grLfbWriteRegion(FxBool pixPipelineP, 668 GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, 669 GrLfbSrcFmt_t src_format, 670 FxU32 src_width, FxU32 src_height, 672 GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, 673 GrLfbSrcFmt_t src_format, 674 FxU32 src_width, FxU32 src_height, 671 675 FxI32 src_stride, void *src_data) 672 676 { … … 675 679 GrLfbInfo_t info; 676 680 GrLfbWriteMode_t writeMode; 677 681 678 682 GR_BEGIN_NOFIFOCHECK("_grLfbWriteRegion", 82); 679 683 GDBG_INFO_MORE(gc->myLevel, 680 "(0x%x, %s, %d, %d, %d, %d, %d, %d, 0x%x)\n", 684 "(0x%x, %s, %d, %d, %d, %d, %d, %d, 0x%x)\n", 681 685 dst_buffer, 682 686 (pixPipelineP ? "Enable" : "Disable"), 683 dst_x, dst_y, 687 dst_x, dst_y, 684 688 src_format, src_width, src_height, 685 689 src_stride, src_data); 686 687 if (src_format == GR_LFB_SRC_FMT_RLE16) 690 691 if (src_format == GR_LFB_SRC_FMT_RLE16) 688 692 writeMode = GR_LFBWRITEMODE_565; 689 else 693 else 690 694 writeMode = src_format; 691 695 692 696 gc->cmdTransportInfo.fifoLfbP = FXTRUE; 693 697 info.size = sizeof(info); 694 695 if (grLfbLock(GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE, 696 dst_buffer, 698 699 if (grLfbLock(GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE, 700 dst_buffer, 697 701 writeMode, 698 702 GR_ORIGIN_UPPER_LEFT, … … 716 720 dstData = (FxU32*)(((FxU8*)info.lfbPtr) + (dst_y * info.strideInBytes)); 717 721 #endif 718 722 719 723 srcData = (FxU32*)src_data; 720 724 scanline = src_height; 721 725 722 726 switch(src_format) { 723 727 /* 16-bit aligned */ … … 736 740 GR_ASSERT(((FxU32)dstData & 0x03UL) == 0); 737 741 end = (FxU32*)((char*)srcData + length - 2); 738 742 739 743 if (srcData < end) { 740 744 LINEAR_WRITE_BEGIN(length >> 2, kLinearWriteLFB, dstData, 0x00, 0x00); … … 746 750 LINEAR_WRITE_END(); 747 751 } 748 752 749 753 if ((length & 0x3) != 0x00) { 750 754 LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, *(FxU16*)srcData, sizeof(FxU16)); … … 752 756 srcData = (FxU32*)(((FxU16*)srcData) + 1); 753 757 } 754 758 755 759 dstData = (FxU32*)(((char*)dstData) + dstJump); 756 760 srcData = (FxU32*)(((char*)srcData) + srcJump); … … 761 765 end = (FxU32*)((char*)srcData + length); 762 766 763 LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, 767 LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, 764 768 *(FxU16*)srcData, sizeof(FxU16)); 765 769 dstData = (FxU32*)(((FxU16*)dstData) + 1); 766 770 srcData = (FxU32*)(((FxU16*)srcData) + 1); 767 771 768 772 if (srcData < end) { 769 773 const FxU32 numWords = (((FxU32)end - (FxU32)srcData) >> 2); … … 778 782 LINEAR_WRITE_END(); 779 783 } 780 784 781 785 if ((length & 0x03) == 0) { 782 LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, 786 LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, 783 787 *(FxU16*)srcData, sizeof(FxU16)); 784 788 dstData = (FxU32*)(((FxU16*)dstData) + 1); 785 789 srcData = (FxU32*)(((FxU16*)srcData) + 1); 786 790 } 787 791 788 792 dstData = (FxU32*)(((char*)dstData) + dstJump); 789 793 srcData = (FxU32*)(((char*)srcData) + srcJump); … … 804 808 while(scanline--) { 805 809 end = (FxU32*)((char*)srcData + length); 806 810 807 811 LINEAR_WRITE_BEGIN(src_width, 808 812 kLinearWriteLFB, … … 815 819 } 816 820 LINEAR_WRITE_END(); 817 821 818 822 dstData = (FxU32*)(((char*)dstData)+dstJump); 819 823 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 845 849 dst_x,dst_y - destination image start coordinates 846 850 src_format - data format of source image 847 src_width, src_height 851 src_width, src_height 848 852 - dimensions of source image 849 853 src_stride - stride of source image in bytes, not meaningful 850 854 for RLE images 851 src_data - pointer to source data memory 855 src_data - pointer to source data memory 852 856 Return: 853 857 FXTRUE succeed 854 858 FXFALSE fail 855 859 -------------------------------------------------------------------*/ 856 GR_ENTRY(grLfbWriteRegion, FxBool, (GrBuffer_t dst_buffer, 857 FxU32 dst_x, FxU32 dst_y, 858 GrLfbSrcFmt_t src_format, 859 FxU32 src_width, FxU32 src_height, 860 GR_ENTRY(grLfbWriteRegion, FxBool, (GrBuffer_t dst_buffer, 861 FxU32 dst_x, FxU32 dst_y, 862 GrLfbSrcFmt_t src_format, 863 FxU32 src_width, FxU32 src_height, 860 864 FxI32 src_stride, void *src_data)) 861 865 { 862 866 FxBool rv = FXTRUE; 863 867 864 868 GR_BEGIN_NOFIFOCHECK("grLfbWriteRegion",82); 865 869 GDBG_INFO_MORE(gc->myLevel, 866 "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n", 867 dst_buffer, dst_x, dst_y, 870 "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n", 871 dst_buffer, dst_x, dst_y, 868 872 src_format, src_width, src_height, 869 873 src_stride, src_data); 870 874 871 875 rv = _grLfbWriteRegion(FXFALSE, dst_buffer, dst_x, dst_y, 872 876 src_format, src_width, src_height, … … 884 888 Grab a rectangle from the frame buffer into user supplied memory 885 889 Arguments: 886 src_buffer - buffer to read from 890 src_buffer - buffer to read from 887 891 src_x - x coordinate of upper left corner rectangle to read 888 892 src_y - y coordinate of upper left corner of rectangle to read … … 895 899 FXFALSE - failure 896 900 -------------------------------------------------------------------*/ 897 GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer, 898 FxU32 src_x, FxU32 src_y, 899 FxU32 src_width, FxU32 src_height, 901 GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer, 902 FxU32 src_x, FxU32 src_y, 903 FxU32 src_width, FxU32 src_height, 900 904 FxU32 dst_stride, void *dst_data)) 901 905 { … … 903 907 FxBool rv = FXTRUE; 904 908 GrLfbInfo_t info; 905 909 906 910 GR_BEGIN_NOFIFOCHECK("grLfbReadRegion", 82); 907 911 GDBG_INFO_MORE(gc->myLevel, … … 910 914 src_width, src_height, dst_stride, dst_data); 911 915 912 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 916 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 913 917 #define kTileSize (32 * sizeof(FxU16)) 914 918 #define kTileMask (kTileSize - 1) … … 920 924 ((src_buffer == GR_BUFFER_FRONTBUFFER) && (gc->hwDep.cvgDep.frontBuf == 2)))); 921 925 922 if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr, 923 gc->grColBuf, 926 if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr, 927 gc->grColBuf, 924 928 0); 925 929 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */ 926 930 927 931 info.size = sizeof(info); 928 932 if (grLfbLock(GR_LFB_READ_ONLY, … … 938 942 FxU32 length; /* bytes to copy in scanline */ 939 943 FxU32 scanline; /* scanline number */ 940 944 941 945 dstData = (FxU32*)dst_data; 942 946 srcData = (const FxU32*)((FxU8*)info.lfbPtr + … … 948 952 srcJump = info.strideInBytes - length; 949 953 950 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 954 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 951 955 /* Voodoo2 has a problem reading from the frame buffer if we are 952 956 * triple buffering and the triple buffer is the currently … … 994 998 /* Copying the logical 1 tile. This may require us to go 995 999 * 'backwards' in physical memory if there was no logical 996 * 0 tile in the current read. 1000 * 0 tile in the current read. 997 1001 */ 998 1002 tilePtr = (const FxU32*)(((FxU32)srcData - tileSlopAdjust) & tileSlopMask); 999 tileEnd = (const FxU32*)MIN((((FxU32)tilePtr + kTileSize) & ~kTileMask), 1003 tileEnd = (const FxU32*)MIN((((FxU32)tilePtr + kTileSize) & ~kTileMask), 1000 1004 (FxU32)end - kTileSize - sizeof(FxU16)); 1001 1005 tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x03UL); … … 1008 1012 tilePtr = (const FxU32*)((FxU8*)tilePtr + sizeof(FxU16)); 1009 1013 } 1010 1014 1011 1015 /* Copy the remainder of the logical 1 tile */ 1012 1016 while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++); 1013 if (tileEnd != tileEndAlign) 1017 if (tileEnd != tileEndAlign) 1014 1018 *(FxU16*)dstData = GR_GET16(*tilePtr); 1015 1019 } 1016 1020 1017 1021 srcData = (const FxU32*)(((FxU32)srcData + (kTileSize << 1)) & ~kPageMask); 1018 1022 } … … 1026 1030 tileEnd = (const FxU32*)((FxU32)tilePtr + kTileSize); 1027 1031 while(tilePtr < tileEnd) *dstData++ = GR_GET(*tilePtr++); 1028 1032 1029 1033 tilePtr = srcData; 1030 1034 tileEnd = (const FxU32*)((FxU32)tilePtr + kTileSize); … … 1038 1042 if (srcData < end) { 1039 1043 const FxU32* startTileAddr = (const FxU32*)((FxU32)srcData + kTileSize); 1040 1044 1041 1045 tilePtr = startTileAddr; 1042 tileEnd = (const FxU32*)((FxU32)startTileAddr + 1046 tileEnd = (const FxU32*)((FxU32)startTileAddr + 1043 1047 MIN(kTileSize, ((FxU32)end - (FxU32)srcData))); 1044 1048 tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x3); 1045 1049 1046 1050 while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++); 1047 if (tileEnd != tileEndAlign) 1051 if (tileEnd != tileEndAlign) 1048 1052 *(FxU16*)dstData = GR_GET16(*tilePtr); 1049 1053 1050 1054 if (startTileAddr < end) { 1051 1055 tilePtr = srcData; 1052 tileEnd = (const FxU32*)((FxU8*)tilePtr + kTileSize - 1056 tileEnd = (const FxU32*)((FxU8*)tilePtr + kTileSize - 1053 1057 ((FxU32)tileEndAlign - (FxU32)end)); 1054 1058 tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x3); 1055 1059 1056 1060 while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++); 1057 if (tileEnd != tileEndAlign) 1061 if (tileEnd != tileEndAlign) 1058 1062 *(FxU16*)dstData = GR_GET16(*tilePtr); 1059 1063 } … … 1065 1069 } 1066 1070 } else 1067 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */ 1071 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */ 1068 1072 /* If the source data is aligned for 4 byte pci reads */ 1069 1073 if (((FxU32)srcData & 0x02UL) == 0) { 1070 1074 while(scanline--) { 1071 1075 const FxU32* end = (const FxU32*)((char*)srcData + length - 2); 1072 1076 1073 1077 while(srcData < end) { 1074 1078 *dstData++ = GR_GET(*srcData++); 1075 1079 } 1076 1080 1077 1081 if (((int)length) & 0x2) { 1078 1082 (*(FxU16*)dstData) = GR_GET16(*srcData); … … 1080 1084 srcData = (FxU32*)(((FxU16*)srcData) + 1); 1081 1085 } 1082 1086 1083 1087 dstData = (FxU32*)(((char*)dstData)+dstJump); 1084 1088 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 1101 1105 srcData = (FxU32*)(((FxU16*)srcData) + 1); 1102 1106 } 1103 1107 1104 1108 dstData = (FxU32*)(((char*)dstData)+dstJump); 1105 1109 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 1112 1116 } 1113 1117 1114 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 1115 if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr, 1116 gc->grColBuf, 1118 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 1119 if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr, 1120 gc->grColBuf, 1117 1121 gc->grAuxBuf); 1118 1122 } -
trunk/src/opengl/glide/cvg/glide/gmovie.c
r2888 r6653 1 /* $Id: gmovie.c,v 1.2 2001-09-05 14:30:26 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gmovie.c,v 1. 1 2000-02-25 00:37:40 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gmovie.c,v 1.2 2001-09-05 14:30:26 bird Exp $ 21 22 ** $Log: gmovie.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:40 sandervl 23 ** Revision 1.2 2001-09-05 14:30:26 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:40 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 6 8/30/97 5:59p Tarolli 27 31 * cleanups 28 * 32 * 29 33 * 5 5/27/97 1:16p Peter 30 * Basic cvg, w/o cmd fifo stuff. 31 * 34 * Basic cvg, w/o cmd fifo stuff. 35 * 32 36 * 4 5/21/97 6:05a Peter 33 * 37 * 34 38 * 3 3/09/97 10:31a Dow 35 39 * Added GR_DIENTRY for di glide functions -
trunk/src/opengl/glide/cvg/glide/gpci.c
r2888 r6653 1 /* $Id: gpci.c,v 1.2 2001-09-05 14:30:27 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gpci.c,v 1. 1 2000-02-25 00:37:40 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gpci.c,v 1.2 2001-09-05 14:30:27 bird Exp $ 21 22 ** $Log: gpci.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:40 sandervl 23 ** Revision 1.2 2001-09-05 14:30:27 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:40 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 110 6/30/98 6:08p Jeske 27 31 ** fixed bug where we tried to setup MTRRs on old (<p6) systems which 28 ** didn't have them. 29 ** 32 ** didn't have them. 33 ** 30 34 ** 109 5/21/98 5:52p Peter 31 35 ** mismatched pairs 32 ** 36 ** 33 37 ** 108 5/20/98 3:51p Peter 34 38 ** no fifo glide 35 ** 39 ** 36 40 ** 107 5/18/98 12:15p Peter 37 41 ** better point code 38 ** 42 ** 39 43 ** 106 4/21/98 5:53p Peter 40 44 ** slidetect vs hw pointers 41 ** 45 ** 42 46 ** 105 4/08/98 3:52p Peter 43 47 ** point coordinate truncation 44 ** 48 ** 45 49 ** 104 4/06/98 9:55a Peter 46 50 ** sli slave detection for oem dll 47 ** 51 ** 48 52 ** 103 3/17/98 6:50p Peter 49 53 ** sli paired vs active 50 ** 54 ** 51 55 ** 102 3/17/98 3:00p Peter 52 56 ** removed unused stats 53 ** 57 ** 54 58 ** 101 3/13/98 5:08p Peter 55 59 ** doh, got it backwards 56 ** 60 ** 57 61 ** 100 3/13/98 3:39p Peter 58 62 ** voodoo1.5 silliness 59 ** 63 ** 60 64 ** 99 2/20/98 9:05a Peter 61 65 ** removed remnants of comdex grot 62 ** 66 ** 63 67 ** 98 2/11/98 5:25p Peter 64 68 ** detection dialog fixes 65 ** 69 ** 66 70 ** 97 1/30/98 4:51p Peter 67 71 ** fixed sli-detect for multiple pairs 68 ** 72 ** 69 73 ** 96 1/30/98 4:27p Peter 70 74 ** no uswc for sli slave 71 ** 75 ** 72 76 ** 95 1/24/98 12:29p Peter 73 77 ** more caching fun 74 ** 78 ** 75 79 ** 94 1/20/98 11:03a Peter 76 80 ** env var to force triple buffering 77 * 81 * 78 82 * 93 1/16/98 5:41p Peter 79 83 * fixed sense of lod_dither 80 * 84 * 81 85 * 92 1/14/98 10:22a Peter 82 86 * no more hacks 83 * 87 * 84 88 * 91 1/08/98 7:09p Peter 85 89 * real hw stuff modulo makefile change 86 * 90 * 87 91 * 90 1/07/98 11:18a Atai 88 92 * remove GrMipMapInfo and GrGC.mm_table in glide3 89 * 93 * 90 94 * 89 1/07/98 10:22a Peter 91 95 * lod dithering env var 92 * 96 * 93 97 * 88 12/17/97 10:08a Peter 94 98 * fast system comdex twiddling 95 * 99 * 96 100 * 87 12/09/97 4:20p Peter 97 101 * 0x100 fbiRev ofset for v2 98 * 102 * 99 103 * 86 12/09/97 12:20p Peter 100 104 * mac glide port 101 * 105 * 102 106 * 85 12/05/97 4:26p Peter 103 107 * watcom warnings 104 * 108 * 105 109 * 84 12/03/97 2:36p Peter 106 110 * upped comdex reset defaults 107 * 111 * 108 112 * 83 12/02/97 9:48a Dow 109 113 * Removed some spurious code I inadvertantly added. 110 * 114 * 111 115 * 82 11/21/97 6:24p Dow 112 116 * Banshee Lying about being Rush stuf 113 * 117 * 114 118 * 81 11/21/97 11:19a Dow 115 119 * Made Banshee report Voodoo2 116 * 120 * 117 121 * 80 11/20/97 6:39p Peter 118 122 * fixed direct_exec w/ csim 119 * 123 * 120 124 * 79 11/19/97 2:49p Peter 121 125 * env vars in registry for win32 122 * 126 * 123 127 * 78 11/17/97 4:55p Peter 124 128 * watcom warnings/chipfield stuff 125 * 129 * 126 130 * 77 11/15/97 7:43p Peter 127 131 * more comdex silliness 128 * 132 * 129 133 * 76 11/14/97 11:10p Peter 130 134 * open vs hw init confusion 131 * 135 * 132 136 * 75 11/14/97 5:02p Peter 133 137 * more comdex stuff 134 * 138 * 135 139 * 74 11/14/97 12:09a Peter 136 140 * comdex thing and some other stuff 137 * 141 * 138 142 * 73 11/12/97 9:54p Peter 139 143 * fixed all the muckage from new config 140 * 144 * 141 145 * 72 11/12/97 9:37p Dow 142 146 * Textures on Banshee half work 143 * 147 * 144 148 * 71 11/12/97 9:22a Dow 145 149 * h3 mods 146 * 150 * 147 151 * 70 11/08/97 3:34p Peter 148 152 * fixed stupid gdbg_info crasher 149 * 153 * 150 154 * 69 11/04/97 4:00p Dow 151 155 * Banshee Mods 152 * 156 * 153 157 * 68 11/03/97 3:43p Peter 154 158 * h3/cvg cataclysm 155 * 159 * 156 160 * 67 11/01/97 12:11p Pgj 157 161 * glide.dll ---> glide2x.dll 158 * 162 * 159 163 * 66 10/31/97 8:53a Peter 160 164 * last lying change, really 161 * 165 * 162 166 * 65 10/30/97 3:42p Peter 163 167 * protected the last bit of nonsense 164 * 168 * 165 169 * 64 10/30/97 3:37p Peter 166 170 * spoof sst1 167 * 171 * 168 172 * 63 10/29/97 2:45p Peter 169 173 * C version of Taco's packing code 170 * 174 * 171 175 * 62 10/23/97 5:28p Peter 172 176 * sli fifo thing 173 * 177 * 174 178 * 61 9/15/97 7:31p Peter 175 179 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 176 180 * place, lfb's are on, Hmmmm.. probably more 177 * 181 * 178 182 * 60 9/10/97 10:13p Peter 179 183 * fifo logic from GaryT, non-normalized fp first cut 180 * 184 * 181 185 * 59 9/05/97 5:29p Peter 182 186 * changes for direct hw 183 * 187 * 184 188 * 58 9/01/97 3:18p Peter 185 189 * correct integer rounding for pts 186 * 190 * 187 191 * 57 8/30/97 5:59p Tarolli 188 192 * init and hal fixups 189 * 193 * 190 194 * 56 8/30/97 1:19p Peter 191 195 * first cut at using blit to clear, more to come to do inner rects 192 * 196 * 193 197 * 55 8/18/97 3:52p Peter 194 198 * pre-hw arrival fixes/cleanup 195 * 199 * 196 200 * 54 7/30/97 2:42p Peter 197 201 * shared and sanitized 198 * 202 * 199 203 * 53 7/28/97 2:41p Peter 200 204 * turned sli code back on for cvg, but waiting for hal 201 * 205 * 202 206 * 52 7/25/97 11:40a Peter 203 207 * removed dHalf, change field name to match real use for cvg 204 * 208 * 205 209 * 51 7/08/97 2:47p Peter 206 210 * fixed merge stupidity from last checkin 207 * 211 * 208 212 * 50 7/02/97 12:28p Peter 209 213 * removed spurious NOP, tex dl 210 * 214 * 211 215 * 49 6/24/97 4:02p Peter 212 216 * proper cmd fifo placement 213 * 217 * 214 218 * 48 6/23/97 4:46p Peter 215 219 * fixed my ,uckage … … 234 238 #include <windows.h> 235 239 236 BOOL WINAPI 237 DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) 240 BOOL WINAPI 241 DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) 238 242 { 239 243 switch( ul_reason_for_call ) { … … 255 259 break; 256 260 } 257 261 258 262 return TRUE; 259 263 … … 270 274 Discover devices on the PCI bus. 271 275 Discover configuration of detected devices. 272 Initialize all Glide GC's 276 Initialize all Glide GC's 273 277 274 278 Recognized devices depend upon compile time flags 275 279 276 This code should NOT initialize the hardware 277 any more than is necessary for discovery of 280 This code should NOT initialize the hardware 281 any more than is necessary for discovery of 278 282 configuration 279 283 280 284 Arguments: none 281 Return: 285 Return: 282 286 FXTRUE - at least one device was detected 283 287 FXFALSE - no devices were detected. 284 288 -------------------------------------------------------------------*/ 285 FxBool 289 FxBool 286 290 _grSstDetectResources(void) 287 291 { … … 301 305 #endif /* !GLIDE_INIT_HAL */ 302 306 303 /* The first time through the init code we need to map 307 /* The first time through the init code we need to map 304 308 * all of the boards. Future calls can just grab this 305 309 * info out of the halInfo that we have here. … … 317 321 ? 4 318 322 : atol(GETENV("FX_GLIDE_HW_REV"))); 319 323 320 324 for(ctx = device = 0; device < count; device++) { 321 325 const FxDeviceInfo* curDev = NULL; … … 336 340 #endif /* !GLIDE_INIT_HAL */ 337 341 338 if ((devRegs != NULL) && 342 if ((devRegs != NULL) && 339 343 (curDev != NULL) && 340 344 (curDev->fbiRevision >= hwRevNum)) { … … 342 346 FxU32 i; 343 347 344 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 348 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 345 349 /* Internally we always keep the real type. */ 346 350 hwConfig->SSTs[ctx].type = GR_SSTTYPE_Voodoo2; … … 358 362 * happy, in win95. However, if this is the slave of an sli 359 363 * pair then we don't want to waste mtrr's that we're never 360 * really going to write to. 364 * really going to write to. 361 365 */ 362 366 if (!inSliPairP && (_GlideRoot.CPUType >= 6)) { 363 364 367 sst1InitCaching((FxU32*)devRegs, FXTRUE); 368 } 365 369 366 370 if (!sst1InitRegisters((FxU32*)devRegs) || … … 378 382 _GlideRoot.GCs[ctx].grSstRez = GR_RESOLUTION_NONE; 379 383 _GlideRoot.GCs[ctx].grSstRefresh = curDev->fbiVideoRefresh; 380 384 381 385 /* Chip configuration */ 382 386 _GlideRoot.GCs[ctx].num_tmu = curDev->numberTmus; … … 386 390 if (!inSliPairP) { 387 391 _GlideRoot.gcMap[curSstNum] = _GlideRoot.gcNum; 388 392 389 393 /* Voodoo^2 glide2x returns that it is an sst1, but the 390 394 * revision is bumped so that developers can really tell. 391 395 * Additionally, we now have the fun on Voodoo^1.5 which is 392 * just a Voodoo^2 in a 2200 configuration. 396 * just a Voodoo^2 in a 2200 configuration. 393 397 */ 394 hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.fbiRev = (curDev->fbiRevision + 398 hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.fbiRev = (curDev->fbiRevision + 395 399 ((curDev->numberTmus == 1) 396 ? 0x080 400 ? 0x080 397 401 : 0x100)); 398 402 399 403 hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.fbRam = curDev->fbiMemSize; 400 404 hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.nTexelfx = curDev->numberTmus; … … 403 407 for(i = 0; i < curDev->numberTmus; i++) { 404 408 const FxU32 curTmuMemSize = curDev->tmuMemSize[i]; 405 409 406 410 hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.tmuConfig[i].tmuRev = curDev->tmuRevision; 407 411 hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.tmuConfig[i].tmuRam = curTmuMemSize; … … 414 418 for(i = 0; i < curDev->numberTmus; i++) { 415 419 const FxU32 curTmuMemSize = curDev->tmuMemSize[i]; 416 420 417 421 memset(&_GlideRoot.GCs[ctx].tmu_state[i], 0, sizeof(_GlideRoot.GCs[ctx].tmu_state[i])); 418 422 _GlideRoot.GCs[ctx].tmu_state[i].total_mem = (curTmuMemSize << 20); 419 420 _GlideRoot.GCs[ctx].tmu_state[i].ncc_mmids[0] = 423 424 _GlideRoot.GCs[ctx].tmu_state[i].ncc_mmids[0] = 421 425 _GlideRoot.GCs[ctx].tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE; 422 426 } … … 425 429 * until after the boards are paired w/ sst1InitSli which we 426 430 * have not yet done. Currently we assume that the next 427 * discovered board will be the slave. 431 * discovered board will be the slave. 428 432 */ 429 433 _GlideRoot.GCs[ctx].scanline_interleaved = curDev->sliDetected; … … 468 472 _GlideRoot.gcNum++; 469 473 _GlideRoot.GCs[ctx].hwInitP = FXTRUE; 470 474 471 475 rv = FXTRUE; 472 476 ctx++; … … 500 504 #else 501 505 # error "Write code for this chip" 502 #endif 503 506 #endif 507 504 508 return rv; 505 509 } /* _grSstDetectResources */ … … 513 517 int tmuNum; 514 518 515 GDBG_INFO(80,"SST board %d: 3Dfx Voodoo%s\n", 519 GDBG_INFO(80,"SST board %d: 3Dfx Voodoo%s\n", 516 520 i, ((hwc->SSTs[i].type == GR_SSTTYPE_VOODOO) ? " Graphics" : "^2")); 517 521 if (hwc->SSTs[i].sstBoard.VoodooConfig.sliDetect) { … … 597 601 ? 0x00UL 598 602 : SST_TLODDITHER); 599 603 600 604 _GlideRoot.environment.nColorBuffer = GLIDE_GETENV("FX_GLIDE_ALLOC_COLOR", -1L); 601 _GlideRoot.environment.nAuxBuffer = GLIDE_GETENV("FX_GLIDE_ALLOC_AUX", -1L); 605 _GlideRoot.environment.nAuxBuffer = GLIDE_GETENV("FX_GLIDE_ALLOC_AUX", -1L); 602 606 _GlideRoot.environment.swFifoLWM = GLIDE_GETENV("FX_GLIDE_LWM", -1L); 603 607 … … 606 610 _GlideRoot.environment.swapInterval = 0; 607 611 } 608 612 609 613 _GlideRoot.environment.snapshot = GLIDE_GETENV("FX_SNAPSHOT", 0); 610 614 611 615 GDBG_INFO(80," triBoundsCheck: %d\n",_GlideRoot.environment.triBoundsCheck); 612 616 GDBG_INFO(80," swapInterval: %d\n",_GlideRoot.environment.swapInterval); … … 637 641 char s[128]; 638 642 const char* errStr = s; 639 643 640 644 if (pciGetErrorCode() == PCI_ERR_NOERR) { 641 645 #ifndef __linux__ … … 649 653 errStr = pciGetErrorString(); 650 654 } 651 655 652 656 GrErrorCallback(errStr, FXTRUE); 653 657 } 654 658 655 659 /* GMT: this isn't really necessary since GlideRoot is static */ 656 660 for (i = 0; i < _GlideRoot.hwConfig.num_sst; i++) { … … 658 662 displayBoardInfo(i, &_GlideRoot.hwConfig); 659 663 } 660 664 661 665 _grMipMapInit(); 662 666 _GlideRoot.initialized = hwDetectP; /* save this for the end */ -
trunk/src/opengl/glide/cvg/glide/gsplash.c
r2888 r6653 1 /* $Id: gsplash.c,v 1.2 2001-09-05 14:30:27 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gsplash.c,v 1. 1 2000-02-25 00:37:41 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gsplash.c,v 1.2 2001-09-05 14:30:27 bird Exp $ 21 22 ** $Log: gsplash.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:41 sandervl 23 ** Revision 1.2 2001-09-05 14:30:27 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:41 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 26 2/20/98 11:00a Peter 27 31 ** removed glide3 from glid2 tree 28 ** 32 ** 29 33 ** 25 2/17/98 3:21p Peter 30 34 ** no splash w/o deepth buffer 31 ** 35 ** 32 36 ** 24 1/28/98 1:12p Peter 33 37 ** Stupid swap state form gratuitous splash screen 34 * 38 * 35 39 * 23 1/09/98 6:48p Atai 36 40 * grTexInfo, GR_LOD_* and GR_ASPECT_* 37 * 41 * 38 42 * 21 1/06/98 6:47p Atai 39 43 * undo grSplash and remove gu routines 40 * 44 * 41 45 * 20 12/18/97 2:13p Peter 42 46 * fogTable cataclysm 43 * 47 * 44 48 * 19 12/15/97 5:52p Atai 45 49 * disable obsolete glide2 api for glide3 46 * 50 * 47 51 * 18 12/09/97 10:20a Peter 48 52 * removed extraneous cruft 49 * 53 * 50 54 * 17 11/14/97 5:03p Peter 51 55 * picking up the torch... removed #!@#$% c++ comments 52 * 56 * 53 57 * 16 10/23/97 5:30p Peter 54 58 * packed rgb happiness 55 * 59 * 56 60 * 15 7/31/97 11:14a Peter 57 61 * merge w/ sst1 glide tree, hopefully 58 * 62 * 59 63 * 13 7/07/97 3:05p Dow 60 64 * Moved fouled clears 61 * 65 * 62 66 * 12 3/18/97 9:07p Dow 63 67 * Got rid of #$#%#$ // comments 64 * 68 * 65 69 * 11 3/16/97 12:42a Jdt 66 70 * Removed watcom warning 67 * 71 * 68 72 * 10 3/13/97 10:53p Jdt 69 73 * Rewrote with simple optimizations. Changed prototype for 70 74 * multi-resolution, and running as a better shameless plug. 71 * 75 * 72 76 * 9 3/13/97 2:52a Jdt 73 77 * Added arguments to splash. 74 * 78 * 75 79 * 8 3/09/97 10:31a Dow 76 80 * Added GR_DIENTRY for di glide functions 77 * 81 * 78 82 * 7 3/01/97 6:24p Jdt 79 83 * Made splash force yorigin. 80 * 84 * 81 85 * 6 1/02/97 1:06p Dow 82 86 * Fixed state bug 83 * 87 * 84 88 * 3 11/17/96 11:16p Garymct 85 89 * Updated grSplash code to set all of the necessary state itself rather … … 149 153 -----------------------------*/ 150 154 /* xScale, xOffset, yScale, yOffset */ 151 static float viewPort[4] = { 152 480.0f, 320.0f, 153 480.0f, 240.0f 155 static float viewPort[4] = { 156 480.0f, 320.0f, 157 480.0f, 240.0f 154 158 }; 155 159 … … 180 184 Privates 181 185 -----------------------------*/ 182 static void 183 sourceTexture(Texture *texture) 186 static void 187 sourceTexture(Texture *texture) 184 188 { 185 189 static Texture *lastTexture; … … 199 203 } 200 204 201 static GrTexTable_t 202 texTableType(GrTextureFormat_t format) 205 static GrTexTable_t 206 texTableType(GrTextureFormat_t format) 203 207 { 204 208 GrTexTable_t rv = (GrTexTable_t)NO_TABLE; … … 219 223 } 220 224 221 static void 222 downloadTexture(Texture *texture, Gu3dfInfo *info) 225 static void 226 downloadTexture(Texture *texture, Gu3dfInfo *info) 223 227 { 224 228 texture->info.data = info->data; … … 248 252 } 249 253 250 static void 251 createTextures(void) 254 static void 255 createTextures(void) 252 256 { 253 257 Gu3dfInfo *info; … … 270 274 } 271 275 272 static void 273 vecMatMult(float *dstVec, float *srcVec, float *matrix) 276 static void 277 vecMatMult(float *dstVec, float *srcVec, float *matrix) 274 278 { 275 279 dstVec[0] = (srcVec[0] * matrix[0] + … … 277 281 srcVec[2] * matrix[8] + 278 282 matrix[12]); 279 283 280 284 dstVec[1] = (srcVec[0] * matrix[1] + 281 285 srcVec[1] * matrix[5] + 282 286 srcVec[2] * matrix[9] + 283 287 matrix[13]); 284 288 285 289 dstVec[2] = (srcVec[0] * matrix[2] + 286 290 srcVec[1] * matrix[6] + … … 289 293 } 290 294 291 static void 292 normMatMult(float *dstVec, float *srcVec, float *matrix) 295 static void 296 normMatMult(float *dstVec, float *srcVec, float *matrix) 293 297 { 294 298 dstVec[0] = (srcVec[0] * matrix[0] + 295 299 srcVec[1] * matrix[4] + 296 300 srcVec[2] * matrix[8]); 297 301 298 302 dstVec[1] = (srcVec[0] * matrix[1] + 299 303 srcVec[1] * matrix[5] + 300 304 srcVec[2] * matrix[9]); 301 305 302 306 dstVec[2] = (srcVec[0] * matrix[2] + 303 307 srcVec[1] * matrix[6] + … … 305 309 } 306 310 307 static void 308 xfAndProj(int frame, int obj) 311 static void 312 xfAndProj(int frame, int obj) 309 313 { 310 314 int vertex; … … 335 339 } 336 340 337 static void 338 setupMaterial(int material_index) 341 static void 342 setupMaterial(int material_index) 339 343 { 340 344 switch(material_index) { … … 363 367 GR_COMBINE_OTHER_TEXTURE, 364 368 FXFALSE); 365 } 369 } 366 370 break; 367 371 case 1: /* fx */ … … 398 402 } 399 403 400 static void 401 calculateIntensity(int material_index, 402 Vector intensity_factor, 403 int frame) 404 static void 405 calculateIntensity(int material_index, 406 Vector intensity_factor, 407 int frame) 404 408 { 405 409 switch(material_index) { … … 437 441 } 438 442 439 static void 440 drawFaces(int frame, int objnum) 443 static void 444 drawFaces(int frame, int objnum) 441 445 { 442 446 int facenum; … … 447 451 int i; 448 452 FxBool aa_a, aa_b, aa_c; 449 453 450 454 for(facenum = 0; facenum < num_faces[objnum]; facenum++) { 451 455 material_index = face[objnum][facenum].mat_index; … … 456 460 prev_mat_index = material_index; 457 461 } 458 462 459 463 if((material_index != 0) && (pass == 2)) 460 464 continue; 461 465 462 466 aa_a = aa_b = aa_c = FXFALSE; 463 467 if(face[objnum][facenum].aa_edge_flags & 4) … … 467 471 if(face[objnum][facenum].aa_edge_flags & 1) 468 472 aa_c = FXTRUE; 469 473 470 474 for(i = 0; i < 3; i++) { 471 475 float *transformed_vert, *transformed_norm; … … 473 477 int vertnum; 474 478 float factor; 475 479 476 480 vertnum = face[objnum][facenum].v[i]; 477 481 transformed_vert = transformed_verts[vertnum]; 478 482 transformed_norm = transformed_norms[vertnum]; 479 483 v = &vert[objnum][vertnum]; 480 484 481 485 gvert[i].x = transformed_vert[0]; 482 486 gvert[i].y = transformed_vert[1]; … … 485 489 gvert[i].tmuvtx[0].sow = v->s * gvert[i].oow; 486 490 gvert[i].tmuvtx[0].tow = v->t * gvert[i].oow; 487 488 factor = ((light[0] * transformed_norm[0] + 489 light[1] * transformed_norm[1] + 491 492 factor = ((light[0] * transformed_norm[0] + 493 light[1] * transformed_norm[1] + 490 494 light[2] * transformed_norm[2])+ 1.0f) * 127.5f; 491 495 … … 495 499 gvert[i].a = 255.0f; 496 500 } 497 501 498 502 if(pass == 2) { 499 503 for(i = 0; i < 3; i++) { 500 504 float *transformed_norm; 501 502 transformed_norm = 505 506 transformed_norm = 503 507 transformed_norms[face[objnum][facenum].v[i]]; 504 505 gvert[i].tmuvtx[0].sow = gvert[i].oow * 508 509 gvert[i].tmuvtx[0].sow = gvert[i].oow * 506 510 (128.0f + transformed_norm[0] * 128.0f); 507 gvert[i].tmuvtx[0].tow = gvert[i].oow * 511 gvert[i].tmuvtx[0].tow = gvert[i].oow * 508 512 (128.0f + transformed_norm[1] * 128.0f); 509 513 510 514 gvert[i].r = intensity_factor[0] * 255.0f; 511 515 gvert[i].g = intensity_factor[1] * 255.0f; 512 516 gvert[i].b = intensity_factor[2] * 255.0f; 513 } 514 517 } 518 515 519 grDrawTriangle(&gvert[0], &gvert[1], &gvert[2]); 516 520 517 521 continue; 518 522 } 519 520 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, 523 524 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, 521 525 GR_BLEND_ONE, GR_BLEND_ZERO); 522 526 /* Do this if 3D. */ 523 527 if(material_index == 0) { 524 528 /* 525 * Draw the textured 3D without specular. 529 * Draw the textured 3D without specular. 526 530 */ 527 531 sourceTexture(&textImage); … … 533 537 FXFALSE); 534 538 #endif 535 grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2], 539 grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2], 536 540 aa_a, aa_b, aa_c); 537 541 } else if(material_index != 1) { … … 543 547 aa_a, aa_b, aa_c); 544 548 } 545 549 546 550 if(do_phong && (material_index != 0)) { 547 /* 551 /* 548 552 * figure out texture coords in [0..255.0f] based on the normal 549 553 * the specular highlight. … … 551 555 for(i = 0; i < 3; i++) { 552 556 float *transformed_norm; 553 554 transformed_norm = 557 558 transformed_norm = 555 559 transformed_norms[face[objnum][facenum].v[i]]; 556 557 gvert[i].tmuvtx[0].sow = gvert[i].oow * 560 561 gvert[i].tmuvtx[0].sow = gvert[i].oow * 558 562 (128.0f + transformed_norm[0] * 128.0f); 559 gvert[i].tmuvtx[0].tow = gvert[i].oow * 563 gvert[i].tmuvtx[0].tow = gvert[i].oow * 560 564 (128.0f + transformed_norm[1] * 128.0f); 561 565 562 566 gvert[i].r = intensity_factor[0] * 255.0f; 563 567 gvert[i].g = intensity_factor[1] * 255.0f; 564 568 gvert[i].b = intensity_factor[2] * 255.0f; 565 } 566 567 grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2], 569 } 570 571 grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2], 568 572 aa_a, aa_b, aa_c); 569 573 } … … 571 575 } 572 576 573 static void 574 intersectLineWithZPlane(Vector result, Vector p1, 575 Vector p2, float z) 577 static void 578 intersectLineWithZPlane(Vector result, Vector p1, 579 Vector p2, float z) 576 580 { 577 581 float t; 578 582 579 583 t = (z - p1[2]) / (p2[2] - p1[2]); 580 584 result[0] = p1[0] + (p2[0] - p1[0]) * t; … … 583 587 } 584 588 585 static float 586 vectorMag(float *v) 589 static float 590 vectorMag(float *v) 587 591 { 588 592 return (float)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); 589 593 } 590 594 591 static void 592 drawShadow(int frame, int shadow_object_index, 593 int receiver_object_index, Vector light_position) 595 static void 596 drawShadow(int frame, int shadow_object_index, 597 int receiver_object_index, Vector light_position) 594 598 { 595 599 float *shadow_object_matrix; … … 598 602 Vector projected_view_verts[4]; 599 603 int i; 600 604 601 605 Vector local_verts[4] = { 602 606 { -280.0f, 0.0f, -160.0f }, 603 607 { -280.0f, 0.0f, 150.0f }, 604 608 { 280.0f, 0.0f, 150.0f }, 605 { 280.0f, 0.0f, -160.0f } 609 { 280.0f, 0.0f, -160.0f } 606 610 }; 607 611 608 612 float texcoords[4][2] = { 609 613 { 10.5f, 127.5f }, … … 612 616 { 255.0f, 127.5f } 613 617 }; 614 618 615 619 GrVertex gvert[4]; 616 620 GrVertex projected_gvert[4]; 617 621 GrVertex light_gvert; 618 622 619 623 /* 620 * The point relative to the back part of the shield that 624 * The point relative to the back part of the shield that 621 625 * the shadow is going to be projected onto. 622 626 */ 623 627 Vector shadow_light; 624 628 625 629 shadow_light[0] = light_position[0]; 626 630 shadow_light[1] = light_position[1]; 627 631 shadow_light[2] = light_position[2]; 628 632 629 633 shadow_object_matrix = &mat[frame][shadow_object_index][0]; 630 634 receiver_object_matrix = &mat[frame][receiver_object_index][0]; 631 635 632 636 /* 633 * Offset the light by the Z position of 637 * Offset the light by the Z position of 634 638 * the backplane that we are projected 635 639 * onto. 636 640 */ 637 641 shadow_light[2] += receiver_object_matrix[14]; 638 642 639 643 for(i = 0; i < 4; i++) { 640 644 vecMatMult(view_verts[i], local_verts[i], shadow_object_matrix); 641 645 642 646 /* 643 * project . . . 647 * project . . . 644 648 */ 645 649 gvert[i].oow = 1.0f / view_verts[i][2]; 646 gvert[i].x = 647 view_verts[i][0] * gvert[i].oow * viewPort[0] + 650 gvert[i].x = 651 view_verts[i][0] * gvert[i].oow * viewPort[0] + 648 652 viewPort[1] + SNAP_BIAS; 649 gvert[i].y = 650 view_verts[i][1] * gvert[i].oow * viewPort[2] + 653 gvert[i].y = 654 view_verts[i][1] * gvert[i].oow * viewPort[2] + 651 655 viewPort[3] + SNAP_BIAS; 652 656 653 657 /* 654 658 * Set up texture coordinates. … … 657 661 gvert[i].tmuvtx[0].tow = texcoords[i][1] * gvert[i].oow; 658 662 } 659 660 663 664 661 665 /* 662 666 * Intersect each line formed by the light source and a 663 * particular corner of the shadow object with the 667 * particular corner of the shadow object with the 664 668 * plane which the texture is to be projected onto. 665 669 */ … … 673 677 * hw, probably because some other state is not being correctly 674 678 * setup. This doesn't seem to affect the 'correctness' of the 675 * splash screen so I'm not investigating it any more. 679 * splash screen so I'm not investigating it any more. 676 680 */ 677 projected_gvert[i].r = 678 projected_gvert[i].g = 679 projected_gvert[i].b = 681 projected_gvert[i].r = 682 projected_gvert[i].g = 683 projected_gvert[i].b = 680 684 projected_gvert[i].a = 0.0f; 681 685 #endif /* GLIDE_PACKED_RGB */ 682 683 intersectLineWithZPlane(projected_view_verts[i], 684 shadow_light, 685 view_verts[i], 686 687 intersectLineWithZPlane(projected_view_verts[i], 688 shadow_light, 689 view_verts[i], 686 690 receiver_object_matrix[14] - 26.0f); 687 691 projected_gvert[i].oow = 1.0f / projected_view_verts[i][2]; … … 690 694 projected_gvert[i].y = (projected_view_verts[i][1] * projected_gvert[i].oow * viewPort[2] + 691 695 viewPort[3] + SNAP_BIAS); 692 696 693 697 tmpvect[0] = projected_view_verts[i][0] - shadow_light[0]; 694 698 tmpvect[1] = projected_view_verts[i][1] - shadow_light[1]; 695 699 tmpvect[2] = projected_view_verts[i][2] - shadow_light[2]; 696 700 q = vectorMag(tmpvect); 697 701 698 702 /* 699 703 * Set up texture coordinates. … … 703 707 projected_gvert[i].tmuvtx[0].tow = texcoords[i][1] * projected_gvert[i].oow; 704 708 } 705 709 706 710 light_gvert.oow = 1.0f / shadow_light[2]; 707 711 light_gvert.x = shadow_light[0] * light_gvert.oow * viewPort[0] + viewPort[1] + SNAP_BIAS; 708 712 light_gvert.y = shadow_light[1] * light_gvert.oow * viewPort[2] + viewPort[3] + SNAP_BIAS; 709 713 710 714 /* 711 715 * Draw a segment between the light and the point which hits … … 718 722 FXFALSE); 719 723 sourceTexture(&shadowImage); 720 724 721 725 grAlphaBlendFunction(GR_BLEND_DST_COLOR, GR_BLEND_ZERO, 722 726 GR_BLEND_ONE, GR_BLEND_ZERO); 723 727 724 grDrawTriangle(&projected_gvert[0], 725 &projected_gvert[1], 728 grDrawTriangle(&projected_gvert[0], 729 &projected_gvert[1], 726 730 &projected_gvert[2]); 727 grDrawTriangle(&projected_gvert[0], 728 &projected_gvert[2], 731 grDrawTriangle(&projected_gvert[0], 732 &projected_gvert[2], 729 733 &projected_gvert[3]); 730 grDrawTriangle(&projected_gvert[0], 731 &projected_gvert[2], 734 grDrawTriangle(&projected_gvert[0], 735 &projected_gvert[2], 732 736 &projected_gvert[1]); 733 grDrawTriangle(&projected_gvert[0], 734 &projected_gvert[3], 737 grDrawTriangle(&projected_gvert[0], 738 &projected_gvert[3], 735 739 &projected_gvert[2]); 736 740 737 741 grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, 738 742 GR_BLEND_ONE, GR_BLEND_ZERO); 739 743 740 744 } 741 745 … … 775 779 776 780 /* Check Screen Dimensions and Check Avail of Depth Buffer */ 777 if ((x > gc->state.screen_width) || 781 if ((x > gc->state.screen_width) || 778 782 ((x+w) > gc->state.screen_width) || 779 783 (y > gc->state.screen_height) || 780 ((y+h) > gc->state.screen_height)) 784 ((y+h) > gc->state.screen_height)) 781 785 return; 782 786 … … 797 801 y = ((gc->state.screen_height - 1.0f) - (h-1.0f)) - y; 798 802 } 799 803 800 804 viewPort[0] = w * (480.0f / 640.0f); 801 805 viewPort[1] = x + (w / 2.0f); … … 827 831 GR_BLEND_ONE, GR_BLEND_ZERO); 828 832 if (useTextures) 829 grTexCombine(GR_TMU0, 833 grTexCombine(GR_TMU0, 830 834 GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, 831 835 GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE, … … 846 850 /* grClipWindow((int)x, (int)y, (int)(x+w), (int)(y+h)); */ 847 851 grFogColorValue(0x0); 848 852 849 853 fadeInFrames = (int)(((float)total_num_frames) * FADEIN_END_PERCENT); 850 fadeOutFrames = (int)(((float)total_num_frames) * 854 fadeOutFrames = (int)(((float)total_num_frames) * 851 855 (1.0f - FADEOUT_BEGIN_PERCENT)); 852 856 … … 854 858 for(frame = 1; frame < total_num_frames; frame++) { 855 859 int i; 856 860 857 861 /* Set Fog Value For This Frame */ 858 862 if(frame < fadeInFrames) { 859 unsigned char fval = (((unsigned char)0xFF) - 863 unsigned char fval = (((unsigned char)0xFF) - 860 864 ((unsigned char)(255.0f * (float)(frame + 1) / (float)fadeInFrames))); 861 865 for(i = 0; i < kInternalFogTableEntryCount; i++) fogTable[i] = fval; … … 864 868 fog = 1; 865 869 } else if(frame > total_num_frames-fadeOutFrames) { 866 unsigned char fval = (((unsigned char)0xFF) - 867 (unsigned char)(255.0f* ((float)(total_num_frames - frame))/ 870 unsigned char fval = (((unsigned char)0xFF) - 871 (unsigned char)(255.0f* ((float)(total_num_frames - frame))/ 868 872 ((float)fadeOutFrames))); 869 for(i = 0; i < kInternalFogTableEntryCount; i++) 873 for(i = 0; i < kInternalFogTableEntryCount; i++) 870 874 fogTable[i] = fval; 871 875 grFogMode(GR_FOG_WITH_TABLE); … … 876 880 fog = 0; 877 881 } 878 882 879 883 grBufferClear(0x00000000, 0, GR_WDEPTHVALUE_FARTHEST); 880 884 881 885 pass = 1; 882 886 … … 890 894 xfAndProj(frame, 2); 891 895 drawFaces(frame, 2); 892 896 893 897 /* yellow and white part of shield. */ 894 898 xfAndProj(frame, 0); … … 926 930 } else { /* Render One Frame */ 927 931 frame = ((_frame>>1) % SPIN_FRAMES)+SPIN_START; 928 932 929 933 grColorMask(FXFALSE, FXFALSE); 930 934 grBufferClear(0x00000000, 0, GR_WDEPTHVALUE_FARTHEST); 931 935 grColorMask(FXTRUE, FXFALSE); 932 936 933 937 pass = 0xbeef; 934 938 935 939 /* 3Dfx logo */ 936 940 xfAndProj(frame, 1); … … 944 948 if (frame == 0) { 945 949 int i; 946 950 947 951 for(i = 0; i < gc->grColBuf; i++) { 948 952 grBufferClear(0x00000000, 0, GR_WDEPTHVALUE_FARTHEST); … … 950 954 } 951 955 } 952 956 953 957 /* 954 958 * Clean up after yourself! -
trunk/src/opengl/glide/cvg/glide/gsst.c
r2888 r6653 1 /* $Id: gsst.c,v 1.2 2001-09-05 14:30:27 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gsst.c,v 1. 1 2000-02-25 00:37:41 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gsst.c,v 1.2 2001-09-05 14:30:27 bird Exp $ 21 22 ** $Log: gsst.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:41 sandervl 23 ** Revision 1.2 2001-09-05 14:30:27 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:41 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 168 6/30/98 6:08p Jeske 27 31 ** fixed bug where we tried to setup MTRRs on old (<p6) systems which 28 ** didn't have them. 29 ** 32 ** didn't have them. 33 ** 30 34 ** 167 6/25/98 10:40a Peter 31 35 ** more cb checks 32 ** 36 ** 33 37 ** 166 6/23/98 5:38p Peter 34 38 ** lfb hinting 35 ** 39 ** 36 40 ** 165 6/04/98 12:13p Peter 37 41 ** splash dll rename 38 ** 42 ** 39 43 ** 164 5/20/98 4:37p Peter 40 44 ** doh 41 ** 45 ** 42 46 ** 163 5/20/98 3:51p Peter 43 47 ** no fifo glide 44 ** 48 ** 45 49 ** 162 5/18/98 12:16p Peter 46 50 ** culling enabling 47 ** 51 ** 48 52 ** 161 4/29/98 3:05p Peter 49 53 ** triple buffering vs grLfbReadRegion 50 ** 54 ** 51 55 ** 160 4/21/98 5:53p Peter 52 56 ** slidetect vs hw pointers 53 ** 57 ** 54 58 ** 159 4/09/98 5:24p Peter 55 59 ** properly re-cache the hw base addresses after a re-init just in case 56 60 ** the base addresses changed 57 ** 61 ** 58 62 ** 158 4/08/98 3:53p Peter 59 63 ** allow different base addresses 60 ** 64 ** 61 65 ** 157 4/06/98 9:55a Peter 62 66 ** sli slave detection for oem dll 63 ** 67 ** 64 68 ** 156 4/01/98 1:52p Peter 65 69 ** sli origin thing vs grRenderBuffer/synced state when doing dynamic 66 70 ** loading of the glide dll on sli 67 ** 71 ** 68 72 ** 155 3/31/98 6:09p Peter 69 73 ** sli origin everywhere (I think) and grLfbReadRegion/grRenderBuffer vs 70 74 ** triple buffering 71 ** 75 ** 72 76 ** 154 3/30/98 2:45p Peter 73 77 ** update default gamma 74 ** 78 ** 75 79 ** 153 3/29/98 1:07p Peter 76 80 ** yet another sli origin thing 77 ** 81 ** 78 82 ** 152 3/23/98 5:57p Peter 79 83 ** warning cleanup 80 ** 84 ** 81 85 ** 151 3/20/98 12:45p Atai 82 86 ** added strapping register in oem boardid field 83 ** 87 ** 84 88 ** 150 3/20/98 11:01a Peter 85 89 ** sli swap interval thing 86 ** 90 ** 87 91 ** 149 3/18/98 7:25p Peter 88 92 ** doh! checked in experiment again 89 ** 93 ** 90 94 ** 148 3/18/98 3:04p Peter 91 95 ** cleaner origin swapping hacks 92 ** 96 ** 93 97 ** 147 3/17/98 6:50p Peter 94 98 ** sli paired vs active 95 ** 99 ** 96 100 ** 146 3/17/98 1:57p Atai 97 101 ** added boardid and requireoemdll registry 98 ** 102 ** 99 103 ** 145 3/14/98 1:07p Peter 100 104 ** mac port happiness 101 ** 105 ** 102 106 ** 144 3/13/98 2:57p Atai 103 107 ** update grSstWinOpen to detect tv connection 104 ** 108 ** 105 109 ** 143 3/13/98 1:27p Peter 106 110 ** removed legacy variables 107 ** 111 ** 108 112 ** 142 3/10/98 9:20a Peter 109 113 ** fixed checkin 110 ** 114 ** 111 115 ** 141 3/09/98 2:24p Peter 112 116 ** change for new pci passthrough interface 113 ** 117 ** 114 118 ** 140 3/03/98 9:37p Peter 115 119 ** more sli origin fun 116 ** 120 ** 117 121 ** 139 3/02/98 7:23p Peter 118 122 ** clear slop on sli systems when changing y origin 119 ** 123 ** 120 124 ** 138 2/24/98 10:15a Peter 121 125 ** oem dll muckage 122 ** 126 ** 123 127 ** 137 2/23/98 7:32p Atai 124 128 ** modify for oem dll 125 ** 129 ** 126 130 ** 136 2/20/98 2:16p Peter 127 131 ** correct error message when failing video init 128 ** 132 ** 129 133 ** 135 2/20/98 11:00a Peter 130 134 ** removed glide3 from glid2 tree 131 ** 135 ** 132 136 ** 134 2/20/98 9:05a Peter 133 137 ** removed remnants of comdex grot 134 ** 138 ** 135 139 ** 133 2/19/98 5:10p Peter 136 140 ** moved passthrough stuff into glide 137 ** 141 ** 138 142 ** 132 2/19/98 3:16p Peter 139 143 ** changes for initVideobuffers 140 ** 144 ** 141 145 ** 131 2/17/98 12:39p Peter 142 146 ** sli monitor detect thing 143 ** 147 ** 144 148 ** 130 2/12/98 9:42p Peter 145 149 ** fixed typo 146 ** 150 ** 147 151 ** 129 2/12/98 8:20p Pgj 148 ** 152 ** 149 153 ** 128 2/12/98 6:47p Atai 150 154 ** fix typo 151 ** 155 ** 152 156 ** 127 2/12/98 4:01p Atai 153 157 ** change refresh rate if oemdll updated for tv out 154 ** 158 ** 155 159 ** 126 2/12/98 3:40p Peter 156 160 ** single buffering for opengl 157 ** 161 ** 158 162 ** 125 2/11/98 5:25p Peter 159 163 ** properly turn off caching 160 ** 164 ** 161 165 ** 124 2/10/98 4:45p Pgj 162 166 ** don't require fxoem2x..dll 163 ** 167 ** 164 168 ** 123 2/04/98 9:21p Pgj 165 169 ** don't require fxoem2x.dll for static builds 166 ** 170 ** 167 171 ** 122 2/04/98 7:56p Pgj 168 172 ** DOS sanity 169 ** 173 ** 170 174 ** 121 2/04/98 6:57p Atai 171 175 ** added fxoem2x.dll for cvg 172 ** 176 ** 173 177 ** 120 2/02/98 4:41p Peter 174 ** 178 ** 175 179 ** 119 1/30/98 4:23p Peter 176 180 ** renamed curSwapBuf->curRenderBuf for clarity 177 ** 181 ** 178 182 ** 118 1/24/98 12:29p Peter 179 183 ** more caching fun 180 ** 184 ** 181 185 ** 117 1/20/98 11:03a Peter 182 186 ** env var to force triple buffering 183 * 187 * 184 188 * 116 1/16/98 4:18p Atai 185 189 * fixed lfb and grLoadGammaTable 186 * 190 * 187 191 * 115 1/16/98 10:47a Peter 188 192 * fixed idle muckage 189 * 193 * 190 194 * 114 1/16/98 10:16a Atai 191 195 * fixed grSstIldle 192 * 196 * 193 197 * 113 1/10/98 4:01p Atai 194 198 * inititialize vertex layout, viewport, added defines 195 * 199 * 196 200 * 110 1/06/98 6:47p Atai 197 201 * undo grSplash and remove gu routines 198 * 202 * 199 203 * 109 1/06/98 3:53p Atai 200 204 * remove grHint, modify grLfbWriteRegion and grGet 201 * 205 * 202 206 * 107 12/18/97 2:12p Peter 203 207 * grSstControl on v2 204 * 208 * 205 209 * 106 12/17/97 4:48p Peter 206 210 * groundwork for CrybabyGlide 207 * 211 * 208 212 * 105 12/17/97 4:06p Atai 209 213 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet() 210 214 * functions 211 * 215 * 212 216 * 104 12/16/97 1:33p Atai 213 217 * added grGammaCorrectionRGB() 214 * 218 * 215 219 * 103 12/16/97 10:03a Atai 216 220 * fixed gutexmemreset for glide2 217 * 221 * 218 222 * 101 12/09/97 12:20p Peter 219 223 * mac glide port 220 * 224 * 221 225 * 100 12/05/97 4:26p Peter 222 226 * watcom warnings 223 * 227 * 224 228 * 99 12/03/97 11:35a Peter 225 229 * is busy thing 226 * 230 * 227 231 * 98 11/25/97 12:09p Peter 228 232 * nested calls to grLfbLock vs init code locking on v2 229 * 233 * 230 234 * 97 11/21/97 1:02p Peter 231 235 * v^2 supported resolutions 232 * 236 * 233 237 * 96 11/21/97 11:19a Dow 234 238 * Added RESOLUTION_NONE hack for Banshee 235 * 239 * 236 240 * 95 11/19/97 2:49p Peter 237 241 * env vars in registry for win32 238 * 242 * 239 243 * 94 11/19/97 2:22p Dow 240 244 * gsst.c 241 * 245 * 242 246 * 93 11/18/97 4:50p Peter 243 247 * chipfield stuff cleanup and w/ direct writes 244 * 248 * 245 249 * 92 11/18/97 4:00p Atai 246 250 * fixed the GR_BEGIN and GR_END error in previous check-in 247 * 251 * 248 252 * 91 11/18/97 3:27p Atai 249 * update vData 253 * update vData 250 254 * optimize state monster 251 * 255 * 252 256 * 90 11/17/97 4:55p Peter 253 257 * watcom warnings/chipfield stuff 254 * 258 * 255 259 * 89 11/16/97 2:20p Peter 256 260 * cleanup 257 * 261 * 258 262 * 88 11/15/97 7:43p Peter 259 263 * more comdex silliness 260 * 264 * 261 265 * 87 11/14/97 11:10p Peter 262 266 * open vs hw init confusion 263 * 267 * 264 268 * 86 11/14/97 5:02p Peter 265 269 * more comdex stuff 266 * 270 * 267 271 * 85 11/14/97 4:47p Dow 268 272 * New splash screen 269 * 273 * 270 274 * 84 11/14/97 12:09a Peter 271 275 * comdex thing and some other stuff 272 * 276 * 273 277 * 83 11/12/97 9:37p Dow 274 278 * Banshee crap 275 * 279 * 276 280 * 82 11/12/97 2:27p Peter 277 * 281 * 278 282 * 81 11/12/97 1:09p Dow 279 283 * H3 Stuf 280 * 284 * 281 285 * 80 11/12/97 9:22a Dow 282 286 * H3 Mods 283 * 287 * 284 288 * 79 11/06/97 3:46p Peter 285 289 * sli shutdown problem 286 * 290 * 287 291 * 78 11/06/97 3:38p Dow 288 292 * More banshee stuff 289 * 293 * 290 294 * 77 11/04/97 5:04p Peter 291 295 * cataclysm part deux 292 * 296 * 293 297 * 76 11/04/97 3:58p Dow 294 298 * Banshee stuff 295 * 299 * 296 300 * 75 11/03/97 3:43p Peter 297 301 * h3/cvg cataclysm 298 * 302 * 299 303 * 74 10/29/97 4:59p Peter 300 * 304 * 301 305 * 73 10/29/97 2:45p Peter 302 306 * C version of Taco's packing code 303 * 307 * 304 308 * 72 10/23/97 5:28p Peter 305 309 * sli fifo thing 306 * 310 * 307 311 * 71 10/17/97 3:15p Peter 308 312 * grSstVidMode thingee 309 * 313 * 310 314 * 70 10/14/97 2:44p Peter 311 315 * moved close flag set 312 * 316 * 313 317 * 69 10/09/97 8:02p Dow 314 318 * State Monster 1st Cut 315 * 319 * 316 320 ** 317 321 */ … … 323 327 #include <glidesys.h> 324 328 325 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 329 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 326 330 #include <init.h> 327 331 #endif … … 347 351 Initialize the selected SST 348 352 349 Initialization has 4 Steps 350 351 Video Init - 353 Initialization has 4 Steps 354 355 Video Init - 352 356 In the full screen case this includes setting the requested 353 resolution/refresh state and allocating any necessary OS 354 resource for the GC. 357 resolution/refresh state and allocating any necessary OS 358 resource for the GC. 355 359 356 360 In the windowed case, this involves acquiring all necessary 357 361 surfaces for rendering, back buffer and memory fifo 358 362 359 Also perform any work necessary to enable access to 3D 363 Also perform any work necessary to enable access to 3D 360 364 registers 361 365 … … 363 367 Assuming video registers are in a reset state, initialize 364 368 the appropriate command transport mechanism. All writes 365 to hardware prior to this action are direct writes, 369 to hardware prior to this action are direct writes, 366 370 afterwards, most commands will go throught the command 367 371 transport 368 372 369 GC Init - 373 GC Init - 370 374 Initialize the current GC based on the user requested 371 375 open parameters and command transport data reported 372 376 during initialization. 373 377 374 3D State Init - 375 Push an initial state onto all of the 3D state registers. 376 378 3D State Init - 379 Push an initial state onto all of the 3D state registers. 380 377 381 Arguments: 378 hwnd - pointer to a window handle or null. If NULL, then 382 hwnd - pointer to a window handle or null. If NULL, then 379 383 the application window handle will be inferred though 380 384 the GetActiveWindow() api. … … 398 402 FXTRUE - glide successfully acquired the necessary resources and a 399 403 is ready for rendering 400 FXFALSE - glide was unsuccessful in getting the necessary resources, 404 FXFALSE - glide was unsuccessful in getting the necessary resources, 401 405 or the requested configuration is unavailble on the host 402 406 hardware - any calls to glide rendering routines will result … … 405 409 GR_ENTRY(grSstWinOpen, FxBool, ( 406 410 FxU32 hWnd, 407 GrScreenResolution_t resolution, 408 GrScreenRefresh_t refresh, 409 GrColorFormat_t format, 410 GrOriginLocation_t origin, 411 GrScreenResolution_t resolution, 412 GrScreenRefresh_t refresh, 413 GrColorFormat_t format, 414 GrOriginLocation_t origin, 411 415 int nColBuffers, 412 416 int nAuxBuffers)) … … 421 425 FxBool tv_swap_board = FXFALSE; 422 426 #endif 423 427 424 428 GR_BEGIN_NOFIFOCHECK("grSstWinOpen",80); 425 429 GDBG_INFO_MORE(gc->myLevel, … … 429 433 nColBuffers, nAuxBuffers); 430 434 GR_CHECK_F(FN_NAME, !gc, "no SST selected as current (gc==NULL)"); 431 432 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 435 436 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 433 437 /* Voodoo^2 has a bug in sli mode where the video cannot really 434 438 * support resolutions less than 512x384 on pc monitors. Rather than 435 439 * saying sli is not fully compatible w/ single board systems the 436 440 * 'solution' is to just not allow these resolutions. 437 * 441 * 438 442 * NB: The current assumption here is taht if the user passes 439 443 * their own video timing structure then they know what the hell … … 451 455 452 456 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 453 GR_CHECK_COMPATABILITY(FN_NAME, 457 GR_CHECK_COMPATABILITY(FN_NAME, 454 458 ((hWnd == 0x00UL) && (GetActiveWindow() == NULL)), 455 459 "A valid active window or hWnd parameter is required."); 456 460 #endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */ 457 461 #endif /* (GLIDE_PLATFORM & GLODE_HW_CVG) */ 458 462 459 463 #if !GLIDE_INIT_HAL 460 464 __tryReOpen: … … 469 473 if (!gc->hwInitP) { 470 474 FxU32* sstRegs = NULL; 471 475 472 476 rv = pciOpen(); 473 477 if (!rv) { … … 475 479 goto BAILOUT; 476 480 } 477 478 sstRegs = sst1InitMapBoard(_GlideRoot.current_sst); 481 482 sstRegs = sst1InitMapBoard(_GlideRoot.current_sst); 479 483 rv = (sstRegs != NULL); 480 484 if (!rv) { … … 483 487 goto BAILOUT; 484 488 } 485 489 486 490 /* Re-enabled write combining */ 487 491 if (_GlideRoot.CPUType >= 6) { … … 494 498 goto BAILOUT; 495 499 } 496 500 497 501 /* Reset up pointers to the various address spaces within the hw 498 502 * since the hw base address can be different from the original 499 * map board. 503 * map board. 500 504 */ 501 505 gc->base_ptr = (FxU32*)HW_BASE_PTR(sstRegs); … … 503 507 gc->lfb_ptr = (FxU32*)HW_LFB_PTR(sstRegs); 504 508 gc->tex_ptr = (FxU32*)HW_TEX_PTR(sstRegs); 505 509 506 510 /* Make sure that the sli-slave gets re-initted too. 507 511 * … … 517 521 goto BAILOUT; 518 522 } 519 523 520 524 rv = sst1InitRegisters(sstRegs); 521 525 if (!rv) { … … 523 527 goto BAILOUT; 524 528 } 525 529 526 530 /* Reset up pointers to the various address spaces within the hw 527 531 * since the hw base address can be different from the original 528 * map board. 532 * map board. 529 533 */ 530 534 (gc + 1)->base_ptr = (FxU32*)HW_BASE_PTR(sstRegs); … … 535 539 gc->slave_ptr = sstRegs; 536 540 } 537 541 538 542 gc->hwInitP = FXTRUE; 539 543 } else if (gc->open) { … … 551 555 } 552 556 #endif /* !GLIDE_INIT_HAL */ 553 557 554 558 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 555 559 /* 556 560 ** load fxoem2x.dll and map board 557 561 */ 558 { 562 { 559 563 gc->oemInit = NULL; 560 564 rv = sst1InitGetDeviceInfo(gc->reg_ptr, &devInfo); … … 574 578 gc->oemi.fxoemPciWriteConfig = (PciConfigProc)pciSetConfigData; 575 579 gc->oemi.fxoemPciReadConfig = (PciConfigProc)pciGetConfigData; 576 580 577 581 boardIDStr = GETENV("FX_GLIDE_BOARDID"); 578 582 boardID = (boardIDStr == NULL) ? 0 : atol(boardIDStr); … … 612 616 } 613 617 } 614 618 615 619 /* 616 ** oem map board 620 ** oem map board 617 621 */ 618 622 if (gc->oemInit) { … … 634 638 /*------------------------------------------------------ 635 639 Video Init 636 ------------------------------------------------------*/ 640 ------------------------------------------------------*/ 637 641 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 638 642 /* 639 643 ** initialize video timing data for oemdll 640 644 ** if tv out component exist, the oem dll need to modify the vidtiming 641 ** data in oemi. Glide will take the changes and pass it to 645 ** data in oemi. Glide will take the changes and pass it to 642 646 ** sst1InitVideoBuffers() 643 647 */ … … 676 680 tvVidtiming.clkFreq16bpp = gc->oemi.vid.clkFreq16bpp; 677 681 tvVidtiming.clkFreq24bpp = gc->oemi.vid.clkFreq24bpp; 678 refresh = tvVidtiming.refreshRate = gc->oemi.vid.refresh; 682 refresh = tvVidtiming.refreshRate = gc->oemi.vid.refresh; 679 683 grSstVidMode(_GlideRoot.current_sst, &tvVidtiming); 680 684 } … … 688 692 { 689 693 GDBG_INFO(gc->myLevel, " HAL Video Init\n"); 690 694 691 695 rv = fxHalInitVideo((SstRegs*)gc->reg_ptr, 692 ((resolution == GR_RESOLUTION_NONE) 696 ((resolution == GR_RESOLUTION_NONE) 693 697 ? GR_RESOLUTION_640x480 694 : resolution), 695 refresh, 698 : resolution), 699 refresh, 696 700 NULL); 697 701 if (!rv) goto BAILOUT; … … 714 718 * 715 719 * NB: We cannot fail the allocation on the env settings since the 716 * user could have messed up and set something ridiculous. 720 * user could have messed up and set something ridiculous. 717 721 */ 718 722 { … … 729 733 (curAuxBuffers == nAuxBuffers)); 730 734 731 rv = sst1InitVideoBuffers(gc->reg_ptr, 732 resolution, refresh, 735 rv = sst1InitVideoBuffers(gc->reg_ptr, 736 resolution, refresh, 733 737 ((curColorBuffers == 1) ? 2 : curColorBuffers), 734 738 curAuxBuffers, … … 740 744 } 741 745 } while(!rv && !triedParamsP); 742 746 743 747 /* Reset the parameters for the possible sli-slave video init and 744 * internal bookkeeping. 748 * internal bookkeeping. 745 749 */ 746 750 nColBuffers = curColorBuffers; … … 755 759 goto __errSliExit; 756 760 } 757 761 758 762 rv = sst1InitVideoBuffers(gc->slave_ptr, 759 763 resolution, refresh, 760 nColBuffers, nAuxBuffers, 764 nColBuffers, nAuxBuffers, 761 765 gc->vidTimings, 762 766 FXTRUE); … … 778 782 if (oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) 779 783 oemInitSetVideo(&gc->oemi); 780 784 781 785 if (oemGet = GetProcAddress(gc->oemInit, "_fxoemGet@12")) { 782 786 oemGet(FX_OEM_TVOUT, 4, &tv_connected); … … 785 789 oemGet(FX_OEM_SLIMASTER, 8, slimaster); 786 790 oemGet(FX_OEM_SLISLAVE, 8, slislave); 787 if (((FxU32 *)slimaster[1] == gc->slave_ptr) && 791 if (((FxU32 *)slimaster[1] == gc->slave_ptr) && 788 792 ((FxU32 *)slislave[1] == gc->base_ptr)) 789 793 tv_swap_board = FXTRUE; … … 820 824 rv = sst1InitGetDeviceInfo(gc->reg_ptr, &devInfo); 821 825 if (!rv) { 822 GDBG_INFO(gc->myLevel, 826 GDBG_INFO(gc->myLevel, 823 827 " sst1InitGetDeviceInfo failed to determine master monitor connectivness.\n"); 824 828 goto __errSliExit; … … 828 832 rv = sst1InitGetDeviceInfo(gc->slave_ptr, &devInfo); 829 833 if (!rv) { 830 GDBG_INFO(gc->myLevel, 834 GDBG_INFO(gc->myLevel, 831 835 " sst1InitGetDeviceInfo failed to determine slave monitor connectivness.\n"); 832 836 goto __errSliExit; 833 837 } 834 838 835 839 rv = FXTRUE; 836 840 if (devInfo.monitorDetected) { 837 GDBG_INFO(gc->myLevel, " Swapping sli slave and master"); 841 GDBG_INFO(gc->myLevel, " Swapping sli slave and master"); 838 842 } else { 839 843 /* no monitors attached. … … 841 845 */ 842 846 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 843 /* 847 /* 844 848 ** We need to check the if tv is connected. 845 849 ** If not, then there is no output. 846 850 */ 847 if (tv_swap_board) 848 GDBG_INFO(gc->myLevel, " TV is connected. Swapping sli slave and master"); 849 else 851 if (tv_swap_board) 852 GDBG_INFO(gc->myLevel, " TV is connected. Swapping sli slave and master"); 853 else 850 854 #endif 851 855 { … … 859 863 rv = FXTRUE; 860 864 goto __errSliExit; 861 } else 865 } else 862 866 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 863 867 if (!tv_swap_board) … … 876 880 * 877 881 * NB: The order of the caching changes is relevant here since 878 * we don't want to waste mtrr's, even briefly. 882 * we don't want to waste mtrr's, even briefly. 879 883 */ 880 884 if (_GlideRoot.CPUType >= 6) { … … 891 895 * NB: However, we don't do this currently because it requires 892 896 * odd semantics to the calling conventions of the oem dll. 893 */ 897 */ 894 898 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && 0 895 899 if (gc->oemInit) { 896 FARPROC oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@4"); 900 FARPROC oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@4"); 897 901 if (oemRestoreVideo != NULL) oemRestoreVideo(&gc->oemi); 898 902 } 899 903 #endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */ 900 904 901 905 gc->hwInitP = FXFALSE; 902 906 } … … 908 912 */ 909 913 pciOpen(); 910 914 911 915 /* Re-init the new master */ 912 916 { … … 923 927 goto __errSliExit; 924 928 } 925 929 926 930 /* Reset up pointers to the various address spaces within the hw 927 931 * since the hw base address can be different from the original 928 * map board. 932 * map board. 929 933 */ 930 934 (gc + 1)->base_ptr = (FxU32*)HW_BASE_PTR(sstRegs); … … 932 936 (gc + 1)->lfb_ptr = (FxU32*)HW_LFB_PTR(sstRegs); 933 937 (gc + 1)->tex_ptr = (FxU32*)HW_TEX_PTR(sstRegs); 934 938 935 939 /* We're done setting up the new master's hw */ 936 940 (gc + 1)->hwInitP = FXTRUE; … … 948 952 } 949 953 } 950 951 /* Switch the senses of the master and slave in the gc's. 952 * 954 955 /* Switch the senses of the master and slave in the gc's. 956 * 953 957 * NB: This only has to swap the hw addresses since the rest of 954 958 * the information has to be the same in order for the boards to 955 * be sli-able. 959 * be sli-able. 956 960 */ 957 961 #define SwapPtrVal(__a, __b) do { FxU32* temp = (__a); (__a) = (__b); (__b) = temp; } while(0); … … 973 977 * 974 978 * NB: The order of the caching changes is relevant here since 975 * we don't want to waste mtrr's, even briefly. 979 * we don't want to waste mtrr's, even briefly. 976 980 */ 977 981 if (_GlideRoot.CPUType >= 6) { … … 980 984 } 981 985 } 982 986 983 987 /* Save that we swapped teh master sense so that we can 984 988 * restore these settings when we shut down. … … 988 992 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 989 993 /* NB: We need to make sure that the oem structure reflects the 990 * 'new' sense of the master/slave relationship. 994 * 'new' sense of the master/slave relationship. 991 995 */ 992 996 gc->oemi.linearAddress = gc->base_ptr; 993 gc->oemi.slaveAddress = gc->slave_ptr; 997 gc->oemi.slaveAddress = gc->slave_ptr; 994 998 995 999 /* re-initialize oem vedio for the board */ … … 1007 1011 * was detected we will get here straightline. If no monitors are 1008 1012 * detected (sli or no) we will get here via an error goto to 1009 * the label __errSliExit. 1013 * the label __errSliExit. 1010 1014 */ 1011 1015 __errSliExit: 1012 if (rv && gc->scanline_interleaved) { 1016 if (rv && gc->scanline_interleaved) { 1013 1017 rv = sst1InitSli(gc->reg_ptr, gc->slave_ptr); 1014 1018 if (!rv) { … … 1020 1024 * override the swapInterval for grBufferSwap so that it always 1021 1025 * goes w/ vsync. Otherwise it can look bad as the boards swap out 1022 * of sync w/ each other. 1026 * of sync w/ each other. 1023 1027 */ 1024 1028 if (_GlideRoot.environment.swapInterval < 0) _GlideRoot.environment.swapInterval = 1; … … 1027 1031 /* Explicitly set the pass through address that the vxd will be 1028 1032 * using to toggle the passthrough. In sli mode this is the master, 1029 * and otherwise it is the card driving the monitor's vidoe. 1033 * and otherwise it is the card driving the monitor's vidoe. 1030 1034 * Currently, we set this to be a 16mb address space. 1031 1035 */ … … 1044 1048 xres = 320; yres = 200; 1045 1049 break; 1046 1050 1047 1051 case GR_RESOLUTION_320x240: 1048 1052 xres = 320; yres = 240; 1049 1053 break; 1050 1054 1051 1055 case GR_RESOLUTION_400x256: 1052 1056 xres = 400; yres = 256; … … 1090 1094 break; 1091 1095 1092 case GR_RESOLUTION_1024x768: 1096 case GR_RESOLUTION_1024x768: 1093 1097 xres = 1024; yres = 768; 1094 1098 break; … … 1117 1121 fbStride = 1024; 1118 1122 1119 GDBG_INFO(gc->myLevel, 1123 GDBG_INFO(gc->myLevel, 1120 1124 " Video init succeeded. xRes:%.04d yRes:%.04d nCol:%d nAux:%d\n", 1121 1125 xres, yres, gc->grColBuf, gc->grAuxBuf); … … 1127 1131 #if !((GLIDE_PLATFORM & GLIDE_HW_CVG)) 1128 1132 InitFIFOData fifoInfo; 1129 1133 1130 1134 GDBG_INFO(gc->myLevel, " Command Transport Init\n"); 1131 1135 rv = initEnableTransport(&fifoInfo); 1132 if (!rv) goto BAILOUT; 1136 if (!rv) goto BAILOUT; 1133 1137 #endif 1134 1138 1135 1139 #if ((GLIDE_PLATFORM & GLIDE_HW_H3) || (GLIDE_PLATFORM & GLIDE_HW_CVG)) 1136 1140 /* Place cmd fifo into fbi memory. There are actually two … … 1159 1163 xTileNum = devInfo.fbiVideoTilesInX; 1160 1164 #endif 1161 1165 1162 1166 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR 1163 1167 { … … 1167 1171 gc->hwDep.cvgDep.tileSlopP = ((xTileNum & 0x01) != 0x00); 1168 1172 gc->hwDep.cvgDep.xTilePages = (xTileNum >> 1); 1169 1173 1170 1174 gc->hwDep.cvgDep.yTileShift = (gc->scanline_interleaved ? 6 : 5); 1171 1175 … … 1194 1198 const FxU32 memEnd = MB2B(gc->fbuf_size); /* size of hw memory */ 1195 1199 FxU32 maxOffset = ((xTileNum * yres) << 6) * (nColBuffers + nAuxBuffers); /* Bytes for buffers */ 1196 1200 1197 1201 /* Align on a page boundary */ 1198 1202 if ((maxOffset & kPageBoundaryMask) != 0x00) { 1199 1203 maxOffset = ((maxOffset + kPageBoundarySlop) & ~kPageBoundaryMask); 1200 1204 } 1201 1205 1202 1206 #if GLIDE_USE_DEBUG_FIFO 1203 1207 fifoSize = 0x1000UL; 1204 1208 #else /* !GLIDE_USE_DEBUG_FIFO */ 1205 /* Too much memory claimed for other stuff? */ 1209 /* Too much memory claimed for other stuff? */ 1206 1210 fifoSize = MIN(memEnd - maxOffset, (0x01 << 18)); 1207 1211 rv = (maxOffset < memEnd); … … 1210 1214 maxOffset, memEnd); 1211 1215 goto BAILOUT; 1212 } 1216 } 1213 1217 #endif /* !GLIDE_USE_DEBUG_FIFO */ 1214 1218 1215 1219 /* Place fifo in hw. Taking all of the remainging memory up to the 1216 1220 * byte swizzling bit in the cmd fifo address. 1217 */ 1221 */ 1218 1222 gc->cmdTransportInfo.fifoOffset = memEnd - fifoSize; 1219 1223 … … 1222 1226 0, /* which fifo - always 0 for cvg */ 1223 1227 /* V fifoStart - offset from hw base V */ 1224 gc->cmdTransportInfo.fifoOffset, 1228 gc->cmdTransportInfo.fifoOffset, 1225 1229 fifoSize, /* size - in bytes */ 1226 1230 FXFALSE, /* directExec */ … … 1236 1240 */ 1237 1241 FxU32 fifoStart = 0; 1238 1242 1239 1243 rv = sst1InitCmdFifo(gc->reg_ptr, FXTRUE, 1240 1244 &fifoStart, … … 1252 1256 } 1253 1257 #endif /* GLIDE_USE_DEBUG_FIFO */ 1254 1258 1255 1259 #if GLIDE_USE_SHADOW_FIFO 1256 1260 /* If we're debugging its nice to know what we really wrote 1257 * into the fifo space, just in case tracing is off. 1261 * into the fifo space, just in case tracing is off. 1258 1262 */ 1259 1263 { … … 1291 1295 gc->cmdTransportInfo.fifoSize = fifoSize; 1292 1296 1293 /* Adjust room values. 1297 /* Adjust room values. 1294 1298 * RoomToEnd needs enough room for the jmp packet since we 1295 1299 * never allow the hw to auto-wrap. RoomToRead needs to be … … 1297 1301 * 1298 1302 * fifoRoom is generally the min of roomToEnd and roomToRead, 1299 * but we 'know' here that roomToRead < roomToEnd. 1303 * but we 'know' here that roomToRead < roomToEnd. 1300 1304 */ 1301 1305 gc->cmdTransportInfo.roomToEnd = fifoSize - FIFO_END_ADJUST; 1302 1306 gc->cmdTransportInfo.fifoRoom = 1303 1307 gc->cmdTransportInfo.roomToReadPtr = 1304 gc->cmdTransportInfo.roomToEnd - sizeof(FxU32); 1308 gc->cmdTransportInfo.roomToEnd - sizeof(FxU32); 1305 1309 1306 1310 /* Set initial fifo state. hw read and sw write pointers at … … 1310 1314 gc->cmdTransportInfo.fifoRead = HW_FIFO_PTR(FXTRUE); 1311 1315 1312 GDBG_INFO(gc->myLevel, 1316 GDBG_INFO(gc->myLevel, 1313 1317 "Fifo Parameters:\n" 1314 1318 "\tStart: 0x%X\n" … … 1332 1336 1333 1337 #if !GLIDE_INIT_HAL && 0 1334 /* dpc - 24 jan 1998 - FixMe! 1338 /* dpc - 24 jan 1998 - FixMe! 1335 1339 * This is currently being done in _grDetectResources so that we 1336 * can match the nt driver semantics in win95. 1340 * can match the nt driver semantics in win95. 1337 1341 */ 1338 1342 if (_GlideRoot.CPUType >= 6) { … … 1344 1348 #endif 1345 1349 } 1346 1350 1347 1351 /* We're effectively open now */ 1348 1352 gc->open = FXTRUE; … … 1362 1366 gc->lockPtrs[GR_LFB_WRITE_ONLY] = (FxU32)-1; 1363 1367 gc->fbStride = fbStride; 1364 1368 1365 1369 /* Initialize the read/write registers to all 0 */ 1366 1370 gc->state.fbi_config.fbzColorPath = 0; … … 1382 1386 FxU32 textureMode = (FxU32)SST_SEQ_8_DOWNLD; 1383 1387 1384 if ((hwConfig->SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_VOODOO) && 1388 if ((hwConfig->SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_VOODOO) && 1385 1389 (hwConfig->SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev == 0)) { 1386 1390 textureMode = 0; … … 1399 1403 gc->state.tmu_config[tmu].evenOdd = GR_MIPMAPLEVELMASK_BOTH; 1400 1404 gc->state.tmu_config[tmu].nccTable = GR_NCCTABLE_NCC0; 1401 } 1405 } 1402 1406 1403 1407 /*------------------------------------------------------ 1404 3D State Init 1408 3D State Init 1405 1409 ------------------------------------------------------*/ 1406 1410 GDBG_INFO(gc->myLevel, " 3D State Init\n"); 1407 gc->state.fbi_config.fbzMode = (SST_ENRECTCLIP | 1408 SST_ENZBIAS | 1411 gc->state.fbi_config.fbzMode = (SST_ENRECTCLIP | 1412 SST_ENZBIAS | 1409 1413 SST_DRAWBUFFER_BACK); 1410 1414 1411 1415 grHints(GR_HINT_ALLOW_MIPMAP_DITHER, 0); 1412 1416 grSstOrigin(origin); 1413 grAlphaBlendFunction(GR_BLEND_ONE , GR_BLEND_ZERO, 1417 grAlphaBlendFunction(GR_BLEND_ONE , GR_BLEND_ZERO, 1414 1418 GR_BLEND_ONE, GR_BLEND_ZERO); 1415 1419 grAlphaTestFunction(GR_CMP_ALWAYS); … … 1417 1421 grChromakeyMode(GR_CHROMAKEY_DISABLE); 1418 1422 grConstantColorValue((FxU32) ~0); 1419 grClipWindow(0, 0, gc->state.screen_width, 1423 grClipWindow(0, 0, gc->state.screen_width, 1420 1424 gc->state.screen_height); 1421 1425 _grColorCombineDelta0Mode(FXFALSE); … … 1446 1450 char* str; 1447 1451 /* 1448 ** if we decided to enable gammargb and gammatable, we need to 1452 ** if we decided to enable gammargb and gammatable, we need to 1449 1453 ** bump the buffer size in GETENV 1450 1454 */ … … 1517 1521 grTexClampMode(GR_TMU2, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP); 1518 1522 grTexDetailControl(GR_TMU2, 0, 1, 1.0F); 1519 grTexFilterMode(GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 1523 grTexFilterMode(GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 1520 1524 GR_TEXTUREFILTER_POINT_SAMPLED); 1521 1525 grTexLodBiasValue(GR_TMU2, 0.0F); … … 1528 1532 grTexClampMode(GR_TMU1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP); 1529 1533 grTexDetailControl(GR_TMU1, 0, 1, 1.0F); 1530 grTexFilterMode(GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 1534 grTexFilterMode(GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 1531 1535 GR_TEXTUREFILTER_POINT_SAMPLED); 1532 1536 grTexLodBiasValue(GR_TMU1, 0.0F); … … 1538 1542 grTexClampMode(GR_TMU0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP); 1539 1543 grTexDetailControl(GR_TMU0, 0, 1, 1.0F); 1540 grTexFilterMode(GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 1544 grTexFilterMode(GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 1541 1545 GR_TEXTUREFILTER_POINT_SAMPLED); 1542 1546 grTexLodBiasValue(GR_TMU0, 0.0F); … … 1561 1565 if (fxSplash = GetProcAddress(newSplash, "_fxSplash@16")) { 1562 1566 fxSplash(hWnd, gc->state.screen_width, gc->state.screen_height, nAuxBuffers); 1563 _GlideRoot.environment.noSplash = 1; 1564 } 1567 _GlideRoot.environment.noSplash = 1; 1568 } 1565 1569 } 1566 1570 } … … 1569 1573 /* If it's still 0, then do the old one */ 1570 1574 if (!_GlideRoot.environment.noSplash) { 1571 grSplash(0.0f, 0.0f, 1575 grSplash(0.0f, 0.0f, 1572 1576 (float) gc->state.screen_width, 1573 1577 (float) gc->state.screen_height, … … 1593 1597 Shutdown has 4 steps 1594 1598 1595 3D Idle 1599 3D Idle 1596 1600 the 3D engine must be idled to make sure that there are no 1597 1601 commands executing in the transport when the registers are … … 1644 1648 */ 1645 1649 sst1InitIdle(gc->reg_ptr); 1646 1650 1647 1651 /*-------------------------- 1648 1652 Command Transport Disable … … 1655 1659 */ 1656 1660 /* When disabling all of the parameters other than sstBase and the 1657 * enable flag are ignored. 1661 * enable flag are ignored. 1658 1662 */ 1659 1663 sst1InitCmdFifo(gc->reg_ptr, FXFALSE, NULL, NULL, NULL, NULL); 1660 1664 1661 1665 /*-------------------------- 1662 Video Restore 1666 Video Restore 1663 1667 --------------------------*/ 1664 1668 GDBG_INFO(gc->myLevel, " Restore Video"); … … 1691 1695 GDBG_INFO(gc->myLevel, " GC Reset"); 1692 1696 1693 /* open and hwInitP are really two different things. 1697 /* open and hwInitP are really two different things. 1694 1698 * 1695 1699 * hwInitP indicates whether the init code mapping/init sequence 1696 * is active for this hw. 1700 * is active for this hw. 1697 1701 * 1698 1702 * open includes setting up video, command transport, and the … … 1701 1705 gc->hwInitP = FXFALSE; 1702 1706 if (gc->scanline_interleaved) (gc + 1)->hwInitP = FXFALSE; 1703 1707 1704 1708 /* If we swapped the monitor sense on open then switch these 1705 1709 * back so that any later re-mappings of the board are in sync 1706 * w/ the init code's mappings. 1710 * w/ the init code's mappings. 1707 1711 */ 1708 1712 if (gc->swapMasterSenseP) { … … 1719 1723 (gc + 1)->slave_ptr = NULL; 1720 1724 } 1721 1725 1722 1726 gc->swapMasterSenseP = FXFALSE; 1723 1727 } … … 1733 1737 } 1734 1738 gc->open = FXFALSE; 1735 1739 1736 1740 GR_END(); 1737 1741 #undef FN_NAME 1738 1742 } /* grSstWinClose */ 1739 1743 1740 GR_ENTRY(grSstControl, FxBool, (GrControl_t code)) 1744 GR_ENTRY(grSstControl, FxBool, (GrControl_t code)) 1741 1745 { 1742 1746 GR_DCL_GC; 1743 #define FN_NAME "grSstControl" 1747 #define FN_NAME "grSstControl" 1744 1748 GDBG_INFO(41, "%s: code = 0x%x, windowsInit = %d\n", FN_NAME, 1745 1749 code, _GlideRoot.windowsInit); 1746 1750 1747 1751 if (_GlideRoot.windowsInit && gc->open) { 1748 1752 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 1749 1753 /* For VG96, windows haven't been created, so there's no point 1750 * trying to control it. 1754 * trying to control it. 1751 1755 */ 1752 1756 1753 1757 /* Believe it or not, the following code really should be bracketed 1754 1758 like this. The reason is that GR_BEGIN_NOFIFOCHECK seg faults … … 1761 1765 xRes, yRes, 1762 1766 clipLeftRight, clipBottomTop; 1763 1767 1764 1768 GR_BEGIN_NOFIFOCHECK(FN_NAME,80); 1765 1769 1766 1770 xRes = initControl(code); 1767 1771 1768 1772 GDBG_INFO((80, "%s: initControl returned 0x%x\n", FN_NAME, xRes)); 1769 1773 1770 1774 if (!xRes) return FXFALSE; 1771 1775 1772 1776 yRes = xRes >> 16; 1773 1777 xRes = xRes & 0xffff; 1774 1778 1775 1779 /* !! FIXME +++ this call should properly update the gc->fbStride, 1776 1780 this information is known only to the init layer and needs to be 1777 1781 exposed, it is only really necessary to lfblock right now, 1778 1782 and therefore is returned by initGetBufferPtr */ 1779 1783 1780 1784 gc->state.screen_width = xRes; 1781 1785 gc->state.screen_height = yRes; 1782 1786 1783 1787 /* Wait for Idle. */ 1784 1788 1785 1789 nTries = 0; 1786 1790 do { 1787 1791 if (nTries++ > 999) { 1788 GDBG_INFO((80, "%s: returning FALSE after %d checks for idle\n", 1792 GDBG_INFO((80, "%s: returning FALSE after %d checks for idle\n", 1789 1793 FN_NAME, nTries)); 1790 1794 return FXFALSE; … … 1792 1796 1793 1797 status = GET(hw->status); 1794 1798 1795 1799 } while (status & 0x1); 1796 1800 … … 1834 1838 1835 1839 } 1836 #endif 1840 #endif 1837 1841 } 1838 1842 1839 1843 GDBG_INFO(41, "%s: Returning TRUE\n", FN_NAME); 1840 return FXTRUE; 1844 return FXTRUE; 1841 1845 #undef FN_NAME 1842 1846 } /* grSstControl */ … … 1844 1848 /*--------------------------------------------------------------------------- 1845 1849 ** grSstPerfStats 1846 */ 1850 */ 1847 1851 GR_ENTRY(grSstPerfStats, void, (GrSstPerfStats_t *pStats)) 1848 1852 { … … 1887 1891 { 1888 1892 const FxU32 stat = GR_GET(hw->status); 1889 1893 1890 1894 GDBG_INFO(84,"grSstStatus() => 0x%x\n", stat); 1891 1895 1892 1896 return stat; 1893 1897 } … … 1947 1951 /* dpc - 22 may 1997 - FixMe! 1948 1952 * Seems like the simplest way to do it, but is this really the way 1949 * to do it? 1953 * to do it? 1950 1954 */ 1951 1955 if (nopP) { … … 2010 2014 fbzMode &= ~(SST_YORIGIN); 2011 2015 2012 /* dpc - 22 may 1997 - FixMe! 2016 /* dpc - 22 may 1997 - FixMe! 2013 2017 * Do we need to do anything here for the HAL? 2014 2018 */ … … 2018 2022 * need to do here? 2019 2023 * 2020 * initOrigin(origin); 2024 * initOrigin(origin); 2021 2025 */ 2022 2026 #endif -
trunk/src/opengl/glide/cvg/glide/gstrip.c
r2888 r6653 1 /* $Id: gstrip.c,v 1.2 2001-09-05 14:30:28 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gstrip.c,v 1. 1 2000-02-25 00:37:41 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gstrip.c,v 1.2 2001-09-05 14:30:28 bird Exp $ 21 22 ** $Log: gstrip.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:41 sandervl 23 ** Revision 1.2 2001-09-05 14:30:28 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:41 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 19 12/12/97 12:43p Atai 27 31 * move i and dateElem into the set up loop 28 * 32 * 29 33 * 17 12/08/97 10:38a Atai 30 34 * added grDrawVertexArrayLinear() 31 * 35 * 32 36 * 16 11/21/97 6:05p Atai 33 37 * use one datalist (tsuDataList) in glide3 34 * 38 * 35 39 * 15 11/06/97 6:10p Atai 36 40 * update GrState size 37 41 * rename grDrawArray to grDrawVertexArray 38 42 * update _grDrawPoint and _grDrawVertexList 39 * 43 * 40 44 * 14 11/04/97 6:35p Atai 41 45 * 1. sync with data structure changes 42 46 * 2. break up aa triangle routine 43 * 47 * 44 48 * 13 11/04/97 4:57p Atai 45 49 * use byte offset 46 * 50 * 47 51 * 12 11/03/97 3:43p Peter 48 52 * h3/cvg cataclysm 49 * 53 * 50 54 * 11 10/17/97 2:11p Atai 51 55 * added grContinueArray. We only support non aa mode for now. 52 * 56 * 53 57 * 10 10/16/97 1:50p Atai 54 58 * fix drawarray bugs 55 * 59 * 56 60 * 9 10/14/97 6:16p Atai 57 61 * reverse triangle order in _grAADrawVertexList 58 * 62 * 59 63 * 8 10/14/97 5:41p Atai 60 64 * added _grAADrawVertexList() 61 * 65 * 62 66 * 7 10/14/97 4:57p Dow 63 67 * Clamping 64 * 68 * 65 69 * 6 10/09/97 8:02p Dow 66 70 * State Monster 1st Cut 67 * 71 * 68 72 * 5 10/08/97 11:32a Peter 69 73 * pre-computed packet headers for packet 3 70 * 74 * 71 75 * 4 9/29/97 1:26p Dow 72 76 * Fixed packed color strips/fans 73 * 77 * 74 78 * 3 9/26/97 10:24a Dow 75 79 * Fixed state Muckage in Glide3 parameter data 76 * 80 * 77 81 * 2 9/23/97 2:35p Dow 78 82 * One less loop 79 * 83 * 80 84 * 1 9/23/97 2:04p Dow 81 85 * DD code for strips … … 98 102 Sends a triangle strip to CVG. 99 103 Arguments: 100 104 101 105 Return: 102 106 -------------------------------------------------------------------*/ … … 150 154 FxU32 i, dataElem; 151 155 float *vPtr; 152 156 153 157 vPtr = pointers; 154 158 if (mode) 155 159 vPtr = *(float **)vPtr; 156 160 (float *)pointers += stride; 157 161 158 162 TRI_SETF(FARRAY(vPtr, GR_VERTEX_X_OFFSET << 2)); 159 163 dataElem = 0; … … 177 181 */ 178 182 float oow; 179 183 180 184 while (count > 0) { 181 185 FxI32 k, vcount = count >= 15 ? 15 : count; … … 184 188 for (k = 0; k < vcount; k++) { 185 189 float *vPtr; 186 190 187 191 vPtr = pointers; 188 192 if (mode) … … 215 219 Sends an aa triangle strip/fan to CVG. 216 220 Arguments: 217 221 218 222 Return: 219 223 -------------------------------------------------------------------*/ … … 259 263 _grAADrawTriangles(1, type, 3, v); 260 264 else 261 _grAAVpDrawTriangles(1, type, 3, v); 265 _grAAVpDrawTriangles(1, type, 3, v); 262 266 } 263 267 } … … 275 279 } 276 280 } 277 else { 281 else { 278 282 if (mode) { 279 283 v[0] = *(float **)pointers; … … 289 293 _grAADrawTriangles(1, type, 3, v); 290 294 else 291 _grAAVpDrawTriangles(1, type, 3, v); 295 _grAAVpDrawTriangles(1, type, 3, v); 292 296 (float *)pointers += stride; 293 297 flip = ~flip; -
trunk/src/opengl/glide/cvg/glide/gtex.c
r2888 r6653 1 /* $Id: gtex.c,v 1.2 2001-09-05 14:30:28 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gtex.c,v 1. 1 2000-02-25 00:37:42 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gtex.c,v 1.2 2001-09-05 14:30:28 bird Exp $ 21 22 ** $Log: gtex.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:42 sandervl 23 ** Revision 1.2 2001-09-05 14:30:28 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:42 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 42 6/24/98 5:19p Peter 27 31 ** cleanedup version merged w/ banshee 28 ** 32 ** 29 33 ** 41 6/23/98 5:39p Peter 30 34 ** gary's trilinear hell bug 31 ** 35 ** 32 36 ** 40 6/06/98 12:06p Peter 33 37 ** gmt's trilinear hell bug 34 ** 38 ** 35 39 ** 39 5/18/98 12:14p Peter 36 40 ** crybaby check in grTexCombine 37 ** 41 ** 38 42 ** 38 5/07/98 4:12p Peter 39 43 ** lbe texture thing 40 ** 44 ** 41 45 ** 37 4/16/98 3:54p Peter 42 46 ** 1x1 lod fix, sorry John 43 ** 47 ** 44 48 ** 36 4/01/98 1:51p Peter 45 49 ** fixed resetting unused tmu muckage 46 ** 50 ** 47 51 ** 35 3/13/98 1:27p Peter 48 52 ** lodDither vs tri-linear 49 ** 53 ** 50 54 ** 34 2/20/98 5:31p Peter 51 55 ** crybaby glide 52 ** 56 ** 53 57 ** 33 2/20/98 11:00a Peter 54 58 ** removed glide3 from glid2 tree 55 * 59 * 56 60 * 32 1/13/98 12:42p Atai 57 61 * fixed grtexinfo, grVertexLayout, and draw triangle 58 * 62 * 59 63 * 31 1/09/98 6:48p Atai 60 64 * grTexInfo, GR_LOD_* and GR_ASPECT_* 61 * 65 * 62 66 * 30 1/08/98 7:09p Peter 63 67 * real hw stuff modulo makefile change 64 * 68 * 65 69 * 29 1/08/98 4:58p Atai 66 70 * tex table broadcast, grVertexLayout enable/disable, stq, and some 67 71 * defines 68 * 72 * 69 73 * 28 1/07/98 10:22a Peter 70 74 * lod dithering env var 71 * 75 * 72 76 * 27 1/05/98 6:06p Atai 73 77 * glide extension stuff 74 * 78 * 75 79 * 26 12/18/97 10:52a Atai 76 80 * fixed grGet(GR_VIDEO_POS) 77 * 81 * 78 82 * 25 12/17/97 4:45p Peter 79 83 * groundwork for CrybabyGlide 80 * 84 * 81 85 * 24 12/11/97 4:15p Peter 82 86 * fixed assertions 83 * 87 * 84 88 * 23 12/05/97 4:26p Peter 85 89 * watcom warnings 86 * 90 * 87 91 * 22 11/20/97 6:57p Dow 88 92 * baseaddress for banshee 89 * 93 * 90 94 * 21 11/18/97 4:36p Peter 91 95 * chipfield stuff cleanup and w/ direct writes 92 * 96 * 93 97 * 20 11/17/97 4:55p Peter 94 98 * watcom warnings/chipfield stuff 95 * 99 * 96 100 * 19 11/03/97 3:43p Peter 97 101 * h3/cvg cataclysm 98 * 102 * 99 103 * 18 9/15/97 7:31p Peter 100 104 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 101 105 * place, lfb's are on, Hmmmm.. probably more 102 * 106 * 103 107 * 17 9/05/97 12:31p Peter 104 108 * more reg write grouping 105 * 109 * 106 110 * 16 7/08/97 2:48p Peter 107 * 111 * 108 112 * 15 6/06/97 10:47a Peter 109 113 * texture downloading, fixed 640x480 dimension, changed cvg dep to be the 110 114 * same as sst1 111 * 115 * 112 116 * 14 5/27/97 1:16p Peter 113 * Basic cvg, w/o cmd fifo stuff. 114 * 117 * Basic cvg, w/o cmd fifo stuff. 118 * 115 119 * 13 5/21/97 6:05a Peter 116 * 120 * 117 121 * 12 3/04/97 9:08p Dow 118 * 122 * 119 123 * 11 3/03/97 10:58a Jdt 120 124 * Fixe for 2-pass trilinear 121 * 125 * 122 126 * 10 12/23/96 1:37p Dow 123 127 * chagnes for multiplatform glide … … 142 146 * we have multiple tmu's, but this state is really setup across 143 147 * multiple calls (grTexCombine, grTexMipMapMode, and 144 * grTexSource). 145 * 148 * grTexSource). 149 * 146 150 * NB: This must be called after the shadows are updated because 147 151 * _grTexCheckTriLinear() will use the shadow register values 148 * to determine the current state of trilinearness. 152 * to determine the current state of trilinearness. 149 153 * 150 154 * FixMe: This should eventually get merged in w/ the texture … … 180 184 * of teh tmu's together to get the correct effect. Within this 181 185 * state there are two sub-states: two-pass trilinear and single 182 * pass using both tmu's w/ split levels. 186 * pass using both tmu's w/ split levels. 183 187 * 184 188 * Case 1 - TMU set for lod blending and has both even/odd levels … … 186 190 if (((curTmu->textureMode & SST_TRILINEAR) == SST_TRILINEAR) && 187 191 (curTmu->evenOdd == GR_MIPMAPLEVELMASK_BOTH)) { 188 192 189 193 /* Check the 'other' tmu to see if it is active, if not then we 190 194 * are doing two pass trilinear so check that we have the … … 200 204 ? SST_LOD_ODD 201 205 : 0); 202 206 203 207 GDBG_INFO(gc->myLevel, FN_NAME": Two-pass trilinear fixup (0x%X) : tLOD : (0x%X : 0x%X)\n", 204 208 tmu, curTmu->tLOD, ((curTmu->tLOD & ~SST_MIPMAP_LEVEL_MASK) | levelMask)); 205 209 206 210 GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1); 207 GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD, 211 GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD, 208 212 ((curTmu->tLOD & ~SST_MIPMAP_LEVEL_MASK) | levelMask)); 209 213 GR_CHECK_SIZE(); … … 214 218 * two tmu's. There are basically three cases based on what 215 219 * the user might have already set on the other tmu. 216 */ 220 */ 217 221 if (((tmu0->textureMode & SST_TC_BLEND) == SST_TC_BLEND) && 218 222 ((tmu1->textureMode & SST_TC_REPLACE) == SST_TC_REPLACE)) { 219 223 FxU32 evenOdd[GLIDE_NUM_TMU]; 220 224 FxU32* curEvenOdd = evenOdd + tmu; 221 225 222 226 { 223 227 FxU32 i; 224 228 225 229 for(i = 0; i < GLIDE_NUM_TMU; i++) { 226 230 evenOdd[i] = gc->state.tmu_config[i].tLOD & SST_LOD_ODD; 227 231 } 228 232 } 229 233 230 234 /* 1 - The other tmu already has the even levels. */ 231 235 if ((otherTmu->evenOdd == GR_MIPMAPLEVELMASK_EVEN) && … … 244 248 /* 3 - The other tmu already has both the levels. If the 245 249 * downstream tmu's factor is lodFrac then the upstream tmu 246 * needs to be (1 - lodFrac) and vice-versa. 250 * needs to be (1 - lodFrac) and vice-versa. 247 251 */ 248 252 if (otherTmu->evenOdd == GR_MIPMAPLEVELMASK_BOTH) { … … 265 269 GR_SET_EXPECTED_SIZE((sizeof(FxU32) << 1), 2); 266 270 { 267 GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD, 271 GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD, 268 272 ((tmu0->tLOD & ~SST_MIPMAP_LEVEL_MASK) | evenOdd[0])); 269 GR_SET(eChipTMU1, SST_TMU(hw, 1), tLOD, 273 GR_SET(eChipTMU1, SST_TMU(hw, 1), tLOD, 270 274 ((tmu1->tLOD & ~SST_MIPMAP_LEVEL_MASK) | evenOdd[1])); 271 275 } … … 276 280 } 277 281 } 278 282 279 283 GR_END(); 280 284 #undef FN_NAME … … 284 288 ** grTexClampMode 285 289 */ 286 GR_ENTRY(grTexClampMode, void, 287 (GrChipID_t tmu, 290 GR_ENTRY(grTexClampMode, void, 291 (GrChipID_t tmu, 288 292 GrTextureClampMode_t s_clamp_mode, GrTextureClampMode_t t_clamp_mode)) 289 293 { … … 296 300 GDBG_INFO_MORE(gc->myLevel,"(%d, %d,%d)\n",tmu,s_clamp_mode,t_clamp_mode); 297 301 GR_CHECK_TMU(FN_NAME, tmu); 298 302 299 303 texturemode = gc->state.tmu_config[tmu].textureMode; 300 304 texturemode &= ~(SST_TCLAMPS | SST_TCLAMPT); … … 310 314 ** grTexCombine 311 315 */ 312 GR_ENTRY(grTexCombine, void, 316 GR_ENTRY(grTexCombine, void, 313 317 (GrChipID_t tmu, 314 GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, 315 GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, 318 GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, 319 GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, 316 320 FxBool rgb_invert, FxBool alpha_invert)) 317 321 { … … 325 329 GR_BEGIN_NOFIFOCHECK("grTexCombine",88); 326 330 GDBG_INFO_MORE(gc->myLevel,"(%d, %d,%d, %d,%d, %d,%d)\n", 327 tmu, rgb_function, rgb_factor, 331 tmu, rgb_function, rgb_factor, 328 332 alpha_function, alpha_factor, 329 333 rgb_invert, alpha_invert); … … 356 360 ((alpha_factor & 0x07UL) == GR_COMBINE_FACTOR_LOD_FRACTION)), 357 361 "Incompatible texture combine factors (rgb vs alpha) based on lod"); 358 362 359 363 texturemode = gc->state.tmu_config[tmu].textureMode; 360 364 texturemode &= ~(SST_TCOMBINE | SST_TACOMBINE); … … 363 367 364 368 /* tmuMask tells grColorCombineFunction what to turn off an on if 365 * the ccFunc requires texture mapping 369 * the ccFunc requires texture mapping 366 370 */ 367 371 tmuMask = GR_TMUMASK_TMU0 << tmu; … … 444 448 break; 445 449 } 446 450 447 451 switch (alpha_function) { 448 452 case GR_COMBINE_FUNCTION_ZERO: … … 503 507 break; 504 508 } 505 509 506 510 /* Hack to enable TWO-PASS Trilinear */ 507 511 if (texturemode & SST_TRILINEAR) { … … 532 536 if (localColorP && localAlphaP) { 533 537 SstRegs* tmuHw = SST_TMU(hw, upstreamTmu); 534 538 535 539 GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1); 536 540 GR_SET((0x02UL << upstreamTmu), tmuHw, tLOD, SST_TLOD_MINMAX_INT(GR_LOD_1, GR_LOD_1)); 537 541 GR_CHECK_SIZE(); 538 542 539 543 gc->hwDep.cvgDep.tmuLodDisable[upstreamTmu] = FXTRUE; 540 541 GDBG_INFO(gc->myLevel, FN_NAME": Disabling tmu(%ld) : (0x%X : 0x%X)\n", 544 545 GDBG_INFO(gc->myLevel, FN_NAME": Disabling tmu(%ld) : (0x%X : 0x%X)\n", 542 546 upstreamTmu, rgb_function, alpha_function); 543 547 } else if (gc->hwDep.cvgDep.tmuLodDisable[upstreamTmu]) { 544 548 SstRegs* tmuHw = SST_TMU(hw, upstreamTmu); 545 549 546 550 GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1); 547 551 GR_SET((0x02UL << upstreamTmu), tmuHw, tLOD, gc->state.tmu_config[upstreamTmu].tLOD); 548 552 GR_CHECK_SIZE(); 549 553 550 554 gc->hwDep.cvgDep.tmuLodDisable[upstreamTmu] = FXFALSE; 551 555 } … … 564 568 { 565 569 SstRegs* tmuHw = SST_TMU(hw, tmu); 566 570 567 571 REG_GROUP_BEGIN((0x02 << tmu), textureMode, 2, 0x3); 568 572 { … … 577 581 * we have multiple tmu's, but this state is really setup across 578 582 * multiple calls (grTexCombine, grTexMipMapMode, and 579 * grTexSource). 580 * 583 * grTexSource). 584 * 581 585 * NB: This must happen after the shadows are updated because 582 586 * _grTexCheckTriLinear() will use the shadow register values … … 613 617 */ 614 618 615 GR_ENTRY(grTexFilterMode, void, 619 GR_ENTRY(grTexFilterMode, void, 616 620 (GrChipID_t tmu, GrTextureFilterMode_t minfilter, GrTextureFilterMode_t magfilter)) 617 621 { … … 639 643 */ 640 644 641 GR_ENTRY(grTexLodBiasValue, void, 645 GR_ENTRY(grTexLodBiasValue, void, 642 646 (GrChipID_t tmu, float fvalue)) 643 647 { 644 648 #define FN_NAME "grTexLodBiasValue" 645 649 FxU32 tLod; 646 650 647 651 GR_BEGIN("grTexLodBiasValue",88,4, 1); 648 652 GDBG_INFO_MORE(gc->myLevel,"(%d,%g)\n",tmu,fvalue); 649 653 GR_CHECK_TMU(FN_NAME, tmu); 650 654 651 655 tLod = gc->state.tmu_config[tmu].tLOD; 652 656 tLod &= ~(SST_LODBIAS); … … 667 671 Description: 668 672 Sets the mip map mode for the specified TMU 669 "Ex" because glide's grTexMipMapMode is inadequate for 673 "Ex" because glide's grTexMipMapMode is inadequate for 670 674 low level texture memory management 671 675 Arguments: 672 676 tmu - tmu to update 673 mmMode - mipmap mode 677 mmMode - mipmap mode 674 678 One of: 675 679 GR_MIPMAP_DISABLE … … 683 687 -------------------------------------------------------------------*/ 684 688 685 GR_ENTRY(grTexMipMapMode, void, 689 GR_ENTRY(grTexMipMapMode, void, 686 690 (GrChipID_t tmu, GrMipMapMode_t mmMode, FxBool lodBlend)) 687 691 { … … 726 730 case GR_MIPMAP_NEAREST: 727 731 /*---------------------------------------------------------- 728 Set LODMIN and LODMAX in the tLod register to the 732 Set LODMIN and LODMAX in the tLod register to the 729 733 actual min and max LODs of the current texture. 730 734 ----------------------------------------------------------*/ … … 752 756 full textures. The assumption here is that the only reason 753 757 you would ever set up Multiply by LODFRAC w/o REVERSE BLEND 754 is for the ODD pass of trilinear. 758 is for the ODD pass of trilinear. 755 759 --------------------------------------------------------------*/ 756 760 if (lodBlend) { 757 761 /* If we're doing trilinear for real then nuke the lod dithering 758 * at the same time because it just looks bad. 762 * at the same time because it just looks bad. 759 763 */ 760 764 texMode = ((texMode & ~SST_TLODDITHER) | SST_TRILINEAR); … … 767 771 } 768 772 tLod |= _gr_evenOdd_xlate_table[gc->state.tmu_config[tmu].evenOdd]; 769 773 770 774 /*-------------------------------------------------------------- 771 775 Write State To Hardware and Update Glide Shadow State … … 786 790 * we have multiple tmu's, but this state is really setup across 787 791 * multiple calls (grTexCombine, grTexMipMapMode, and 788 * grTexSource). 789 * 792 * grTexSource). 793 * 790 794 * NB: This must happen after the shadows are updated because 791 795 * _grTexCheckTriLinear() will use the shadow register values … … 830 834 -------------------------------------------------------------------*/ 831 835 832 GR_ENTRY(grTexNCCTable, void, 836 GR_ENTRY(grTexNCCTable, void, 833 837 (GrChipID_t tmu, GrNCCTable_t table)) 834 838 { 835 839 #define FN_NAME "grTexNCCTable" 836 840 FxU32 texMode; 837 841 838 842 GR_BEGIN("grTexNCCTable",88,4, 1); 839 843 GDBG_INFO_MORE(gc->myLevel,"(%d)\n",tmu); … … 845 849 ------------------------------------------------------------------*/ 846 850 gc->state.tmu_config[tmu].nccTable = table; 847 851 848 852 /*------------------------------------------------------------------ 849 853 Grab shadow texMode, update TexMode, update shadow/real register … … 853 857 if (table == GR_TEXTABLE_NCC1) 854 858 texMode |= SST_TNCCSELECT; 855 else 859 else 856 860 texMode &= ~(SST_TNCCSELECT); 857 861 … … 877 881 the selected texture 878 882 One of: 879 GR_MIPMAPLEVELMASK_EVEN 883 GR_MIPMAPLEVELMASK_EVEN 880 884 GR_MIPMAPLEVELMASK_ODD 881 885 GR_MIPMAPLEVELMASK_BOTH … … 885 889 none 886 890 -------------------------------------------------------------------*/ 887 GR_ENTRY(grTexSource, void, 891 GR_ENTRY(grTexSource, void, 888 892 (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info)) 889 893 { … … 894 898 GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x,%d,0x%x)\n",tmu,startAddress,evenOdd,info); 895 899 GR_CHECK_TMU(FN_NAME, tmu); 896 GR_CHECK_COMPATABILITY(FN_NAME, 897 startAddress >= gc->tmu_state[tmu].total_mem, 900 GR_CHECK_COMPATABILITY(FN_NAME, 901 startAddress >= gc->tmu_state[tmu].total_mem, 898 902 "invalid startAddress"); 899 903 900 904 GR_CHECK_COMPATABILITY(FN_NAME, 901 (startAddress + grTexTextureMemRequired(evenOdd, info) >= 905 (startAddress + grTexTextureMemRequired(evenOdd, info) >= 902 906 gc->tmu_state[tmu].total_mem), 903 907 "insufficient texture ram at startAddress"); 904 908 GR_CHECK_F(FN_NAME, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid"); 905 909 GR_CHECK_F(FN_NAME, !info, "invalid info pointer"); 906 910 907 911 /*------------------------------------------------------------- 908 912 Update Texture Unit State … … 910 914 gc->state.tmu_config[tmu].smallLod = info->smallLod; 911 915 gc->state.tmu_config[tmu].largeLod = info->largeLod; 912 gc->state.tmu_config[tmu].evenOdd = evenOdd; 913 916 gc->state.tmu_config[tmu].evenOdd = evenOdd; 917 914 918 /*------------------------------------------------------------- 915 919 Calculate Base Address … … 924 928 baseAddress += 0x200000; 925 929 #endif 926 930 927 931 /*------------------------------------------------------------- 928 932 Update Texture Mode … … 931 935 texMode &= ~SST_TFORMAT; 932 936 texMode |= (info->format << SST_TFORMAT_SHIFT) | SST_TPERSP_ST | SST_TCLAMPW; 933 937 934 938 /*------------------------------------------------------------- 935 939 Compute TLOD (keep LODBIAS in tact) 936 940 -------------------------------------------------------------*/ 937 941 tLod = gc->state.tmu_config[tmu].tLOD; 938 tLod &= ~(SST_LODMIN | 939 SST_LODMAX | 942 tLod &= ~(SST_LODMIN | 943 SST_LODMAX | 940 944 SST_LOD_ASPECT | 941 SST_LOD_TSPLIT | 942 SST_LOD_ODD | 945 SST_LOD_TSPLIT | 946 SST_LOD_ODD | 943 947 SST_LOD_S_IS_WIDER); 944 948 tLod |= SST_TLOD_MINMAX_INT(info->largeLod, … … 958 962 } 959 963 REG_GROUP_END(); 960 964 961 965 /* update shadows */ 962 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 963 gc->state.tmu_config[tmu].textureMode = texMode; 964 gc->state.tmu_config[tmu].tLOD = tLod; 966 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 967 gc->state.tmu_config[tmu].textureMode = texMode; 968 gc->state.tmu_config[tmu].tLOD = tLod; 965 969 966 970 /* Make sure that the trilinear blending bits are set in a … … 968 972 * we have multiple tmu's, but this state is really setup across 969 973 * multiple calls (grTexCombine, grTexMipMapMode, and 970 * grTexSource). 971 * 974 * grTexSource). 975 * 972 976 * NB: This must happen after the shadows are updated because 973 977 * _grTexCheckTriLinear() will use the shadow register values … … 975 979 */ 976 980 if (gc->num_tmu > 1) _grTexCheckTriLinear(tmu); 977 981 978 982 GR_END(); 979 983 #undef FN_NAME … … 994 998 -------------------------------------------------------------------*/ 995 999 996 GR_ENTRY(grTexMultibase, void, 1000 GR_ENTRY(grTexMultibase, void, 997 1001 (GrChipID_t tmu, FxBool enable)) 998 1002 { 999 1003 #define FN_NAME "grTexMultibase" 1000 1004 FxU32 tLod; 1001 1005 1002 1006 GR_BEGIN("grTexMultibase",88,4,1); 1003 1007 GDBG_INFO_MORE(gc->myLevel,"(%d,%d)\n",tmu,enable); 1004 1008 GR_CHECK_TMU(FN_NAME,tmu); 1005 1009 1006 1010 tLod = gc->state.tmu_config[tmu].tLOD; 1007 1011 if (enable) … … 1034 1038 GR_TEXBASE_64 1035 1039 GR_TEXBASE_32_TO_1 1036 startAddress - start address that data was downloaded to 1040 startAddress - start address that data was downloaded to 1037 1041 hardware with using grTexDownload/Level 1038 1042 info - pointer to GrTexInfo structure containing … … 1042 1046 -------------------------------------------------------------------*/ 1043 1047 1044 GR_ENTRY(grTexMultibaseAddress, void, 1048 GR_ENTRY(grTexMultibaseAddress, void, 1045 1049 (GrChipID_t tmu, GrTexBaseRange_t range, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info)) 1046 1050 { … … 1055 1059 GR_CHECK_F(FN_NAME, evenOdd > 0x3, "evenOdd mask invalid"); 1056 1060 GR_CHECK_F(FN_NAME, info, "invalid info pointer"); 1057 1061 1058 1062 1059 1063 /* Write relevant registers out to hardware and shadows */ … … 1067 1071 evenOdd) >> 3; 1068 1072 GR_SET(tmuChip, hw, texBaseAddr, baseAddress); 1069 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 1073 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 1070 1074 break; 1071 1075 … … 1077 1081 evenOdd) >> 3; 1078 1082 GR_SET(tmuChip, hw, texBaseAddr1, baseAddress); 1079 gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 1083 gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 1080 1084 break; 1081 1085 … … 1087 1091 evenOdd) >> 3; 1088 1092 GR_SET(tmuChip, hw, texBaseAddr2, baseAddress); 1089 gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 1093 gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 1090 1094 break; 1091 1095 … … 1097 1101 evenOdd) >> 3; 1098 1102 GR_SET(tmuChip, hw, texBaseAddr38, baseAddress); 1099 gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress; 1103 gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress; 1100 1104 break; 1101 1105 } -
trunk/src/opengl/glide/cvg/glide/gtexdl.c
r2888 r6653 1 /* $Id: gtexdl.c,v 1.2 2001-09-05 14:30:29 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gtexdl.c,v 1. 1 2000-02-25 00:37:42 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gtexdl.c,v 1.2 2001-09-05 14:30:29 bird Exp $ 21 22 ** $Log: gtexdl.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:42 sandervl 23 ** Revision 1.2 2001-09-05 14:30:29 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:42 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 61 5/18/98 12:11p Peter 27 31 ** removed unnecesasry fencing 28 ** 32 ** 29 33 ** 60 4/29/98 2:32p Peter 30 34 ** fixed texture palette broadcast 31 ** 35 ** 32 36 ** 59 3/30/98 2:46p Peter 33 37 ** fixed texture download muckage 34 ** 38 ** 35 39 ** 58 3/29/98 10:54p Jdt 36 40 ** Unset GLIDE_POINTCAST_PALETTE 37 ** 41 ** 38 42 ** 57 2/20/98 5:31p Peter 39 43 ** crybaby glide 40 ** 44 ** 41 45 ** 56 2/20/98 11:00a Peter 42 46 ** removed glide3 from glid2 tree 43 ** 47 ** 44 48 ** 55 2/02/98 2:14p Atai 45 49 ** fixed palette broadcasts in _grTexDownloadNccTable and 46 ** _grTexDownloadPalette 47 * 50 ** _grTexDownloadPalette 51 * 48 52 * 54 1/09/98 6:48p Atai 49 53 * grTexInfo, GR_LOD_* and GR_ASPECT_* 50 * 54 * 51 55 * 53 1/08/98 7:09p Peter 52 56 * real hw stuff modulo makefile change 53 * 57 * 54 58 * 52 1/08/98 4:58p Atai 55 59 * tex table broadcast, grVertexLayout enable/disable, stq, and some 56 60 * defines 57 * 61 * 58 62 * 51 1/08/98 11:06a Dow 59 63 * Set palette downloads to broadcast. 60 * 64 * 61 65 * 50 12/11/97 4:15p Peter 62 66 * fixed assertions 63 * 67 * 64 68 * 49 12/09/97 12:20p Peter 65 69 * mac glide port 66 * 70 * 67 71 * 48 12/05/97 4:26p Peter 68 72 * watcom warnings 69 * 73 * 70 74 * 47 12/02/97 9:48a Dow 71 75 * Got rid of Texelfx rev 0 warning 72 * 76 * 73 77 * 46 11/21/97 1:03p Peter 74 78 * small texture download problem 75 * 79 * 76 80 * 45 11/20/97 6:57p Dow 77 81 * Texture Downloads for Banshee 78 * 82 * 79 83 * 44 11/18/97 4:36p Peter 80 84 * chipfield stuff cleanup and w/ direct writes 81 * 85 * 82 86 * 43 11/17/97 4:55p Peter 83 87 * watcom warnings/chipfield stuff 84 * 88 * 85 89 * 42 11/14/97 12:09a Peter 86 90 * comdex thing and some other stuff 87 * 91 * 88 92 * 41 11/12/97 11:16a Peter 89 93 * cleaned up assertions 90 * 94 * 91 95 * 40 11/05/97 1:50p Peter 92 96 * fixed partial palette downloads 93 * 97 * 94 98 * 39 11/03/97 3:43p Peter 95 99 * h3/cvg cataclysm 96 * 100 * 97 101 * 38 10/08/97 11:33a Peter 98 102 * reg group for palette download 99 * 103 * 100 104 * 37 9/15/97 7:31p Peter 101 105 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 102 106 * place, lfb's are on, Hmmmm.. probably more 103 * 107 * 104 108 * 36 9/04/97 3:32p Peter 105 109 * starting grouping serial reg writes 106 * 110 * 107 111 * 35 8/18/97 3:52p Peter 108 112 * pre-hw arrival fixes/cleanup 109 * 113 * 110 114 * 34 7/26/97 5:18p Peter 111 115 * fixed macro muckage 112 * 116 * 113 117 * 33 7/08/97 2:49p Peter 114 * 118 * 115 119 * 32 7/02/97 12:28p Peter 116 120 * removed spurious NOP, tex dl 117 * 121 * 118 122 * 31 6/30/97 3:22p Peter 119 123 * cmd fifo sanity 120 * 124 * 121 125 ** 122 126 */ … … 216 220 GR_CHECK_F(FN_NAME, start < 0, "invalid start index"); 217 221 GR_CHECK_F(FN_NAME, end > 255, "invalid end index"); 218 222 219 223 /* NOTE: 220 224 ** … … 223 227 ** there are. This is fallout from the fact that future hardware 224 228 ** has a unified memory architecture. 225 ** 229 ** 226 230 ** Source licensees (meaning arcade or LBE vendors that) require the 227 231 ** one palette/tmu mode should define GLIDE_POINTCAST_PALETTE on … … 232 236 #ifdef GLIDE_POINTCAST_PALETTE 233 237 /* 234 ** FURTHER NOTE: 238 ** FURTHER NOTE: 235 239 ** There is a sublety (nice way of saying BUG) here. 236 240 ** If TMU0 is specified, then the palette will be broadcast to all … … 252 256 * format: stuff before the 8 word alignment, aligned writes, and 253 257 * stuff after the 8 word alignment to the end. The slop regions 254 * are one packet apiece. 258 * are one packet apiece. 255 259 */ 256 260 { … … 265 269 266 270 /* Is the start of the palette range unaligned or is the end of 267 * the range less than a completely aligned range? 271 * the range less than a completely aligned range? 268 272 */ 269 273 if (((start & 0x07) != 0) || (end < ((start + 8) & ~0x07))) { 270 274 const FxI32 slopCount = startSlop - start + 1; 271 275 GR_ASSERT((slopCount > 0) && (slopCount <= 8)); 272 273 REG_GROUP_BEGIN(chipId, nccTable0[4 + (start & 0x07)], 276 277 REG_GROUP_BEGIN(chipId, nccTable0[4 + (start & 0x07)], 274 278 slopCount, (0xFF >> (8 - slopCount))); 275 279 while(i < start + slopCount) { … … 284 288 while(i < endSlop) { 285 289 const int endIndex = i + 8; 286 290 287 291 REG_GROUP_BEGIN(chipId, nccTable0[4], 8, 0xFF); 288 292 while(i < endIndex) { … … 293 297 REG_GROUP_END(); 294 298 } 295 299 296 300 /* Do we have any more slop at the end of the ragne? */ 297 301 if (i <= end) { 298 302 const FxU32 slopCount = end - endSlop + 1; 299 300 REG_GROUP_BEGIN(chipId, nccTable0[4], 303 304 REG_GROUP_BEGIN(chipId, nccTable0[4], 301 305 slopCount, (0xFF >> (8 - slopCount))); 302 306 while(i <= end) { … … 308 312 } 309 313 } 310 314 311 315 GR_END(); 312 316 #undef FN_NAME … … 368 372 thisLod - lod constant that describes the mipmap level 369 373 to be downloaded 370 largeLod - largest level of detail in complete mipmap to 374 largeLod - largest level of detail in complete mipmap to 371 375 be downloaded at startAddress of which level to 372 376 be downloaded is a part … … 376 380 the selected texture 377 381 One of: 378 GR_MIPMAPLEVELMASK_EVEN 382 GR_MIPMAPLEVELMASK_EVEN 379 383 GR_MIPMAPLEVELMASK_ODD 380 384 GR_MIPMAPLEVELMASK_BOTH … … 399 403 tmu,startAddress,thisLod,largeLod,aspectRatio, 400 404 format,evenOdd,data,t,max_t); 401 405 402 406 /* Check fo silly things */ 403 407 { 404 const FxU32 size = _grTexTextureMemRequired(thisLod, thisLod, 408 const FxU32 size = _grTexTextureMemRequired(thisLod, thisLod, 405 409 aspectRatio, format, evenOdd); 406 410 407 411 GR_CHECK_TMU(FN_NAME, tmu); 408 GR_CHECK_COMPATABILITY(FN_NAME, 412 GR_CHECK_COMPATABILITY(FN_NAME, 409 413 startAddress + size > gc->tmu_state[tmu].total_mem, 410 414 "insufficient texture ram at startAddress"); 411 GR_CHECK_COMPATABILITY(FN_NAME, 415 GR_CHECK_COMPATABILITY(FN_NAME, 412 416 startAddress & 0x7, 413 417 "unaligned startAddress"); … … 418 422 GR_CHECK_F(FN_NAME, thisLod < largeLod, 419 423 "thisLod may not be larger than largeLod"); 420 GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 || 424 GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 || 421 425 aspectRatio < GR_ASPECT_8x1, 422 426 "aspectRatio invalid"); … … 444 448 ------------------------------------------------------------*/ 445 449 const FxU32 baseAddress = _grTexCalcBaseAddress(startAddress, 446 largeLod, 450 largeLod, 447 451 aspectRatio, 448 452 format, 449 453 evenOdd) >> 3; 450 451 /*------------------------------------------------------------ 452 Compute pertinant contents of tLOD and texMode registers 454 455 /*------------------------------------------------------------ 456 Compute pertinant contents of tLOD and texMode registers 453 457 ------------------------------------------------------------*/ 454 458 FxU32 tLod = SST_TLOD_MINMAX_INT(largeLod, GR_LOD_1); 455 459 FxU32 texMode = format << SST_TFORMAT_SHIFT; 456 460 457 461 tLod |= _gr_evenOdd_xlate_table[evenOdd]; 458 462 tLod |= _gr_aspect_xlate_table[aspectRatio]; 459 463 460 464 if (gc->state.tmu_config[tmu].textureMode & SST_SEQ_8_DOWNLD) { 461 465 sh = 2; … … 506 510 case 1: 507 511 for (; t <= max_t; t++) { 508 LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 512 LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 509 513 (FxU32)tex_address - (FxU32)gc->tex_ptr, 510 514 0x00UL, 0x00UL); 511 515 LINEAR_WRITE_SET_8(tex_address, (const FxU32)*(const FxU8*)src8); 512 516 LINEAR_WRITE_END(); 513 517 514 518 src8 += width; 515 519 tex_address += TEX_ROW_ADDR_INCR(1, thisLod); … … 519 523 case 2: 520 524 for (; t <= max_t; t++) { 521 LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 525 LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 522 526 (FxU32)tex_address - (FxU32)gc->tex_ptr, 523 527 0x00UL, 0x00UL); 524 528 LINEAR_WRITE_SET_8(tex_address, (const FxU32)*(const FxU16*)src8); 525 529 LINEAR_WRITE_END(); 526 530 527 531 src8 += width; 528 532 tex_address += TEX_ROW_ADDR_INCR(1, thisLod); … … 532 536 case 4: 533 537 for (; t <= max_t; t++) { 534 LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 538 LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 535 539 (FxU32)tex_address - (FxU32)gc->tex_ptr, 536 540 0x00UL, 0x00UL); 537 541 LINEAR_WRITE_SET_8(tex_address, *(const FxU32*)src8); 538 542 LINEAR_WRITE_END(); 539 543 540 544 src8 += width; 541 545 tex_address += TEX_ROW_ADDR_INCR(1, thisLod); … … 559 563 const FxU32 t0 = *(const FxU32*)(src8 ); 560 564 const FxU32 t1 = *(const FxU32*)(src8 + sizeof(FxU32)); 561 565 562 566 LINEAR_WRITE_SET_8(tex_address , t0); 563 567 LINEAR_WRITE_SET_8(tex_address + sizeof(FxU32), t1); … … 585 589 LINEAR_WRITE_SET_16(tex_address, (const FxU32)*(const FxU16*)src16); 586 590 LINEAR_WRITE_END(); 587 591 588 592 src16 += width; 589 593 tex_address += TEX_ROW_ADDR_INCR(1, thisLod); 590 594 } 591 595 break; 592 596 593 597 case 2: 594 598 for (; t <= max_t; t++) { … … 598 602 LINEAR_WRITE_SET_16(tex_address, *(const FxU32*)src16); 599 603 LINEAR_WRITE_END(); 600 604 601 605 src16 += width; 602 606 tex_address += TEX_ROW_ADDR_INCR(1, thisLod); … … 610 614 tex_address = tmu_baseaddress + TEX_ROW_ADDR_INCR(t, thisLod); 611 615 612 /* Loop unrolled to process 2 dwords per iteration */ 616 /* Loop unrolled to process 2 dwords per iteration */ 613 617 LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 614 618 (FxU32)tex_address - (FxU32)gc->tex_ptr, … … 622 626 LINEAR_WRITE_SET_16(tex_address , t0); 623 627 LINEAR_WRITE_SET_16(tex_address + 4, t1); 624 628 625 629 tex_address += 8; 626 630 src16 += 4; 627 631 } 628 632 629 633 LINEAR_WRITE_END(); 630 634 } … … 633 637 } 634 638 } 635 639 636 640 /*------------------------------------------------------------ 637 641 Restore TLOD, texMode, baseAddress … … 650 654 } /* grTexDownloadMipmapLevelPartial */ 651 655 652 /* 656 /* 653 657 Let me take this opportunity to register my formal opposition to 654 658 this function. Either we do this or we don't. Let's not hack like … … 678 682 #define FN_NAME "ConvertAndDownloadRLE" 679 683 GR_BEGIN_NOFIFOCHECK(FN_NAME, 89); 680 684 681 685 /* make sure even number */ 682 686 width&=0xFFFFFFFE; 683 687 684 688 max_s=width>>1; 685 689 max_t=height; 686 690 687 691 GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d)\n", 688 692 tmu,startAddress,thisLod,largeLod,aspectRatio, 689 693 format,evenOdd,bm_data,max_t); 690 694 691 695 size = _grTexTextureMemRequired(thisLod, thisLod, aspectRatio, format, evenOdd); 692 696 GR_CHECK_TMU(FN_NAME, tmu); … … 697 701 GR_CHECK_F(FN_NAME, largeLod > GR_LOD_1, "largeLod invalid"); 698 702 GR_CHECK_F(FN_NAME, thisLod < largeLod, "thisLod may not be larger than largeLod"); 699 GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 || 703 GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 || 700 704 aspectRatio < GR_ASPECT_8x1, 701 705 "aspectRatio invalid"); … … 714 718 if (!(evenOdd & (thisLod & 0x1 ? GR_MIPMAPLEVELMASK_ODD:GR_MIPMAPLEVELMASK_EVEN))) 715 719 goto all_done; 716 720 717 721 /*------------------------------------------------------------ 718 722 Compute Base Address Given Start Address Offset 719 723 ------------------------------------------------------------*/ 720 724 baseAddress = _grTexCalcBaseAddress(startAddress, 721 largeLod, 725 largeLod, 722 726 aspectRatio, 723 727 format, … … 733 737 tmu_baseaddress = (FxU32)gc->tex_ptr; 734 738 tmu_baseaddress += (((FxU32)tmu)<<21) + (((FxU32)thisLod)<<17); 735 736 /*------------------------------------------------------------ 737 Compute pertinant contents of tLOD and texMode registers 739 740 /*------------------------------------------------------------ 741 Compute pertinant contents of tLOD and texMode registers 738 742 ------------------------------------------------------------*/ 739 743 tLod = SST_TLOD_MINMAX_INT(largeLod, GR_LOD_1); … … 759 763 } 760 764 REG_GROUP_END(); 761 765 762 766 _GlideRoot.stats.texBytes += dest_width * (dest_height) * 2; 763 767 764 768 /* here I can do my writes and conversion and I will be so happy */ 765 769 offset=4+bm_h; 766 770 for (i=0; i<v0; i++) 767 771 offset += bm_data[4+i]; 768 772 769 773 max_s=dest_width>>1; 770 774 expected_size=max_s*5; 771 775 772 776 rle_line_end=rle_line+width+u0; 773 777 for(t=0;t<max_t;t++) { 774 778 tex_address = tmu_baseaddress + TEX_ROW_ADDR_INCR(t, thisLod); 775 779 src = rle_line + u0; 776 780 777 781 rle_decode_line_asm(tlut,&bm_data[offset],rle_line); 778 779 LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 782 783 LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 780 784 (FxU32)tex_address - (FxU32)gc->tex_ptr, 781 0x00UL, 0x00UL); 785 0x00UL, 0x00UL); 782 786 for(s = 0; s < max_s; s++) { 783 787 LINEAR_WRITE_SET(tex_address + (s << 2), *(FxU32 *) src); … … 785 789 } 786 790 LINEAR_WRITE_END(); 787 791 788 792 offset+=bm_data[4+i++]; 789 793 } … … 793 797 src=rle_line+u0; 794 798 795 LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 799 LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 796 800 (FxU32)tex_address - (FxU32)gc->tex_ptr, 797 0x00UL, 0x00UL); 801 0x00UL, 0x00UL); 798 802 for(s = 0; s < max_s; s++) { 799 803 LINEAR_WRITE_SET(tex_address + (s << 2), *(FxU32 *) src); 800 804 src += 2; 801 805 } 802 LINEAR_WRITE_END(); 806 LINEAR_WRITE_END(); 803 807 } 804 808 -
trunk/src/opengl/glide/cvg/glide/gu.c
r2888 r6653 1 /* $Id: gu.c,v 1.2 2001-09-05 14:30:30 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gu.c,v 1. 1 2000-02-25 00:37:42 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gu.c,v 1.2 2001-09-05 14:30:30 bird Exp $ 21 22 ** $Log: gu.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:42 sandervl 23 ** Revision 1.2 2001-09-05 14:30:30 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:42 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 14 12/18/97 2:13p Peter 27 31 * fogTable cataclysm 28 * 32 * 29 33 * 13 5/27/97 1:16p Peter 30 * Basic cvg, w/o cmd fifo stuff. 31 * 34 * Basic cvg, w/o cmd fifo stuff. 35 * 32 36 * 12 5/21/97 6:05a Peter 33 * 37 * 34 38 * 11 3/09/97 10:31a Dow 35 39 * Added GR_DIENTRY for di glide functions 36 * 40 * 37 41 * 10 3/05/97 9:36p Jdt 38 42 * Added guEncodeRLE16 39 * 43 * 40 44 * 9 12/23/96 1:37p Dow 41 45 * chagnes for multiplatform glide … … 64 68 switch ( mode ) { 65 69 case GR_ALPHASOURCE_CC_ALPHA: 66 grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, 67 GR_COMBINE_FACTOR_NONE, 68 GR_COMBINE_LOCAL_CONSTANT, 69 GR_COMBINE_OTHER_NONE, 70 grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, 71 GR_COMBINE_FACTOR_NONE, 72 GR_COMBINE_LOCAL_CONSTANT, 73 GR_COMBINE_OTHER_NONE, 70 74 FXFALSE ); 71 75 break; 72 76 73 77 case GR_ALPHASOURCE_ITERATED_ALPHA: 74 grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, 75 GR_COMBINE_FACTOR_NONE, 76 GR_COMBINE_LOCAL_ITERATED, 77 GR_COMBINE_OTHER_NONE, 78 grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, 79 GR_COMBINE_FACTOR_NONE, 80 GR_COMBINE_LOCAL_ITERATED, 81 GR_COMBINE_OTHER_NONE, 78 82 FXFALSE ); 79 83 break; 80 84 81 85 case GR_ALPHASOURCE_TEXTURE_ALPHA: 82 grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, 83 GR_COMBINE_FACTOR_ONE, 84 GR_COMBINE_LOCAL_NONE, 85 GR_COMBINE_OTHER_TEXTURE, 86 grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, 87 GR_COMBINE_FACTOR_ONE, 88 GR_COMBINE_LOCAL_NONE, 89 GR_COMBINE_OTHER_TEXTURE, 86 90 FXFALSE ); 87 91 break; 88 92 89 93 case GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA: 90 grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, 91 GR_COMBINE_FACTOR_LOCAL, 92 GR_COMBINE_LOCAL_ITERATED, 93 GR_COMBINE_OTHER_TEXTURE, 94 grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, 95 GR_COMBINE_FACTOR_LOCAL, 96 GR_COMBINE_LOCAL_ITERATED, 97 GR_COMBINE_OTHER_TEXTURE, 94 98 FXFALSE ); 95 99 break; … … 182 186 grColorCombine( GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_NONE, FXTRUE ); 183 187 break; 184 188 185 189 default: 186 190 GR_CHECK_F("grColorCombineFunction", 1, "unsupported color combine function"); … … 217 221 */ 218 222 GR_DIENTRY(guFogGenerateExp, void, 219 ( GrFog_t fogtable[], float density )) 223 ( GrFog_t fogtable[], float density )) 220 224 { 221 225 int i; … … 274 278 ** guFogGenerateLinear 275 279 */ 276 GR_DIENTRY(guFogGenerateLinear, void, 280 GR_DIENTRY(guFogGenerateLinear, void, 277 281 ( GrFog_t fogtable[kInternalFogTableEntryCount], 278 282 float nearZ, float farZ )) … … 287 291 if ( world_w > 65535.0F ) 288 292 world_w = 65535.0F; 289 293 290 294 f = ( world_w - nearZ ) / ( farZ - nearZ ); 291 295 if ( f > 1.0F ) … … 430 434 431 435 srcPixels+=length; 432 sourceImageSizeInWords-=length; 436 sourceImageSizeInWords-=length; 433 437 } 434 438 } else { … … 446 450 byteCount+=4; 447 451 srcPixels+=length; 448 sourceImageSizeInWords-=length; 452 sourceImageSizeInWords-=length; 449 453 } 450 454 } -
trunk/src/opengl/glide/cvg/glide/guclip.c
r2888 r6653 1 /* $Id: guclip.c,v 1.2 2001-09-05 14:30:30 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/guclip.c,v 1. 1 2000-02-25 00:37:42 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/guclip.c,v 1.2 2001-09-05 14:30:30 bird Exp $ 21 22 ** $Log: guclip.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:42 sandervl 23 ** Revision 1.2 2001-09-05 14:30:30 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:42 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 12 12/15/97 5:52p Atai 27 31 * disable obsolete glide2 api for glide3 28 * 32 * 29 33 * 11 12/09/97 12:20p Peter 30 34 * mac glide port 31 * 35 * 32 36 * 10 12/08/97 12:06p Atai 33 37 * change prototype for grDrawPoint, grDrawLine, grDrawTriangel 34 * 38 * 35 39 * 9 8/18/97 3:52p Peter 36 40 * pre-hw arrival fixes/cleanup 37 * 41 * 38 42 * 8 7/31/97 11:14a Peter 39 43 * merge w/ sst1 glide tree, hopefully 40 * 44 * 41 45 * 5 6/27/97 4:16p Atai 42 46 * fixed guDrawTriangleWithClip bug (#484) by removing +1.0F and -1.0F in 43 47 * intersectTop(), intersectBottom(), intersectLeft(), and 44 48 * intersectRight() routine 45 * 49 * 46 50 * 4 3/09/97 10:31a Dow 47 51 * Added GR_DIENTRY for di glide functions … … 68 72 isect->b = a->b + d * ( b->b - a->b ); 69 73 } 70 74 71 75 if (gc->state.paramIndex & STATE_REQUIRES_IT_ALPHA) { 72 76 isect->a = a->a + d * ( b->a - a->a ); … … 112 116 } /* calcParams */ 113 117 114 static void 118 static void 115 119 intersectTop( const GrVertex *a, const GrVertex *b, GrVertex *intersect ) 116 120 { … … 118 122 float 119 123 d = ( gc->state.clipwindowf_ymin - a->y ) / ( b->y - a->y ); 120 124 121 125 intersect->x = a->x + d * ( b->x - a->x ); 122 intersect->y = gc->state.clipwindowf_ymin; 123 126 intersect->y = gc->state.clipwindowf_ymin; 127 124 128 calcParams(a, b, intersect, d); 125 129 … … 132 136 float 133 137 d = ( gc->state.clipwindowf_ymax - a->y ) / ( b->y - a->y ); 134 138 135 139 intersect->x = a->x + d * ( b->x - a->x ); 136 intersect->y = gc->state.clipwindowf_ymax; 140 intersect->y = gc->state.clipwindowf_ymax; 137 141 138 142 calcParams(a, b, intersect, d); … … 146 150 float 147 151 d = ( gc->state.clipwindowf_xmax - a->x ) / ( b->x - a->x ); 148 149 intersect->x = gc->state.clipwindowf_xmax; 152 153 intersect->x = gc->state.clipwindowf_xmax; 150 154 intersect->y = a->y + d * ( b->y - a->y ); 151 155 … … 160 164 float 161 165 d = ( gc->state.clipwindowf_xmin - a->x ) / ( b->x - a->x ); 162 166 163 167 intersect->x = gc->state.clipwindowf_xmin; 164 168 intersect->y = a->y + d * ( b->y - a->y ); … … 174 178 return (( p->y > gc->state.clipwindowf_ymin ) ? FXTRUE : FXFALSE); 175 179 } /* aboveYMin */ 176 180 177 181 178 182 static FxBool … … 216 220 int 217 221 j; 218 222 219 223 *outlength = 0; 220 224 221 225 s = invertexarray[inlength-1]; 222 226 for ( j = 0; j < inlength; j++ ) { … … 310 314 input_array[1] = *b; 311 315 input_array[2] = *c; 312 316 313 317 shClipPolygon( input_array, output_array, 3, &outlength, belowXMax, intersectRight ); 314 318 shClipPolygon( output_array, output_array2, outlength, &outlength, belowYMax, intersectBottom ); 315 319 shClipPolygon( output_array2, output_array, outlength, &outlength, aboveXMin, intersectLeft ); 316 320 shClipPolygon( output_array, output_array2, outlength, &outlength, aboveYMin, intersectTop ); 317 321 318 322 /* 319 323 ** snap vertices then decompose the n-gon into triangles … … 379 383 input_array[1] = *b; 380 384 input_array[2] = *c; 381 385 382 386 shClipPolygon( input_array, output_array, 3, &outlength, belowXMax, intersectRight ); 383 387 shClipPolygon( output_array, output_array2, outlength, &outlength, belowYMax, intersectBottom ); 384 388 shClipPolygon( output_array2, output_array, outlength, &outlength, aboveXMin, intersectLeft ); 385 389 shClipPolygon( output_array, output_array2, outlength, &outlength, aboveYMin, intersectTop ); 386 390 387 391 /* 388 392 ** snap vertices then decompose the n-gon into triangles -
trunk/src/opengl/glide/cvg/glide/gump.c
r2888 r6653 1 /* $Id: gump.c,v 1.2 2001-09-05 14:30:30 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gump.c,v 1. 1 2000-02-25 00:37:42 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gump.c,v 1.2 2001-09-05 14:30:30 bird Exp $ 21 22 ** $Log: gump.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:42 sandervl 23 ** Revision 1.2 2001-09-05 14:30:30 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:42 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 * 29 * 26 30 * 10 12/09/97 12:20p Peter 27 31 * mac glide port 28 * 32 * 29 33 * 9 11/12/97 5:12p Pgj 30 34 * stubs for evil guFb{Read|Write}Region() calls 31 * 35 * 32 36 * 8 5/27/97 1:16p Peter 33 * Basic cvg, w/o cmd fifo stuff. 34 * 37 * Basic cvg, w/o cmd fifo stuff. 38 * 35 39 * 7 5/21/97 6:05a Peter 36 * 40 * 37 41 * 6 3/09/97 10:31a Dow 38 42 * Added GR_DIENTRY for di glide functions 39 * 43 * 40 44 * 5 12/23/96 1:37p Dow 41 45 * chagnes for multiplatform glide … … 70 74 } 71 75 72 GR_DIENTRY(guMPTexCombineFunction, void, 76 GR_DIENTRY(guMPTexCombineFunction, void, 73 77 ( GrMPTextureCombineFnc_t tc_fnc )) 74 78 { … … 77 81 } 78 82 79 GR_DIENTRY(guMPTexSource, void, 83 GR_DIENTRY(guMPTexSource, void, 80 84 ( GrChipID_t virtual_tmu, GrMipMapId_t mmid )) 81 85 { -
trunk/src/opengl/glide/cvg/glide/gutex.c
r2888 r6653 1 /* $Id: gutex.c,v 1.2 2001-09-05 14:30:31 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gutex.c,v 1. 1 2000-02-25 00:37:43 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gutex.c,v 1.2 2001-09-05 14:30:31 bird Exp $ 21 22 ** $Log: gutex.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:43 sandervl 23 ** Revision 1.2 2001-09-05 14:30:31 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:43 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 22 2/20/98 5:31p Peter 27 31 ** crybaby glide 28 ** 32 ** 29 33 ** 21 2/20/98 11:00a Peter 30 34 ** removed glide3 from glid2 tree 31 * 35 * 32 36 * 20 1/07/98 10:22a Peter 33 37 * lod dithering env var 34 * 38 * 35 39 * 19 1/06/98 6:47p Atai 36 40 * undo grSplash and remove gu routines 37 * 41 * 38 42 * 18 12/17/97 4:45p Peter 39 43 * groundwork for CrybabyGlide 40 * 44 * 41 45 * 17 12/02/97 9:49a Dow 42 46 * rid the world of the "Setting the same state twice" message 43 * 47 * 44 48 * 16 11/20/97 6:59p Dow 45 49 * Fixed baseAddress for Banshee (the Devil's Own Test still uses guTex 46 50 * Stuff). 47 * 51 * 48 52 * 15 11/18/97 4:36p Peter 49 53 * chipfield stuff cleanup and w/ direct writes 50 * 54 * 51 55 * 14 11/17/97 4:55p Peter 52 56 * watcom warnings/chipfield stuff 53 * 57 * 54 58 * 13 11/03/97 3:43p Peter 55 59 * h3/cvg cataclysm 56 * 60 * 57 61 * 12 9/15/97 7:31p Peter 58 62 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 59 63 * place, lfb's are on, Hmmmm.. probably more 60 * 64 * 61 65 * 11 9/04/97 3:32p Peter 62 66 * starting grouping serial reg writes 63 * 67 * 64 68 * 10 6/06/97 10:47a Peter 65 69 * texture downloading, fixed 640x480 dimension, changed cvg dep to be the 66 70 * same as sst1 67 * 71 * 68 72 * 9 5/27/97 1:16p Peter 69 * Basic cvg, w/o cmd fifo stuff. 70 * 73 * Basic cvg, w/o cmd fifo stuff. 74 * 71 75 * 8 5/21/97 6:05a Peter 72 * 76 * 73 77 * 7 3/04/97 9:08p Dow 74 * 78 * 75 79 * 6 12/23/96 1:37p Dow 76 80 * chagnes for multiplatform glide 77 * 81 * 78 82 * 5 11/18/96 9:14a Sellers 79 83 * added checking for crossing of 2 MByte texture boundry … … 138 142 139 143 oldtexMode = gc->state.tmu_config[tmu].textureMode; 140 oldtexMode &= ~(SST_TFORMAT | SST_TCLAMPT | 141 SST_TCLAMPS | SST_TNCCSELECT | 142 SST_TLODDITHER | SST_TCLAMPW | 143 SST_TMAGFILTER | SST_TMINFILTER | 144 oldtexMode &= ~(SST_TFORMAT | SST_TCLAMPT | 145 SST_TCLAMPS | SST_TNCCSELECT | 146 SST_TLODDITHER | SST_TCLAMPW | 147 SST_TMAGFILTER | SST_TMINFILTER | 144 148 SST_TRILINEAR); 145 149 texMode |= oldtexMode; … … 207 211 gc->state.tmu_config[tmu].textureMode = texMode; 208 212 gc->state.tmu_config[tmu].tLOD = tLod; 209 213 210 214 GR_END(); 211 215 #undef FN_NAME -
trunk/src/opengl/glide/cvg/glide/gxdraw.c
r2888 r6653 1 /* $Id: gxdraw.c,v 1.2 2001-09-05 14:30:31 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gxdraw.c,v 1. 1 2000-02-25 00:37:43 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gxdraw.c,v 1.2 2001-09-05 14:30:31 bird Exp $ 21 22 ** $Log: gxdraw.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:43 sandervl 23 ** Revision 1.2 2001-09-05 14:30:31 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:43 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 61 3/17/98 3:00p Peter 27 31 ** removed vertex sorting 28 * 32 * 29 33 * 60 12/01/97 6:13p Peter 30 34 * non-packet3 tsu triangles ooz vs z 31 * 35 * 32 36 * 59 11/21/97 3:20p Peter 33 37 * direct writes tsu registers 34 * 38 * 35 39 * 58 11/18/97 4:36p Peter 36 40 * chipfield stuff cleanup and w/ direct writes 37 * 41 * 38 42 * 57 11/17/97 4:55p Peter 39 43 * watcom warnings/chipfield stuff 40 * 44 * 41 45 * 56 11/12/97 9:54p Peter 42 46 * fixed all the muckage from new config 43 * 47 * 44 48 * 55 11/03/97 4:38p Peter 45 49 * yapc fix 46 * 50 * 47 51 * 54 11/01/97 10:01a Peter 48 52 * tri dispatch stuff 49 * 53 * 50 54 * 53 10/29/97 2:45p Peter 51 55 * C version of Taco's packing code 52 * 56 * 53 57 * 52 10/27/97 5:59p Peter 54 58 * removed some debugging code 55 * 59 * 56 60 * 51 10/21/97 3:22p Peter 57 61 * hand pack rgb 58 * 62 * 59 63 * 50 10/19/97 12:51p Peter 60 64 * no tsu happiness 61 * 65 * 62 66 * 49 10/19/97 10:59a Peter 63 67 * fixed p1 tsu writes 64 * 68 * 65 69 * 48 10/17/97 3:15p Peter 66 70 * removed unused addr field from datalist 67 * 71 * 68 72 * 47 10/17/97 10:15a Peter 69 73 * packed rgb state cleanup 70 * 74 * 71 75 * 46 10/16/97 5:33p Peter 72 76 * argb != rgba 73 * 77 * 74 78 * 45 10/16/97 3:40p Peter 75 79 * packed rgb 76 * 80 * 77 81 * 44 10/16/97 10:31a Peter 78 82 * fixed hoopti tsu-subtractor unsorted 79 * 83 * 80 84 * 43 10/15/97 5:53p Peter 81 85 * hoopti tri compare code 82 * 86 * 83 87 * 42 10/10/97 4:33p Peter 84 88 * non-packet3 tsu triangles 85 * 89 * 86 90 * 41 10/08/97 5:19p Peter 87 91 * optinally clamp only texture params 88 * 92 * 89 93 * 40 10/08/97 11:32a Peter 90 94 * pre-computed packet headers for packet 3 91 * 95 * 92 96 * 39 9/20/97 4:42p Peter 93 97 * tri_setf fixup/big fifo 94 * 98 * 95 99 * 38 9/16/97 2:50p Peter 96 100 * fixed watcom unhappiness w/ static initializers 97 * 101 * 98 102 * 37 9/15/97 7:31p Peter 99 103 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right 100 104 * place, lfb's are on, Hmmmm.. probably more 101 * 105 * 102 106 * 36 9/10/97 10:13p Peter 103 107 * fifo logic from GaryT, non-normalized fp first cut 104 * 108 * 105 109 * 35 9/03/97 2:11p Peter 106 110 * start gdbg_info cleanup, fixed zero area no-tsu triangle muckage 107 * 111 * 108 112 * 34 9/01/97 3:19p Peter 109 113 * no-tsu w from vertex not tmuvtx 110 * 114 * 111 115 * 33 8/31/97 4:06p Peter 112 116 * no tsu fix 113 * 117 * 114 118 * 32 8/31/97 12:04p Peter 115 119 * hacked no-tsu code 116 * 120 * 117 121 * 31 7/25/97 11:40a Peter 118 122 * removed dHalf, change field name to match real use for cvg 119 * 123 * 120 124 * 30 6/30/97 3:22p Peter 121 125 * cmd fifo sanity 122 * 126 * 123 127 * 29 6/24/97 4:02p Peter 124 128 * proper cmd fifo placement 125 * 129 * 126 130 * 28 6/23/97 4:43p Peter 127 131 * cleaned up #defines etc for a nicer tree … … 139 143 #ifdef GDBG_INFO_ON 140 144 /* Some debugging information */ 141 static char *indexNames[] = { 145 static char *indexNames[] = { 142 146 "GR_VERTEX_X_OFFSET", /* 0 */ 143 147 "GR_VERTEX_Y_OFFSET", /* 1 */ … … 154 158 "GR_VERTEX_SOW_TMU1_OFFSET", /* 12 */ 155 159 "GR_VERTEX_TOW_TMU1_OFFSET", /* 13 */ 156 "GR_VERTEX_OOW_TMU1_OFFSET" 157 }; 160 "GR_VERTEX_OOW_TMU1_OFFSET" /* 14 */ 161 }; 158 162 #endif 159 163 … … 185 189 const float *fc = &vc->x; 186 190 float dxAB, dxBC, dyAB, dyBC; 187 191 188 192 /* Compute Area */ 189 193 dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET]; 190 194 dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET]; 191 195 192 196 dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET]; 193 197 dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET]; 194 198 195 199 /* Stash the area in the float pool for easy access */ 196 200 _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB; 197 201 198 202 #define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875)) 199 203 { 200 204 const FxI32 j = *(FxI32*)&_GlideRoot.pool.ftemp1; 201 205 const FxU32 culltest = (gc->state.cull_mode << 31UL); 202 206 203 207 /* Zero-area triangles are BAD!! */ 204 208 if ((j & 0x7FFFFFFF) == 0) { 205 209 GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n", 206 FloatVal(fa[0]), FloatVal(fa[1]), 207 FloatVal(fb[0]), FloatVal(fb[1]), 208 FloatVal(fc[0]), FloatVal(fc[1]), 210 FloatVal(fa[0]), FloatVal(fa[1]), 211 FloatVal(fb[0]), FloatVal(fb[1]), 212 FloatVal(fc[0]), FloatVal(fc[1]), 209 213 _GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest); 210 214 211 215 return 0; 212 216 } 213 217 214 218 /* Backface culling, use sign bit as test */ 215 219 if ((gc->state.cull_mode != GR_CULL_DISABLE) && (((FxI32)(j ^ culltest)) >= 0)) { 216 220 GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n", 217 FloatVal(fa[0]), FloatVal(fa[1]), 218 FloatVal(fb[0]), FloatVal(fb[1]), 219 FloatVal(fc[0]), FloatVal(fc[1]), 221 FloatVal(fa[0]), FloatVal(fa[1]), 222 FloatVal(fb[0]), FloatVal(fb[1]), 223 FloatVal(fc[0]), FloatVal(fc[1]), 220 224 _GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest); 221 225 222 226 return -1; 223 227 } … … 244 248 for(vectorIndex = 0; vectorIndex < sizeof(vectorArray) / sizeof(float*); vectorIndex++) { 245 249 const float* const vector = vectorArray[vectorIndex]; 246 250 247 251 /* Triangle vertex coordinages (x, y) */ 248 252 TRI_SETF(vector[GR_VERTEX_X_OFFSET]); 249 253 TRI_SETF(vector[GR_VERTEX_Y_OFFSET]); 250 254 251 255 /* Other triangle parameters */ 252 256 { … … 257 261 FxBool doColorP = FXFALSE; 258 262 FxU32 packedColor = 0x00; 259 263 260 264 if (*dataList == (GR_VERTEX_R_OFFSET << 2)) { 261 packedColor = (RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_B_OFFSET << 2)), B) | 265 packedColor = (RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_B_OFFSET << 2)), B) | 262 266 RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_G_OFFSET << 2)), G) | 263 267 RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_R_OFFSET << 2)), R)); … … 271 275 doColorP = FXTRUE; 272 276 } 273 277 274 278 if (doColorP) TRI_SET(packedColor); 275 279 } … … 284 288 dataList++; 285 289 #endif /* GLIDE_FP_CLAMP_TEX */ 286 290 287 291 while(*dataList != 0) { 288 292 TRI_SETF_CLAMP(FARRAY(vector, *dataList)); 289 293 dataList++; 290 294 } 291 } 295 } 292 296 } 293 297 } … … 365 369 GR_SET(BROADCAST_ID, hw, sSetupMode, sMode); 366 370 GR_CHECK_SIZE(); 367 371 368 372 for(vectorIndex = 0; vectorIndex < sizeof(vectorArray) / sizeof(float*); vectorIndex++) { 369 373 const GrVertex* curVertex = (const GrVertex*)vectorArray[vectorIndex]; 370 374 371 375 REG_GROUP_BEGIN(BROADCAST_ID, sVx, paramCount, paramMask); 372 376 { … … 382 386 (RGBA_COMP_CLAMP(curVertex->r) << 16UL)); 383 387 if (hasAlpha) packedVal |= (RGBA_COMP_CLAMP(curVertex->a) << 24UL); 384 388 385 389 REG_GROUP_SET(hw, sARGB, packedVal); 386 390 } … … 441 445 const float ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1; 442 446 volatile FxU32* hwAddr = &hw->FvA.x; 443 447 444 448 /* Divide the deltas by the area for gradient calculation. */ 445 449 dxBC *= ooa; … … 447 451 dxAB *= ooa; 448 452 dyBC *= ooa; 449 453 450 454 GDBG_INFO(85, FN_NAME": No-TSU Triangle area: (%g %g) : (%g %g %g %g)\n", 451 455 _GlideRoot.pool.ftemp1, ooa, 452 456 dxAB, dxBC, dyAB, dyBC); 453 454 /* write out X & Y for vertex A */ 457 458 /* write out X & Y for vertex A */ 455 459 TRI_NO_TSU_SETF(hwAddr++, fa[GR_VERTEX_X_OFFSET]); 456 460 TRI_NO_TSU_SETF(hwAddr++, fa[GR_VERTEX_Y_OFFSET]); … … 458 462 /* write out X & Y for vertex B */ 459 463 TRI_NO_TSU_SETF(hwAddr++, fb[GR_VERTEX_X_OFFSET]); 460 TRI_NO_TSU_SETF(hwAddr++, fb[GR_VERTEX_Y_OFFSET]); 461 464 TRI_NO_TSU_SETF(hwAddr++, fb[GR_VERTEX_Y_OFFSET]); 465 462 466 /* write out X & Y for vertex C */ 463 467 TRI_NO_TSU_SETF(hwAddr++, fc[GR_VERTEX_X_OFFSET]); … … 493 497 const float curGrad = (((fa[i] - fb[i]) * dyBC) - 494 498 ((fb[i] - fc[i]) * dyAB)); 495 499 496 500 GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n", 497 501 ((FxU32)hwAddr - (FxU32)hw) >> 2, 498 502 fa[i], fb[i], fc[i], curGrad); 499 503 500 504 TRI_NO_TSU_SETF(hwAddr++, curGrad); 501 505 i++; … … 503 507 504 508 /* Skip fbi oow */ 505 i++; 509 i++; 506 510 507 511 /* FixMe? We currently only do one tmu. */ … … 509 513 const float curGrad = (((fa[i] - fb[i]) * dyBC) - 510 514 ((fb[i] - fc[i]) * dyAB)); 511 515 512 516 GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n", 513 517 ((FxU32)hwAddr - (FxU32)hw) >> 2, 514 518 fa[i], fb[i], fc[i], curGrad); 515 519 516 520 TRI_NO_TSU_SETF(hwAddr++, curGrad); 517 521 i++; … … 521 525 const float curGrad = (((fa[GR_VERTEX_OOW_OFFSET] - fb[GR_VERTEX_OOW_OFFSET]) * dyBC) - 522 526 ((fb[GR_VERTEX_OOW_OFFSET] - fc[GR_VERTEX_OOW_OFFSET]) * dyAB)); 523 527 524 528 TRI_NO_TSU_SETF(hwAddr++, curGrad); 525 529 } … … 533 537 const float curGrad = (((fb[i] - fc[i]) * dxAB) - 534 538 ((fa[i] - fb[i]) * dxBC)); 535 539 536 540 GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n", 537 541 ((FxU32)hwAddr - (FxU32)hw) >> 2, … … 549 553 const float curGrad = (((fb[i] - fc[i]) * dxAB) - 550 554 ((fa[i] - fb[i]) * dxBC)); 551 555 552 556 GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n", 553 557 ((FxU32)hwAddr - (FxU32)hw) >> 2, 554 558 fa[i], fb[i], fc[i], curGrad); 555 559 556 560 TRI_NO_TSU_SETF(hwAddr++, curGrad); 557 561 i++; … … 561 565 const float curGrad = (((fb[GR_VERTEX_OOW_OFFSET] - fc[GR_VERTEX_OOW_OFFSET]) * dxAB) - 562 566 ((fa[GR_VERTEX_OOW_OFFSET] - fb[GR_VERTEX_OOW_OFFSET]) * dxBC)); 563 567 564 568 TRI_NO_TSU_SETF(hwAddr++, curGrad); 565 } 566 } 567 569 } 570 } 571 568 572 /* Draw the triangle by writing the area to the triangleCMD register */ 569 573 TRI_NO_TSU_SETF(hwAddr, _GlideRoot.pool.ftemp1); … … 582 586 583 587 return 1; 584 588 585 589 #undef FN_NAME 586 590 } /* _trisetup_nogradients */ -
trunk/src/opengl/glide/cvg/glide/splshdat.c
r2888 r6653 1 /* $Id: splshdat.c,v 1.2 2001-09-05 14:30:32 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/splshdat.c,v 1. 1 2000-02-25 00:37:45 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/splshdat.c,v 1.2 2001-09-05 14:30:32 bird Exp $ 21 22 ** $Log: splshdat.c,v $ 22 ** Revision 1.1 2000-02-25 00:37:45 sandervl 23 ** Revision 1.2 2001-09-05 14:30:32 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:37:45 sandervl 23 27 ** Created Voodoo 2 dir 24 28 ** 25 ** 29 ** 26 30 ** 7 2/20/98 11:00a Peter 27 31 ** removed glide3 from glid2 tree 28 * 32 * 29 33 * 6 1/09/98 6:48p Atai 30 34 * grTexInfo, GR_LOD_* and GR_ASPECT_* 31 * 35 * 32 36 * 5 12/09/97 10:20a Peter 33 37 * removed extraneous cruft 34 * 38 * 35 39 * 4 6/02/97 4:09p Peter 36 40 * Compile w/ gcc for Dural 37 * 41 * 38 42 * 3 5/21/97 6:05a Peter 39 43 ** … … 3593 3597 3594 3598 3595 static Vert *vert[] = { 3599 static Vert *vert[] = { 3596 3600 vert_0, 3597 3601 vert_1, … … 3605 3609 }; 3606 3610 3607 static Face *face[] = { 3611 static Face *face[] = { 3608 3612 face_0, 3609 3613 face_1, … … 3619 3623 static int total_num_frames = 75; 3620 3624 3621 static Matrix mat[][3] = 3625 static Matrix mat[][3] = 3622 3626 { 3623 3627 { 3624 { 3628 { 3625 3629 1.000000f, 0.000000f, 0.000000f, 0.000000f, 3626 3630 0.000000f, 0.000000f, 1.000000f, 0.000000f, 3627 3631 0.000000f, 1.000000f, 0.000000f, 0.000000f, 3628 3632 -41.462547f, 14.736900f, 22198.351563f, 1.000000f 3629 }, 3633 }, 3630 3634 { 3631 3635 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3641 3645 } 3642 3646 }, 3643 { 3647 { 3644 3648 { 3645 3649 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3661 3665 } 3662 3666 }, 3663 { 3667 { 3664 3668 { 3665 3669 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3681 3685 } 3682 3686 }, 3683 { 3687 { 3684 3688 { 3685 3689 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3701 3705 }, 3702 3706 }, 3703 { 3707 { 3704 3708 { 3705 3709 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3721 3725 } 3722 3726 }, 3723 { 3727 { 3724 3728 { 3725 3729 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3741 3745 } 3742 3746 }, 3743 { 3747 { 3744 3748 { 3745 3749 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3761 3765 } 3762 3766 }, 3763 { 3767 { 3764 3768 { 3765 3769 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3801 3805 } 3802 3806 }, 3803 3807 3804 3808 { 3805 3809 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3821 3825 } 3822 3826 }, 3823 3827 3824 3828 { 3825 3829 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3841 3845 } 3842 3846 }, 3843 3847 3844 3848 { 3845 3849 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3861 3865 } 3862 3866 }, 3863 3867 3864 3868 { 3865 3869 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3881 3885 } 3882 3886 }, 3883 3887 3884 3888 { 3885 3889 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3901 3905 } 3902 3906 }, 3903 3907 3904 3908 { 3905 3909 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3941 3945 } 3942 3946 }, 3943 3947 3944 3948 { 3945 3949 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3961 3965 } 3962 3966 }, 3963 3967 3964 3968 { 3965 3969 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 3981 3985 } 3982 3986 }, 3983 3987 3984 3988 { 3985 3989 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4001 4005 } 4002 4006 }, 4003 4007 4004 4008 { 4005 4009 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4021 4025 } 4022 4026 }, 4023 4027 4024 4028 { 4025 4029 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4041 4045 } 4042 4046 }, 4043 4047 4044 4048 { 4045 4049 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4061 4065 } 4062 4066 }, 4063 4067 4064 4068 { 4065 4069 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4081 4085 } 4082 4086 }, 4083 4087 4084 4088 { 4085 4089 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4101 4105 } 4102 4106 }, 4103 4107 4104 4108 { 4105 4109 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4121 4125 } 4122 4126 }, 4123 4127 4124 4128 { 4125 4129 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4141 4145 } 4142 4146 }, 4143 4147 4144 4148 { 4145 4149 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4161 4165 } 4162 4166 }, 4163 4167 4164 4168 { 4165 4169 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4181 4185 } 4182 4186 }, 4183 4187 4184 4188 { 4185 4189 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4201 4205 } 4202 4206 }, 4203 4207 4204 4208 { 4205 4209 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4221 4225 } 4222 4226 }, 4223 4227 4224 4228 { 4225 4229 { 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4241 4245 } 4242 4246 }, 4243 { 4247 { 4244 4248 { 4245 4249 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4261 4265 } 4262 4266 }, 4263 { 4267 { 4264 4268 { 4265 4269 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4281 4285 } 4282 4286 }, 4283 { 4287 { 4284 4288 { 4285 4289 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4301 4305 } 4302 4306 }, 4303 { 4307 { 4304 4308 { 4305 4309 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4321 4325 } 4322 4326 }, 4323 { 4327 { 4324 4328 { 4325 4329 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4341 4345 } 4342 4346 }, 4343 { 4347 { 4344 4348 { 4345 4349 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4361 4365 } 4362 4366 }, 4363 { 4367 { 4364 4368 { 4365 4369 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4381 4385 } 4382 4386 }, 4383 { 4387 { 4384 4388 { 4385 4389 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4401 4405 } 4402 4406 }, 4403 { 4407 { 4404 4408 { 4405 4409 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4421 4425 } 4422 4426 }, 4423 { 4427 { 4424 4428 { 4425 4429 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4441 4445 } 4442 4446 }, 4443 { 4447 { 4444 4448 { 4445 4449 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4461 4465 } 4462 4466 }, 4463 { 4467 { 4464 4468 { 4465 4469 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4481 4485 } 4482 4486 }, 4483 { 4487 { 4484 4488 { 4485 4489 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4501 4505 } 4502 4506 }, 4503 { 4507 { 4504 4508 { 4505 4509 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4521 4525 } 4522 4526 }, 4523 { 4527 { 4524 4528 { 4525 4529 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4541 4545 } 4542 4546 }, 4543 { 4547 { 4544 4548 { 4545 4549 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4561 4565 } 4562 4566 }, 4563 { 4567 { 4564 4568 { 4565 4569 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4581 4585 } 4582 4586 }, 4583 { 4587 { 4584 4588 { 4585 4589 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4601 4605 } 4602 4606 }, 4603 { 4607 { 4604 4608 { 4605 4609 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4621 4625 } 4622 4626 }, 4623 { 4627 { 4624 4628 { 4625 4629 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4641 4645 } 4642 4646 }, 4643 { 4647 { 4644 4648 { 4645 4649 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4661 4665 } 4662 4666 }, 4663 { 4667 { 4664 4668 { 4665 4669 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4681 4685 } 4682 4686 }, 4683 { 4687 { 4684 4688 { 4685 4689 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4701 4705 } 4702 4706 }, 4703 { 4707 { 4704 4708 { 4705 4709 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4721 4725 } 4722 4726 }, 4723 { 4727 { 4724 4728 { 4725 4729 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4741 4745 } 4742 4746 }, 4743 { 4747 { 4744 4748 { 4745 4749 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4761 4765 } 4762 4766 }, 4763 { 4767 { 4764 4768 { 4765 4769 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4781 4785 } 4782 4786 }, 4783 { 4787 { 4784 4788 { 4785 4789 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4801 4805 } 4802 4806 }, 4803 { 4807 { 4804 4808 { 4805 4809 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4821 4825 } 4822 4826 }, 4823 { 4827 { 4824 4828 { 4825 4829 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4841 4845 } 4842 4846 }, 4843 { 4847 { 4844 4848 { 4845 4849 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4861 4865 } 4862 4866 }, 4863 { 4867 { 4864 4868 { 4865 4869 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4881 4885 } 4882 4886 }, 4883 { 4887 { 4884 4888 { 4885 4889 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4901 4905 } 4902 4906 }, 4903 { 4907 { 4904 4908 { 4905 4909 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4921 4925 } 4922 4926 }, 4923 { 4927 { 4924 4928 { 4925 4929 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4941 4945 } 4942 4946 }, 4943 { 4947 { 4944 4948 { 4945 4949 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4961 4965 } 4962 4966 }, 4963 { 4967 { 4964 4968 { 4965 4969 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 4981 4985 } 4982 4986 }, 4983 { 4987 { 4984 4988 { 4985 4989 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5001 5005 } 5002 5006 }, 5003 { 5007 { 5004 5008 { 5005 5009 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5021 5025 } 5022 5026 }, 5023 { 5027 { 5024 5028 { 5025 5029 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5041 5045 } 5042 5046 }, 5043 { 5047 { 5044 5048 { 5045 5049 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5061 5065 } 5062 5066 }, 5063 { 5067 { 5064 5068 { 5065 5069 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5081 5085 } 5082 5086 }, 5083 { 5087 { 5084 5088 { 5085 5089 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5101 5105 } 5102 5106 }, 5103 { 5107 { 5104 5108 { 5105 5109 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5121 5125 } 5122 5126 }, 5123 { 5127 { 5124 5128 { 5125 5129 1.000000f, 0.000000f, 0.000000f, 0.000000f, … … 5156 5160 { /* yRGB */ 5157 5161 0x22, 0x22, 0x2b, 0x3c, 5158 0x44, 0x44, 0x66, 0x77, 5159 0x88, 0x99, 0xaa, 0xbb, 5162 0x44, 0x44, 0x66, 0x77, 5163 0x88, 0x99, 0xaa, 0xbb, 5160 5164 0xcc, 0xdd, 0xee, 0xff 5161 5165 }, … … 14788 14792 }; 14789 14793 14790 #undef RAW_NAME 14791 #undef IMAGE_NAME 14794 #undef RAW_NAME 14795 #undef IMAGE_NAME -
trunk/src/opengl/glide/cvg/init/dac.c
r2888 r6653 1 /* $Id: dac.c,v 1.2 2001-09-05 14:30:35 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:51 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:35 $ 23 24 ** 24 25 ** Initialization code for initializing supported SST-1 DACs … … 45 46 ** Read external DAC registers 46 47 ** NOTE: The video unit of FBI must be in reset before calling this routine. 47 ** The rendering engines of FBI and TREX must be idle before calling 48 ** The rendering engines of FBI and TREX must be idle before calling 48 49 ** this routine. 49 50 ** fbiInit23 register remapping (PCI config. initEnable[2]=1) must be … … 78 79 ** Write to external DAC registers 79 80 ** NOTE: The video unit of FBI must be in reset before calling this routine. 80 ** The rendering engines of FBI and TREX must be idle before calling 81 ** The rendering engines of FBI and TREX must be idle before calling 81 82 ** this routine. 82 83 ** … … 613 614 { 614 615 float calc; 615 616 616 617 calc = ((float) 14.318 * (float) (m + 2)) / 617 618 ((float) (n + 2) * vcoFreqDivide); … … 694 695 vcoFreq = ((float) 14.31818 * (float) (clkTiming->clkTiming_M + 2)) / 695 696 ((float) (clkTiming->clkTiming_N + 2)); 696 697 697 698 printf("freq:%.3f calc:%.3f\n", freq, clkFreq); 698 699 printf("m:%d p:%d n:%d vco:%.2f\n", clkTiming->clkTiming_M, -
trunk/src/opengl/glide/cvg/init/gamma.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: gamma.c,v 1.2 2001-09-05 14:30:36 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 22 ** 22 ** $Revision: 1. 1 $23 ** $Date: 200 0-02-25 00:37:51 $23 ** $Revision: 1.2 $ 24 ** $Date: 2001-09-05 14:30:36 $ 24 25 ** 25 26 ** Initialization code for loading SST-1 gamma tables … … 149 150 FxU32 gcG = gammaTableG[(x<<3)]; 150 151 FxU32 gcB = gammaTableB[(x<<3)]; 151 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 152 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 152 153 (gcR<<SST_CLUTDATA_RED_SHIFT) | 153 154 (gcG<<SST_CLUTDATA_GREEN_SHIFT) | … … 217 218 FxU32 gcG = gammaTableG[(x)]; 218 219 FxU32 gcB = gammaTableB[(x)]; 219 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 220 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 220 221 (gcR<<SST_CLUTDATA_RED_SHIFT) | 221 222 (gcG<<SST_CLUTDATA_GREEN_SHIFT) | -
trunk/src/opengl/glide/cvg/init/gdebug.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: gdebug.c,v 1.2 2001-09-05 14:30:37 bird Exp $ */ 2 3 #include "vxd.h" 3 4 … … 6 7 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 7 8 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 8 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 9 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 10 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 10 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 11 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 11 12 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 12 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 13 ** 13 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 14 ** 14 15 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 15 16 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 17 18 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 18 19 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 19 ** THE UNITED STATES. 20 ** 20 ** THE UNITED STATES. 21 ** 21 22 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 22 23 ** 23 ** $Revision: 1. 1$24 ** $Date: 200 0-02-25 00:37:51$24 ** $Revision: 1.2 $ 25 ** $Date: 2001-09-05 14:30:37 $ 25 26 */ 26 27 … … 66 67 #endif 67 68 68 static char *gdbg_myname = "gd"; 69 static char gdbg_debuglevel[GDBG_MAX_LEVELS]; 69 static char *gdbg_myname = "gd"; // default library name 70 static char gdbg_debuglevel[GDBG_MAX_LEVELS]; // array of debuglevel controls 70 71 71 72 static long gdbg_errors = 0; … … 82 83 { 83 84 if (level >= GDBG_MAX_LEVELS) 84 85 level = GDBG_MAX_LEVELS - 1; 85 86 86 87 gdbg_debuglevel[level] = value; … … 89 90 90 91 #ifndef KERNEL_NT 91 // we need to call a kernal printf. 92 // we need to call a kernal printf. 92 93 extern int __cdecl klvfprintf(FILE *stream, 93 94 const char *format, … … 95 96 #endif 96 97 97 static FILE *gdbg_msgfile; 98 static FILE *gdbg_msgfile; // GDBG info/error file 98 99 #else /* #ifdef KERNEL */ 99 100 100 static FILE *gdbg_msgfile = NULL; /*stdout;*/ 101 static FILE *gdbg_msgfile = NULL; /*stdout;*/ // GDBG info/error file 101 102 102 103 //---------------------------------------------------------------------- … … 107 108 int r0,r1,pos; 108 109 109 sscanf(buf,"%i%n",&r0,&pos); 110 if (buf[pos]=='-' || buf[pos]==':') { 111 112 sscanf(buf,"%i%n",&r1,&pos);// then parse it110 sscanf(buf,"%i%n",&r0,&pos); // parse the first integer 111 if (buf[pos]=='-' || buf[pos]==':') { // if there's a second 112 buf += pos+1; 113 sscanf(buf,"%i%n",&r1,&pos); // then parse it 113 114 } 114 115 else 115 116 117 if (r0 < 0) r0 = 0; 116 r1 = r0; 117 118 if (r0 < 0) r0 = 0; // sanity checks 118 119 if (r1 >= GDBG_MAX_LEVELS) r1 = GDBG_MAX_LEVELS-1; 119 120 if (r1 < r0) r1 = r0; 120 121 121 while (r0 <= r1) 122 123 124 return buf + pos; 122 while (r0 <= r1) // now set the debuglevel levels 123 gdbg_debuglevel[r0++] = val; 124 125 return buf + pos; // and return rest of string 125 126 } 126 127 … … 131 132 132 133 do { 133 if (env[0] == ',')// advance past commas134 135 if (env[0] == '+')// if + then enable a range136 137 else if (env[0] == '-')// if - then disable a range138 139 else {// else just a number140 141 if (pos==0) return;// oops, guess not142 143 while (level >= 0)// enable the range [0,#]144 145 146 134 if (env[0] == ',') // advance past commas 135 env++; 136 if (env[0] == '+') // if + then enable a range 137 env = setRange(env+1,1); 138 else if (env[0] == '-') // if - then disable a range 139 env = setRange(env+1,0); 140 else { // else just a number 141 if (sscanf(env,"%i%n",&level,&pos) <= 0) return; 142 if (pos==0) return; // oops, guess not 143 if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1; 144 while (level >= 0) // enable the range [0,#] 145 gdbg_debuglevel[level--] = 1; 146 env += pos; 147 } 147 148 } while (env[0] == ','); 148 149 } … … 153 154 gdbg_init(void) 154 155 { 155 static int done=0; 156 static int done=0; // only execute once 156 157 char *env; 157 158 … … 163 164 164 165 #if __MWERKS__ 165 SIOUXSettings.standalone= false;166 SIOUXSettings.setupmenus= false;167 SIOUXSettings.autocloseonquit= true;168 SIOUXSettings.asktosaveonclose= false;169 #endif 170 166 SIOUXSettings.standalone = false; 167 SIOUXSettings.setupmenus = false; 168 SIOUXSettings.autocloseonquit = true; 169 SIOUXSettings.asktosaveonclose = false; 170 #endif 171 171 172 #ifdef KERNEL 172 173 gdbg_debuglevel[0] = 1; 174 gdbg_debuglevel[120] = 1; 173 // put code in here to set the default level 174 gdbg_debuglevel[0] = 1; // always enable level 0 175 gdbg_debuglevel[120] = 1; // always enable level 0 175 176 done = 1; 176 177 env = 0; … … 178 179 #else /* #ifdef KERNEL */ 179 180 done = 1; 180 gdbg_debuglevel[0] = 1; 181 gdbg_debuglevel[0] = 1; // always enable level 0 181 182 env = GETENV("GDBG_FILE"); 182 183 if (env != NULL) GDBG_SET_FILE(env); … … 193 194 gdbg_info(1,"gdbg_shutdown()\n"); 194 195 #ifndef KERNEL 195 if (gdbg_msgfile != stdout) { 196 if (gdbg_msgfile != stdout) { // close any existing output file 196 197 #if USE_DEBUG_STRING 197 if (!UseDebugString) 198 if (!UseDebugString) 198 199 #endif /* USE_DEBUG_STRING */ 199 200 fclose(gdbg_msgfile); … … 286 287 __asm mov ebx, format; 287 288 MyPrintf(); 288 #endif /* #ifndef KERNEL */ 289 #endif /* #ifndef KERNEL */ 289 290 290 291 } … … 307 308 308 309 if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]) 309 310 return(0); 310 311 #ifndef KERNEL 311 312 va_start(args, format); … … 341 342 342 343 if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]) 343 344 return(0); 344 345 #ifndef KERNEL 345 346 va_start(args, format); … … 406 407 va_start(args, format); 407 408 sprintf(newformat, "%s error (%s): ", gdbg_myname,kind); 408 strcat(newformat,format); 409 strcat(newformat,format); // add a preamble to message 409 410 gdbg_vprintf(newformat,args); 410 gdbg_errors++; 411 va_end(args); 412 411 gdbg_errors++; // increment the error counter 412 va_end(args); 413 413 414 { 414 415 int i; 415 416 const int count = sizeof(errorProcList) / sizeof(errorProcList[0]); 416 417 417 418 for(i = 0; i < count; i++) { 418 419 if (errorProcList[i] != NULL) { … … 466 467 FILE *outf; 467 468 468 if (gdbg_msgfile != stdout) { 469 if (gdbg_msgfile != stdout) { // close any existing output file 469 470 fclose(gdbg_msgfile); 470 471 gdbg_msgfile = stdout; … … 475 476 gdbg_msgfile = (FILE *) 1; 476 477 UseDebugString = 1; 477 } else 478 } else 478 479 #endif /* USE_DEBUG_STRING */ 479 480 { 480 outf = fopen(name,"w"); 481 outf = fopen(name,"w"); // open up a new one 481 482 if (outf) gdbg_msgfile = outf; 482 483 } … … 485 486 #else /* #ifndef KERNEL */ 486 487 return 0; 487 #endif /* #ifndef KERNEL */ 488 } 488 #endif /* #ifndef KERNEL */ 489 } -
trunk/src/opengl/glide/cvg/init/info.c
r2888 r6653 1 /* $Id: info.c,v 1.2 2001-09-05 14:30:37 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:52 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:37 $ 23 24 ** 24 25 ** Routines to detect memory size, strapping pin, and other initialization … … 43 44 #define XY_ONE (1<<SST_XY_FRACBITS) 44 45 45 static FxBool 46 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 47 46 static FxBool 47 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 48 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) 48 49 { 49 50 FxU32 rd_x, rd_y; … … 56 57 sst1InitIdle(sstbase); 57 58 if (x & 1) { 58 59 59 INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x)); 60 return(FXFALSE); 60 61 } 61 62 … … 65 66 *b_sum = 0; 66 67 67 for (rd_y = 0; rd_y < 4; rd_y++) { 68 69 if ((rd_x & 1)==0) {/* read 2 pixels at a time */70 71 72 73 74 75 76 77 78 79 80 81 82 68 for (rd_y = 0; rd_y < 4; rd_y++) { /* read 4 scanlines */ 69 for (rd_x = 0; rd_x < 4; rd_x ++) { 70 if ((rd_x & 1)==0) { /* read 2 pixels at a time */ 71 rd_col = 72 IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]); 73 } 74 else rd_col >>= 16; 75 rd_r = ((rd_col >> 11) & 0x1f) << 3; 76 rd_g = ((rd_col >> 5) & 0x3f) << 2; 77 rd_b = ((rd_col >> 0) & 0x1f) << 3; 78 *r_sum += rd_r; 79 *g_sum += rd_g; 80 *b_sum += rd_b; 81 INIT_INFO((4,"%d,%d = rd_col: 0x%04x rgb: %02x %02x %02x\n", 82 rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b)); 83 } 83 84 } 84 85 INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", 85 86 86 *r_sum, *g_sum, *b_sum)); 87 return(FXTRUE); 87 88 } 88 89 … … 123 124 /* init sum array */ 124 125 for (r_sum = 0; r_sum <= 0xfff; r_sum++) { 125 126 126 rb_tbl[r_sum] = -1; 127 g_tbl[r_sum] = -1; 127 128 } 128 129 … … 132 133 /* fill sum array */ 133 134 for (tst_color = 0; tst_color <= 255; tst_color++) { 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 } 157 135 INIT_INFO((2,"tst_color=0x%02x\n", tst_color)); 136 ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color); 137 138 drawTriangle(sst, x,y,36); 139 if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE) 140 return(FXFALSE); 141 142 /* check sums for uniqueness and then store away */ 143 if (r_sum != b_sum) { 144 INIT_PRINTF(("ERROR: b_sum=0x%03x r_sum=0x%03x\n", r_sum, b_sum)); 145 return(FXFALSE); 146 } 147 if (rb_tbl[r_sum] != -1) { 148 INIT_PRINTF(("ERROR: non-unique r/b_sum=0x%03x\n", r_sum)); 149 return(FXFALSE); 150 } 151 rb_tbl[r_sum] = tst_color; 152 if (g_tbl[g_sum] != -1) { 153 INIT_PRINTF(("ERROR: non-unique g_sum=0x%03x\n", g_sum)); 154 return(FXFALSE); 155 } 156 g_tbl[g_sum] = tst_color; 157 } 158 return(FXTRUE); 158 159 } 159 160 … … 164 165 if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1) 165 166 { 166 167 167 INIT_PRINTF(("ERROR: unDither: invalid color sum\n")); 168 return(FXFALSE); 168 169 } 169 170 *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; 170 171 return(FXTRUE); 171 172 } 172 173 … … 177 178 FxU32 r_sum, g_sum, b_sum; 178 179 SstRegs *sst = (SstRegs *) sstbase; 179 180 FxU32 tmuRevision; 180 181 181 182 /* set trex's (all 3) to output configuration bits */ … … 186 187 /* render into the frame buffer */ 187 188 ISET(sst->fbzColorPath, 188 189 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 189 190 ISET(sst->texBaseAddr, 0); 190 191 ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS); … … 193 194 194 195 readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); 195 196 197 198 199 200 201 202 203 204 196 if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { 197 info->tmuConfig = 0x0; 198 } else { 199 if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) 200 return(FXFALSE); 201 } 202 203 ///////////////////////// 204 // Get new revision... 205 ///////////////////////// 205 206 ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0] | (1 << 18) | 206 207 (5 << SST_TEX_SEND_CONFIG_SEL_SHIFT)); 207 208 ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1] | (1 << 18)); 208 209 ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2] | (1 << 18)); … … 210 211 /* render into the frame buffer */ 211 212 ISET(sst->fbzColorPath, 212 213 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 213 214 ISET(sst->texBaseAddr, 0); 214 215 ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS); … … 217 218 218 219 readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); 219 220 221 222 223 224 225 226 227 228 229 230 220 if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE) 221 return(FXFALSE); 222 223 info->tmuFab[0] = (tmuRevision >> 4) & 0xf; 224 info->tmuFab[1] = (tmuRevision >> 12) & 0xf; 225 info->tmuFab[2] = (tmuRevision >> 20) & 0xf; 226 227 /* Adjust configuration structure for "new" revision ID */ 228 info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14)); 229 info->tmuConfig |= (((tmuRevision & 0x7) + 3) | 230 ((((tmuRevision >> 8) & 0x7) + 3) << 7) | 231 ((((tmuRevision >> 16) & 0x7) + 3) << 14)); 231 232 232 233 /* reset trex's init registers */ … … 235 236 ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]); 236 237 237 238 if(GETENV(("SSTV2_TMUCFG"))) 238 239 SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig); 239 240 240 241 return(FXTRUE); 241 242 } 242 243 … … 246 247 247 248 static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, 248 249 FxU32 mem, FxU32 init) 249 250 { 250 251 SstRegs *sst = (SstRegs *) sstbase; … … 256 257 sst1InitIdle(sstbase); 257 258 258 ISET(sst->texBaseAddr, 0x200000>>3); 259 ISET(texAddr[0], SENSE2); 260 261 ISET(sst->texBaseAddr, 0x100000>>3); 262 ISET(texAddr[0], SENSE1); 263 264 ISET(sst->texBaseAddr, 0x000000>>3); 265 ISET(texAddr[0], SENSE0); 266 267 ISET(sst->texBaseAddr, mem>>3); 268 drawTriangle(sst,0,0,4); 259 ISET(sst->texBaseAddr, 0x200000>>3); /* set to 2 MB */ 260 ISET(texAddr[0], SENSE2); /* write a random value */ 261 262 ISET(sst->texBaseAddr, 0x100000>>3); /* set to 1 MB */ 263 ISET(texAddr[0], SENSE1); /* write a random value */ 264 265 ISET(sst->texBaseAddr, 0x000000>>3); /* set to 0 MB */ 266 ISET(texAddr[0], SENSE0); /* write a random value */ 267 268 ISET(sst->texBaseAddr, mem>>3); /* reset to 2 MB */ 269 drawTriangle(sst,0,0,4); /* draw a 4x4 right triangle */ 269 270 sst1InitIdle(sstbase); 270 271 … … 281 282 FX_EXPORT FxBool FX_CSTYLE 282 283 sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, 283 284 FxU32 *TmuMemorySize) 284 285 { 285 286 FxU32 i,data; … … 288 289 INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); 289 290 290 291 292 293 294 295 296 297 298 299 300 301 302 291 if(GETENV(("SSTV2_TMU_MEMSIZE"))) { 292 *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); 293 // If user specifies 2 MBytes on a 4 MBytes board, disable the 294 // second RAS so that apps which may incorrectly store data in the 295 // upper 2 Mbytes will not function properly... 296 if(*TmuMemorySize == 2) { 297 info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS; 298 sst1InitIdle(sstbase); 299 ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]); 300 sst1InitIdle(sstbase); 301 } 302 return(FXTRUE); 303 } 303 304 304 305 ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); 305 306 ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); 306 307 ISET(sst->fbzColorPath, 307 308 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 308 309 ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE); 309 310 ISET(sst->tLOD, 0); … … 311 312 /* setup all downstream TMUs to be in pass-thru mode */ 312 313 for (i=0; i<tmu; i++) 313 314 ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS); 314 315 315 316 /* first see if we have 4 Mbytes by writing a texel at 2MB followed by … … 331 332 332 333 INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n")); 333 334 return(FXFALSE); 334 335 } 335 336 336 337 /*--------------------------------------------------------------------------- 337 338 NOTES: 338 339 339 assumes that board and registers are initialized 340 destroys part of the framebuffer 340 341 ---------------------------------------------------------------------------*/ 341 342 FX_EXPORT FxBool FX_CSTYLE … … 345 346 346 347 if(initSumTables(sstbase) == FXFALSE) 347 348 return(FXFALSE); 348 349 if(getTmuConfigData(sstbase,info) == FXFALSE) 349 350 return(FXFALSE); 350 351 351 352 info->numberTmus = 1; 352 353 354 355 356 357 358 359 360 361 362 353 if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { 354 info->tmuRevision = 4; 355 sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]); 356 info->tmuMemSize[0] = 2; 357 } else { 358 /* Get TMU memory size */ 359 info->tmuRevision = info->tmuConfig & 0x7; 360 if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == 361 FXFALSE) 362 return(FXFALSE); 363 } 363 364 364 365 INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); 365 if (info->tmuConfig & FXBIT(6)) { 366 info->numberTmus++;/* increment TMU count */367 trev = (info->tmuConfig>>7) & 0x7;/* get its revision */366 if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ 367 info->numberTmus++; /* increment TMU count */ 368 trev = (info->tmuConfig>>7) & 0x7; /* get its revision */ 368 369 #if 0 // Ignore for now... 369 370 371 372 370 if (info->tmuRevision != trev) { 371 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); 372 return(FXFALSE); 373 } 373 374 #endif 374 375 if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) 375 376 } 377 if (info->tmuConfig & FXBIT(13)) { 378 info->numberTmus++;/* increment TMU count */379 trev = (info->tmuConfig>>14) & 0x7;/* get its revision */376 return(FXFALSE); 377 } 378 if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ 379 info->numberTmus++; /* increment TMU count */ 380 trev = (info->tmuConfig>>14) & 0x7; /* get its revision */ 380 381 #if 0 // Ignore for now... 381 382 383 384 382 if (info->tmuRevision != trev) { 383 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); 384 return(FXFALSE); 385 } 385 386 #endif 386 387 if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) 387 388 } 389 390 388 return(FXFALSE); 389 } 390 if(GETENV(("SSTV2_NUM_TMUS"))) 391 info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS"))); 391 392 392 393 INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); … … 401 402 ** 402 403 */ 403 #define LFB_PUTPIXEL(X, Y, DATA) 404 405 #define LFB_GETPIXEL(X, Y) 406 404 #define LFB_PUTPIXEL(X, Y, DATA) \ 405 ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA) 406 #define LFB_GETPIXEL(X, Y) \ 407 IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)]) 407 408 408 409 static int fbiMemSize(FxU32 *sstbase) 409 410 { 410 411 412 413 414 415 416 417 418 419 420 421 422 411 SstRegs *sst = (SstRegs *) sstbase; 412 volatile unsigned short *lfbptr = (unsigned short *) sstbase; 413 FxU32 init0Save = IGET(sst->fbiInit0); 414 FxU32 init1Save = IGET(sst->fbiInit1); 415 FxU32 init2Save = IGET(sst->fbiInit2); 416 int retval = 0; 417 418 if(GETENV(("SSTV2_FBI_MEMSIZE"))) 419 return(ATOI(GETENV(("SSTV2_FBI_MEMSIZE")))); 420 421 /* Enable dram refresh, disable memory fifo, and setup memory */ 422 /* for rendering */ 423 ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); 423 424 ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); 424 425 426 427 428 429 430 425 sst1InitIdleFBI(sstbase); 426 427 /* Setup Basic rendering datapath */ 428 ISET(sst->fbzColorPath, SST_CC_MONE); 429 ISET(sst->fogMode, 0x0); 430 ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT); 431 sst1InitIdleFBI(sstbase); 431 432 432 433 sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); 433 434 435 436 437 438 439 440 441 LFB_PUTPIXEL(128, 100, 0xdead);/* maps to row:0x216, col:0x80, bank:0x1 */442 443 444 LFB_PUTPIXEL(200, 200, 0x55aa);/* maps to row:0x23d, col:0x104, bank:0x0 */445 446 447 448 449 450 451 452 453 454 455 456 457 434 sst1InitIdleFBI(sstbase); 435 436 ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | 437 SST_LFB_READDEPTHABUFFER); 438 sst1InitIdleFBI(sstbase); 439 440 /* Check for 4 MBytes... */ 441 /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */ 442 LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */ 443 LFB_PUTPIXEL(0, 0, 0x0); 444 LFB_PUTPIXEL(798, 599, 0xffff); 445 LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */ 446 LFB_PUTPIXEL(20, 20, 0xffff); 447 LFB_PUTPIXEL(400, 400, 0x0); 448 sst1InitIdleFBI(sstbase); 449 if((LFB_GETPIXEL(128, 100) == 0xdead) && 450 (LFB_GETPIXEL(200, 200) == 0x55aa)) { 451 retval = 4; 452 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); 453 sst1InitIdleFBI(sstbase); 454 goto fbiMemSizeDone; 455 } 456 457 /* Check for 2 MBytes... */ 458 /* Write to color buffer in 640x480 resolution */ 458 459 sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); 459 460 461 462 LFB_PUTPIXEL(50, 100, 0xdead);/* maps to row:0x1e, col:0x99, bank:0x0 */463 464 465 466 467 468 LFB_PUTPIXEL(178, 436, 0xaa55);/* maps to row:0x11e, col:0x99, bank:0x0 */469 470 471 472 473 474 475 476 477 478 479 460 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | 461 SST_LFB_READFRONTBUFFER); 462 sst1InitIdleFBI(sstbase); 463 LFB_PUTPIXEL(50, 100, 0xdead); /* maps to row:0x1e, col:0x99, bank:0x0 */ 464 LFB_PUTPIXEL(0, 0, 0x0); 465 LFB_PUTPIXEL(638, 479, 0xffff); 466 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER | 467 SST_LFB_READFRONTBUFFER); 468 sst1InitIdleFBI(sstbase); 469 LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */ 470 LFB_PUTPIXEL(20, 20, 0x0); 471 LFB_PUTPIXEL(400, 400, 0xffff); 472 sst1InitIdleFBI(sstbase); 473 if(LFB_GETPIXEL(50, 100) != 0xdead) 474 goto check1MByte; 475 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); 476 sst1InitIdleFBI(sstbase); 477 if(LFB_GETPIXEL(178, 436) == 0xaa55) { 478 retval = 2; 479 goto fbiMemSizeDone; 480 } 480 481 481 482 check1MByte: 482 483 484 485 LFB_PUTPIXEL(10, 10, 0xdead);/* maps to row:0x0, col:0x145, bank:0x0 */486 487 488 LFB_PUTPIXEL(100, 200, 0x5a5a);/* maps to row:0x3c, col:0x112, bank:0x1 */489 490 491 492 493 494 483 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | 484 SST_LFB_READFRONTBUFFER); 485 sst1InitIdleFBI(sstbase); 486 LFB_PUTPIXEL(10, 10, 0xdead); /* maps to row:0x0, col:0x145, bank:0x0 */ 487 LFB_PUTPIXEL(8, 8, 0x0); 488 LFB_PUTPIXEL(340, 340, 0xffff); 489 LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */ 490 LFB_PUTPIXEL(66, 0, 0x0); 491 LFB_PUTPIXEL(360, 360, 0xffff); 492 sst1InitIdleFBI(sstbase); 493 if((LFB_GETPIXEL(10, 10) == 0xdead) && 494 (LFB_GETPIXEL(100, 200) == 0x5a5a)) 495 retval = 1; 495 496 496 497 fbiMemSizeDone: 497 498 499 500 501 502 503 498 /* Restore init registers to original state */ 499 ISET(sst->fbiInit0, init0Save); 500 ISET(sst->fbiInit1, init1Save); 501 ISET(sst->fbiInit2, init2Save); 502 sst1InitIdleFBI(sstbase); 503 504 return(retval); 504 505 } 505 506 … … 507 508 sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) 508 509 { 509 510 SstRegs *sst = (SstRegs *) sstbase; 510 511 511 512 info->fbiMemSize = fbiMemSize(sstbase); 512 513 513 514 514 /* Detect board identification and memory speed */ 515 if(GETENV(("SSTV2_FBICFG"))) 515 516 SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig); 516 517 else 517 518 519 520 521 522 523 524 525 526 518 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> 519 SST_FBI_MEM_TYPE_SHIFT; 520 521 info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf; 522 if(IGET(sst->fbiInit7) & BIT(0)) 523 info->fbiBoardID |= 0x10; 524 525 /* Detect scanline interleaving */ 526 info->sliPaired = sst1InitSliPaired(sstbase); 527 info->sliDetected = sst1InitSliDetect(sstbase); 527 528 528 529 return FXTRUE; … … 563 564 if(GETENV(("SSTV2_NODEVICEINFO"))) { 564 565 /* fill device info struct with sane values... */ 565 566 567 568 569 570 571 572 573 574 575 566 INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); 567 568 if(GETENV(("SSTV2_FBICFG"))) 569 SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig); 570 else 571 info->fbiConfig = 0x0; 572 573 if(GETENV(("SSTV2_TMUCFG"))) 574 SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig); 575 else 576 info->tmuConfig = 0x0; 576 577 577 578 info->numberTmus = 1; 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 579 if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ 580 info->numberTmus++; 581 if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ 582 info->numberTmus++; 583 584 info->tmuRevision = info->tmuConfig & 0x7; 585 586 if(GETENV(("SSTV2_FBI_MEMSIZE"))) 587 info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))); 588 else 589 info->fbiMemSize = 2; 590 591 if(GETENV(("SSTV2_TMU_MEMSIZE"))) 592 info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); 593 else 594 info->tmuMemSize[0] = 2; 595 info->tmuMemSize[1] = info->tmuMemSize[0]; 596 info->tmuMemSize[2] = info->tmuMemSize[0]; 596 597 } else { 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 } 614 598 int i; 599 600 for(i=0; i<5; i++) { 601 if(i) 602 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); 603 /* GetFbiInfo() must be called before GetTmuInfo() */ 604 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) 605 continue; 606 /* get the revision ID of each TMU and verify that they are all the 607 same */ 608 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) 609 continue; 610 break; 611 } 612 if(i == 5) 613 return(FXFALSE); 614 } 615 // Measure silicon performance 615 616 sst1InitMeasureSiProcess(sstbase, 0); // measure NAND-tree 616 617 sst1InitMeasureSiProcess(sstbase, 1); // measure NOR-tree 617 618 618 619 INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID)); 619 620 INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n", 620 621 info->fbiConfig, info->tmuConfig)); … … 630 631 if(sst1InitUseVoodooFile == FXTRUE) { 631 632 if(iniDac == (sst1InitDacStruct *) NULL) 632 633 634 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 635 636 637 638 639 640 641 642 643 644 645 646 633 INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); 634 else 635 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 636 iniDac->dacManufacturer, iniDac->dacDevice)); 637 } else { 638 INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); 639 if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT) 640 INIT_PRINTF(("AT&T ATT20C409\n")); 641 else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS) 642 INIT_PRINTF(("ICS ICS5342\n")); 643 else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI) 644 INIT_PRINTF(("TI TVP3409\n")); 645 else 646 INIT_PRINTF(("Unknown\n")); 647 } 647 648 INIT_PRINTF(("sst1DeviceInfo: SLI Detected:%d\n", info->sliDetected)); 648 649 -
trunk/src/opengl/glide/cvg/init/parse.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: parse.c,v 1.2 2001-09-05 14:30:38 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 22 ** 22 ** $Revision: 1. 1 $23 ** $Date: 200 0-02-25 00:37:52 $23 ** $Revision: 1.2 $ 24 ** $Date: 2001-09-05 14:30:38 $ 24 25 ** 25 26 ** Parsing code for grabbing information from "voodoo2.ini" initialization file … … 84 85 int helper = (getenv(("SSTV2_DEBUGDAC"))) ? 1 : 0; 85 86 86 87 88 87 filename[0] = '\0'; 88 if (checkedFileP) goto __errExit; 89 89 90 #if __DOS32__ 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 91 { 92 char fixedFilename[512], *tmpPtr; 93 char path[512]; 94 int i; 95 96 97 if(getenv("VOODOO2_FILE")) { 98 /* Override voodoo2.ini name */ 99 strcpy(filename, getenv("VOODOO2_FILE")); 100 if(!(file = fopen(filename, "r"))) goto __errExit; 101 } else { 102 /* Override path setting */ 103 if(getenv("VOODOO2_PATH")) 104 strcpy(path, getenv("VOODOO2_PATH")); 105 else if(getenv("PATH")) { 106 strcpy(path, ".;"); 107 strcat(path, getenv("PATH")); 108 } else 109 strcpy(path, ".;"); 110 111 i = 0; 112 while(1) { 113 if(!i) { 114 if((tmpPtr = strtok(path, ";")) == NULL) 115 break; 116 } else { 117 if((tmpPtr = strtok(NULL, ";")) == NULL) 118 break; 119 } 120 strcpy(filename, tmpPtr); 121 sst1InitFixFilename(fixedFilename, filename); 122 if(fixedFilename[strlen(fixedFilename)-1] == '\\') 123 sprintf(filename, "%svoodoo2.var", filename); 124 else 125 sprintf(filename, "%s\\voodoo2.var", filename); 126 i++; 127 if((file = fopen(filename, "r"))) 128 break; 129 } 130 } 131 } 131 132 #elif __MWERKS__ 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 164 165 166 167 168 169 } 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 if (FindFolder(kOnSystemDisk, folderList[i], false, 185 186 187 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 133 { 134 FSSpec iniSpec = { 135 0, 0, 136 "\pvoodoo2.var" 137 }; 138 Boolean foundP = false; 139 140 /* Check the app's directory */ 141 if (!foundP) { 142 ProcessSerialNumber curApp; 143 ProcessInfoRec appInfo; 144 FSSpec appSpec; 145 146 if (GetCurrentProcess(&curApp) != noErr) goto __errAppDir; 147 148 /* We only care about the app's location */ 149 appInfo.processInfoLength = sizeof(ProcessInfoRec); 150 appInfo.processName = NULL; 151 appInfo.processAppSpec = &appSpec; 152 if (GetProcessInformation(&curApp, &appInfo) != noErr) goto __errAppDir; 153 154 { 155 CInfoPBRec thePB; 156 157 thePB.hFileInfo.ioCompletion = NULL; 158 thePB.hFileInfo.ioNamePtr = iniSpec.name; 159 thePB.hFileInfo.ioVRefNum = appSpec.vRefNum; 160 thePB.hFileInfo.ioDirID = appSpec.parID; 161 162 thePB.hFileInfo.ioFDirIndex = 0; 163 164 foundP = ((PBGetCatInfoSync(&thePB) == noErr) && 165 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0)); 166 if (foundP) { 167 iniSpec.vRefNum = appSpec.vRefNum; 168 iniSpec.parID = appSpec.parID; 169 } 170 } 171 172 __errAppDir: 173 ; 174 } 175 176 /* Check the mac's version of the 'search path' */ 177 if (!foundP) { 178 OSType folderList[] = { kPreferencesFolderType, kExtensionFolderType }; 179 int i; 180 181 for(i = 0; i < sizeof(folderList) / sizeof(folderList[0]); i++) { 182 short vRefNum; 183 long dirId; 184 185 if (FindFolder(kOnSystemDisk, folderList[i], false, 186 &vRefNum, &dirId) == noErr) { 187 188 CInfoPBRec thePB; 189 190 thePB.hFileInfo.ioCompletion = NULL; 191 thePB.hFileInfo.ioNamePtr = iniSpec.name; 192 thePB.hFileInfo.ioVRefNum = vRefNum; 193 thePB.hFileInfo.ioDirID = dirId; 194 195 thePB.hFileInfo.ioFDirIndex = 0; 196 197 foundP = ((PBGetCatInfoSync(&thePB) == noErr) && 198 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0)); 199 if (foundP) { 200 iniSpec.vRefNum = vRefNum; 201 iniSpec.parID = dirId; 202 203 break; 204 } 205 } 206 } 207 } 208 209 if (foundP) { 210 short wdRefNum; 211 long wdDirId; 212 213 /* Change working directories, just in case the app did something else */ 214 if (HGetVol(NULL, &wdRefNum, &wdDirId) != noErr) goto __errFile; 215 if (HSetVol(NULL, iniSpec.vRefNum, iniSpec.parID) != noErr) goto __errFile; 216 217 /* NB: We leave the name trashed after this */ 218 p2cstr(iniSpec.name); 219 file = fopen((const char*)iniSpec.name, "r"); 220 221 HSetVol(NULL, wdRefNum, wdDirId); 222 223 __errFile: 224 ; 225 } 226 } 226 227 #endif 227 228 … … 261 262 262 263 __errExit: 263 264 checkedFileP = FXTRUE; 264 265 #endif /* !DIRECTX */ 265 266 … … 294 295 /* Override voodoo2.ini name */ 295 296 strcpy(filename, getenv("VOODOO2_FILE")); 296 if (!(file = fopen(filename, "r"))) 297 if (!(file = fopen(filename, "r"))) 297 298 goto __errExit; 298 299 } else { … … 307 308 while(1) { 308 309 if (!i) { 309 310 310 if ((tmpPtr = strtok(path, ":")) == NULL) 311 break; 311 312 } else { 312 313 313 if ((tmpPtr = strtok(NULL, ":")) == NULL) 314 break; 314 315 } 315 316 strcpy(filename, tmpPtr); 316 317 if (filename[strlen(filename)-1] == '\\') 317 318 sprintf(filename, "%voodoo2", filename); 318 319 else 319 320 sprintf(filename, "%s/voodoo2", filename); 320 321 i++; 321 322 if ((file = fopen(filename, "r"))) 322 323 break; 323 324 } 324 325 } … … 638 639 break; 639 640 } 640 if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 641 if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 641 642 return(0); 642 643 … … 982 983 983 984 #if __WIN32__ 984 FxBool GetRegistryKey(HKEY hKey, const char* keyName, 985 FxBool GetRegistryKey(HKEY hKey, const char* keyName, 985 986 char* regValBuf, FxU32 bufSize) 986 987 { … … 1004 1005 } 1005 1006 } 1006 1007 1007 1008 return retVal; 1008 } 1009 } 1009 1010 #endif /* __WIN32__ */ 1010 1011 … … 1020 1021 * string table has been freed by the c runtime but has not been set 1021 1022 * to NULL. Bad things happen if this memory has been unmapped by 1022 * the system or if the string cannot be found. 1023 * the system or if the string cannot be found. 1023 1024 */ 1024 1025 { … … 1051 1052 { 1052 1053 const char* retVal; 1053 1054 1054 1055 /* Does the real environment variable exist? 1055 1056 * This overrides everything for glide. … … 1084 1085 } 1085 1086 #endif /* __WIN32__ */ 1086 1087 1087 1088 /* Does the requested environment variable exist in "voodoo2.ini"? */ 1088 1089 /* Dump CFG Data... */ 1089 1090 if (!checkedFileP) { 1090 1091 1092 1093 1094 1095 1096 1097 } 1098 1091 static FxBool inProc = FXFALSE; 1092 1093 if (!inProc) { 1094 inProc = FXTRUE; 1095 sst1InitVoodooFile(); 1096 inProc = FXFALSE; 1097 } 1098 } 1099 1099 1100 { 1100 1101 sst1InitEnvVarStruct *envVarsPtr = envVarsBase; -
trunk/src/opengl/glide/cvg/init/print.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: print.c,v 1.2 2001-09-05 14:30:39 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 22 ** 22 ** $Revision: 1. 1 $23 ** $Date: 200 0-02-25 00:37:53 $23 ** $Revision: 1.2 $ 24 ** $Date: 2001-09-05 14:30:39 $ 24 25 ** 25 26 ** Print functions for SST-1 Initialization routines … … 54 55 if(firstPass == FXTRUE) { 55 56 firstPass = FXFALSE; 56 57 58 59 60 57 if (sst1InitMsgFile == NULL) 58 { 59 /* I couldn't initialize to stdout because stdout is not constant */ 60 sst1InitMsgFile = stdout; 61 } 61 62 if(GETENV(("SSTV2_INITDEBUG")) || GDBG_GET_DEBUGLEVEL(5)) 62 63 printIt = FXTRUE; … … 64 65 printIt = ((sst1InitMsgFile = fopen(GETENV(("SSTV2_INITDEBUG_FILE")), "w")) != NULL); 65 66 if (!printIt) { 66 fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n", 67 fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n", 67 68 GETENV(("SSTV2_INITDEBUG_FILE"))); 68 69 } -
trunk/src/opengl/glide/cvg/init/sli.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: sli.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:53 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:42 $ 23 24 ** 24 25 ** Initialization code for initializing scanline interleaving … … 182 183 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 183 184 PCICFG_WR(SST1_PCI_INIT_ENABLE, 184 ((j & ~SST_SCANLINE_SLV_OWNPCI) | SST_SCANLINE_SLI_SLV)); 185 ((j & ~SST_SCANLINE_SLV_OWNPCI) | SST_SCANLINE_SLI_SLV)); 185 186 ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) | 186 187 (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE)); … … 226 227 SST_VID_CLK_DAC_DATA16_SEL); 227 228 ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & 228 ~SST_VIDEO_VID_CLK_SLAVE); 229 ~SST_VIDEO_VID_CLK_SLAVE); 229 230 sst1CurrentBoard->fbiInit6 &= ~SST_SLI_SYNC_MASTER; 230 231 sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & … … 250 251 ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) & 251 252 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 252 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 253 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 253 254 SST_EN_SCANLINE_INTERLEAVE | 254 255 // SST_VIDEO_VID_CLK_SLAVE | 255 256 // SST_VIDEO_VID_CLK_2X | 256 // SST_VIDEO_INVERT_VID_CLK_2X | 257 // SST_VIDEO_INVERT_VID_CLK_2X | 257 258 SST_VIDEO_VCLK_SEL | 258 259 SST_PCI_WRWS_1 | … … 264 265 ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) & 265 266 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 266 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 267 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 267 268 SST_EN_SCANLINE_INTERLEAVE | 268 269 // SST_VIDEO_VID_CLK_SLAVE | … … 371 372 SST_VID_CLK_DAC_DATA16_SEL); 372 373 ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & 373 ~SST_VIDEO_VID_CLK_SLAVE); 374 ~SST_VIDEO_VID_CLK_SLAVE); 374 375 sst1CurrentBoard->fbiInit6 |= SST_SLI_SYNC_MASTER; 375 376 sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & … … 379 380 ISET(sstMaster->fbiInit6, sst1CurrentBoard->fbiInit6); 380 381 381 // Following work well up to around 100 MHz... 382 // Following work well up to around 100 MHz... 382 383 // masterVInClkDel = 2; 383 384 // masterVOutClkDel = 0; … … 400 401 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 401 402 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL | 402 SST_VIDEO_BLANK_EN)) | 403 SST_VIDEO_BLANK_EN)) | 403 404 SST_EN_SCANLINE_INTERLEAVE | 404 405 // SST_VIDEO_VID_CLK_2X | … … 417 418 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 418 419 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL | 419 SST_VIDEO_BLANK_EN)) | 420 SST_VIDEO_BLANK_EN)) | 420 421 SST_EN_SCANLINE_INTERLEAVE | 421 422 // SST_VIDEO_VID_CLK_2X | … … 458 459 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 459 460 PCICFG_WR(SST1_PCI_INIT_ENABLE, 460 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 461 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 461 462 MasterPhysAddr = sst1CurrentBoard->physAddr[0]; 462 463 sst1InitReturnStatus(sstbase0); // flush pci packer with reads … … 485 486 if (!sst1InitCheckBoard(sstbase1)) return FXFALSE; 486 487 infoSlave = sst1CurrentBoard; 487 488 488 489 /* fbi and tmu clock freqs should be equal since they are 489 490 * both set from sst1InitCalcGrxClk. … … 491 492 if (infoMaster->fbiGrxClkFreq != infoSlave->fbiGrxClkFreq) { 492 493 /* Recompute the actual clock rates before any clocking down 493 * due to sli for some board revisions. 494 * due to sli for some board revisions. 494 495 */ 495 496 if (!sst1InitCalcGrxClk(sstbase0)) return FXFALSE; … … 513 514 * They no longer need to match, but any future calls to 514 515 * sst1InitGetDeviceInfo should now reflect the current 515 * minimized state of the world. 516 * minimized state of the world. 516 517 */ 517 518 { … … 520 521 if (infoMaster->fbiMemSize != infoSlave->fbiMemSize) { 521 522 memSize = MIN(infoMaster->fbiMemSize, infoSlave->fbiMemSize); 522 infoMaster->fbiMemSize = 523 infoMaster->fbiMemSize = 523 524 infoSlave->fbiMemSize = memSize; 524 525 } … … 581 582 sst1InitReturnStatus(sstbase1); 582 583 583 // De-assert reset to Graphics core... 584 // De-assert reset to Graphics core... 584 585 ISET(sstMaster->fbiInit0, IGET(sstMaster->fbiInit0) & ~SST_GRX_RESET); 585 586 sst1InitReturnStatus(sstbase0); … … 587 588 sst1InitReturnStatus(sstbase1); 588 589 589 // De-assert reset to Video core... 590 // De-assert reset to Video core... 590 591 ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & ~SST_VIDEO_RESET); 591 592 sst1InitReturnStatus(sstbase0); … … 707 708 else 708 709 sliDetected = sst1InitSliPaired(sstbase); 709 710 710 711 return sliDetected; 711 712 } … … 717 718 ** 718 719 */ 719 FX_ENTRY FxU32 FX_CALL 720 FX_ENTRY FxU32 FX_CALL 720 721 sst1InitSliPaired(FxU32 *sstbase) 721 722 { … … 725 726 if(firstTime) { 726 727 SstRegs* sst = (SstRegs *) sstbase; 727 728 728 729 sliPaired = (((IGET(sst->fbiInit5) & SST_SLI_DETECT) == SST_SLI_DETECT) && 729 730 (boardsInSystem > 1)); -
trunk/src/opengl/glide/cvg/init/sst1init.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: sst1init.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:54 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:42 $ 23 24 ** 24 25 */ … … 29 30 ** NOTE: This code must compiled with optimizations DISABLED!! 30 31 ** 31 ** The following environment variables can optionally be used to alter 32 ** The following environment variables can optionally be used to alter 32 33 ** functionality (A value of X is a "don't care"): 33 34 ** … … 99 100 ** 960, (960x720) 100 101 ** 1024} (1024x768) 101 ** SSTV2_SLOWMEM_RTW X Insert wait state for read-to-write 102 ** SSTV2_SLOWMEM_RTW X Insert wait state for read-to-write 102 103 ** transitions 103 ** SSTV2_SLOWMEM_WTR X Insert wait state for write-to-read 104 ** SSTV2_SLOWMEM_WTR X Insert wait state for write-to-read 104 105 ** transitions 105 106 ** SSTV2_SLOWPCIWR X Enable 1 wait-state PCI writes … … 186 187 static FxU32 clearBoardInfo = FXTRUE; 187 188 188 FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber, 189 FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber, 189 190 FxBool resetSLI) 190 191 { … … 204 205 // Open PCI library (necessary for multiple calls to init routines, after 205 206 // PCI library is closed by pciClose() call in sst1InitShutdown(). 206 // 207 // 207 208 // NB: It is safe to do this even if we never called pciClose. 208 209 pciOpen(); … … 231 232 // Clear board info structure 232 233 sst1InitClearBoardInfo(); 233 234 234 235 clearBoardInfo = FXFALSE; 235 236 … … 239 240 * the vxd etc. This is not functionally longer fatal, but w/o 240 241 * it we will not be able to do things like set the caching on 241 * the board's memory etc. This is bad. 242 * the board's memory etc. This is bad. 242 243 * 243 244 * The actual cost of doing the re-mapping again is pretty low … … 323 324 FxU32 k; 324 325 SstRegs *sst; 325 326 326 327 for(k=0; k<boardsInSystemReally; k++) { 327 328 // Disable SLI if detected... … … 331 332 sst1CurrentBoard = &sst1BoardInfo[k]; 332 333 sst = (SstRegs *) sstbase; 333 334 334 335 if(IGET(sst->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) { 335 336 INIT_PRINTF(("sst1InitMapBoard(): Disabling Scanline Interleaving (board #%d)...\n", (k+1))); … … 424 425 PCICFG_WR(SST1_PCI_BUS_SNOOP0, SST_PCI_BUS_SNOOP_DEFAULT); 425 426 PCICFG_WR(SST1_PCI_BUS_SNOOP1, SST_PCI_BUS_SNOOP_DEFAULT); 426 sst1InitReturnStatus(sstbase); // Stall - can't call IdleFbi because 427 sst1InitReturnStatus(sstbase); // Stall - can't call IdleFbi because 427 428 sst1InitReturnStatus(sstbase); // FBI could be hung at this stage 428 429 sst1InitReturnStatus(sstbase); 429 430 430 431 // Adjust Trex-to-Fbi FIFO 431 432 if(GETENV(("SSTV2_TF_FIFO_THRESH"))) … … 573 574 (tf2_clkdel<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT); 574 575 } 575 INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 576 INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 576 577 sst1CurrentBoard->tmuInit1[2])); 577 578 … … 662 663 sst1InitIdleFBINoNOP(sstbase); 663 664 664 sst1InitRenderingRegisters(sstbase); 665 sst1InitRenderingRegisters(sstbase); 665 666 sst1CurrentBoard->tmuRevision = 0xdead; // Force sst1InitFillDeviceInfo() 666 667 if(sst1InitFillDeviceInfo(sstbase, sst1CurrentBoard) == FXFALSE) { … … 909 910 #ifndef __linux__ 910 911 pciUnmapPhysical((FxU32)sst1CurrentBoard->virtAddr[0], 911 912 0x1000000UL); 912 913 #endif 913 914 914 915 if((++n > 1) || !sliEnabled) 915 916 break; 916 917 } 917 918 918 919 /* sst1InitIdle(sstbase); */ 919 920 920 921 #if !DIRECTX 921 // 922 // 922 923 // HACK alert. 923 924 // … … 940 941 // cleared next time sst1InitMapBoard() is called. 941 942 clearBoardInfo = FXTRUE; 942 943 943 944 return(FXTRUE); 944 945 } … … 980 981 devInfo.sliDetected && 981 982 !devInfo.monitorDetected) { 982 983 983 984 SstRegs* tempAddr = NULL; 984 985 … … 997 998 if (tempAddr != NULL) sstBaseAddr = tempAddr; 998 999 } 999 1000 1000 1001 return (FxU32*)sstBaseAddr; 1001 1002 } … … 1100 1101 ** 1101 1102 */ 1102 FX_ENTRY FxBool FX_CSTYLE 1103 FX_ENTRY FxBool FX_CSTYLE 1103 1104 sst1InitCaching(FxU32* sstBase, FxBool enableP) 1104 1105 { … … 1109 1110 if (enableP && (GETENV("SSTV2_IGNORE_CACHING") == NULL)) { 1110 1111 FxU32 physAddr; 1111 1112 1112 1113 /* Get the board's base. Isn't this the same as what we 1113 1114 * cary around in sst1CurrentBoard->physAddr[0]? 1114 1115 */ 1115 1116 pciGetConfigData(PCI_BASE_ADDRESS_0, sst1CurrentBoard->deviceNumber, &physAddr); 1116 1117 1117 1118 // For some reason, there sometimes is a 008 at the end of the 1118 1119 // physical address, so mask that puppy RTF out … … 1134 1135 #define kCacheSizeUncacheable (0x1000UL) 1135 1136 FxBool hasWC = pciFindMTRRMatch(physAddr, kCacheSizeWriteCombine, 1136 PciMemTypeWriteCombining, 1137 PciMemTypeWriteCombining, 1137 1138 &sst1CurrentBoard->mtrrWriteCombine); 1138 1139 FxBool hasUC = pciFindMTRRMatch(physAddr, kCacheSizeUncacheable, … … 1167 1168 1168 1169 /* We only succeed if we have them both since having only uswc 1169 * seems to cause problems. 1170 * seems to cause problems. 1170 1171 */ 1171 1172 retVal = (hasWC && hasUC); -
trunk/src/opengl/glide/cvg/init/util.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: util.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:55 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:42 $ 23 24 ** 24 25 ** Utility routines for SST-1 Initialization code … … 345 346 if(enable) { 346 347 // VGA controls monitor 347 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 348 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 348 349 sst1CurrentBoard->vgaPassthruEnable); 349 350 ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN); 350 351 } else { 351 352 // SST-1 controls monitor 352 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 353 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 353 354 sst1CurrentBoard->vgaPassthruDisable); 354 355 ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_BLANK_EN); … … 493 494 * they are managing. However, some registers cannot be accessed via 494 495 * the command fifo, and, inconveniently, these are not contiguously 495 * allocated. 496 * allocated. 496 497 */ 497 498 const FxU32 addrOffset = ((const FxU32)addr - (const FxU32)sst1CurrentBoard->virtAddr[0]); … … 545 546 ** 546 547 */ 547 FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable, 548 FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable, 548 549 FxU32 *virtAddrStart, FxU32 *memAddrStart, FxU32 *size, FxSet32Proc set32Proc) 549 550 { … … 566 567 if(enable == FXFALSE) { 567 568 // Remove any client set callbacks before continuing since 568 // these must go straight to the hw. 569 // these must go straight to the hw. 569 570 sst1CurrentBoard->set32 = NULL; 570 571 sst1CurrentBoard->fbiCmdFifoEn = 0; … … 621 622 *size = fifoSize; 622 623 623 if(!sst1InitCmdFifoDirect(sstbase, 0, 624 fifoStart, fifoSize, 624 if(!sst1InitCmdFifoDirect(sstbase, 0, 625 fifoStart, fifoSize, 625 626 directExec, disableHoles, 626 627 set32Proc)) { … … 628 629 return(FXFALSE); 629 630 } 630 631 631 632 if(sst1CurrentBoard->sliSlaveVirtAddr) { 632 633 if(!sst1InitCmdFifoDirect(sst1CurrentBoard->sliSlaveVirtAddr, 0, 633 fifoStart, fifoSize, 634 fifoStart, fifoSize, 634 635 directExec, disableHoles, 635 636 set32Proc)) { … … 646 647 ** 647 648 ** sst1InitCmdFifoDirect(): 648 ** Explicitly initialize Command FIFO. This routine is typically not 649 ** Explicitly initialize Command FIFO. This routine is typically not 649 650 ** called directly from apps. 650 651 ** … … 653 654 ** 654 655 */ 655 FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which, 656 FxU32 start, FxU32 size, FxBool directExec, FxBool disableHoles, 656 FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which, 657 FxU32 start, FxU32 size, FxBool directExec, FxBool disableHoles, 657 658 FxSet32Proc set32Proc) 658 659 { … … 686 687 // Disable memory-backed fifo, and disallow lfb and texture writes 687 688 // through command fifo... 688 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & 689 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & 689 690 ~(SST_MEM_FIFO_EN | SST_EN_LFB_MEMFIFO | SST_EN_TEX_MEMFIFO))); 690 691 sst1InitReturnStatus(sstbase); … … 751 752 ** and texture accesses do not pass through the command fifo. 752 753 ** WARNING: No register writes of any kind may be performed between a 753 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 754 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 754 755 ** writes are allowed. 755 756 */ … … 810 811 ** and texture accesses do not pass through the command fifo. 811 812 ** WARNING: No register writes of any kind may be performed between a 812 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 813 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 813 814 ** writes are allowed. 814 815 */ … … 925 926 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 926 927 SST_SIPROCESS_OSC_CNTR_RESET_N | SST_SIPROCESS_OSC_NAND_SEL); 927 928 928 929 // Allow oscillator to run... 929 930 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); … … 931 932 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 932 933 SST_SIPROCESS_OSC_CNTR_RUN | SST_SIPROCESS_OSC_NAND_SEL); 933 934 934 935 // Loop until PCI counter decrements to 0 935 936 cntr = 0 ; … … 938 939 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 939 940 } while(siProcess & SST_SIPROCESS_PCI_CNTR); 940 941 941 942 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 942 943 siProcess &= SST_SIPROCESS_OSC_CNTR; … … 954 955 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 955 956 SST_SIPROCESS_OSC_CNTR_RESET_N | SST_SIPROCESS_OSC_NOR_SEL); 956 957 957 958 // Allow oscillator to run... 958 959 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); … … 960 961 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 961 962 SST_SIPROCESS_OSC_CNTR_RUN | SST_SIPROCESS_OSC_NOR_SEL); 962 963 963 964 // Loop until PCI counter decrements to 0 964 965 cntr = 0 ; … … 967 968 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 968 969 } while(siProcess & SST_SIPROCESS_PCI_CNTR); 969 970 970 971 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 971 972 siProcess &= SST_SIPROCESS_OSC_CNTR; -
trunk/src/opengl/glide/cvg/init/video.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: video.c,v 1.2 2001-09-05 14:30:43 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:55 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:43 $ 23 24 ** 24 25 ** Initialization code for initializing SST-1 video unit … … 161 162 memSizeInPages <<= 1; 162 163 163 // To be compatible with Voodoo1, if there is enough memory to 164 // To be compatible with Voodoo1, if there is enough memory to 164 165 // allocate an aux buffer, then do it... 165 166 if(nCol == 2 && nAux == 0) { … … 211 212 // Reset Video Refresh Unit 212 213 ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET); 213 214 214 215 // Setup SST video timing registers 215 216 if(GETENV(("SSTV2_HSYNC"))) { … … 267 268 // Setup SST memory mapper for desired resolution 268 269 if(sst1CurrentBoard->fbiMemSize == 4) 269 sst1InitSetResolution(sstbase, sstVideoRez, 1); 270 sst1InitSetResolution(sstbase, sstVideoRez, 1); 270 271 else 271 sst1InitSetResolution(sstbase, sstVideoRez, 0); 272 sst1InitSetResolution(sstbase, sstVideoRez, 0); 272 273 273 274 // Calculate graphics clock frequency … … 342 343 if(sst1InitAllocBuffers(sstbase, nCol, nAux) == FXFALSE) 343 344 return(FXFALSE); 344 345 INIT_PRINTF(("sst1InitVideo(): Allocating %d Color Buffers and %d Aux Buffer(s)...\n", 345 346 INIT_PRINTF(("sst1InitVideo(): Allocating %d Color Buffers and %d Aux Buffer(s)...\n", 346 347 sst1CurrentBoard->fbiVideoColBuffs, sst1CurrentBoard->fbiVideoAuxBuffs)); 347 348 ISET(sst->fbiInit4, IGET(sst->fbiInit4) | … … 389 390 INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n", 390 391 sst1CurrentBoard->memFifoStatusLwm, 391 sst1CurrentBoard->memFifoStatusLwm)); 392 sst1CurrentBoard->memFifoStatusLwm)); 392 393 } 393 394 … … 665 666 ** 666 667 */ 667 static FxBool 668 static FxBool 668 669 sst1InitAllocBuffersDirect(FxU32 *sstbase, FxU32 nColorBuffs, FxU32 nAuxBuffs) 669 670 { … … 689 690 SST_BUFFER_ALLOC_3C1Z); 690 691 else { 691 INIT_PRINTF(("sst1InitAllocBuffers(): Unsupported Color/Aux buffer combination (%d/%d)\n", 692 INIT_PRINTF(("sst1InitAllocBuffers(): Unsupported Color/Aux buffer combination (%d/%d)\n", 692 693 nCol, nAux)); 693 694 return(FXFALSE); … … 698 699 } 699 700 700 FX_EXPORT FxBool FX_CSTYLE 701 FX_EXPORT FxBool FX_CSTYLE 701 702 sst1InitAllocBuffers(FxU32 *sstbase, FxU32 nColorBuffs, FxU32 nAuxBuffs) 702 703 { … … 712 713 return(FXFALSE); 713 714 714 retVal = sst1InitAllocBuffersDirect(sstbase, 715 retVal = sst1InitAllocBuffersDirect(sstbase, 715 716 nColorBuffs, nAuxBuffs); 716 717 717 718 if (retVal && sst1CurrentBoard->sliDetected) { 718 719 /* NB: When writing to the slave we need to make sure that it does 719 * not have a client callback installed. 720 * not have a client callback installed. 720 721 */ 721 722 FxSet32Proc saveProc = sst1CurrentBoard->set32; … … 797 798 ** 798 799 */ 799 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 800 sst1VideoTimingStruct *sstVideoRez, 800 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 801 sst1VideoTimingStruct *sstVideoRez, 801 802 FxU32 Banked) 802 803 { … … 907 908 */ 908 909 FX_EXPORT FxBool FX_CSTYLE sst1InitVideoBorder(FxU32 *sstbase, 909 FxU32 mask, 910 FxU32 mask, 910 911 FxU32 color) 911 912 { … … 949 950 950 951 FX_EXPORT sst1VideoTimingStruct* FX_CSTYLE 951 sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 952 sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 952 953 GrScreenRefresh_t screenRefresh) 953 954 { … … 1014 1015 1015 1016 case(GR_RESOLUTION_512x384): 1016 1017 1017 1018 if( GETENV( ("SSTV2_REFRESH_512x384") ) ) 1018 1019 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_512x384") ) ) ); 1019 1020 1020 1021 if(refreshRate == GR_REFRESH_120Hz) 1021 1022 return(&SST_VREZ_512X384_120); … … 1039 1040 1040 1041 case(GR_RESOLUTION_640x400): 1041 1042 1042 1043 if( GETENV( ("SSTV2_REFRESH_640x400") ) ) 1043 1044 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_640x400") ) ) ); 1044 1045 1045 1046 if(refreshRate == GR_REFRESH_120Hz) 1046 1047 return(&SST_VREZ_640X400_120); … … 1054 1055 1055 1056 case(GR_RESOLUTION_640x480): 1056 1057 1057 1058 if( GETENV( ("SSTV2_REFRESH_640x480") ) ) 1058 1059 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_640x480") ) ) ); 1059 1060 1060 1061 if(refreshRate == GR_REFRESH_120Hz) 1061 1062 return(&SST_VREZ_640X480_120); … … 1069 1070 1070 1071 case(GR_RESOLUTION_800x600): 1071 1072 1072 1073 if( GETENV( ("SSTV2_REFRESH_800x600") ) ) 1073 1074 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_800x600") ) ) ); 1074 1075 1075 1076 if(refreshRate == GR_REFRESH_120Hz) 1076 1077 return(&SST_VREZ_800X600_120); … … 1090 1091 if( GETENV( ("SSTV2_REFRESH_960x720") ) ) 1091 1092 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_960x720") ) ) ); 1092 1093 1093 1094 if(refreshRate == GR_REFRESH_85Hz) 1094 1095 return(&SST_VREZ_960X720_85); … … 1100 1101 1101 1102 case(GR_RESOLUTION_1024x768): 1102 1103 1103 1104 if( GETENV( ("SSTV2_REFRESH_1024x768") ) ) 1104 1105 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_1024x768") ) ) ); 1105 1106 1106 1107 if(refreshRate == GR_REFRESH_85Hz) 1107 1108 return(&SST_VREZ_1024X768_85); … … 1173 1174 j = IGET(sst->status); 1174 1175 } while(!(j & SST_VRETRACE)); 1175 1176 1176 1177 // Wait for active vsync 1177 1178 do { … … 1264 1265 else 1265 1266 tf2_clkdel = 0x6; 1266 } else 1267 } else 1267 1268 tf2_clkdel = 0x6; 1268 1269 … … 1274 1275 else 1275 1276 tf1_clkdel = 0x6; 1276 } else 1277 } else 1277 1278 tf1_clkdel = 0x6; 1278 1279 -
trunk/src/opengl/glide/cvg/initterm.cpp
r5135 r6653 1 /* $Id: initterm.cpp,v 1.5 2001-09-05 14:30:18 bird Exp $ */ 1 2 /* 2 3 * DLL entry point … … 51 52 case DLL_THREAD_ATTACH: 52 53 case DLL_THREAD_DETACH: 53 54 return DllMain(hinstDLL, fdwReason, fImpLoad); 54 55 55 56 case DLL_PROCESS_DETACH: 56 57 58 57 DllMain(hinstDLL, fdwReason, fImpLoad); 58 ctordtorTerm(); 59 return TRUE; 59 60 } 60 61 return FALSE; … … 86 87 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 87 88 88 89 if(dllHandle == 0) 90 89 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 90 if(dllHandle == 0) 91 return 0UL; 91 92 92 93 break; 93 94 case 1 : 94 95 if(dllHandle) { 95 96 UnregisterLxDll(dllHandle); 96 97 } 97 98 break; -
trunk/src/opengl/glide/cvg/texus/3df.c
r2888 r6653 1 /* $Id: 3df.c,v 1.2 2001-09-05 14:30:43 bird Exp $ */ 1 2 /* 2 3 * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 * FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 * FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 11 * 11 12 * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO … … 25 26 /*************************************** 3df files ****************************/ 26 27 /* Read word, msb first */ 27 static FxBool 28 static FxBool 28 29 _txRead16 (FILE *stream, FxU16* data) 29 30 { … … 36 37 37 38 /* Read long word, msb first */ 38 static FxBool 39 static FxBool 39 40 _txRead32 (FILE *stream, FxU32* data) 40 41 { … … 53 54 54 55 /* Read NCC table */ 55 static FxBool 56 static FxBool 56 57 _txRead3DFNCCTable (FILE* stream, FxI32* ncc_table) 57 58 { … … 87 88 } 88 89 89 static FxBool 90 static FxBool 90 91 _txRead3DFPalTable (FILE* stream, FxI32* pal) 91 92 { … … 114 115 if (fscanf (stream, "f v%6s", version) != 1) return FXFALSE; 115 116 116 /* 117 /* 117 118 * skip comments 118 119 */ -
trunk/src/opengl/glide/cvg/texus/clamp.c
r2888 r6653 1 /* $Id: clamp.c,v 1.2 2001-09-05 14:30:44 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:37:58$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:44 $ 23 24 */ 24 25 … … 37 38 if( txVerbose ) 38 39 { 39 printf( "clamping from %dx%d to %dx%d\n", 40 printf( "clamping from %dx%d to %dx%d\n", 40 41 ix, iy, ox, oy ); 41 42 } … … 76 77 if ((srcMip->data[0] == NULL) || (dstMip->data[0] == NULL)) 77 78 txPanic("txImageClamp: Null buffer\n"); 78 79 79 80 sw = srcMip->width; 80 81 sh = srcMip->height; … … 82 83 dh = dstMip->height; 83 84 84 for( i = 0; i < srcMip->depth; i++ ) 85 for( i = 0; i < srcMip->depth; i++ ) 85 86 { 86 87 if( !dstMip->data[i] ) … … 103 104 } 104 105 } 105 106 -
trunk/src/opengl/glide/cvg/texus/dequant.c
r2888 r6653 1 /* $Id: dequant.c,v 1.2 2001-09-05 14:30:44 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:37:58$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:44 $ 23 24 */ 24 25 … … 30 31 #include "texusint.h" 31 32 32 /* 33 /* 33 34 * Pn_8 = convert n bits (n <= 6) to 8 bits by replicating the msb's of input 34 35 * into the lsb's of the output. … … 94 95 95 96 /* 16 bit pixels */ 96 static FxU32 97 static FxU32 97 98 _txPixArgb8332to8888(FxU16 c8332) 98 99 { 99 100 FxU32 a, r, g, b; 100 a = (c8332 >> 8); 101 a = (c8332 >> 8); 101 102 r = P3_8[(c8332 >> 5) & 0x7]; 102 103 g = P3_8[(c8332 >> 2) & 0x7]; … … 233 234 in += n; 234 235 while (n--) { 235 in--; 236 in--; 236 237 *--out = (pal[(*in) & 0xff] & 0x00ffffff) | ((*in & 0xFF00) << 16); 237 238 } … … 302 303 in += n; 303 304 304 while (n--) *--out = *--in; 305 while (n--) *--out = *--in; 305 306 } 306 307 … … 314 315 for( i = 0; i < n; i++ ) 315 316 { 316 out[i] = 317 ( ( ( FxU32 )0xff ) << 24 ) | 317 out[i] = 318 ( ( ( FxU32 )0xff ) << 24 ) | 318 319 ( ( ( FxU32 )in[i*3] )<< 16 ) | 319 320 ( ( ( FxU32 )in[i*3+1] )<< 8 ) | … … 322 323 } 323 324 324 void 325 void 325 326 txMipDequantize(TxMip *txMip, TxMip *pxMip) 326 327 { … … 344 345 printf(" %dx%d", w, h); fflush(stdout); 345 346 } 346 347 347 348 switch(pxMip->format) { 348 case GR_TEXFMT_RGB_332: _txImgDequantizeRGB332(dst, src, w, h); 349 break; 350 case GR_TEXFMT_YIQ_422: _txImgDequantizeYIQ422(dst, src, w, h, 349 case GR_TEXFMT_RGB_332: _txImgDequantizeRGB332(dst, src, w, h); 350 break; 351 case GR_TEXFMT_YIQ_422: _txImgDequantizeYIQ422(dst, src, w, h, 351 352 (long *)pxMip->pal); break; 352 case GR_TEXFMT_A_8: _txImgDequantizeA8(dst, src, w, h); 353 break; 354 case GR_TEXFMT_I_8: _txImgDequantizeI8(dst, src, w, h); 355 break; 356 case GR_TEXFMT_AI_44: _txImgDequantizeAI44(dst, src, w, h); 357 break; 358 case GR_TEXFMT_P_8: _txImgDequantizeP8(dst, src, w, h, 353 case GR_TEXFMT_A_8: _txImgDequantizeA8(dst, src, w, h); 354 break; 355 case GR_TEXFMT_I_8: _txImgDequantizeI8(dst, src, w, h); 356 break; 357 case GR_TEXFMT_AI_44: _txImgDequantizeAI44(dst, src, w, h); 358 break; 359 case GR_TEXFMT_P_8: _txImgDequantizeP8(dst, src, w, h, 359 360 pxMip->pal); break; 360 361 361 case GR_TEXFMT_ARGB_8332: _txImgDequantizeARGB8332(dst, src, w, h); 362 break; 363 case GR_TEXFMT_AYIQ_8422: _txImgDequantizeAYIQ8422(dst, src, w, h, 362 case GR_TEXFMT_ARGB_8332: _txImgDequantizeARGB8332(dst, src, w, h); 363 break; 364 case GR_TEXFMT_AYIQ_8422: _txImgDequantizeAYIQ8422(dst, src, w, h, 364 365 (long *)pxMip->pal); break; 365 case GR_TEXFMT_RGB_565: _txImgDequantizeRGB565(dst, src, w, h); 366 break; 367 case GR_TEXFMT_ARGB_1555: _txImgDequantizeARGB1555(dst, src, w, h); 368 break; 369 case GR_TEXFMT_ARGB_4444: _txImgDequantizeARGB4444(dst, src, w, h); 370 break; 371 case GR_TEXFMT_AI_88: _txImgDequantizeAI88(dst, src, w, h); 372 break; 373 case GR_TEXFMT_AP_88: _txImgDequantizeAP88(dst, src, w, h, 366 case GR_TEXFMT_RGB_565: _txImgDequantizeRGB565(dst, src, w, h); 367 break; 368 case GR_TEXFMT_ARGB_1555: _txImgDequantizeARGB1555(dst, src, w, h); 369 break; 370 case GR_TEXFMT_ARGB_4444: _txImgDequantizeARGB4444(dst, src, w, h); 371 break; 372 case GR_TEXFMT_AI_88: _txImgDequantizeAI88(dst, src, w, h); 373 break; 374 case GR_TEXFMT_AP_88: _txImgDequantizeAP88(dst, src, w, h, 374 375 pxMip->pal); break; 375 case GR_TEXFMT_ARGB_8888: _txImgDequantizeARGB8888(dst, src, w, h); 376 break; 377 case GR_TEXFMT_RGB_888: _txImgDequantizeRGB888(dst, src, w, h); 378 break; 379 380 default: 376 case GR_TEXFMT_ARGB_8888: _txImgDequantizeARGB8888(dst, src, w, h); 377 break; 378 case GR_TEXFMT_RGB_888: _txImgDequantizeRGB888(dst, src, w, h); 379 break; 380 381 default: 381 382 break; 382 383 } -
trunk/src/opengl/glide/cvg/texus/diffuse.c
r2888 r6653 1 /* $Id: diffuse.c,v 1.2 2001-09-05 14:30:44 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:37:58$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:44 $ 23 24 */ 24 25 … … 39 40 FxU8 bestR[256], bestG[256], bestB[256]; 40 41 41 static int 42 static int 42 43 _txAscendingR(const void *a, const void *b) 43 44 { … … 46 47 47 48 48 static int 49 static int 49 50 _txAscendingG(const void *a, const void *b) 50 51 { … … 53 54 54 55 55 static int 56 static int 56 57 _txAscendingB(const void *a, const void *b) 57 58 { … … 78 79 79 80 #if 0 80 for (i=0; i<ncolors; i++) 81 printf("[%3d] = R%.08x G%.08x B%.08x\n", 81 for (i=0; i<ncolors; i++) 82 printf("[%3d] = R%.08x G%.08x B%.08x\n", 82 83 i, sortR[i], sortG[i], sortB[i]); 83 84 #endif 84 85 85 86 86 87 for (i=0; i<256; i++) { 87 88 … … 129 130 persist = 0; 130 131 for (i=bestR[r]; i>=0; i--) { 131 d = DISTANCE(r, g, b, 132 d = DISTANCE(r, g, b, 132 133 ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff)); 133 134 if (d < mindist) { mindist = d; minpos = (pal[i] >> 24) & 0xff; } … … 138 139 persist = 0; 139 140 for (i=bestR[r]+1; i < nsorted; i++) { 140 d = DISTANCE(r, g, b, 141 d = DISTANCE(r, g, b, 141 142 ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff)); 142 143 if (d < mindist) { mindist = d; minpos = (pal[i] >> 24) & 0xff; } … … 149 150 persist = 0; 150 151 for (i=bestG[g]; i>=0; i--) { 151 d = DISTANCE(r, g, b, 152 d = DISTANCE(r, g, b, 152 153 ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff)); 153 154 if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; } … … 158 159 persist = 0; 159 160 for (i=bestG[g]+1; i < nsorted; i++) { 160 d = DISTANCE(r, g, b, 161 d = DISTANCE(r, g, b, 161 162 ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff)); 162 163 if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; } … … 168 169 persist = 0; 169 170 for (i=bestB[b]; i>=0; i--) { 170 d = DISTANCE(r, g, b, 171 d = DISTANCE(r, g, b, 171 172 ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff)); 172 173 if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; } … … 177 178 persist = 0; 178 179 for (i=bestB[b]+1; i < nsorted; i++) { 179 d = DISTANCE(r, g, b, 180 d = DISTANCE(r, g, b, 180 181 ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff)); 181 182 if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; } … … 221 222 ib += qb + ErrB[x]; 222 223 223 qr = ir; // quantized pixel values. 224 qr = ir; // quantized pixel values. 224 225 qg = ig; // qR is error from pixel to left, errR is 225 226 qb = ib; // error from pixel to the top & top left. … … 245 246 qb = ib - qb; 246 247 247 // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 248 // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 248 249 // 1/4 (0.25) to the SOUTH-EAST. 249 250 ErrR[x] = ((x == 0) ? 0 : ErrR[x]) + ((int) (qr * 0.375f)); … … 279 280 printf("EDiffusion:..."); fflush(stdout); 280 281 } 281 282 282 283 #if FAST_DIFFUSION 283 284 _txMakeRange(palette, ncolors); … … 289 290 290 291 for (i=0; i<txMip->depth; i++) { 291 _txToDiffuseIndex(pxMip->data[i], pixsize, palette, ncolors, 292 _txToDiffuseIndex(pxMip->data[i], pixsize, palette, ncolors, 292 293 txMip->data[i], w, h); 293 294 if (w > 1) w >>= 1; -
trunk/src/opengl/glide/cvg/texus/gldutil.c
r2888 r6653 1 /* $Id: gldutil.c,v 1.2 2001-09-05 14:30:45 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:37:59$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:45 $ 23 24 */ 24 25 … … 35 36 /* 36 37 * Allocate memory via Glide for a texture. 37 * Assumes that the passed image is already quantized to 38 * Assumes that the passed image is already quantized to 38 39 * the format that you want to download. 39 40 */ … … 325 326 ncc_table.yRGB[i] = ( FxU8 )texture->pal[i]; 326 327 } 327 328 328 329 for( i = 0; i < 4; i++ ) 329 330 { -
trunk/src/opengl/glide/cvg/texus/mipmap.c
r2888 r6653 1 /* $Id: mipmap.c,v 1.2 2001-09-05 14:30:45 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:37:59$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:45 $ 23 24 */ 24 25 -
trunk/src/opengl/glide/cvg/texus/ncc.c
r2888 r6653 1 /* $Id: ncc.c,v 1.2 2001-09-05 14:30:45 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Revision: 1. 1$21 ** $Date: 200 0-02-25 00:37:59$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:30:45 $ 22 23 */ 23 24 … … 29 30 #include "texusint.h" 30 31 31 static int 32 dithmat[4][4] = { 0, 8, 2, 10, 33 12, 4, 14, 6, 34 3, 11, 1, 9, 32 static int 33 dithmat[4][4] = { 0, 8, 2, 10, 34 12, 4, 14, 6, 35 3, 11, 1, 9, 35 36 15, 7, 13, 5 }; 36 37 … … 45 46 _txPixQuantize_YIQ422 (unsigned long argb, int x, int y, int w) 46 47 { 47 int r, g, b; 48 int r, g, b; 48 49 int iy, ii, iq; 49 50 … … 125 126 126 127 static void 127 _txImgNcc(char *odata, unsigned long *idata, int w, int h, int format, 128 _txImgNcc(char *odata, unsigned long *idata, int w, int h, int format, 128 129 int dither) 129 130 { … … 153 154 154 155 RGB values can be converted to YIQ using the equation: 155 156 156 157 Y = 0.30F * R + 0.59F * G + 0.11F * B; 157 158 I = 0.60F * R - 0.28F * G - 0.32F * B; 158 159 Q = 0.21F * R - 0.52F * G + 0.31F * B; 159 160 160 Assuming that each of the RGB components are in the range 0..255, 161 Assuming that each of the RGB components are in the range 0..255, 161 162 Y ranges from (0 .. 255) 162 163 I ranges from (-0.60 * 255 .. 0.60 * 255) i.e, (-153 to 153) … … 166 167 167 168 168 static void 169 static void 169 170 _txMipNccStatTable(TxMip *txMip) 170 171 { 171 172 int i, w, h; 172 173 173 for (i=0; i<256; i++) 174 for (i=0; i<256; i++) 174 175 ncc.yhist[i] = ncc.ihist[i] = ncc.qhist[i] = 0; 175 176 ncc.npixels = 0; … … 250 251 251 252 252 void 253 void 253 254 txMipNcc(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression) 254 255 { … … 256 257 257 258 switch (compression & TX_COMPRESSION_MASK) { 258 case TX_COMPRESSION_HEURISTIC: 259 case TX_COMPRESSION_HEURISTIC: 259 260 _txMipNccStatTable(txMip); 260 261 for (i=0; i< 16; i++) pxMip->pal[ 0 + i] = ncc.y[i]; -
trunk/src/opengl/glide/cvg/texus/nccnnet.c
r2888 r6653 1 /* $Id: nccnnet.c,v 1.2 2001-09-05 14:30:45 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:37:59$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:45 $ 23 24 */ 24 25 #include <stdio.h> … … 33 34 * ARGB8888 format and produces an optimal YAB table, and an 8 bit image 34 35 * in YAB format that best represents the original image. A very detailed 35 * explanation of the algorithm is available in 36 * explanation of the algorithm is available in 36 37 * /tdfx/engr/devel/sst1/docs/yab.doc. The summary follows. 37 38 * 38 * Neural net algorithms first determine a "representative sample" of the 39 * Neural net algorithms first determine a "representative sample" of the 39 40 * input image. This representative sample is repeatedly run through the net 40 41 * during the network learning stage, and the neural net "learns" which colors 41 42 * are important and which ones are not. It's quite possible to feed every 42 43 * pixel in the original image repeatedly into the neural net 43 * to make it learn; however, this can be extremely time consuming. 44 * to make it learn; however, this can be extremely time consuming. 44 45 * 45 46 * So, we prefer to make a representative sample of colors for the input image. … … 48 49 * colors (just like for the 8-bit palettized case) works quite well, and 49 50 * so we first quantize to 8 bit palette, and use the palette as the sample 50 * colors to feed the neural network. This also makes using 256-palette 51 * colors to feed the neural network. This also makes using 256-palette 51 52 * textures very easy. 52 53 * 53 54 * After the "representative colors" are determined, we train the neural net, 54 * and obtain the optimal YAB table. Each sample color in the palette, 55 * which was originally in ARGB8888 format is now replaced with IRGB8888, 56 * where the RGB is the same as before, but the alpha channel is replaced 57 * with an 8 bit number I which is the YAB index corresponding to this 58 * representative color. 55 * and obtain the optimal YAB table. Each sample color in the palette, 56 * which was originally in ARGB8888 format is now replaced with IRGB8888, 57 * where the RGB is the same as before, but the alpha channel is replaced 58 * with an 8 bit number I which is the YAB index corresponding to this 59 * representative color. 59 60 * 60 61 * So now it's possible to translate the original image into an 8 bit image … … 65 66 * In the process of converting the original image to the YAB format, we could 66 67 * optionally dither the image. Ordered dithering doesn't quite work, so we 67 * use error-diffusion dithering. 68 * use error-diffusion dithering. 68 69 * 69 70 * I've found that there are three speed bottlenecks to overcome. The first 70 71 * time consuming operation is the computation of representative image colors. 71 * 256 color quantization is used for this part. The second bottleneck is the 72 * training of the neural net algorithm itself, and I've optimized this as 72 * 256 color quantization is used for this part. The second bottleneck is the 73 * training of the neural net algorithm itself, and I've optimized this as 73 74 * much as possible. The third bottleneck is the translation of the original 74 75 * image into the 8 bit YAB indexed image; this still needs work, especially … … 79 80 80 81 /****************************************************************************** 81 * 82 * 82 83 * The hardcore neural net stuff begins here. 83 84 * … … 117 118 _nn_modifyNeurons(long ir, long ig, long ib) 118 119 { 119 int i; 120 int i; 120 121 int d0, d1; // closest & next closest distance to input 121 122 int p0, p1; // index into the 256 color table. … … 138 139 139 140 d = DISTANCE(n->r, n->g, n->b, ir, ig, ib); 140 if (d < d0) { 141 if (d < d0) { 141 142 d1 = d0; d0 = d; 142 143 p1 = p0; p0 = i; … … 145 146 d1 = d; 146 147 p1 = i; 147 } 148 } 148 149 } 149 150 … … 183 184 pb = N[p0].pb; 184 185 py->r += (dr >> 2) + (dg >> 1) + (db >> 2); CLAMP_PLUS(py->r); 185 pa->r += (dr >> 2) ; CLAMP_BOTH(pa->r); 186 pa->r += (dr >> 2) ; CLAMP_BOTH(pa->r); 186 187 pa->g += (dg >> 2) ; CLAMP_BOTH(pa->g); 187 188 pa->b += (db >> 2) ; CLAMP_BOTH(pa->b); … … 258 259 259 260 static int order[256]; 260 static int 261 static int 261 262 _nn_randomOrder(const void *a, const void *b) 262 263 { … … 275 276 276 277 _nn_initTables(); 277 /* 278 /* 278 279 * Select a number which is relatively prime to nsamples. 279 280 */ … … 295 296 FxU32 *pRGB; 296 297 297 // We present the samples randomly to the network. 298 // We present the samples randomly to the network. 298 299 // _nn_modify_neurons() makes the neurons learn 299 300 // errR, errG, errB, errMax are computed in _nn_modifyNeurons(), as … … 308 309 309 310 if (errMax < bstMax) { 310 /* 311 /* 311 312 * A lower total error than before, take a Snapshot 312 313 * … … 344 345 bstB = errB; 345 346 #if 0 346 printf("%8d%, dry=%8d, eMax=%8x eMax=%3d%3d%3d eAvg=%3d%3d%3d\n", 347 iterations, drySpells, errMax, 348 errG, errR, errB, 347 printf("%8d%, dry=%8d, eMax=%8x eMax=%3d%3d%3d eAvg=%3d%3d%3d\n", 348 iterations, drySpells, errMax, 349 errG, errR, errB, 349 350 totG/nsamples, totR/nsamples, totB/nsamples 350 351 ); … … 356 357 } 357 358 358 if (errMax == 0) { 359 // printf("******Exact Solution in %d iterations\n", iterations); 360 // _nn_Dump(); 359 if (errMax == 0) { 360 // printf("******Exact Solution in %d iterations\n", iterations); 361 // _nn_Dump(); 361 362 break; 362 363 } 363 364 } 364 365 365 /* 366 /* 366 367 * At this point YAB has the YAB table, samples has input palette, 367 368 * Replace MSB of samples with index to be used with YAB table. … … 393 394 394 395 395 /* 396 * Get a 256 color palette, to be used as samples 396 /* 397 * Get a 256 color palette, to be used as samples 397 398 * Incidentally, convert src 32 bit image to dst 8 bit indexed image, 398 399 * with indices referring to the 256 color palette. … … 403 404 printf("NCC Neural nets..."); fflush(stdout); 404 405 } 405 pxMip->format = (format == GR_TEXFMT_YIQ_422) ? GR_TEXFMT_P_8 : 406 pxMip->format = (format == GR_TEXFMT_YIQ_422) ? GR_TEXFMT_P_8 : 406 407 GR_TEXFMT_AP_88; 407 408 ncolors = txMipPal256(pxMip, txMip, pxMip->format, 0, 0); … … 413 414 if( txVerbose ) 414 415 { 415 printf("eMax=(%3d%3d%3d)...eAvg=(%3d%3d%3d)\n", 416 errG, errR, errB, 416 printf("eMax=(%3d%3d%3d)...eAvg=(%3d%3d%3d)\n", 417 errG, errR, errB, 417 418 totG/ncolors, totR/ncolors, totB/ncolors 418 419 ); … … 423 424 /* 424 425 * At this point, we can lose the 256 color palette, and replace it with 425 * the 256 color palette generated from the YAB table. This will be 426 * the 256 color palette generated from the YAB table. This will be 426 427 * useful for error diffusion dithering. 427 428 */ 428 429 txYABtoPal256((long *)pxMip->pal, (long *)yabTable); 429 430 txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256); 430 } 431 } 431 432 else { 432 433 -
trunk/src/opengl/glide/cvg/texus/pal256.c
r2888 r6653 1 /* $Id: pal256.c,v 1.2 2001-09-05 14:30:45 bird Exp $ */ 1 2 /* 2 3 * This software is copyrighted as noted below. It may be freely copied, 3 * modified, and redistributed, provided that the copyright notice is 4 * modified, and redistributed, provided that the copyright notice is 4 5 * preserved on all copies. 5 * 6 * 6 7 * There is no warranty or other guarantee of fitness for this software, 7 8 * it is provided solely "as is". Bug reports or fixes may be sent … … 9 10 * 10 11 * You may not include this software in a program or other software product 11 * without supplying the source, or without informing the end-user that the 12 * without supplying the source, or without informing the end-user that the 12 13 * source is available for no extra charge. 13 14 * … … 72 73 * Readability constants. 73 74 */ 74 #define REDI 0 75 #define REDI 0 75 76 #define GREENI 1 76 #define BLUEI 2 77 #define BLUEI 2 77 78 #define TRUE 1 78 79 #define FALSE 0 … … 111 112 * Perform variance-based color quantization on a 24-bit image. 112 113 */ 113 int 114 int 114 115 txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression) 115 116 { … … 117 118 int i; /* Counter */ 118 119 int OutColors; /* # of entries computed */ 119 int Colormax; /* quantized full-intensity */ 120 int Colormax; /* quantized full-intensity */ 120 121 float Cfactor; /* Conversion factor */ 121 122 #if 0 … … 131 132 Cfactor = (float)FULLINTENSITY / Colormax; 132 133 133 Boxes = _Boxes; 134 Boxes = _Boxes; 134 135 #if 0 135 136 Histogram = (ulong *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(long)); … … 157 158 158 159 OutColors = CutBoxes(Boxes, MAXCOLORS); 159 160 160 161 /* 161 162 * We now know the set of representative colors. We now … … 180 181 pxMip->pal[i] = (r<<16) | (g << 8) | b; 181 182 } 182 ComputeRGBMap(Boxes, OutColors, rgbmap); 183 ComputeRGBMap(Boxes, OutColors, rgbmap); 183 184 184 185 /* … … 218 219 *dst++ = rgbmap[index]; 219 220 } else { 220 *(FxU16 *)dst = (rgbmap[index]) | 221 *(FxU16 *)dst = (rgbmap[index]) | 221 222 ((argb >> 16) & 0xFF00); 222 223 dst+= 2; … … 253 254 * We compute both the histogram and the proj. frequencies of 254 255 * the first box at the same time to save a pass through the 255 * entire image. 256 * entire image. 256 257 */ 257 258 258 259 for (i = 0; i < npixels; i++) { 259 260 rr = (uchar) (((*pixels >> 16) & 0xff) >> (8-NBITS)); … … 266 267 Histogram[(((rr<<NBITS)|gg)<<NBITS)|bb]++; 267 268 } 268 269 269 270 } 270 271 … … 273 274 */ 274 275 static int 275 CutBoxes(Box *boxes, int colors) 276 CutBoxes(Box *boxes, int colors) 276 277 { 277 278 int curbox; … … 363 364 * Find 'optimal' cutpoint along each of the red, green and blue 364 365 * axes. Sum the variances of the two boxes which would result 365 * by making each cut and store the resultant boxes for 366 * by making each cut and store the resultant boxes for 366 367 * (possible) later use. 367 368 */ … … 461 462 bzero(box1->freq[0], ColormaxI * sizeof(ulong)); 462 463 bzero(box1->freq[1], ColormaxI * sizeof(ulong)); 463 bzero(box1->freq[2], ColormaxI * sizeof(ulong)); 464 bzero(box1->freq[2], ColormaxI * sizeof(ulong)); 464 465 465 466 for (r = box1->low[0]; r < box1->high[0]; r++) { … … 507 508 { 508 509 int r, g, b; 509 510 510 511 for (r = box->low[REDI]; r < box->high[REDI]; r++) { 511 512 for (g = box->low[GREENI]; g < box->high[GREENI]; g++) { 512 513 for (b = box->low[BLUEI]; b < box->high[BLUEI]; b++) { 513 514 int index; 514 515 515 516 index = (((r<<NBITS)|g)<<NBITS)|b; 516 517 rgbmap[index]=(char)boxnum; … … 528 529 int min_index; 529 530 long r, g, b; 530 531 531 532 min_dist = 256 * 256 + 256 * 256 + 256 * 256; 532 533 min_index = -1; … … 573 574 unsigned long index; 574 575 unsigned long r_index, g_index, b_index; 575 576 576 577 r_index = ( ( ( unsigned long )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) ); 577 578 g_index = ( ( ( unsigned long )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) ); 578 579 b_index = ( ( ( unsigned long )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) ); 579 index = 580 index = 580 581 ( r_index << ( INVERSE_PAL_G_BITS + INVERSE_PAL_B_BITS ) ) | 581 582 ( g_index << INVERSE_PAL_B_BITS ) | … … 618 619 static FxU32 last_pal[256]; 619 620 static FxBool been_here = FXFALSE; 620 621 621 622 w = outputMip->width; 622 623 h = outputMip->height; … … 632 633 } 633 634 634 for( i = 0; i < trueColorMip->depth; i++ ) 635 for( i = 0; i < trueColorMip->depth; i++ ) 635 636 { 636 637 _txImgTrueToFixedPal( outputMip->data[i], trueColorMip->data[i], pal, -
trunk/src/opengl/glide/cvg/texus/ppm.c
r2888 r6653 1 /* $Id: ppm.c,v 1.2 2001-09-05 14:30:46 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:38:00$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:46 $ 23 24 ** 24 25 */ … … 32 33 33 34 34 FxBool 35 FxBool 35 36 _txReadPPMHeader( FILE *stream, FxU32 cookie, TxMip *info) 36 { 37 { 37 38 char buffer[256]; 38 39 FxU32 state = 1; 39 40 FxBool done = FXFALSE; 40 41 41 42 if ( stream == NULL ) { 42 43 43 txPanic("PPM file: Bad file handle."); 44 return FXFALSE; 44 45 } 45 46 46 47 while( !done && fgets( buffer, 256, stream ) ) { 47 char *token; 48 49 if ( buffer[0] == '#' ) continue; 50 for (token = strtok( buffer, " \t\n\r" ); token != NULL; 51 token = strtok( NULL, " \t\n\r" )) { 52 switch( state ) { 53 case 1: // Width 54 info->width = atoi( token ); 55 state++; 56 break; 48 char *token; 57 49 58 case 2: // height 59 info->height = atoi( token ); 60 state++; 61 break; 50 if ( buffer[0] == '#' ) continue; 51 for (token = strtok( buffer, " \t\n\r" ); token != NULL; 52 token = strtok( NULL, " \t\n\r" )) { 53 switch( state ) { 54 case 1: // Width 55 info->width = atoi( token ); 56 state++; 57 break; 62 58 63 case 3: // Color Depth 64 info->format = atoi( token ); 65 if ( info->format != 255 ) { 66 txPanic("Unsupported PPM format: max != 255\n"); 67 return FXFALSE; 68 } 69 state++; 70 done = FXTRUE; 71 break; 59 case 2: // height 60 info->height = atoi( token ); 61 state++; 62 break; 72 63 73 default: 74 txPanic("PPM file: parse error\n"); 75 return FXFALSE; 76 break; 77 } 78 } 64 case 3: // Color Depth 65 info->format = atoi( token ); 66 if ( info->format != 255 ) { 67 txPanic("Unsupported PPM format: max != 255\n"); 68 return FXFALSE; 69 } 70 state++; 71 done = FXTRUE; 72 break; 73 74 default: 75 txPanic("PPM file: parse error\n"); 76 return FXFALSE; 77 break; 78 } 79 79 } 80 80 } 81 81 82 if ( state < 4 ) { 82 83 83 txPanic("PPM file: Read error before end of header."); 84 return FXFALSE; 84 85 } 85 86 info->depth = 1; … … 89 90 } 90 91 91 FxBool 92 _txReadPPMData( FILE *stream, TxMip *info) 93 { 92 FxBool 93 _txReadPPMData( FILE *stream, TxMip *info) 94 { 94 95 FxU32 numPixels; 95 96 FxU32 *data32 = info->data[0]; 96 97 97 98 numPixels = info->width * info->height; 98 99 99 100 if ( stream == NULL ) { 100 101 101 txPanic("PPM file: Bad file handle."); 102 return FXFALSE; 102 103 } 103 104 104 105 // Read in image data 105 106 while (numPixels--) { 106 107 int r, g, b; 107 108 108 109 110 111 112 113 114 115 109 r = getc( stream ); 110 g = getc( stream ); 111 b = getc( stream ); 112 if ( b == EOF ) { 113 txPanic("PPM file: Unexpected End of File."); 114 return FXFALSE; 115 } 116 *data32++ = (0xFF << 24) | (r << 16) | (g << 8) | b; 116 117 } 117 118 return FXTRUE; -
trunk/src/opengl/glide/cvg/texus/quantize.c
r2888 r6653 1 /* $Id: quantize.c,v 1.2 2001-09-05 14:30:46 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:38:00$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:46 $ 23 24 */ 24 25 … … 30 31 #include "texusint.h" 31 32 32 static int 33 dithmat[4][4] = { 0, 8, 2, 10, 34 12, 4, 14, 6, 35 3, 11, 1, 9, 33 static int 34 dithmat[4][4] = { 0, 8, 2, 10, 35 12, 4, 14, 6, 36 3, 11, 1, 9, 36 37 15, 7, 13, 5 }; 37 38 38 39 // for error diffusion. 39 static int errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH]; 40 static int errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH]; 40 41 41 42 static int … … 54 55 int n, t; 55 56 56 n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 57 n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 57 58 t = (n>>4)<<5; 58 n = (int) (((argb >> 8) & 0xFF) * 0x70/255.0f + 0.5f) + d; 59 n = (int) (((argb >> 8) & 0xFF) * 0x70/255.0f + 0.5f) + d; 59 60 t |= (n>>4)<<2; 60 n = (int) (((argb ) & 0xFF) * 0x30/255.0f + 0.5f) + d; 61 n = (int) (((argb ) & 0xFF) * 0x30/255.0f + 0.5f) + d; 61 62 t |= (n>>4)<<0; 62 63 return t & 0xFF; … … 82 83 ib += errB[x] + qb; 83 84 84 qr = ir; // quantized pixel values. 85 qr = ir; // quantized pixel values. 85 86 qg = ig; // qR is error from pixel to left, errR is 86 87 qb = ib; // error from pixel to the top & top left. … … 157 158 158 159 159 n = (int) (n * 0xF0/255.0f + 0.5f) + d; 160 n = (int) (n * 0xF0/255.0f + 0.5f) + d; 160 161 t = (n>>4); 161 162 t |= (int) ((argb>>24) & 0xF0); … … 215 216 int n, t; 216 217 217 n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 218 n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 218 219 t = (n>>4)<<5; 219 n = (int) (((argb >> 8) & 0xFF) * 0x70/255.0f + 0.5f) + d; 220 n = (int) (((argb >> 8) & 0xFF) * 0x70/255.0f + 0.5f) + d; 220 221 t |= (n>>4)<<2; 221 n = (int) (((argb ) & 0xFF) * 0x30/255.0f + 0.5f) + d; 222 n = (int) (((argb ) & 0xFF) * 0x30/255.0f + 0.5f) + d; 222 223 t |= (n>>4)<<0; 223 224 t |= ((argb >> 16) & 0xFF00); … … 252 253 int n, t; 253 254 254 n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 255 n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 255 256 t = (n>>4)<<11; 256 n = (int) (((argb >> 8) & 0xFF) * 0x3F0/255.0f + 0.5f) + d; 257 n = (int) (((argb >> 8) & 0xFF) * 0x3F0/255.0f + 0.5f) + d; 257 258 t |= (n>>4)<<5; 258 n = (int) (((argb ) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 259 n = (int) (((argb ) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 259 260 t |= (n>>4)<<0; 260 261 return t & 0xFFFF; … … 279 280 ib += errB[x] + qb; 280 281 281 qr = ir; // quantized pixel values. 282 qr = ir; // quantized pixel values. 282 283 qg = ig; // qR is error from pixel to left, errR is 283 284 qb = ib; // error from pixel to the top & top left. … … 324 325 ((argb >> 9) & 0x7C00) | 325 326 ((argb >> 6) & 0x03E0) | 326 ((argb >> 3) & 0x001F) | 327 ((argb >> 3) & 0x001F) | 327 328 ((argb >> 24) ? 0x8000 : 0) ); 328 329 } … … 334 335 int n, t; 335 336 336 n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 337 n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 337 338 t = (n>>4)<<10; 338 n = (int) (((argb >> 8) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 339 n = (int) (((argb >> 8) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 339 340 t |= (n>>4)<<5; 340 n = (int) (((argb ) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 341 n = (int) (((argb ) & 0xFF) * 0x1F0/255.0f + 0.5f) + d; 341 342 t |= (n>>4)<<0; 342 343 t |= ((argb >> 24) ? 0x8000 : 0); … … 361 362 ib += errB[x] + qb; 362 363 363 qr = ir; // quantized pixel values. 364 qr = ir; // quantized pixel values. 364 365 qg = ig; // qR is error from pixel to left, errR is 365 366 qb = ib; // error from pixel to the top & top left. … … 407 408 ((argb >> 12) & 0x0F00) | 408 409 ((argb >> 8) & 0x00F0) | 409 ((argb >> 4) & 0x000F) | 410 ((argb >> 4) & 0x000F) | 410 411 ((argb >> 16) & 0xF000) ); 411 412 } … … 417 418 int n, t; 418 419 419 n = (int) (((argb >> 16) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 420 n = (int) (((argb >> 16) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 420 421 t = (n>>4)<<8; 421 n = (int) (((argb >> 8) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 422 n = (int) (((argb >> 8) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 422 423 t |= (n>>4)<<4; 423 n = (int) (((argb ) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 424 n = (int) (((argb ) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 424 425 t |= (n>>4)<<0; 425 426 t |= (argb >> 16) & 0xF000; … … 444 445 ib += errB[x] + qb; 445 446 446 qr = ir; // quantized pixel values. 447 qr = ir; // quantized pixel values. 447 448 qg = ig; // qR is error from pixel to left, errR is 448 449 qb = ib; // error from pixel to the top & top left. … … 511 512 512 513 switch(format) { 513 case GR_TEXFMT_RGB_332: quantizer = _txPixQuantize_RGB332_DErr; 514 break; 515 case GR_TEXFMT_A_8: quantizer = _txPixQuantize_A8; 514 case GR_TEXFMT_RGB_332: quantizer = _txPixQuantize_RGB332_DErr; 515 break; 516 case GR_TEXFMT_A_8: quantizer = _txPixQuantize_A8; 516 517 break; 517 518 case GR_TEXFMT_I_8: quantizer = _txPixQuantize_I8; … … 521 522 case GR_TEXFMT_ARGB_8332: quantizer = _txPixQuantize_ARGB8332_DErr; 522 523 break; 523 case GR_TEXFMT_RGB_565: quantizer = _txPixQuantize_RGB565_DErr; 524 case GR_TEXFMT_RGB_565: quantizer = _txPixQuantize_RGB565_DErr; 524 525 break; 525 526 case GR_TEXFMT_ARGB_1555: quantizer = _txPixQuantize_ARGB1555_DErr; … … 535 536 536 537 switch(format) { 537 case GR_TEXFMT_RGB_332: quantizer = _txPixQuantize_RGB332_D4x4; 538 break; 539 case GR_TEXFMT_A_8: quantizer = _txPixQuantize_A8; 540 break; 541 case GR_TEXFMT_I_8: quantizer = _txPixQuantize_I8; 542 break; 543 case GR_TEXFMT_AI_44: quantizer = _txPixQuantize_AI44_D4x4; 544 break; 545 546 case GR_TEXFMT_ARGB_8332: quantizer = _txPixQuantize_ARGB8332_D4x4; 547 break; 548 case GR_TEXFMT_RGB_565: quantizer = _txPixQuantize_RGB565_D4x4; 549 break; 550 case GR_TEXFMT_ARGB_1555: quantizer = _txPixQuantize_ARGB1555_D4x4; 551 break; 552 case GR_TEXFMT_ARGB_4444: quantizer = _txPixQuantize_ARGB4444_D4x4; 553 break; 554 case GR_TEXFMT_AI_88: quantizer = _txPixQuantize_AI88; 555 break; 556 557 default: txPanic("Bad case in txQuantize()\n"); 538 case GR_TEXFMT_RGB_332: quantizer = _txPixQuantize_RGB332_D4x4; 539 break; 540 case GR_TEXFMT_A_8: quantizer = _txPixQuantize_A8; 541 break; 542 case GR_TEXFMT_I_8: quantizer = _txPixQuantize_I8; 543 break; 544 case GR_TEXFMT_AI_44: quantizer = _txPixQuantize_AI44_D4x4; 545 break; 546 547 case GR_TEXFMT_ARGB_8332: quantizer = _txPixQuantize_ARGB8332_D4x4; 548 break; 549 case GR_TEXFMT_RGB_565: quantizer = _txPixQuantize_RGB565_D4x4; 550 break; 551 case GR_TEXFMT_ARGB_1555: quantizer = _txPixQuantize_ARGB1555_D4x4; 552 break; 553 case GR_TEXFMT_ARGB_4444: quantizer = _txPixQuantize_ARGB4444_D4x4; 554 break; 555 case GR_TEXFMT_AI_88: quantizer = _txPixQuantize_AI88; 556 break; 557 558 default: txPanic("Bad case in txQuantize()\n"); 558 559 break; 559 560 } … … 561 562 562 563 switch(format) { 563 case GR_TEXFMT_RGB_332: quantizer = _txPixQuantize_RGB332; 564 break; 565 case GR_TEXFMT_A_8: quantizer = _txPixQuantize_A8; 566 break; 567 case GR_TEXFMT_I_8: quantizer = _txPixQuantize_I8; 568 break; 569 case GR_TEXFMT_AI_44: quantizer = _txPixQuantize_AI44; 570 break; 571 572 case GR_TEXFMT_ARGB_8332: quantizer = _txPixQuantize_ARGB8332; 573 break; 574 case GR_TEXFMT_RGB_565: quantizer = _txPixQuantize_RGB565; 575 break; 576 case GR_TEXFMT_ARGB_1555: quantizer = _txPixQuantize_ARGB1555; 577 break; 578 case GR_TEXFMT_ARGB_4444: quantizer = _txPixQuantize_ARGB4444; 579 break; 580 case GR_TEXFMT_AI_88: quantizer = _txPixQuantize_AI88; 581 break; 582 583 default: txPanic("Bad case in txQuantize()\n"); 564 case GR_TEXFMT_RGB_332: quantizer = _txPixQuantize_RGB332; 565 break; 566 case GR_TEXFMT_A_8: quantizer = _txPixQuantize_A8; 567 break; 568 case GR_TEXFMT_I_8: quantizer = _txPixQuantize_I8; 569 break; 570 case GR_TEXFMT_AI_44: quantizer = _txPixQuantize_AI44; 571 break; 572 573 case GR_TEXFMT_ARGB_8332: quantizer = _txPixQuantize_ARGB8332; 574 break; 575 case GR_TEXFMT_RGB_565: quantizer = _txPixQuantize_RGB565; 576 break; 577 case GR_TEXFMT_ARGB_1555: quantizer = _txPixQuantize_ARGB1555; 578 break; 579 case GR_TEXFMT_ARGB_4444: quantizer = _txPixQuantize_ARGB4444; 580 break; 581 case GR_TEXFMT_AI_88: quantizer = _txPixQuantize_AI88; 582 break; 583 584 default: txPanic("Bad case in txQuantize()\n"); 584 585 break; 585 586 } … … 614 615 * quality levels in each of the compression cases. 615 616 */ 616 void 617 void 617 618 txMipQuantize(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression) 618 619 { … … 636 637 return; 637 638 638 case GR_TEXFMT_ARGB_8888: 639 case GR_TEXFMT_ARGB_8888: 639 640 // Copy source to destination, and be done. 640 641 if( txVerbose ) … … 651 652 652 653 // Normal cases 653 case GR_TEXFMT_A_8: 654 case GR_TEXFMT_I_8: 655 case GR_TEXFMT_AI_44: 654 case GR_TEXFMT_A_8: 655 case GR_TEXFMT_I_8: 656 case GR_TEXFMT_AI_44: 656 657 case GR_TEXFMT_RGB_332: 657 case GR_TEXFMT_RGB_565: 658 case GR_TEXFMT_ARGB_8332: 659 case GR_TEXFMT_ARGB_1555: 658 case GR_TEXFMT_RGB_565: 659 case GR_TEXFMT_ARGB_8332: 660 case GR_TEXFMT_ARGB_1555: 660 661 case GR_TEXFMT_ARGB_4444: 661 662 case GR_TEXFMT_AI_88: -
trunk/src/opengl/glide/cvg/texus/read.c
r2888 r6653 1 /* $Id: read.c,v 1.2 2001-09-05 14:30:46 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Revision: 1. 1$21 ** $Date: 200 0-02-25 00:38:00$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:30:46 $ 22 23 */ 23 24 … … 38 39 #define TX_UNK 0x200 // TGA is unknown from cookie signature. 39 40 40 int 41 int 41 42 _txReadHeader( FILE *stream, TxMip *info ) 42 43 { … … 86 87 } 87 88 88 static FxBool 89 static FxBool 89 90 _txReadData( FILE *stream, int fformat, TxMip *info ) 90 91 { … … 109 110 110 111 file = fopen(filename, "rb"); 111 if( file == NULL ) 112 if( file == NULL ) 112 113 { 113 114 fprintf( stderr,"Error: can't open input file %s\n", filename ); 114 115 exit(2); 115 116 } 116 117 117 118 retval = txMipReadFromFP( txMip, filename, file, prefFormat ); 118 119 fclose(file); … … 128 129 129 130 if ((prefFormat != GR_TEXFMT_ARGB_8888) && 130 (prefFormat != GR_TEXFMT_ANY)) 131 (prefFormat != GR_TEXFMT_ANY)) 131 132 { 132 133 txPanic("txMipRead: bad preferred format."); … … 143 144 fprintf(stderr,"Loading image file "); 144 145 145 fprintf (stderr,"%s (%dw x %dh x %d Bpp x %d mips) .. ", debug_filename, 146 fprintf (stderr,"%s (%dw x %dh x %d Bpp x %d mips) .. ", debug_filename, 146 147 txMip->width,txMip->height, GR_TEXFMT_SIZE(txMip->format), txMip->depth); 147 148 } 148 149 149 150 /* 150 * Allocate memory requested in data[0]; 151 * Allocate memory requested in data[0]; 151 152 */ 152 153 … … 159 160 continue; 160 161 } 161 txMip->data[i] = (FxU8*)txMip->data[i-1] + 162 txMip->data[i] = (FxU8*)txMip->data[i-1] + 162 163 w * h * GR_TEXFMT_SIZE(txMip->format); 163 164 if (w > 1) w >>= 1; … … 166 167 167 168 if( txVerbose ) { 168 169 170 171 169 fprintf( stderr, "mip-> format: %d width: %d height: %d depth: %d size: %d\n", 170 txMip->format, txMip->width, txMip->height, txMip->depth, 171 txMip->size ); 172 fflush( stderr ); 172 173 } 173 174 … … 195 196 if( txVerbose ) 196 197 { 197 fprintf(stderr, "Dequantizing Input from %s to argb8888.\n", 198 fprintf(stderr, "Dequantizing Input from %s to argb8888.\n", 198 199 Format_Name[txMip->format]); 199 200 } -
trunk/src/opengl/glide/cvg/texus/resample.c
r2888 r6653 1 /* $Id: resample.c,v 1.2 2001-09-05 14:30:46 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:38:00$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:46 $ 23 24 */ 24 25 … … 38 39 * total of ox * ix fragments, same as before. 39 40 * Initialize an accumulator to 0. Add the first input pixel, multiplied by ox 40 * the number of fragments per input pixel. Keep track of the number of 41 * the number of fragments per input pixel. Keep track of the number of 41 42 * fragments in the accumulator; when this is >= ix, (the number of fragments 42 * it takes to make an output pixel), multiply the accumulator by 43 * it takes to make an output pixel), multiply the accumulator by 43 44 */ 44 45 … … 65 66 int oa, or, og, ob; 66 67 67 // Yes, we have (possibly more than) enough to generate an output 68 // pixel. Of the nf new fragments, use up enough to generate an 68 // Yes, we have (possibly more than) enough to generate an output 69 // pixel. Of the nf new fragments, use up enough to generate an 69 70 // output pixel. 70 71 71 72 ef = ix - accf; // the excessive # of fragments. 72 73 73 // printf("New: accf = %3d, nf = %3d, ef = %3d, ix = %3d, ox = %3d\n", 74 // printf("New: accf = %3d, nf = %3d, ef = %3d, ix = %3d, ox = %3d\n", 74 75 // accf, nf, ef, ix, ox); 75 76 … … 94 95 95 96 *out++ = (oa << 24) | (or << 16) | (og << 8) | ob; 96 // printf("Output pixel %4d: %.02x %.02x %.02x %.02x\n", 97 // printf("Output pixel %4d: %.02x %.02x %.02x %.02x\n", 97 98 // o, oa, or, og, ob); 98 99 o++; … … 124 125 125 126 static void 126 _txImgResample(FxU32 *out, int ox, int oy, 127 _txImgResample(FxU32 *out, int ox, int oy, 127 128 const FxU32 *in, int ix, int iy) 128 129 { … … 147 148 int ef; 148 149 149 // Yes, we have (possibly more than) enough to generate an output 150 // pixel. Of the nf new fragments, use up enough to generate an 150 // Yes, we have (possibly more than) enough to generate an output 151 // pixel. Of the nf new fragments, use up enough to generate an 151 152 // output pixel. 152 153 … … 243 244 printf("Resampling to %dx%d: ", destMip->width, destMip->height); 244 245 245 246 246 247 sw = srcMip->width; 247 248 sh = srcMip->height; -
trunk/src/opengl/glide/cvg/texus/rgt.c
r2888 r6653 1 /* $Id: rgt.c,v 1.2 2001-09-05 14:30:46 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:38:00$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:46 $ 23 24 ** 24 25 */ … … 36 37 const FxU16 ITYPE_BGR = 0x04; 37 38 const FxU16 ITYPE_RGT = 0x08; 38 39 39 40 typedef struct _rgtHeader{ 40 41 FxU16 magic; … … 67 68 while (length--) { 68 69 s = *array; 69 *array++ = (s << 24) | ((s >> 8)&0xFF00) | 70 *array++ = (s << 24) | ((s >> 8)&0xFF00) | 70 71 ((s&0xFF00) << 8) | (s>>24); 71 72 } … … 83 84 84 85 85 FxBool 86 FxBool 86 87 _txReadRGTHeader( FILE *stream, FxU32 cookie, TxMip *info) 87 88 { … … 93 94 return FXFALSE; 94 95 } 95 96 96 97 if ( fread( &(rgtHeader->typeLo), 1, sizeof(RgtHeader)-2, stream ) != 10 ) { 97 98 txPanic("RGT file: Unexpected end of file."); … … 104 105 105 106 106 info->format = GR_TEXFMT_ARGB_8888; 107 info->format = GR_TEXFMT_ARGB_8888; 107 108 info->width = rgtHeader->sizeXHi << 8 | rgtHeader->sizeXLo; 108 109 info->height = rgtHeader->sizeYHi << 8 | rgtHeader->sizeYLo; … … 111 112 if( txVerbose ) 112 113 { 113 printf("Magic: %.04x w = %d, h = %d, z = %d, typehi = %d, typelo = %d, swap=%d\n", rgtHeader->magic, 114 printf("Magic: %.04x w = %d, h = %d, z = %d, typehi = %d, typelo = %d, swap=%d\n", rgtHeader->magic, 114 115 info->width, info->height, rgtHeader->sizeZLo, rgtHeader->typeHi, rgtHeader->typeLo, rgtHeader->magic == IMAGIC); 115 116 } … … 119 120 // RGT is RGBA in memory (low byte to high byte), or ABGR in a register 120 121 121 FxBool 122 FxBool 122 123 _txReadRGTData( FILE *stream, TxMip *info) 123 124 { 124 125 RgtHeader *rgtHeader = (RgtHeader *) info->pal; 125 126 FxU16 type = (rgtHeader->typeHi); 126 FxU16 swap = (rgtHeader->magic == IMAGIC); 127 FxU16 swap = (rgtHeader->magic == IMAGIC); 127 128 int x, y; 128 129 129 130 if ( stream == NULL ) { 130 131 txPanic("RGT file: Bad file handle."); … … 139 140 return FXFALSE; 140 141 } 141 142 142 143 // load rgt, rgt's are bottom up 143 144 for ( y = 0; y < info->height; y++ ) { -
trunk/src/opengl/glide/cvg/texus/texuslib.c
r2888 r6653 1 /* $Id: texuslib.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Id: texuslib.c,v 1. 1 2000-02-25 00:38:01 sandervlExp $21 ** $Id: texuslib.c,v 1.2 2001-09-05 14:30:47 bird Exp $ 21 22 */ 22 23 #include <string.h> … … 59 60 60 61 /* size in texels */ 61 static FxU32 _grMipMapHostSize[4][16] = 62 static FxU32 _grMipMapHostSize[4][16] = 62 63 { 63 64 { /* 1:1 aspect ratio */ … … 71 72 4, /* 7 : 2x2 */ 72 73 1, /* 8 : 1x1 */ 73 }, 74 }, 74 75 { /* 2:1 aspect ratio */ 75 76 32768, /* 0 : 256x128 */ … … 82 83 2, /* 7 : 2x1 */ 83 84 1, /* 8 : 1x1 */ 84 }, 85 }, 85 86 { /* 4:1 aspect ratio */ 86 87 16384, /* 0 : 256x64 */ … … 129 130 #else 130 131 _grMipMapHostSize[_gr_aspect_index_table[aspect]] [lod] << (format>=GR_TEXFMT_16BIT); 131 #endif 132 #endif 132 133 } 133 134 return memRequired ; … … 296 297 } 297 298 298 void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table ) 299 void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table ) 299 300 { 300 301 int i, j; … … 304 305 pal[i] = ncc_table->yRGB[i]; 305 306 } 306 307 307 308 for( i = 0; i < 4; i++ ) 308 309 { … … 322 323 ncc_table->yRGB[i] = ( FxU8 )pal[i]; 323 324 } 324 325 325 326 for( i = 0; i < 4; i++ ) 326 327 { … … 331 332 } 332 333 } 333 334 334 335 /* 335 336 ** pack the table Y entries … … 338 339 { 339 340 FxU32 packedvalue; 340 341 341 342 packedvalue = ( ( FxU32 )( ncc_table->yRGB[i*4+0] & 0xff ) ); 342 343 packedvalue |= ( ( FxU32 )( ncc_table->yRGB[i*4+1] & 0xff ) ) << 8; … … 346 347 ncc_table->packed_data[i] = packedvalue; 347 348 } 348 349 349 350 /* 350 351 ** pack the table I entries … … 353 354 { 354 355 FxU32 packedvalue; 355 356 356 357 packedvalue = ( ( FxU32 )( ncc_table->iRGB[i][0] & 0x1ff ) ) << 18; 357 358 packedvalue |= ( ( FxU32 )( ncc_table->iRGB[i][1] & 0x1ff ) ) << 9; 358 359 359 360 packedvalue |= ( ( FxU32 )( ncc_table->iRGB[i][2] & 0x1ff ) ) << 0; 360 361 361 362 ncc_table->packed_data[i+4] = packedvalue; 362 363 } 363 364 364 365 /* 365 366 ** pack the table Q entries … … 368 369 { 369 370 FxU32 packedvalue; 370 371 371 372 packedvalue = ( ( FxU32 )( ncc_table->qRGB[i][0] & 0x1ff ) ) << 18; 372 373 packedvalue |= ( ( FxU32 )( ncc_table->qRGB[i][1] & 0x1ff ) ) << 9;; 373 374 packedvalue |= ( ( FxU32 )( ncc_table->qRGB[i][2] & 0x1ff ) ) << 0; 374 375 375 376 ncc_table->packed_data[i+8] = packedvalue; 376 377 } 377 378 } 378 379 379 size_t txInit3dfInfoFromFile( FILE *file, 380 size_t txInit3dfInfoFromFile( FILE *file, 380 381 Gu3dfInfo *info, GrTextureFormat_t destFormat, 381 382 int *destWidth, int *destHeight, … … 415 416 416 417 /* 417 * Set the file offset back to where it was when we entered this 418 * Set the file offset back to where it was when we entered this 418 419 * function. 419 420 */ 420 421 fseek( file, file_start_position, SEEK_SET ); 421 422 422 423 /* 423 424 * Return the memory required for this texture. … … 452 453 *destHeight = txCeilPow2( *destHeight ); 453 454 } 454 455 455 456 /* 456 457 * Make sure the dimensions are in range. … … 520 521 */ 521 522 info->header.format = destFormat; 522 523 523 524 info->mem_required = txTexCalcMemRequired( info->header.small_lod, 524 525 info->header.large_lod, … … 534 535 535 536 536 FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info, 537 FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info, 537 538 FxU32 flags, const void *palNcc ) 538 539 { … … 540 541 FxBool retval; 541 542 TxMip txMip; 542 543 543 544 /* 544 545 * Save the current position of the input file so that we can … … 609 610 610 611 /* 611 * Set to one level only since we only want to dequant the first 612 * Set to one level only since we only want to dequant the first 612 613 * level. 613 614 */ … … 620 621 621 622 /* 622 * We realy have more than one level, so. . . 623 * We realy have more than one level, so. . . 623 624 */ 624 625 #ifdef GLIDE3 … … 633 634 634 635 /* 635 * Resample the true color version of the input image to 636 * Resample the true color version of the input image to 636 637 * the passed in size. . . . this should be a valid 637 638 * size for the hardware to handle. … … 653 654 #endif 654 655 } 655 656 656 657 657 658 #if 0 658 659 if( _heapchk() != _HEAPOK ) … … 691 692 txMipSetMipPointers( &outputMip ); 692 693 #endif 693 694 694 695 if( ( flags & TX_TARGET_PALNCC_MASK ) == TX_TARGET_PALNCC_SOURCE ) 695 696 { 696 txMipTrueToFixedPal( &outputMip, &trueColorMip, palNcc, 697 txMipTrueToFixedPal( &outputMip, &trueColorMip, palNcc, 697 698 flags & TX_FIXED_PAL_QUANT_MASK ); 698 699 } 699 700 else 700 701 { 701 txMipQuantize( &outputMip, &trueColorMip, outputMip.format, 702 txMipQuantize( &outputMip, &trueColorMip, outputMip.format, 702 703 flags & TX_DITHER_MASK, flags & TX_COMPRESSION_MASK ); 703 704 } … … 710 711 txPalToNcc( &info->table.nccTable, outputMip.pal ); 711 712 } 712 713 713 714 if( info->header.format == GR_TEXFMT_P_8 || info->header.format == GR_TEXFMT_AP_88 ) 714 715 { -
trunk/src/opengl/glide/cvg/texus/tga.c
r2888 r6653 1 /* $Id: tga.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Revision: 1. 1$21 ** $Date: 200 0-02-25 00:38:01$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:30:47 $ 22 23 */ 23 24 … … 52 53 53 54 /* Definitions for image types. */ 54 #define TGA_NULL 55 #define TGA_CMAP 56 #define TGA_TRUE 57 #define TGA_MONO 58 #define TGA_CMAP_RLE 59 #define TGA_TRUE_RLE 60 #define TGA_MONO_RLE 55 #define TGA_NULL 0 56 #define TGA_CMAP 1 57 #define TGA_TRUE 2 58 #define TGA_MONO 3 59 #define TGA_CMAP_RLE 9 60 #define TGA_TRUE_RLE 10 61 #define TGA_MONO_RLE 11 61 62 62 63 FxBool 63 64 _txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info) 64 65 { 65 TgaHeader 66 int 67 68 // Fill up rest of the TGA header. 69 if ( fread( &(tgaHeader->ImgType), 1, sizeof(TgaHeader)-2, stream ) != 70 71 72 73 } 74 tgaHeader->IDLength 66 TgaHeader *tgaHeader = (TgaHeader *) info->pal; 67 int i; 68 69 // Fill up rest of the TGA header. 70 if ( fread( &(tgaHeader->ImgType), 1, sizeof(TgaHeader)-2, stream ) != 71 sizeof(TgaHeader)-2) { 72 txPanic("Unexpected end of file."); 73 return FXFALSE; 74 } 75 tgaHeader->IDLength = (FxU8) ((cookie >> 8) & 0xFF); 75 76 tgaHeader->CMapType = (FxU8) ((cookie ) & 0xFF); 76 77 77 78 // Optionally, skip the image id fields. 78 79 for (i= (tgaHeader->IDLength) & 0xFF; i; i--) { 79 intc;80 81 82 83 84 80 int c; 81 82 if ((c = getc(stream)) == EOF) { 83 txPanic("Unexpected EOF."); 84 return FXFALSE; 85 } 85 86 } 86 87 … … 91 92 92 93 if ((info->width <= 0) || (info->height <= 0)) { 93 94 94 txError("TGA Image: width or height is 0."); 95 return FXFALSE; 95 96 } 96 97 97 98 switch(tgaHeader->ImgType) { 98 99 case TGA_MONO: 99 case TGA_MONO_RLE: 100 101 102 103 104 105 100 case TGA_MONO_RLE: // True color image. 101 if (tgaHeader->PixelDepth != 8) { 102 txError("TGA Image: Mono image is not 8 bits/pixel."); 103 return FXFALSE; 104 } 105 info->format = GR_TEXFMT_I_8; 106 break; 106 107 107 108 case TGA_TRUE: 108 109 case TGA_TRUE_RLE: 109 110 case 15:111 case 16:112 113 case 24:114 case 32:115 116 default:117 118 return FXFALSE;119 120 121 122 110 switch (tgaHeader->PixelDepth ) { 111 case 15: 112 case 16: 113 info->format = GR_TEXFMT_ARGB_1555; break; 114 case 24: 115 case 32: 116 info->format = GR_TEXFMT_ARGB_8888; break; 117 default: 118 txError("TGA Image: True color image is not 24/32 bits/pixel."); 119 return FXFALSE; 120 break; 121 } 122 break; 123 123 124 case TGA_CMAP: 124 case TGA_CMAP_RLE: 125 126 127 128 129 130 131 132 133 134 135 125 case TGA_CMAP_RLE: // Color mapped image. 126 if ( tgaHeader->CMapType != 1 ) { 127 txError("TGA Image: Color-mapped TGA image has no palette"); 128 return FXFALSE; 129 } 130 if (((tgaHeader->CMapLengthLo + tgaHeader->CMapLengthHi * 256L) 131 +(tgaHeader->CMapStartLo + tgaHeader->CMapStartHi * 256L)) > 256){ 132 txError("TGA Image: Color-mapped image has > 256 colors"); 133 return FXFALSE; 134 } 135 info->format = GR_TEXFMT_P_8; 136 break; 136 137 137 138 default: 138 139 139 txError("TGA Image: unsupported format"); 140 return FXFALSE; 140 141 } 141 142 info->size = info->width*info->height*GR_TEXFMT_SIZE(info->format); … … 147 148 _txReadTGAColorMap(FILE *stream, const TgaHeader *tgaHeader, FxU32 *palette) 148 149 { 149 int 150 int 151 int 152 int 150 int cmapStart; 151 int cmapLength; 152 int cmapDepth; 153 int i; 153 154 154 155 cmapStart = tgaHeader->CMapStartLo; … … 160 161 cmapDepth = tgaHeader->CMapDepth; 161 162 162 if (tgaHeader->CMapType == 0) return FXTRUE; 163 if (tgaHeader->CMapType == 0) return FXTRUE; // no colormap. 163 164 164 165 /* Validate some parameters */ 165 166 if (cmapStart < 0) { 166 167 168 } 169 170 cmapDepth = (cmapDepth + 1) >> 3; 167 txError("TGA Image: Bad Color Map start value."); 168 return FXFALSE; 169 } 170 171 cmapDepth = (cmapDepth + 1) >> 3; // to bytes. 171 172 if ((cmapDepth <= 0) || (cmapDepth > 4)) { 172 173 173 txError("TGA Image: Bad Color Map depth."); 174 return FXFALSE; 174 175 } 175 176 176 177 // May have to skip the color map. 177 if ((tgaHeader->ImgType != TGA_CMAP) && 178 179 180 181 182 183 intc;184 185 186 187 188 189 190 191 192 } 193 194 // This is a real palette that's going to be used. 178 if ((tgaHeader->ImgType != TGA_CMAP) && 179 (tgaHeader->ImgType != TGA_CMAP_RLE)) { 180 /* True color, yet there is a palette, this is OK, just skip. */ 181 182 cmapLength *= cmapDepth; 183 while (cmapLength--) { 184 int c; 185 186 c = getc(stream); 187 if (c == EOF) { 188 txError("TGA Image: Unexpected EOF reading Color Map."); 189 return FXFALSE; 190 } 191 } 192 return FXTRUE; 193 } 194 195 // This is a real palette that's going to be used. 195 196 196 197 // Verify that it's not too large. 197 198 if ((cmapStart + cmapLength) > 256) { 198 199 199 txError("TGA Image: Color Map > 256 entries."); 200 return FXFALSE; 200 201 } 201 202 202 203 203 204 // printf("cmapdepth = %d, start = %d, length = %d\n", cmapDepth, 204 // 205 // cmapStart, cmapLength); 205 206 for (i=0; i<256; i++) { 206 intr, g, b, a;207 208 209 210 211 212 213 214 215 216 case 1:// 8 bpp217 218 219 220 221 222 223 224 225 226 case 2:// 15, 16 bpp.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 254 255 256 257 258 259 260 261 207 int r, g, b, a; 208 209 if ((i < cmapStart) || (i >= (cmapStart + cmapLength))) { 210 palette[i] = 0; 211 // printf("Skipping palette entry %d\n", i); 212 continue; 213 } 214 215 // Read this colormap entry. 216 switch (cmapDepth) { 217 case 1: // 8 bpp 218 r = getc(stream); 219 if (r == EOF) { 220 txError("TGA Image: Unexpected End of File."); 221 return FXFALSE; 222 } 223 r &= 0xFF; 224 palette[i] = (r << 24) | (r << 16) | (r << 8) | (r); 225 break; 226 227 case 2: // 15, 16 bpp. 228 229 b = getc(stream); 230 r = getc(stream); 231 if ((r == EOF) || (b == EOF)) { 232 txError("TGA Image: Unexpected End of File."); 233 return FXFALSE; 234 } 235 r &= 0xFF; 236 b &= 0xFF; 237 g = ((r & 0x3) << 6) + ((b & 0xE0) >> 2); 238 r = (r & 0x7C) << 1; 239 b = (b & 0x1F) << 3; 240 241 palette[i] = (r << 16) | (g << 8) | (b) | 0xFF000000L; 242 break; 243 244 case 3: 245 case 4: 246 b = getc(stream); 247 g = getc(stream); 248 r = getc(stream); 249 a = (cmapDepth == 4) ? getc(stream) : 0x0FF; 250 251 if ((r == EOF) || (g == EOF) || (b == EOF) | (a == EOF)) { 252 txError("TGA Image: Unexpected End of File."); 253 return FXFALSE; 254 } 255 palette[i] = (a << 24) | (r << 16) | (g << 8) | b; 256 // printf("Setting palette %3d to %.08x\n", i, palette[i]); 257 break; 258 259 default: 260 txError("TGA Image: Bad Color Map depth."); 261 return FXFALSE; 262 } 262 263 } 263 264 return FXTRUE; 264 265 } 265 266 266 static int tgaRLE, tgaRLEflag, tgaRLEcount, tgaRLEsav[4];267 268 static 267 static int tgaRLE, tgaRLEflag, tgaRLEcount, tgaRLEsav[4]; 268 269 static FxBool 269 270 _txReadTGARLEPixel( FILE *stream, FxU8 *data, int pixsize) 270 271 { 271 int 272 int c, i; 272 273 273 274 // Run length encoded data Only 274 275 if (tgaRLEcount == 0) { 275 276 277 278 279 280 281 282 283 284 // Replicated color, read the color to be replicated 285 286 287 288 289 290 291 292 276 // Need to restart the run. 277 if ( (tgaRLEcount = c = getc( stream )) == EOF) { 278 txError("TGA Image: Unexpected End of File."); 279 return FXFALSE; 280 } 281 tgaRLEflag = tgaRLEcount & 0x80; 282 tgaRLEcount = (tgaRLEcount & 0x7F) + 1; 283 284 if (tgaRLEflag) { 285 // Replicated color, read the color to be replicated 286 for (i=0; i<pixsize; i++) { 287 if ( (c = getc( stream )) == EOF) { 288 txError("TGA Image: Unexpected End of File\n"); 289 return FXFALSE; 290 } 291 tgaRLEsav[i] = (FxU8) c; 292 } 293 } 293 294 } 294 295 … … 296 297 tgaRLEcount--; 297 298 if (tgaRLEflag) { 298 299 299 // deliver from saved data. 300 for (i=0; i<pixsize; i++) *data++ = (FxU8) tgaRLEsav[i]; 300 301 } else { 301 302 303 304 305 306 307 302 for (i=0; i<pixsize; i++) { 303 if ( (c = getc( stream )) == EOF) { 304 txError("TGA Image: Unexpected End of File\n"); 305 return FXFALSE; 306 } 307 *data++ = (FxU8) c; 308 } 308 309 } 309 310 return FXTRUE; … … 314 315 { 315 316 if (tgaRLE == 0) { 316 317 318 319 320 317 if ( fread( data, 1, w * pixsize, stream) != (FxU32)(w * pixsize)) { 318 txError("TGA Image: Unexpected End of File\n"); 319 return FXFALSE; 320 } 321 return FXTRUE; 321 322 } 322 323 323 324 // Otherwise, RLE data. 324 325 while (w--) { 325 326 327 328 326 if (!_txReadTGARLEPixel( stream, data, pixsize)) { 327 return FXFALSE; 328 } 329 data += pixsize; 329 330 } 330 331 return FXTRUE; … … 334 335 _txReadTGAData( FILE *stream, TxMip *info) 335 336 { 336 TgaHeader 337 int 338 int bpp;// bytesPerPixel339 FxU8* 340 long 337 TgaHeader *tgaHeader = (TgaHeader *) info->pal; 338 int i, stride; 339 int bpp; // bytesPerPixel 340 FxU8* data; 341 long BigEndian = 0xff000000; 341 342 342 343 // printf("TxREAD TGA DATA\n"); … … 346 347 347 348 switch (tgaHeader->ImgType) { 348 case TGA_MONO: 349 case TGA_MONO_RLE: 350 351 case TGA_TRUE: tgaRLE = 0; info->format = (bpp == 2) ?352 353 case TGA_TRUE_RLE: tgaRLE = 1; info->format = (bpp == 2) ?354 355 356 case TGA_CMAP: 357 case TGA_CMAP_RLE: 349 case TGA_MONO: tgaRLE = 0; info->format = GR_TEXFMT_I_8; break; 350 case TGA_MONO_RLE: tgaRLE = 1; info->format = GR_TEXFMT_I_8; break; 351 352 case TGA_TRUE: tgaRLE = 0; info->format = (bpp == 2) ? 353 GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break; 354 case TGA_TRUE_RLE: tgaRLE = 1; info->format = (bpp == 2) ? 355 GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break; 356 357 case TGA_CMAP: tgaRLE = 0; info->format = GR_TEXFMT_P_8; break; 358 case TGA_CMAP_RLE: tgaRLE = 1; info->format = GR_TEXFMT_P_8; break; 358 359 } 359 360 … … 363 364 data = info->data[0]; 364 365 if ((tgaHeader->ImageDescriptor & 0x20) == 0) { 365 366 367 366 // Origin is lower left 367 data = data + (info->height-1) * stride; 368 stride = -stride; 368 369 } 369 370 370 371 /* If there's a colormap, read it now. */ 371 if (!_txReadTGAColorMap(stream, tgaHeader, (FxU32 *) &(info->pal[0]))) 372 372 if (!_txReadTGAColorMap(stream, tgaHeader, (FxU32 *) &(info->pal[0]))) 373 return FXFALSE; 373 374 // printf("read in color map\n"); 374 375 375 376 /* Read in all the data */ 376 377 for ( i = 0; i < info->height; i++) { 377 378 379 380 381 378 if (!_txReadTGASpan( stream, data, info->width, bpp)) { 379 txError("TGA Image: Unexpected end of file."); 380 return FXFALSE; 381 } 382 data += stride; 382 383 } 383 384 … … 390 391 // printf("Repacking\n"); 391 392 if (bpp == 3) { 392 intnpixels = info->width * info->height;393 FxU8*src = ((FxU8 *) info->data[0]) + (npixels - 1) * 3;394 FxU8*dst = ((FxU8 *) info->data[0]) + (npixels - 1) * 4;395 396 397 398 399 400 401 402 403 393 int npixels = info->width * info->height; 394 FxU8 *src = ((FxU8 *) info->data[0]) + (npixels - 1) * 3; 395 FxU8 *dst = ((FxU8 *) info->data[0]) + (npixels - 1) * 4; 396 397 while (npixels--) { 398 dst[3] = 0xFF; 399 dst[2] = src[2]; 400 dst[1] = src[1]; 401 dst[0] = src[0]; 402 dst -= 4; 403 src -= 3; 404 } 404 405 } 405 406 // printf("Done\n"); 406 407 if (*(FxU8 *)&BigEndian) { 407 408 /* Repack 16bpp and 32bpp cases */ 408 409 if (bpp == 2) { 409 intnpixels = info->width * info->height;410 FxU16*src = (FxU16 *) info->data[0];411 412 413 410 int npixels = info->width * info->height; 411 FxU16 *src = (FxU16 *) info->data[0]; 412 413 while (npixels--) { 414 *src = (*src << 8) | ((*src >> 8) & 0xff); 414 415 src++; 415 416 } 416 417 } 417 418 if ((bpp == 3) || (bpp == 4)) { 418 intnpixels = info->width * info->height;419 FxU32*src = (FxU32 *) info->data[0];420 421 422 423 424 425 419 int npixels = info->width * info->height; 420 FxU32 *src = (FxU32 *) info->data[0]; 421 422 while (npixels--) { 423 *src = (((*src ) & 0xff) << 24)| 424 (((*src >> 8) & 0xff) << 16)| 425 (((*src >> 16) & 0xff) << 8)| 426 (((*src >> 24) & 0xff) ); 426 427 src++; 427 428 } 428 429 } 429 430 } -
trunk/src/opengl/glide/cvg/texus/util.c
r2888 r6653 1 /* $Id: util.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */ 1 2 2 3 /* … … 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1$22 ** $Date: 200 0-02-25 00:38:01$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:47 $ 23 24 */ 24 25 … … 33 34 34 35 char *Format_Name[] = { 35 "rgb332", // GR_TEXFMT_RGB_332 36 "rgb332", // GR_TEXFMT_RGB_332 36 37 "yiq", // GR_TEXFMT_YIQ_422 37 38 "a8", // GR_TEXFMT_ALPHA_8 … … 136 137 txYABtoPal256(long *palette, const long* yabTable) 137 138 { 138 // Convert YAB table to a 256 color palette 139 // Convert YAB table to a 256 color palette 139 140 // Assume yabTable[] has first 16Y's, 12 A's, 12 B's 140 141 … … 268 269 txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int ncolors) 269 270 { 270 int i, d; 271 int i, d; 271 272 int mindist, minpos; // closest distance to input 272 273 … … 274 275 txPanic("Bad explode\n"); 275 276 276 mindist = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 277 mindist = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 277 278 ir, ig, ib); 278 279 minpos = 0; … … 281 282 /* Find closest color */ 282 283 for (i=1; i<ncolors; i++, pal ++) { 283 d = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 284 d = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 284 285 ir, ig, ib); 285 286 if (d < mindist) { mindist = d; minpos = i; } … … 327 328 328 329 void 329 txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride, 330 txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride, 330 331 int width, int height) 331 332 { … … 414 415 { 415 416 /* Strip the pathname and leave us with filename.ext */ 416 char *s; 417 char *s; 417 418 const char *p, *slash; 418 419 … … 428 429 for (s = basename; *s; s++); 429 430 430 // Walk backwards; replace any . with 0 431 // Walk backwards; replace any . with 0 431 432 while (--s >= basename) { 432 433 if (*s == '.') {*s = 0; break;} … … 463 464 } 464 465 465 if (ext) 466 if (ext) 466 467 while (*ext) *extname++ = *ext++; 467 468 468 469 *extname = 0; 469 470 } -
trunk/src/opengl/glide/cvg/texus/view.c
r2888 r6653 1 /* $Id: view.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 ** $Revision: 1. 1$21 ** $Date: 200 0-02-25 00:38:02$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:30:47 $ 22 23 */ 23 24 -
trunk/src/opengl/glide/cvg/texus/write.c
r2888 r6653 1 /* $Id: write.c,v 1.2 2001-09-05 14:30:48 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 8 9 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 10 ** 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 */ … … 30 31 */ 31 32 static char *Version = "1.1"; 32 static char* aspect_names[] = { "8 1", "4 1", "2 1", "1 1", 33 static char* aspect_names[] = { "8 1", "4 1", "2 1", "1 1", 33 34 "1 2", "1 4", "1 8" }; 34 35 35 36 /*************************************** tga files ****************************/ 36 /* 37 /* 37 38 * Write a tga file from an ARGB8888 mipmap. 38 39 */ 39 static FxBool 40 static FxBool 40 41 txWriteTGA( FILE *stream, TxMip *txMip) 41 42 { … … 73 74 return FXFALSE; 74 75 } 75 76 76 77 outW = txMip->width; 77 78 outH = txMip->height; 78 79 if (txMip->depth > 1) outW += outW/2; 79 80 80 81 tgaHeader.IDLength = 0; 81 82 tgaHeader.ColorMapType = 0; … … 96 97 tgaHeader.PixelDepth = 32; 97 98 tgaHeader.ImageDescriptor = 0x20; // image always right side up. 98 99 99 100 100 101 if ( fwrite( &tgaHeader, 1, 18, stream ) != 18 ) { … … 110 111 111 112 /* Copy level 0 into malloc'd area */ 112 txRectCopy( data, outW * 4, txMip->data[0], txMip->width * 4, 113 txRectCopy( data, outW * 4, txMip->data[0], txMip->width * 4, 113 114 txMip->width * 4, txMip->height); 114 115 … … 116 117 117 118 /* Copy the rest of the levels to the right of level 0 */ 118 w = txMip->width; 119 h = txMip->height; 119 w = txMip->width; 120 h = txMip->height; 120 121 for (i=1; i< txMip->depth; i++) { 121 122 // printf("Copying: level = %d\n", i); … … 129 130 data32 = (FxU32 *) data; 130 131 for (i=outW*outH; i; i--) { 131 putc(((*data32 ) & 0xff) , stream); 132 putc(((*data32 >> 8) & 0xff) , stream); 133 putc(((*data32 >> 16) & 0xff) , stream); 134 putc(((*data32 >> 24) & 0xff) , stream); 132 putc(((*data32 ) & 0xff) , stream); 133 putc(((*data32 >> 8) & 0xff) , stream); 134 putc(((*data32 >> 16) & 0xff) , stream); 135 putc(((*data32 >> 24) & 0xff) , stream); 135 136 data32++; 136 137 } … … 142 143 /* Write word, msb first */ 143 144 144 static FxBool 145 static FxBool 145 146 _txWrite16 (FILE *stream, FxU16 data) 146 147 { … … 155 156 /* Write long word, msb first */ 156 157 157 static FxBool 158 static FxBool 158 159 _txWrite32 (FILE *stream, FxU32 data) 159 160 { … … 169 170 170 171 /* Write NCC table */ 171 static FxBool 172 static FxBool 172 173 _txWrite3dfNCCTable (FILE *stream, FxU32 *yab) 173 174 { … … 177 178 if (!_txWrite16 (stream, (FxU16) (yab[i] & 0x00ff))) return FXFALSE; 178 179 179 for (i = 0; i < 12; i++) 180 for (i = 0; i < 12; i++) 180 181 if (!_txWrite16 (stream, (FxU16) (yab[16+i] & 0xffff))) return FXFALSE; 181 182 182 for (i = 0; i < 12; i++) 183 for (i = 0; i < 12; i++) 183 184 if (!_txWrite16 (stream, (FxU16) (yab[28+i] & 0xffff))) return FXFALSE; 184 185 … … 197 198 } 198 199 199 static FxBool 200 static FxBool 200 201 txWrite3df (FILE *stream, TxMip *txMip) 201 202 { … … 213 214 214 215 // printf("Writing header...\n"); 215 if (EOF == fprintf (stream, 216 if (EOF == fprintf (stream, 216 217 "3df v%s\n%s\nlod range: %d %d\naspect ratio: %s\n", 217 Version, 218 Version, 218 219 Format_Name[txMip->format], 219 220 small_lod, … … 226 227 (txMip->format == GR_TEXFMT_AYIQ_8422)) { 227 228 if (!_txWrite3dfNCCTable (stream, txMip->pal)) return FXFALSE; 228 } 229 } 229 230 230 231 else if ((txMip->format == GR_TEXFMT_P_8) || 231 232 (txMip->format == GR_TEXFMT_AP_88)) { 232 233 if (!_txWrite3dfPalTable (stream, txMip->pal)) return FXFALSE; 233 } 234 } 234 235 235 236 … … 289 290 if( txVerbose ) 290 291 { 291 printf("Writing file \"%s\" (format: %s)\n", 292 printf("Writing file \"%s\" (format: %s)\n", 292 293 filename, Format_Name[txMip->format]); 293 294 } … … 380 381 break; 381 382 case TX_WRITE_TGA: 382 if( mip.format == GR_TEXFMT_YIQ_422 || 383 if( mip.format == GR_TEXFMT_YIQ_422 || 383 384 mip.format == GR_TEXFMT_AYIQ_8422 ) 384 385 {
Note:
See TracChangeset
for help on using the changeset viewer.