Changeset 6653 for trunk/src/opengl/glide/sst1
- Timestamp:
- Sep 5, 2001, 4:31:14 PM (24 years ago)
- Location:
- trunk/src/opengl/glide/sst1
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/glide/sst1/glide/cpudetect.c
r2885 r6653 1 /* 1 /* $Id: cpudetect.c,v 1.2 2001-09-05 14:30:48 bird Exp $ */ 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/sst1/glide/ddgump.c
r2885 r6653 1 /* $Id: ddgump.c,v 1.2 2001-09-05 14:30:49 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/sst1/glide/ddgump.c,v 1. 1 2000-02-25 00:31:09 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/ddgump.c,v 1.2 2001-09-05 14:30:49 bird Exp $ 21 22 ** $Log: ddgump.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:09 sandervl 23 ** Revision 1.2 2001-09-05 14:30:49 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:09 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 2 3/04/97 9:08p Dow 27 31 * Neutered multiplatform multiheaded monster 28 * 32 * 29 33 * 1 12/23/96 1:39p Dow 30 34 * Changes for multiplatform … … 49 53 /* 50 54 ** _gumpTexCombineFunction 51 ** 55 ** 52 56 ** Sets the texture combine function. For a dual TMU system this function 53 57 ** will configure the TEXTUREMODE registers as appropriate. For a … … 114 118 texmode |= ( SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD | 115 119 SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND | 116 SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER ); 120 SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER ); 117 121 } 118 122 break; … … 180 184 case GR_MPTEXTURECOMBINE_SUBTRACT: 181 185 /* 182 tmu0: other - local 186 tmu0: other - local 183 187 tmu1: local 184 188 doesn't work, alpha blender can't subtract … … 319 323 */ 320 324 321 325 322 326 fbzcolorpath &= ~(SST_CC_ADD_CLOCAL | SST_CC_ADD_ALOCAL | SST_CC_SUB_CLOCAL); 323 327 GR_SET( hw->fbzColorPath, fbzcolorpath ); -
trunk/src/opengl/glide/sst1/glide/diglide.c
r2885 r6653 1 /* $Id: diglide.c,v 1.2 2001-09-05 14:30:49 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/sst1/glide/diglide.c,v 1. 1 2000-02-25 00:31:09 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/diglide.c,v 1.2 2001-09-05 14:30:49 bird Exp $ 21 22 ** $Log: diglide.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:09 sandervl 23 ** Revision 1.2 2001-09-05 14:30:49 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:09 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 10 6/18/97 5:54p Dow 27 31 * P6 adjustments 28 * 32 * 29 33 * 9 3/13/97 2:51a Jdt 30 34 * Removed splash from grGlideInit(). 31 * 35 * 32 36 * 8 3/09/97 10:31a Dow 33 37 * Added GR_DIENTRY for di glide functions 34 * 38 * 35 39 * 7 2/12/97 2:09p Hanson 36 * Hopefully removed the rest of my muckage. 37 * 40 * Hopefully removed the rest of my muckage. 41 * 38 42 * 6 2/12/97 11:25a Hanson 39 * 43 * 40 44 * 5 1/18/97 11:38p Dow 41 45 * Removed _curGCFuncs Global (moved into _GlideRoot) 42 * 46 * 43 47 * 4 1/16/97 3:37p Dow 44 48 * Added _curGCFuncs global 45 * 49 * 46 50 * 3 1/14/97 10:44a Dow 47 51 * Modified grGlideInit to only call sstopen if splash screen is going to 48 52 * happen && HW != SST96 49 * 53 * 50 54 * 2 1/09/97 10:50a Dow 51 55 * disabled splash screen for sst-96 52 * 56 * 53 57 * 1 12/23/96 1:39p Dow 54 58 * Changes for multiplatform 55 * 59 * 56 60 * 32 11/17/96 11:16p Garymct 57 61 * Updated grSplash code to set all of the necessary state itself rather 58 62 * than expecting the caller to do so. 59 * 63 * 60 64 * 31 11/18/96 1:37a Tarolli 61 65 * fixed grAlphaBlendFunction warning bug 62 * 66 * 63 67 * 29 11/15/96 3:40p Jdt 64 68 * Fixed SST-96 build. 65 * 69 * 66 70 * 28 11/15/96 3:24p Tarolli 67 71 * renamed version.h to rcver.h , added some alpha blend function … … 175 179 ** 176 180 */ 177 void 181 void 178 182 _grSwizzleColor( GrColor_t *color ) 179 183 { 180 184 GR_DCL_GC; 181 185 unsigned long red, green, blue, alpha; 182 186 183 187 switch( gc->state.color_format ) { 184 188 case GR_COLORFORMAT_ARGB: … … 252 256 gc->state.checkFifo = FXTRUE; 253 257 /* swFifoLWM is kept internally in bytes, hints are in fifo 254 entries */ 258 entries */ 255 259 if (_GlideRoot.environment.swFifoLWM >= 0) 256 260 gc->hwDep.sst1Dep.swFifoLWM = … … 280 284 { 281 285 GDBG_INIT(); 282 286 283 287 GDBG_INFO((80,"grGlideInit()\n")); 284 288 _GlideInitEnvironment(); /* the main init code */ -
trunk/src/opengl/glide/sst1/glide/digutex.c
r2885 r6653 1 /* $Id: digutex.c,v 1.2 2001-09-05 14:30:49 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/sst1/glide/digutex.c,v 1. 1 2000-02-25 00:31:10 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/digutex.c,v 1.2 2001-09-05 14:30:49 bird Exp $ 21 22 ** $Log: digutex.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:10 sandervl 23 ** Revision 1.2 2001-09-05 14:30:49 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:10 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 5 8/14/97 7:02p Pgj 27 31 * per GMT 28 * 32 * 29 33 * 4 5/05/97 4:24p Pgj 30 34 * Neuter guTexDownloadMipMap error message 31 * 35 * 32 36 * 3 3/18/97 9:07p Dow 33 37 * Got rid of #$#%#$ // comments 34 * 38 * 35 39 * 2 3/09/97 10:31a Dow 36 40 * Added GR_DIENTRY for di glide functions 37 * 41 * 38 42 * 1 12/23/96 1:39p Dow 39 43 * Changes for multiplatform … … 98 102 */ 99 103 GR_CHECK_F(myName, small_lod < large_lod, "smallest_lod is larger than large_lod"); 100 104 101 105 info.smallLod = small_lod; 102 106 info.largeLod = large_lod; … … 111 115 (gc->tmu_state[tmu].freemem_base + memrequired > 0x200000)) 112 116 gc->tmu_state[tmu].freemem_base = 0x200000; 113 117 114 118 /* 115 119 ** If we have enough memory and a free mip map handle then go for it 116 120 */ 117 121 memavail = guTexMemQueryAvail( tmu ); 118 122 119 123 if ( memavail < memrequired ) 120 124 return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE; 121 125 122 126 if (gc->mm_table.free_mmid >= MAX_MIPMAPS_PER_SST ) 123 127 return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE; 124 128 125 129 /* 126 130 ** Allocate the mip map id … … 131 135 ** calculate baseAddress (where LOD 0 would go) 132 136 */ 133 baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base, 134 large_lod, 135 aspect_ratio, 136 format, 137 baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base, 138 large_lod, 139 aspect_ratio, 140 format, 137 141 odd_even_mask ); 138 142 139 143 GDBG_INFO((gc->myLevel," baseAddress = 0x%x (in bytes)\n",baseAddress)); 140 144 141 145 /* 142 146 ** reduce available memory to reflect allocation … … 157 161 (magfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0) 158 162 ); 159 163 160 164 clampMode = ( 161 165 (s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) | 162 166 (t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0) 163 ); 164 167 ); 168 165 169 /* 166 170 ** Create the tTextureMode register value for this mip map … … 171 175 texturemode |= filterMode; 172 176 texturemode |= clampMode; 173 177 174 178 if ( mipmap_mode == GR_MIPMAP_NEAREST_DITHER ) 175 179 texturemode |= SST_TLODDITHER; 176 180 177 181 if ( trilinear ) { 178 182 texturemode |= SST_TRILINEAR; … … 184 188 tLod |= SST_LOD_TSPLIT; 185 189 } 186 190 187 191 /* 188 192 ** Fill in the mm_table data for this mip map … … 210 214 gc->mm_table.data[mmid].width = width; 211 215 gc->mm_table.data[mmid].height = height; 212 216 213 217 GR_RETURN(mmid); 214 218 } /* guTexAllocateMemory */ … … 221 225 int texturemode = 0; 222 226 int tLod = 0; 223 FxU32 227 FxU32 224 228 filterMode, /* filter mode bits of texturemode */ 225 229 clampMode; /* clamp mode bits of texturemode */ … … 234 238 (mminfo->t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0) 235 239 ); 236 240 237 241 /* 238 242 ** build up tTextureMode … … 268 272 269 273 /*--------------------------------------------------------------------------- 270 ** guTexChangeAttributes 274 ** guTexChangeAttributes 271 275 */ 272 276 GR_DIENTRY(guTexChangeAttributes, FxBool, ( GrMipMapId_t mmid, … … 332 336 /*--------------------------------------------------------------------------- 333 337 ** grTexCombineFunction - obsolete 334 ** 338 ** 335 339 */ 336 340 GR_DIENTRY(grTexCombineFunction, void, 337 (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 341 (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 338 342 { 339 343 guTexCombineFunction( tmu, tc ); … … 342 346 /*--------------------------------------------------------------------------- 343 347 ** guTexCombineFunction 344 ** 348 ** 345 349 ** Sets the texture combine function. For a dual TMU system this function 346 350 ** will configure the TEXTUREMODE registers as appropriate. For a … … 421 425 ** to be in row major order from largest mip map to smallest mip map. 422 426 */ 423 GR_DIENTRY(guTexDownloadMipMap, void, 427 GR_DIENTRY(guTexDownloadMipMap, void, 424 428 (GrMipMapId_t mmid, const void *src, const GuNccTable 425 429 *ncc_table ) ) … … 472 476 const GrMipMapInfo *mminfo; 473 477 GR_DCL_GC; 474 478 475 479 GDBG_INFO((99,"guTexDownloadMipMapLevel(%d,%d,0x%x)\n",mmid,lod,src_base)); 476 480 GR_ASSERT(src_base != NULL); … … 546 550 { 547 551 int i; 548 552 549 553 GR_BEGIN_NOFIFOCHECK("guTexMemReset",99); 550 554 GDBG_INFO_MORE((gc->myLevel,"()\n")); … … 552 556 memset( gc->mm_table.data, 0, sizeof( gc->mm_table.data ) ); 553 557 gc->mm_table.free_mmid = 0; 554 558 555 559 for ( i = 0; i < gc->num_tmu; i++ ) { 556 560 gc->state.current_mm[i] = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE; 557 561 gc->tmu_state[i].freemem_base = 0; 558 gc->tmu_state[i].ncc_mmids[0] = 559 gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE; 560 gc->tmu_state[i].ncc_table[0] = 562 gc->tmu_state[i].ncc_mmids[0] = 563 gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE; 564 gc->tmu_state[i].ncc_table[0] = 561 565 gc->tmu_state[i].ncc_table[1] = 0; 562 566 } -
trunk/src/opengl/glide/sst1/glide/disst.c
r2885 r6653 1 /* $Id: disst.c,v 1.2 2001-09-05 14:30:49 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/sst1/glide/disst.c,v 1. 1 2000-02-25 00:31:10 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/disst.c,v 1.2 2001-09-05 14:30:49 bird Exp $ 21 22 ** $Log: disst.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:10 sandervl 23 ** Revision 1.2 2001-09-05 14:30:49 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:10 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 9 8/13/97 8:51a Pgj 27 31 * Fix Bug 710 28 * 32 * 29 33 * 8 7/24/97 10:55a Dow 30 34 * Fixed bogus check in grSstQueryHardware 31 * 35 * 32 36 * 7 5/02/97 2:07p Pgj 33 37 * grSstScreenWidth/Height now FxU32 34 * 38 * 35 39 * 6 3/17/97 6:25a Jdt 36 40 * Added initDeviceSelect to grSstSelect() 37 * 41 * 38 42 * 5 3/09/97 10:31a Dow 39 43 * Added GR_DIENTRY for di glide functions 40 * 44 * 41 45 * 4 3/04/97 9:08p Dow 42 46 * Neutered multiplatform multiheaded monster 43 * 47 * 44 48 * 3 1/18/97 11:39p Dow 45 49 * Changed location of _curGCFuncs 46 * 50 * 47 51 * 2 1/16/97 3:39p Dow 48 52 * Added ref to _curGCFuncs during grSstSelect() 49 * 53 * 50 54 * 1 12/23/96 1:39p Dow 51 55 * Changes for multiplatform … … 166 170 #endif 167 171 168 _GlideRoot.GCs[whichSst].vidTimings = vidTimings; 172 _GlideRoot.GCs[whichSst].vidTimings = vidTimings; 169 173 } /* grSstVidMode */ 170 174 -
trunk/src/opengl/glide/sst1/glide/ditex.c
r2885 r6653 1 /* $Id: ditex.c,v 1.2 2001-09-05 14:30:49 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/sst1/glide/ditex.c,v 1. 1 2000-02-25 00:31:10 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/ditex.c,v 1.2 2001-09-05 14:30:49 bird Exp $ 21 22 ** $Log: ditex.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:10 sandervl 23 ** Revision 1.2 2001-09-05 14:30:49 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:10 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 11 8/19/97 5:02p Atai 27 31 * delete the hack for 4MB texture memory 28 * 32 * 29 33 * 10 8/14/97 6:45p Pgj 30 34 * Fixed bug per GMT 31 * 35 * 32 36 * 9 8/11/97 3:56p Atai 33 37 * fixed error message 34 * 38 * 35 39 * 8 8/11/97 1:39p Atai 36 40 * step 1: use environment variable to set up texture memory size 37 * 41 * 38 42 * 7 7/18/97 6:46p Jdt 39 43 * Protected access to vgInfo structure 40 * 44 * 41 45 * 6 3/15/97 8:09p Jdt 42 46 * Remove grTexDownloadTable from this file because I added SST-1 only 43 47 * code to it 44 * 48 * 45 49 * 5 3/09/97 10:31a Dow 46 50 * Added GR_DIENTRY for di glide functions 47 * 51 * 48 52 * 4 2/12/97 2:09p Hanson 49 * Hopefully removed the rest of my muckage. 50 * 53 * Hopefully removed the rest of my muckage. 54 * 51 55 * 3 2/12/97 12:34p Dow 52 56 * Fixed Hanson muckage 53 * 57 * 54 58 * 2 1/18/97 11:41p Dow 55 59 * Fixed Gary's "Last C Bug" analog 56 60 * Fixed usage of _grMipMapOffset_Tsplit 57 * 61 * 58 62 * 1 12/23/96 1:39p Dow 59 63 * Changes for multiplatform … … 81 85 82 86 /* size in texels */ 83 FxU32 _grMipMapHostSize[4][16] = 87 FxU32 _grMipMapHostSize[4][16] = 84 88 { 85 89 { /* 1:1 aspect ratio */ … … 131 135 const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2] = 132 136 { 133 { 134 256 , 32, 135 128 , 16, 136 64 , 8, 137 32 , 4, 138 16 , 2, 139 8 , 1, 140 4 , 1, 141 2 , 1, 142 1 , 1 137 { 138 256 , 32, 139 128 , 16, 140 64 , 8, 141 32 , 4, 142 16 , 2, 143 8 , 1, 144 4 , 1, 145 2 , 1, 146 1 , 1 143 147 }, 144 { 145 256 , 64, 146 128 , 32, 147 64 , 16, 148 32 , 8, 149 16 , 4, 148 { 149 256 , 64, 150 128 , 32, 151 64 , 16, 152 32 , 8, 153 16 , 4, 150 154 8 , 2, 151 4 , 1, 152 2 , 1, 153 1 , 1 155 4 , 1, 156 2 , 1, 157 1 , 1 154 158 }, 155 { 156 256 , 128, 157 128 , 64, 158 64 , 32, 159 { 160 256 , 128, 161 128 , 64, 162 64 , 32, 159 163 32 , 16, 160 164 16 , 8, 161 8 , 4, 162 4 , 2, 163 2 , 1, 164 1 , 1 165 8 , 4, 166 4 , 2, 167 2 , 1, 168 1 , 1 165 169 }, 166 { 167 256 , 256, 168 128 , 128, 170 { 171 256 , 256, 172 128 , 128, 169 173 64 , 64, 170 174 32 , 32, 171 175 16 , 16, 172 8 , 8, 173 4 , 4, 174 2 , 2, 175 1 , 1 176 8 , 8, 177 4 , 4, 178 2 , 2, 179 1 , 1 176 180 }, 177 { 181 { 178 182 128, 256, 179 183 64, 128, 180 184 32, 64 , 181 185 16, 32 , 182 8, 16 , 183 4, 8 , 184 2, 4 , 185 1, 2 , 186 8, 16 , 187 4, 8 , 188 2, 4 , 189 1, 2 , 186 190 1, 1 187 191 }, … … 192 196 8, 32 , 193 197 4, 16 , 194 2, 8 , 195 1, 4 , 196 1, 2 , 198 2, 8 , 199 1, 4 , 200 1, 2 , 197 201 1, 1 198 202 }, 199 { 203 { 200 204 32, 256, 201 205 16, 128, … … 203 207 4, 32 , 204 208 2, 16 , 205 1, 8 , 206 1, 4 , 209 1, 8 , 210 1, 4 , 207 211 1, 2 , 208 212 1, 1 … … 222 226 }; 223 227 224 FxU32 _gr_evenOdd_xlate_table[] = 228 FxU32 _gr_evenOdd_xlate_table[] = 225 229 { 226 230 0xFFFFFFFF, /* invalid */ … … 310 314 */ 311 315 FxU32 312 _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 316 _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 313 317 GrAspectRatio_t aspect, GrTextureFormat_t format, 314 318 FxU32 evenOdd ) … … 330 334 memrequired = 0; 331 335 /* construct XOR mask */ 332 evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0; 336 evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0; 333 337 while (large_lod <= small_lod) { /* sum up all the mipmap levels */ 334 338 if ((large_lod ^ evenOdd) & 1) /* that match the XOR mask */ … … 383 387 sum_of_lod_sizes = _grMipMapOffset_Tsplit[aspect][large_lod]; 384 388 } 385 389 386 390 if ( format >= GR_TEXFMT_16BIT ) 387 391 sum_of_lod_sizes <<= 1; … … 393 397 */ 394 398 GR_DIENTRY(grTexCalcMemRequired, FxU32, 395 ( GrLOD_t small_lod, GrLOD_t large_lod, 399 ( GrLOD_t small_lod, GrLOD_t large_lod, 396 400 GrAspectRatio_t aspect, GrTextureFormat_t format )) 397 401 { 398 402 FxU32 memrequired; 399 403 400 memrequired = _grTexTextureMemRequired(small_lod, large_lod, 404 memrequired = _grTexTextureMemRequired(small_lod, large_lod, 401 405 aspect, format, 402 406 GR_MIPMAPLEVELMASK_BOTH ); … … 417 421 FxU32 dmax = ( FxU32 ) ( detail_max * _GlideRoot.pool.f255 ); 418 422 FxU32 dscale = detail_scale; 419 423 420 424 GR_BEGIN_NOFIFOCHECK("grTexDetailControl",88); 421 425 GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%g)\n",tmu,detail_scale,detail_max)); … … 428 432 tDetail |= ( ( dmax << SST_DETAIL_MAX_SHIFT ) & SST_DETAIL_MAX ); 429 433 tDetail |= ( ( dscale << SST_DETAIL_SCALE_SHIFT ) & SST_DETAIL_SCALE ); 430 434 431 435 /* MULTIPLAT */ 432 436 _grTexDetailControl( tmu, tDetail ); … … 471 475 Library: glide 472 476 Description: 473 Returns the tmu memory required to store the specified mipmap 474 ( Gary and I don't like the name of this function, but are 475 a little backed into a corner because of the existence 477 Returns the tmu memory required to store the specified mipmap 478 ( Gary and I don't like the name of this function, but are 479 a little backed into a corner because of the existence 476 480 of grTexMemRequired() which does not imply any distinction 477 481 between texture memory and system ram ) … … 479 483 evenOdd - which set of mipmap levels are to be stored 480 484 One of: 481 GR_MIPMAPLEVELMASK_EVEN 485 GR_MIPMAPLEVELMASK_EVEN 482 486 GR_MIPMAPLEVELMASK_ODD 483 487 GR_MIPMAPLEVELMASK_BOTH … … 485 489 of texture 486 490 Return: 487 offset to be added to current texture base address to calculate next 491 offset to be added to current texture base address to calculate next 488 492 valid texture memory download location 489 493 -------------------------------------------------------------------*/ … … 494 498 495 499 GR_CHECK_F( "grTexTextureMemRequired", !info, "invalid info pointer" ); 496 memrequired = _grTexTextureMemRequired( info->smallLod, info->largeLod, 500 memrequired = _grTexTextureMemRequired( info->smallLod, info->largeLod, 497 501 info->aspectRatio, info->format, 498 502 evenOdd ); 499 503 500 504 GDBG_INFO((88,"grTexTextureMemRequired(%d,0x%x) => 0x%x(%d)\n", 501 505 evenOdd,info,memrequired,memrequired)); … … 526 530 none 527 531 -------------------------------------------------------------------*/ 528 GR_DIENTRY(grTexDownloadMipMap, void, 532 GR_DIENTRY(grTexDownloadMipMap, void, 529 533 ( GrChipID_t tmu, FxU32 startAddress, FxU32 530 534 evenOdd, GrTexInfo *info )) … … 543 547 GR_CHECK_F( "grTexDownloadMipMap", evenOdd > 0x3, "evenOdd mask invalid" ); 544 548 GR_CHECK_F( "grTexDownloadMipMap", !info, "info invalid" ); 545 549 546 550 if ((startAddress < 0x200000) && (startAddress + size > 0x200000)) 547 551 GrErrorCallback("grTexDownloadMipMap: mipmap " … … 549 553 550 554 src_base = (char *)info->data; 551 555 552 556 /*--------------------------------------------------------------- 553 557 Download one mipmap level at a time 554 558 ---------------------------------------------------------------*/ 555 559 for( lod = info->largeLod; lod <= info->smallLod; lod++ ) { 556 grTexDownloadMipMapLevel( tmu, 557 startAddress, 560 grTexDownloadMipMapLevel( tmu, 561 startAddress, 558 562 lod, 559 563 info->largeLod, … … 562 566 evenOdd, 563 567 src_base ); 564 568 565 569 src_base += _grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod] 566 570 << (info->format>=GR_TEXFMT_16BIT); … … 588 592 -------------------------------------------------------------------*/ 589 593 GR_DIENTRY(grTexDownloadTablePartial, void, 590 ( GrChipID_t tmu, GrTexTable_t type, 594 ( GrChipID_t tmu, GrTexTable_t type, 591 595 void *data, int start, int end )) 592 596 { … … 612 616 ** grTexDownloadMipMapLevel 613 617 */ 614 GR_DIENTRY(grTexDownloadMipMapLevel, void, 618 GR_DIENTRY(grTexDownloadMipMapLevel, void, 615 619 ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, 616 620 GrLOD_t largeLod, GrAspectRatio_t aspectRatio, 617 GrTextureFormat_t format, FxU32 evenOdd, void *data )) 621 GrTextureFormat_t format, FxU32 evenOdd, void *data )) 618 622 { 619 623 GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevel",89); … … 622 626 format,evenOdd,data)); 623 627 grTexDownloadMipMapLevelPartial( tmu, startAddress, 624 thisLod, largeLod, 628 thisLod, largeLod, 625 629 aspectRatio, format, 626 630 evenOdd, data, -
trunk/src/opengl/glide/sst1/glide/fxbldno.c
r2885 r6653 1 /* $Id: fxbldno.c,v 1.2 2001-09-05 14:30:50 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/sst1/glide/fxbldno.c,v 1. 1 2000-02-25 00:31:11 sandervlExp $21 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/fxbldno.c,v 1.2 2001-09-05 14:30:50 bird Exp $ 21 22 * $Log: fxbldno.c,v $ 22 * Revision 1.1 2000-02-25 00:31:11 sandervl 23 * Revision 1.2 2001-09-05 14:30:50 bird 24 * Added $Id:$ keyword. 25 * 26 * Revision 1.1 2000/02/25 00:31:11 sandervl 23 27 * Created new Voodoo 1 Glide 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/sst1/glide/fxgasm.c
r2885 r6653 1 /* $Id: fxgasm.c,v 1.2 2001-09-05 14:30:50 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:31:11$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:30:50 $ 22 23 */ 23 24 … … 104 105 printf("#define __FX_INLINE_H__\n"); 105 106 printf("\n"); 106 107 107 108 printf("/* The # of 2-byte entries in the hw fog table */\n"); 108 109 printf("#define kInternalFogTableEntryCount 0x%XUL\n", … … 142 143 HWOFFSET (sst,FtriangleCMD,"FTRIANGLECMD\t"); 143 144 #else 144 #error "Update fxgasm.c for this chip" 145 #error "Update fxgasm.c for this chip" 145 146 #endif 146 147 NEWLINE; -
trunk/src/opengl/glide/sst1/glide/g3df.c
r2885 r6653 1 /* $Id: g3df.c,v 1.2 2001-09-05 14:30:50 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/sst1/glide/g3df.c,v 1. 1 2000-02-25 00:31:12 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/g3df.c,v 1.2 2001-09-05 14:30:50 bird Exp $ 21 22 ** $Log: g3df.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:12 sandervl 23 ** Revision 1.2 2001-09-05 14:30:50 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:12 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 6 3/09/97 10:31a Dow 27 31 * Added GR_DIENTRY for di glide functions … … 101 105 GR_ASPECT_8x1 102 106 }; 103 CfTableEntry cftable[] = 107 CfTableEntry cftable[] = 104 108 { 105 109 { "I8", GR_TEXFMT_INTENSITY_8, FXTRUE }, … … 364 368 packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+2] ) << 16; 365 369 packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+3] ) << 24; 366 370 367 371 info->table.nccTable.packed_data[index] = packedvalue; 368 372 } -
trunk/src/opengl/glide/sst1/glide/gaa.c
r2885 r6653 1 /* $Id: gaa.c,v 1.2 2001-09-05 14:30:50 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/sst1/glide/gaa.c,v 1. 1 2000-02-25 00:31:12 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gaa.c,v 1.2 2001-09-05 14:30:50 bird Exp $ 21 22 ** $Log: gaa.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:12 sandervl 23 ** Revision 1.2 2001-09-05 14:30:50 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:12 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 13 8/21/97 2:26p Atai 27 31 * fix FIFO size 28 * 32 * 29 33 * 12 7/25/97 2:55p Atai 30 34 * Remove slope calculation in edge sense code, use cross product instead. 31 35 * Move grAADrawTriEdgeSense() 1/area calculation after pci write command. 32 * 36 * 33 37 * 11 7/24/97 5:59p Atai 34 38 * optimize grAADrawPoint, grAADrawLine and grAADrawTriangle for sst1 35 * 39 * 36 40 * 10 3/04/97 9:08p Dow 37 41 * Neutered multiplatform multiheaded monster 38 * 42 * 39 43 * 9 12/23/96 1:37p Dow 40 44 * chagnes for multiplatform glide … … 80 84 ** total = 29 + 3 * n 81 85 */ 82 GR_ENTRY(grAADrawPoint, void, ( const GrVertex *e )) 86 GR_ENTRY(grAADrawPoint, void, ( const GrVertex *e )) 83 87 { 84 88 int i, j; … … 216 220 ** \ \| 217 221 ** +F(x2,y2+1.0) 218 ** 222 ** 219 223 ** pci write command (x major line ) 220 224 ** 1st triangle A-B-V2 … … 226 230 ** 4th triangle V1-V2-F 227 231 ** 5 + n 228 ** total = 232 ** total = 229 233 */ 230 GR_ENTRY(grAADrawLine, void, ( const GrVertex *v1, const GrVertex *v2 )) 234 GR_ENTRY(grAADrawLine, void, ( const GrVertex *v1, const GrVertex *v2 )) 231 235 { 232 236 float adx; /* |dX| */ … … 248 252 tv = v1; v1 = v2; v2 = tv; 249 253 } 250 254 251 255 /* compute deltas and absolute deltas */ 252 256 dx = adx = v1->x - v2->x; … … 254 258 if ( adx < 0 ) 255 259 adx = -adx; 256 260 257 261 if ( adx >= dy ) { /* X major line */ 258 262 … … 284 288 else { 285 289 dp = FARRAY(v1,i); 286 287 288 289 290 291 290 GR_SETF( fp[0], dp ); 291 dp -= FARRAY(v2, i); 292 GR_SETF( fp[DPDX_OFFSET>>2] , dp * dx); 293 dlp++; 294 i = dlp->i; 295 GR_SETF( fp[DPDY_OFFSET>>2] , _GlideRoot.pool.f0 ); 292 296 } 293 297 } … … 330 334 grSetVertexParameter(v1); 331 335 332 GR_SETF( hw->Fdadx , dp ); 336 GR_SETF( hw->Fdadx , dp ); 333 337 GR_SETF( hw->Fdady , -v2->a ); 334 338 P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, -dx ) ); … … 354 358 fp = dlp->addr; 355 359 if (i & 1) { /* packer bug check */ 356 357 358 359 360 360 if (i & 2) P6FENCE; 361 GR_SETF( fp[0], 0.0f); 362 if (i & 2) P6FENCE; 363 dlp++; 364 i = dlp->i; 361 365 } 362 366 else { 363 364 367 dp = FARRAY(v1,i); 368 GR_SETF( fp[0], dp ); 365 369 dp -= FARRAY(v2, i); 366 367 368 370 GR_SETF( fp[DPDX_OFFSET>>2] , _GlideRoot.pool.f0); 371 dlp++; 372 i = dlp->i; 369 373 GR_SETF( fp[DPDY_OFFSET>>2] , dp * dy ); 370 374 } … … 468 472 if (dx > 0.0f) { 469 473 if (dx >= -dy) /* X-major line */ 470 474 sense = (cp > 0) ? aaEdgeSenseTop : aaEdgeSenseBottom; 471 475 else /* Y-major line */ 472 476 sense = (cp > 0) ? aaEdgeSenseRight : aaEdgeSenseLeft; 473 477 } 474 478 else { 475 479 if (dx <= dy) /* X-major line */ 476 480 sense = (cp < 0) ? aaEdgeSenseTop : aaEdgeSenseBottom; 477 481 else /* Y-major line */ 478 482 sense = (cp < 0) ? aaEdgeSenseLeft : aaEdgeSenseRight; 479 483 } 480 484 } … … 492 496 dp = a->a * dy; 493 497 GR_SETF( hw->FvC.y, b->y + _GlideRoot.pool.f1); 494 498 495 499 grSetVertexParameter(a); 496 500 497 501 GR_SETF( hw->Fdady, -a->a); 498 502 dp *= m; 499 503 GR_SETF( hw->Fdadx, dp); 500 504 P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) ); 501 505 502 506 dp = b->a * dy; 503 507 GR_SETF( hw->FvB.x, b->x); … … 506 510 507 511 grSetVertexParameter(a); 508 512 509 513 GR_SETF( hw->Fdady, -b->a); 510 514 dp *= m; 511 515 GR_SETF( hw->Fdadx, dp); 512 516 P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) ); 513 517 514 518 break; 515 519 516 520 case aaEdgeSenseLeft: 517 521 /* pci comamnd 16 + 2 * n */ … … 520 524 GR_SETF( hw->FvB.x, a->x); 521 525 GR_SETF( hw->FvB.y, a->y); 522 GR_SETF( hw->FvC.y, b->y); 526 GR_SETF( hw->FvC.y, b->y); 523 527 m = 1.0f / dy; 524 528 GR_SETF( hw->FvA.x, a->x - _GlideRoot.pool.f1); … … 532 536 GR_SETF( hw->Fdady, dp); 533 537 P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dy ) ); 534 538 535 539 GR_SETF( hw->FvA.x, a->x); 536 540 dp = b->a * dx; … … 545 549 GR_SETF( hw->Fdady, dp); 546 550 P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dy ) ); 547 551 548 552 break; 549 553 550 554 case aaEdgeSenseBottom: 551 555 552 556 if (dy < -1.0f) { 553 557 /* pci comamnd 17 + 2 * n */ … … 556 560 GR_SETF( hw->FvB.x, a->x); 557 561 GR_SETF( hw->FvB.y, a->y); 558 GR_SETF( hw->FvC.x, b->x); 562 GR_SETF( hw->FvC.x, b->x); 559 563 m = 1.0f / dx; 560 564 GR_SETF( hw->FvA.y, a->y - _GlideRoot.pool.f1); … … 563 567 grSetVertexParameter(a); 564 568 GR_SET(hw->Fa, 0); 565 569 566 570 dp = a->a * dy; 567 571 dp *= m; … … 569 573 GR_SETF( hw->Fdady, a->a); 570 574 P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) ); 571 575 572 576 GR_SETF( hw->FvA.y, a->y); 573 577 dp = b->a * dy; … … 577 581 GR_SETF( hw->FvC.y, b->y); 578 582 grSetVertexParameter(a); 579 583 580 584 GR_SETF( hw->Fdady, b->a); 581 585 dp *= m; … … 588 592 GR_SET_EXPECTED_SIZE(8+(_GlideRoot.curTriSizeNoGradient << 1)); 589 593 GR_SETF( hw->FvA.x, a->x); 590 GR_SETF( hw->FvC.x, b->x); 594 GR_SETF( hw->FvC.x, b->x); 591 595 GR_SETF( hw->FvC.y, b->y); 592 596 GR_SETF( hw->FvB.x, b->x); … … 601 605 GR_SETF( hw->Fdady, b->a); 602 606 P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) ); 603 607 604 608 GR_SETF( hw->FvB.x, a->x); 605 609 GR_SETF( hw->FvB.y, a->y); 606 610 grSetVertexParameter(a); 607 611 GR_SET(hw->Fa, 0); 608 612 609 613 dp = a->a - b->a; 610 614 GR_SETF( hw->Fdady, a->a); … … 619 623 GR_SETF( hw->FvA.x, a->x); 620 624 GR_SETF( hw->FvB.x, b->x); 621 GR_SETF( hw->FvC.x, a->x); 625 GR_SETF( hw->FvC.x, a->x); 622 626 GR_SETF( hw->FvC.y, a->y); 623 627 m = 1.0f / dx; … … 627 631 grSetVertexParameter(a); 628 632 GR_SET(hw->Fa, 0); 629 633 630 634 dp = -a->a * dy * m; 631 635 GR_SETF( hw->Fdadx, dp); … … 638 642 GR_SETF( hw->FvB.y, a->y); 639 643 dp = b->a * dy; 640 GR_SETF( hw->FvC.x, b->x); 644 GR_SETF( hw->FvC.x, b->x); 641 645 GR_SETF( hw->FvC.y, b->y); 642 646 … … 649 653 P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) ); 650 654 } 651 655 652 656 break; 653 657 case aaEdgeSenseRight: … … 670 674 GR_SETF( hw->Fdady, dp); 671 675 P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) ); 672 676 673 677 GR_SETF( hw->FvA.x, a->x); 674 678 dp = b->a * dx; … … 677 681 GR_SETF( hw->FvB.y, b->y); 678 682 grSetVertexParameter(a); 679 683 680 684 GR_SETF( hw->Fdadx, -b->a); 681 685 dp *= m; 682 686 GR_SETF( hw->Fdady, dp); 683 P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) ); 687 P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) ); 684 688 break; 685 689 } … … 690 694 /* 691 695 ** aaCalculateSignOfSinTheta 692 ** 696 ** 693 697 */ 694 698 float … … 701 705 Now, we make two vectors: ab [x1 y1] and ac [x2 y2] 702 706 Fromt the cross product, we know that 703 707 704 708 x1*y2 - x2*y1 = |ab|*|ac|*sin(theta), where theta is the angle 705 709 between the two lines. If sin(theta) > 0, c is above the line ab, … … 708 712 x1 = b->x - a->x; 709 713 y1 = b->y - a->y; 710 714 711 715 x2 = c->x - a->x; 712 716 y2 = c->y - a->y; 713 717 714 718 return ((x1 * y2) - (x2 * y1)); 715 719 716 720 } /* aaCalculateSignOfSinTheta */ 717 721 #endif … … 723 727 ** NOTE: This doesn't quite work yet 724 728 */ 725 GR_ENTRY(grAADrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVertex *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias ) ) 729 GR_ENTRY(grAADrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVertex *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias ) ) 726 730 { 727 731 FxU32 … … 748 752 grAADrawTriEdgeSense(a, b, c); 749 753 } 750 754 751 755 if ( bc_antialias ) { 752 756 grAADrawTriEdgeSense(b, c, a); 753 757 } 754 758 755 759 if ( ca_antialias ) { 756 760 grAADrawTriEdgeSense(c, a, b); … … 768 772 */ 769 773 770 GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 774 GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 771 775 { 772 776 int … … 795 799 } else if (i == (nverts - 2)) { 796 800 grAADrawTriEdgeSense(c, a, b); 797 } 801 } 798 802 799 803 grAADrawTriEdgeSense(b, c, a); … … 808 812 */ 809 813 810 GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 814 GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 811 815 { 812 816 int … … 838 842 } else if (i == (nverts - 2)) { 839 843 grAADrawTriEdgeSense(c, a, b); 840 } 844 } 841 845 842 846 grAADrawTriEdgeSense(b, c, a); -
trunk/src/opengl/glide/sst1/glide/gbanner.c
r2885 r6653 1 /* $Id: gbanner.c,v 1.2 2001-09-05 14:30:51 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/sst1/glide/gbanner.c,v 1. 1 2000-02-25 00:31:13 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gbanner.c,v 1.2 2001-09-05 14:30:51 bird Exp $ 21 22 ** $Log: gbanner.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:13 sandervl 23 ** Revision 1.2 2001-09-05 14:30:51 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:13 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 9 5/02/97 2:08p Pgj 27 31 * screen_width/height now FxU32 28 * 32 * 29 33 * 8 3/16/97 2:24a Jdt 30 34 * Fixed bug. Didn't initialize info. 31 * 35 * 32 36 * 7 3/12/97 11:51p Jdt 33 37 * Watcom warning. 34 * 38 * 35 39 * 6 3/12/97 4:20p Jdt 36 40 * Fixed for VG96 and optimized SST-1 37 * 41 * 38 42 * 5 2/26/97 11:55a Jdt 39 43 * Updated banner for new lfb api 40 * 44 * 41 45 * 4 12/23/96 1:37p Dow 42 46 * chagnes for multiplatform glide … … 66 70 GDBG_INFO_MORE((gc->myLevel,"()\n")); 67 71 68 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 72 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 69 73 grGlideGetState( &state ); 70 74 grDisableAllEffects(); … … 84 88 grClipWindow( 0, 0, 85 89 gc->state.screen_width - 1, 86 gc->state.screen_height - 1); 90 gc->state.screen_height - 1); 87 91 grDepthMask(FXFALSE); 88 92 grDepthBufferFunction(GR_CMP_ALWAYS); 89 93 grDepthBufferMode( GR_DEPTHBUFFER_DISABLE ); 90 94 91 95 grChromakeyValue( 0x0000 ); 92 96 grChromakeyMode( GR_CHROMAKEY_ENABLE ); … … 97 101 info.size = sizeof( info ); 98 102 if ( grLfbLock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER, 99 GR_LFBWRITEMODE_565,GR_ORIGIN_UPPER_LEFT, 103 GR_LFBWRITEMODE_565,GR_ORIGIN_UPPER_LEFT, 100 104 FXTRUE, &info ) ) { 101 105 FxU32 *dstData; … … 114 118 115 119 dstData = info.lfbPtr; 116 dstData = (FxU32*)( ((char*)dstData) + 120 dstData = (FxU32*)( ((char*)dstData) + 117 121 (info.strideInBytes*((scrHeight-1)-banner_height)) + 118 122 ((scrWidth-banner_width)<<1) ); … … 137 141 info.size = sizeof( info ); 138 142 if ( grLfbLock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER, 139 GR_LFBWRITEMODE_565,GR_ORIGIN_UPPER_LEFT, 143 GR_LFBWRITEMODE_565,GR_ORIGIN_UPPER_LEFT, 140 144 FXFALSE, &info ) ) { 141 145 … … 155 159 156 160 dstData = info.lfbPtr; 157 dstData = (FxU16*)( ((char*)dstData) + 161 dstData = (FxU16*)( ((char*)dstData) + 158 162 (info.strideInBytes*((scrHeight-1)-banner_height)) + 159 163 ((scrWidth-banner_width)<<1) ); … … 174 178 srcData += srcJump; 175 179 } 176 180 177 181 grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER ); 178 182 } 179 183 180 184 #else 181 # error "Shameless Plug Unimplemented on this Hardware" 185 # error "Shameless Plug Unimplemented on this Hardware" 182 186 #endif 183 187 -
trunk/src/opengl/glide/sst1/glide/gdraw.c
r2885 r6653 1 /* $Id: gdraw.c,v 1.2 2001-09-05 14:30:51 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/sst1/glide/gdraw.c,v 1. 1 2000-02-25 00:31:13 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gdraw.c,v 1.2 2001-09-05 14:30:51 bird Exp $ 21 22 ** $Log: gdraw.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:13 sandervl 23 ** Revision 1.2 2001-09-05 14:30:51 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:13 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 ** 29 ** 26 30 ** 31 6/02/98 8:03p Peter 27 31 ** Mmmmm.... points 28 * 32 * 29 33 * 30 9/07/97 1:52p Atai 30 34 * performance tuning for previous check-in 31 * 35 * 32 36 * 29 9/05/97 7:20p Atai 33 37 * fixed bug 764 (grDrawPoint integer snapping). 34 * 38 * 35 39 * 28 6/20/97 5:51p Dow 36 40 * Moved grDebugGroupWriteHEader to sst96.c 37 * 41 * 38 42 * 27 5/27/97 11:37p Pgj 39 43 * Fix for Bug report 545 40 * 44 * 41 45 * 26 5/27/97 2:00p Dow 42 46 * Parenthesized a ternary op in GR_BEGIN to work around a Watcom compiler 43 47 * bug. 44 * 48 * 45 49 * 25 3/21/97 12:42p Dow 46 50 * Made STWHints not send the Bend Over Baby Packet to FBI Jr. 47 * 51 * 48 52 * 24 3/04/97 9:08p Dow 49 53 * Neutered multiplatform multiheaded monster 50 * 54 * 51 55 * 23 2/18/97 9:51a Jdt 52 56 * Ifdefed out some if(0) code to supress watcom warnings 53 * 57 * 54 58 * 22 12/23/96 1:37p Dow 55 59 * chagnes for multiplatform glide 56 * 60 * 57 61 * 21 11/18/96 12:13p Jdt 58 62 * Made all debugging code go through the C-call to the assembly trisetup 59 63 * code. 60 * 64 * 61 65 * 20 11/14/96 11:52p Jdt 62 66 * Fixed Watcom Assembly calling bug … … 84 88 /*--------------------------------------------------------------------------- 85 89 NOTE: by Gary Tarolli 86 90 87 91 The following code is very carefully scheduled for MSVC4.2 Version 10.20.6166 88 92 The trick is to schedule operations between PCI writes (GR_SET*). … … 116 120 * can change the rounding mode so that it is difficult to get the 117 121 * correct truncation/ceiling operation w/ a simple adjustment to 118 * the bias. 122 * the bias. 119 123 * 120 124 * NB: The constant kNumMantissaBits defines how many bits of … … 145 149 146 150 _GlideRoot.stats.pointsDrawn++; 147 151 148 152 /* draw a little triangle, with the lower left corner at pixel center */ 149 153 GR_SET( hw->vA.x, x ); 150 154 GR_SET( hw->vA.y, y ); 151 155 152 156 x += (0x01UL << (21UL - kNumMantissaBits)); 153 157 GR_SET( hw->vB.x, x ); … … 168 172 if (i & 2) P6FENCE; 169 173 } 170 else 174 else 171 175 GR_SETF( *dlp->addr, FARRAY(p,i) ); 172 176 dlp++; … … 250 254 GR_SETF(hw->FvC.x,dp) 251 255 _GlideRoot.stats.linesDrawn++; 252 256 253 257 GR_SETF(hw->FvA.y,a->y - _GlideRoot.pool.fHalf); 254 258 … … 296 300 _GlideRoot.stats.linesDrawn++; 297 301 GR_SETF(hw->FvC.y,dp); 298 302 299 303 GR_SETF(hw->FvA.x,a->x - _GlideRoot.pool.fHalf); 300 304 … … 304 308 i = dlp->i; 305 309 GR_SETF(hw->FvC.x,dp + _GlideRoot.pool.fHalf); 306 310 307 311 while (i) { 308 312 fp = dlp->addr; … … 325 329 } 326 330 P6FENCE_CMD( GR_SET( hw->triangleCMD, 0xFFFFFFFF) ); 327 331 328 332 GR_SETF(hw->FvB.x,a->x + _GlideRoot.pool.fHalf); 329 333 GR_SETF(hw->FvB.y,a->y); … … 382 386 #endif /* GLIDE_DEBUG */ 383 387 384 /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 388 /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 385 389 TRISETUP( a, b, c ); 386 390 -
trunk/src/opengl/glide/sst1/glide/gerror.c
r2885 r6653 1 /* $Id: gerror.c,v 1.2 2001-09-05 14:30:51 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/sst1/glide/gerror.c,v 1. 1 2000-02-25 00:31:13 sandervlExp $22 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gerror.c,v 1.2 2001-09-05 14:30:51 bird Exp $ 22 23 ** $Log: gerror.c,v $ 23 ** Revision 1.1 2000-02-25 00:31:13 sandervl 24 ** Revision 1.2 2001-09-05 14:30:51 bird 25 ** Added $Id:$ keyword. 26 ** 27 ** Revision 1.1 2000/02/25 00:31:13 sandervl 24 28 ** Created new Voodoo 1 Glide dir 25 29 ** 26 * 30 * 27 31 * 10 6/03/97 11:57p Pgj 28 32 * fix bug 558 29 * 33 * 30 34 * 9 5/28/97 2:10p Dow 31 35 * Some mode setting, other cleanup 32 * 36 * 33 37 * 8 5/27/97 2:02p Dow 34 38 * added _grAssert 35 * 39 * 36 40 * 7 5/20/97 9:47a Pgj 37 41 * Use OutputDebugString for non-fatal errors under windows 38 * 42 * 39 43 * 6 5/19/97 7:35p Pgj 40 44 * Print cogent error message if h/w not found 41 * 45 * 42 46 * 5 3/09/97 10:31a Dow 43 47 * Added GR_DIENTRY for di glide functions 44 * 48 * 45 49 * 4 12/23/96 1:37p Dow 46 50 * chagnes for multiplatform glide … … 133 137 grGlideShutdown(); 134 138 135 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) && (GLIDE_PLATFORM & GLIDE_OS_DOS32) 139 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) && (GLIDE_PLATFORM & GLIDE_OS_DOS32) 136 140 { 137 141 /* Set Mode 3 before going */ 138 142 union REGS 139 143 inR, outR; 140 144 141 145 inR.w.ax = 0x0003; 142 146 int386(0x10, &inR, &outR); -
trunk/src/opengl/glide/sst1/glide/gglide.c
r2885 r6653 1 /* $Id: gglide.c,v 1.2 2001-09-05 14:30:51 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/sst1/glide/gglide.c,v 1. 1 2000-02-25 00:31:14 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gglide.c,v 1.2 2001-09-05 14:30:51 bird Exp $ 21 22 ** $Log: gglide.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:14 sandervl 23 ** Revision 1.2 2001-09-05 14:30:51 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:14 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 ** 29 ** 26 30 ** 78 1/21/98 2:25p Peter 27 31 ** fixed assertion muckage 28 * 32 * 29 33 * 77 1/12/98 10:25p Dow 30 34 * H3D Stereo Support 31 * 35 * 32 36 * 76 1/07/98 9:58a Jdt 33 37 * Include Z in datalist for GR_COMBINE_LOCAL_DEPTH...Fixes Bug 1084 34 * 38 * 35 39 * 75 12/19/97 8:09a Peter 36 40 * fog table propogation 37 * 41 * 38 42 * 74 9/24/97 7:02p Atai 39 43 * 1. use initStatus() instead of grSstStatus() in grBufferNumPending 40 44 * 2. add one p6 nudge code in grBufferSwap() 41 * 45 * 42 46 * 73 9/07/97 12:14p Pgj 43 47 * fix bug 660 44 * 48 * 45 49 * 72 9/05/97 4:46p Peter 46 50 * fixed fifo silliness, sorry 47 * 51 * 48 52 * 71 8/19/97 8:55p Peter 49 53 * lots of stuff, hopefully no muckage 50 * 54 * 51 55 * 70 8/17/97 10:04p Pgj 52 56 * Fix bug 735 53 * 57 * 54 58 * 69 8/01/97 11:48a Dow 55 59 * Added a size check for debugging 56 * 60 * 57 61 * 68 7/20/97 2:05p Dow 58 62 * Hopefully worked around VSYNC bug 59 * 63 * 60 64 * 67 7/18/97 6:48p Jdt 61 65 * grGlideShutdown now unsets _GlideRoot.initialized, further open/close 62 66 * symmetry fix 63 * 67 * 64 68 * 66 7/09/97 10:18a Dow 65 69 * Further Nudge Of Love adjustments 66 * 70 * 67 71 * 65 7/04/97 12:08p Dow 68 72 * Separated SST96 & SST1 versions of grRebuildDataList, fixed chip field 69 73 * muckage 70 * 74 * 71 75 * 64 6/30/97 6:43p Dow 72 76 * Added more blank lines 73 * 77 * 74 78 * 63 6/29/97 11:47p Jdt 75 79 * Adjustments for triangle optimization 76 * 80 * 77 81 * 62 6/29/97 1:58p Dow 78 82 * Fixed busted ifdef 79 * 83 * 80 84 * 61 6/26/97 3:09p Dow 81 85 * protected P6 stuff 82 * 86 * 83 87 * 60 6/20/97 5:52p Dow 84 88 * Changes to make chip field work 85 * 89 * 86 90 * 59 6/19/97 7:35p Dow 87 91 * More P6 Stuff 88 * 92 * 89 93 * 58 6/18/97 6:08p Dow 90 94 * Fixed bogus call to gdbg_error 91 * 95 * 92 96 * 57 6/18/97 5:54p Dow 93 97 * P6 adjustments 94 * 98 * 95 99 * 56 6/12/97 5:19p Pgj 96 100 * Fix bug 578 97 * 101 * 98 102 * 55 5/27/97 11:37p Pgj 99 103 * Fix for Bug report 545 100 * 104 * 101 105 * 54 5/22/97 2:18p Pgj 102 106 * maxx --> maxy 103 * 107 * 104 108 * 53 5/11/97 11:27p Pgj 105 109 * bug report 1152 106 * 110 * 107 111 * 52 5/04/97 12:47p Dow 108 112 * Moved ClipWindow sanity check to internal routine as grSstControl needs 109 113 * it. 110 * 114 * 111 115 * 51 5/02/97 2:09p Pgj 112 116 * grClipWindow sanity checks coords (intersect w/screen rect) 113 * 117 * 114 118 * 50 3/24/97 2:00p Dow 115 119 * Fixed some chip field problems 116 * 120 * 117 121 * 49 3/22/97 7:04p Dow 118 122 * Fixed chip field 119 * 123 * 120 124 * 48 3/21/97 12:58p Dow 121 125 * Fixed error for SST1 122 * 126 * 123 127 * 47 3/21/97 12:42p Dow 124 128 * Made STWHints not send the Bend Over Baby Packet to FBI Jr. 125 * 129 * 126 130 * 46 3/19/97 10:42p Dow 127 131 * Dither subtraction sense, windowsInit 128 * 132 * 129 133 * 45 3/18/97 9:08p Dow 130 134 * Added FX_GLIDE_NO_DITHER_SUB environment variable 131 * 135 * 132 136 * 44 3/17/97 6:26a Jdt 133 137 * Re-worked grGlideShutdown() 134 * 138 * 135 139 * 43 3/07/97 2:51p Jdt 136 140 * Fix for SST96 register offsets. 137 * 141 * 138 142 * 42 3/07/97 2:29p Dow 139 143 * Maybe fixed lines 140 * 144 * 141 145 * 41 3/05/97 1:07p Dow 142 146 * Clipping and origin changes for SST98 143 * 147 * 144 148 * 40 3/04/97 9:08p Dow 145 149 * Neutered multiplatform multiheaded monster 146 * 150 * 147 151 * 39 3/01/97 2:48p Dow 148 152 * Moved buffer swap count increment so that it works for both VG & VR 149 * 153 * 150 154 * 38 2/26/97 11:56a Jdt 151 155 * Updated lfb api, fixed swapping 152 * 156 * 153 157 * 37 2/18/97 9:51a Jdt 154 158 * Removed a bunch of warnings, no functional changes. 155 * 159 * 156 160 * 36 2/12/97 10:39p Hanson 157 * 161 * 158 162 * 35 2/12/97 2:09p Hanson 159 * Hopefully removed the rest of my muckage. 160 * 163 * Hopefully removed the rest of my muckage. 164 * 161 165 * 34 1/14/97 10:45a Dow 162 166 * Added check for pending swaps to grBufferSwap for VG96 163 167 * Modified grBufferNumPending to work with VG96 164 * 168 * 165 169 * 33 12/23/96 1:37p Dow 166 170 * chagnes for multiplatform glide 167 * 171 * 168 172 * 32 11/17/96 11:16p Garymct 169 173 * Updated grSplash code to set all of the necessary state itself rather 170 174 * than expecting the caller to do so. 171 * 175 * 172 176 * 31 11/18/96 1:37a Tarolli 173 177 * fixed grAlphaBlendFunction warning bug 174 * 178 * 175 179 * 29 11/15/96 3:40p Jdt 176 180 * Fixed SST-96 build. 177 * 181 * 178 182 * 28 11/15/96 3:24p Tarolli 179 183 * renamed version.h to rcver.h , added some alpha blend function … … 230 234 else 231 235 alphamode |= SST_ENALPHABLEND; 232 236 233 237 alphamode &= ~( SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT ); 234 238 235 239 alphamode |= ( ( ( FxU32 ) rgb_sf ) << SST_RGBSRCFACT_SHIFT ) | 236 240 ( ( ( FxU32 ) rgb_df ) << SST_RGBDSTFACT_SHIFT ) | 237 241 ( ( ( FxU32 ) alpha_sf ) << SST_ASRCFACT_SHIFT ) | 238 242 ( ( ( FxU32 ) alpha_df ) << SST_ADSTFACT_SHIFT ); 239 243 240 244 GR_SET( hw->alphaMode, alphamode ); 241 245 gc->state.fbi_config.alphaMode = alphamode; … … 282 286 SST_CCA_ADD_ALOCAL | 283 287 SST_CCA_INVERT_OUTPUT ); 284 288 285 289 /* setup reverse blending first, then strip off the the high bit */ 286 290 if ( (factor & 0x8) == 0 ) … … 293 297 gc->state.ac_requires_it_alpha = ( local == GR_COMBINE_LOCAL_ITERATED ) | 294 298 ( other == GR_COMBINE_OTHER_ITERATED ); 295 299 296 300 /* setup scale factor bits */ 297 301 fbzColorPath |= factor << SST_CCA_MSELECT_SHIFT; … … 299 303 /* setup local color bits */ 300 304 fbzColorPath |= local << SST_ALOCALSELECT_SHIFT; 301 305 302 306 /* setup other color bits */ 303 307 fbzColorPath |= other << SST_ASELECT_SHIFT; 304 305 308 309 306 310 /* setup invert output bits */ 307 311 if ( invert ) 308 312 fbzColorPath |= SST_CCA_INVERT_OUTPUT; 309 313 310 314 /* setup core color combine unit bits */ 311 315 switch ( function ) { … … 313 317 fbzColorPath |= SST_CCA_ZERO_OTHER; 314 318 break; 315 319 316 320 case GR_COMBINE_FUNCTION_LOCAL: 317 321 case GR_COMBINE_FUNCTION_LOCAL_ALPHA: 318 322 fbzColorPath |= SST_CCA_ZERO_OTHER | SST_CCA_ADD_ALOCAL; 319 323 break; 320 324 321 325 case GR_COMBINE_FUNCTION_SCALE_OTHER: 322 326 break; 323 327 324 328 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: 325 329 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: 326 330 fbzColorPath |= SST_CCA_ADD_ALOCAL; 327 331 break; 328 332 329 333 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: 330 334 fbzColorPath |= SST_CCA_SUB_CLOCAL; 331 335 break; 332 336 333 337 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: 334 338 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: 335 339 fbzColorPath |= SST_CCA_SUB_CLOCAL | SST_CCA_ADD_ALOCAL; 336 340 break; 337 341 338 342 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: 339 343 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: … … 345 349 if ( gc->state.cc_requires_texture || gc->state.ac_requires_texture ) 346 350 fbzColorPath |= SST_ENTEXTUREMAP; 347 351 348 352 /* transition into/out of texturing ... add nopCMD */ 349 353 if(oldTextureEnabled != (fbzColorPath & SST_ENTEXTUREMAP)) … … 352 356 GR_SET( hw->fbzColorPath, fbzColorPath ); 353 357 gc->state.fbi_config.fbzColorPath = fbzColorPath; 354 358 355 359 /* setup paramIndex bits */ 356 360 _grUpdateParamIndex(); 357 GR_END_SLOPPY(); 361 GR_END_SLOPPY(); 358 362 } /* grAlphaCombine */ 359 363 360 364 /*--------------------------------------------------------------------------- 361 365 ** grAlphaControlsITRGBLighting 362 ** 366 ** 363 367 ** Determines whether the LSB of alpha controls what lighting is used-- 364 368 ** Specifically whether grConstantColorValu or the interated RGB values are used 365 369 ** during TEXTURE_TIMES_itrgb & TEXTURE_TIMES_ITRGB_DELTA0 color combine modes. 366 370 ** 367 */ 371 */ 368 372 369 373 GR_ENTRY(grAlphaControlsITRGBLighting, void, (FxBool enable)) … … 485 489 /* Restore fbzMode to previous state */ 486 490 GR_SET(hw->fbzMode, gc->state.fbi_config.fbzMode); 487 491 488 492 } else 489 493 #endif … … 528 532 GDBG_INFO_MORE((gc->myLevel,"(%d)\n",swapInterval)); 529 533 530 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 534 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 531 535 FXUNUSED( vSync ); 532 536 … … 570 574 pending = grBufferNumPending(); 571 575 } while (pending > 3); 572 576 573 577 /* optionally display the 3Dfx powerfield logo overlay */ 574 578 if (_GlideRoot.environment.shamelessPlug) … … 589 593 P6_NUDGE_OF_LOVE; 590 594 591 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 595 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 592 596 /* optionally display the 3Dfx powerfield logo overlay */ 593 597 if (_GlideRoot.environment.shamelessPlug) … … 634 638 635 639 /* turn off tracing after frame 0 and the snapshot frame */ 636 if (_GlideRoot.stats.bufferSwaps == 1 || 640 if (_GlideRoot.stats.bufferSwaps == 1 || 637 641 _GlideRoot.stats.bufferSwaps == _GlideRoot.environment.snapshot+1) 638 642 { … … 652 656 grSstStatus(); /* special bug workaround */ 653 657 #else 654 # error "Need to implement swap." 658 # error "Need to implement swap." 655 659 #endif /* GLIDE_PLATFORM & GLIDE_HW_SST1 */ 656 660 … … 658 662 659 663 GR_END(); 660 #undef FN_NAME 664 #undef FN_NAME 661 665 } /* grBufferSwap */ 662 666 … … 668 672 { 669 673 int 670 pend; /* Num Swaps pending */ 674 pend; /* Num Swaps pending */ 671 675 /* 672 676 * For improved speed we take the following steps … … 762 766 763 767 *clipLeftRight = 764 ( minx << SST_CLIPLEFT_SHIFT ) | ( maxx << SST_CLIPRIGHT_SHIFT ); 768 ( minx << SST_CLIPLEFT_SHIFT ) | ( maxx << SST_CLIPRIGHT_SHIFT ); 765 769 766 770 *clipBottomTop = … … 773 777 /* Enable clipping */ 774 778 *clipLeftRight |= 0x80000000; 775 #endif 776 #undef FN_NAME 779 #endif 780 #undef FN_NAME 777 781 } /* _grClipNormalizeAndGenerateRegValues */ 778 782 … … 781 785 */ 782 786 GR_ENTRY(grClipWindow, void, ( FxU32 minx, FxU32 miny, FxU32 maxx, 783 FxU32 maxy )) 787 FxU32 maxy )) 784 788 { 785 789 FxU32 … … 1107 1111 case GR_DEPTHBUFFER_DISABLE: 1108 1112 break; 1109 1113 1110 1114 case GR_DEPTHBUFFER_ZBUFFER: 1111 1115 fbzMode |= SST_ENDEPTHBUFFER | SST_ENZBIAS; … … 1301 1305 Library: Glide 1302 1306 Description: 1303 Shutdown the Glide Library. Iterate through all hardware and 1307 Shutdown the Glide Library. Iterate through all hardware and 1304 1308 call grSstWinClose(). Call InitShutdown() which unmaps all 1305 1309 hardware from linear memory. … … 1320 1324 } 1321 1325 { 1322 int i; 1326 int i; 1323 1327 GR_BEGIN_NOFIFOCHECK("grGlideShutdown",80); 1324 1328 GDBG_INFO_MORE((gc->myLevel,"()\n")); 1325 1329 1326 1330 for( i = 0; i < _GlideRoot.hwConfig.num_sst; i++ ) { 1327 1331 grSstSelect( i ); 1328 1332 grSstWinClose(); 1329 1333 } 1330 1334 1331 1335 initClose(); 1332 1336 1333 1337 _grDisplayStats(); 1334 1338 gc->grSstRez = GR_RESOLUTION_NONE; … … 1400 1404 1401 1405 GR_END_SLOPPY(); 1402 1406 1403 1407 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 1404 1408 if (gc->state.fbi_config.fbzMode & SST_YORIGIN) … … 1429 1433 FxU32 fbzMode; 1430 1434 GR_SET_EXPECTED_SIZE( 4 ); 1431 1435 1432 1436 fbzMode = gc->state.fbi_config.fbzMode; 1433 1437 fbzMode &= ~( SST_DRAWBUFFER ); 1434 1438 fbzMode |= buffer == GR_BUFFER_FRONTBUFFER ? SST_DRAWBUFFER_FRONT : SST_DRAWBUFFER_BACK; 1435 1439 1436 1440 GR_SET( hw->fbzMode, fbzMode ); 1437 1441 gc->state.fbi_config.fbzMode = fbzMode; … … 1498 1502 GR_ASSERT(gc->state.tmuMask < sizeof(paramI_array)/sizeof(paramI_array[0])); 1499 1503 paramIndex |= paramI_array[gc->state.tmuMask]; 1500 } 1504 } 1501 1505 1502 1506 /* See if we need iterated RGB */ … … 1509 1513 1510 1514 /* See if we need to iterate alpha based on the value of 1511 ac_requires_it_alpha */ 1515 ac_requires_it_alpha */ 1512 1516 if (gc->state.ac_requires_it_alpha) { 1513 1517 paramIndex |= STATE_REQUIRES_IT_ALPHA; … … 1518 1522 1519 1523 /* See what fbzColorPath contributes - BUG 1084*/ 1520 if ( ( fbzColorPath & SST_ALOCALSELECT ) == 1524 if ( ( fbzColorPath & SST_ALOCALSELECT ) == 1521 1525 ( SST_ALOCAL_Z ) ) { 1522 1526 paramIndex |= STATE_REQUIRES_OOZ; … … 1576 1580 paramIndex &= ~STATE_REQUIRES_W_TMU0; 1577 1581 } 1578 1582 1579 1583 /* Turn off ST for TMU1 if TMU0 is active and TMU1 is not different */ 1580 1584 if (((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQUIRES_ST_TMU1)) == … … 1582 1586 !(hints & GR_STWHINT_ST_DIFF_TMU1)) 1583 1587 paramIndex &= ~STATE_REQUIRES_ST_TMU1; 1584 1585 /* Turn off W for TMU1 if we have a previous W, and don't have a hint */ 1588 1589 /* Turn off W for TMU1 if we have a previous W, and don't have a hint */ 1586 1590 if ((paramIndex & STATE_REQUIRES_W_TMU1) && !(hints & GR_STWHINT_W_DIFF_TMU1)) 1587 1591 paramIndex &= ~STATE_REQUIRES_W_TMU1; 1588 1592 1589 1593 #if (GLIDE_NUM_TMU > 2) 1590 /* Turn off ST for TMU1 if it's not different & any other is set up. */ 1594 /* Turn off ST for TMU1 if it's not different & any other is set up. */ 1591 1595 if ((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQURES_ST_TMU1)) && 1592 1596 (paramIndex & STATE_REQUIRES_ST_TMU2) && 1593 1597 !(hints & GR_STWHINT_ST_DIFF_TMU2)) 1594 1598 paramIndex &= ~STATE_REQUIRES_ST_TMU2; 1595 1596 /* Turn off W for TMU2 if we have a previous W, and don't have a hint */ 1599 1600 /* Turn off W for TMU2 if we have a previous W, and don't have a hint */ 1597 1601 if ((paramIndex & STATE_REQUIRES_W_TMU2) && !(hints & GR_STWHINT_W_DIFF_TMU2)) 1598 1602 paramIndex &= ~STATE_REQUIRES_W_TMU2; 1599 1603 #endif 1600 1604 1601 1605 gc->state.paramIndex = paramIndex; 1602 1606 … … 1673 1677 Sstregs *tmu0; 1674 1678 Sstregs *tmu1; 1675 1679 1676 1680 #ifdef GDBG_INFO_ON 1677 1681 static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow", 1678 1682 "s0","t0","w0","s1","t1","w1","s2","t2","w2"}; 1679 1683 #endif 1680 1684 1681 1685 GDBG_INFO((80,"_grRebuildDataList() paramHints=0x%x paramIndex=0x%x\n", 1682 1686 gc->state.paramHints,gc->state.paramIndex)); 1683 1687 1684 1688 curTriSize = params = 0; 1685 1689 i = gc->state.paramIndex; 1686 1690 if (_GlideRoot.CPUType == 6) packMask |= 2; 1687 1691 1688 1692 tmu0 = SST_CHIP(hw,0xE); /* tmu 0,1,2 */ 1689 1693 tmu1 = SST_CHIP(hw,0xC); /* tmu 1,2 */ 1690 1694 1691 1695 /* init group write data */ 1692 1696 gwHeaderNum = 0; … … 1696 1700 place I can think of to init this for now */ 1697 1701 gc->hwDep.sst96Dep.gwCommand = GWH_GEN_ADDRESS(&hw->FvA.x); 1698 1702 1699 1703 /* 1700 1704 ((((FxU32)((FxU32) &hw->FvA.x) - (FxU32) gc->lfb_ptr) >> 2) | 0x100000 | ( 1L << (31) )); 1701 1705 */ 1702 1706 1703 1707 gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] = 0; 1704 1708 gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_VTX_BITS; 1705 1709 1706 1710 if (i & STATE_REQUIRES_IT_DRGB) { 1707 1711 /* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */ … … 1718 1722 gwpSize += 9; 1719 1723 } 1720 1724 1721 1725 if (i & STATE_REQUIRES_OOZ) { 1722 1726 gc->dataList[curTriSize + 0].i = GR_VERTEX_OOZ_OFFSET<<2; … … 1728 1732 gwpSize += 3; 1729 1733 } 1730 1734 1731 1735 if (i & STATE_REQUIRES_IT_ALPHA) { 1732 1736 gc->dataList[curTriSize + 0].i = GR_VERTEX_A_OFFSET<<2; … … 1738 1742 gwpSize += 3; 1739 1743 } 1740 1744 1741 1745 /* TMU1 --------------------------------- */ 1742 1746 /* always output to ALL chips, saves from having to change CHIP field */ … … 1752 1756 gwpSize += 6; 1753 1757 } 1754 1758 1755 1759 /* we squeeze FBI.OOW in here for sequential writes in the simple case */ 1756 1760 if (i & STATE_REQUIRES_OOW_FBI) { … … 1772 1776 gc->dataList[curTriSize + 1].i = GR_VERTEX_OOW_TMU0_OFFSET<<2; 1773 1777 gc->dataList[curTriSize + 1].addr = 0L; 1774 1778 1775 1779 if (gwpSize & 1) 1776 1780 ++gwpSize; /* Justify your love */ 1777 1781 gwpSize += 5; /* 2 header + grads */ 1778 1782 1779 1783 ++gwHeaderNum; 1780 1784 gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_W_BITS; … … 1782 1786 params += 1; 1783 1787 } 1784 1788 1785 1789 gc->dataList[curTriSize++].i = 0; /* terminate the list with 0,* */ 1786 1790 /* followed by the FtriangleCMD reg */ 1787 1791 gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */ 1788 1792 gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD; 1789 1793 1790 1794 /* 6 X,Y values plus AREA = 7, plus parameters */ 1791 1795 if (gwHeaderNum) { … … 1803 1807 if (gwpSize & 1) 1804 1808 ++gwpSize; /* justify the fifo */ 1805 } 1809 } 1806 1810 1807 1811 _GlideRoot.curTriSize = gwpSize << 2; /* GR.curTriSize in bytes */ … … 1809 1813 /* Need to know tri size without gradients for planar polygons */ 1810 1814 _GlideRoot.curTriSizeNoGradient = _GlideRoot.curTriSize - (params<<3); 1811 1815 1812 1816 #ifdef GDBG_INFO_ON 1813 1817 GDBG_INFO((282, "DataList\n")); … … 1834 1838 Sstregs *tmu0; 1835 1839 Sstregs *tmu1; 1836 1840 1837 1841 #ifdef GLIDE_DEBUG 1838 1842 static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow", 1839 1843 "s0","t0","w0","s1","t1","w1","s2","t2","w2"}; 1840 1844 #endif 1841 1845 1842 1846 GDBG_INFO((80,"_grRebuildDataList() paramHints=0x%x paramIndex=0x%x\n", 1843 1847 gc->state.paramHints,gc->state.paramIndex)); 1844 1848 1845 1849 curTriSize = params = 0; 1846 1850 i = gc->state.paramIndex; … … 1850 1854 register mappings */ 1851 1855 #endif /* GLIDE_USE_ALT_REGMAP */ 1852 1856 1853 1857 tmu0 = SST_CHIP(hw,0xE); /* tmu 0,1,2 */ 1854 1858 tmu1 = SST_CHIP(hw,0xC); /* tmu 1,2 */ 1855 1859 1856 1860 if (i & STATE_REQUIRES_IT_DRGB) { 1857 1861 /* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */ … … 1865 1869 params += 3; 1866 1870 } 1867 1871 1868 1872 if (i & STATE_REQUIRES_OOZ) { 1869 1873 gc->dataList[curTriSize + 0].i = GR_VERTEX_OOZ_OFFSET<<2; … … 1872 1876 params += 1; 1873 1877 } 1874 1878 1875 1879 if (i & STATE_REQUIRES_IT_ALPHA) { 1876 1880 gc->dataList[curTriSize + 0].i = GR_VERTEX_A_OFFSET<<2; … … 1879 1883 params += 1; 1880 1884 } 1881 1885 1882 1886 /* TMU1 --------------------------------- */ 1883 1887 /* always output to ALL chips, saves from having to change CHIP field */ … … 1890 1894 params += 2; 1891 1895 } 1892 1896 1893 1897 /* we squeeze FBI.OOW in here for sequential writes in the simple case */ 1894 1898 if (i & STATE_REQUIRES_OOW_FBI) { … … 1907 1911 params += 1; 1908 1912 } 1909 1913 1910 1914 /* TMU1 --------------------------------- */ 1911 1915 if (i & STATE_REQUIRES_ST_TMU1) { … … 1921 1925 } 1922 1926 else packerFlag = 1; 1923 1927 1924 1928 if (i & STATE_REQUIRES_W_TMU1) { 1925 1929 if (packerFlag) { … … 1936 1940 error WRITE THIS CODE; 1937 1941 #endif 1938 1942 1939 1943 /* if last write was not to chip 0 */ 1940 1944 if ( SST_CHIP_MASK & (FxU32)gc->dataList[curTriSize-1].addr ) { 1941 1945 /* flag write as a packer bug fix */ 1942 gc->dataList[curTriSize].i = packMask; 1946 gc->dataList[curTriSize].i = packMask; 1943 1947 gc->dataList[curTriSize].addr = (float *)_GlideRoot.packerFixAddress; 1944 1948 curTriSize++; 1945 1949 } 1946 1950 1947 1951 1948 1952 gc->dataList[curTriSize++].i = 0; /* terminate the list with 0,* */ 1949 1953 /* followed by the FtriangleCMD reg */ 1950 1954 gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */ 1951 1955 gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD; 1952 1956 1953 1957 /* 6 X,Y values plus AREA = 7, plus parameters */ 1954 1958 _GlideRoot.curTriSize = (6 + curTriSize + (params<<1)) <<2; … … 1956 1960 /* Need to know tri size without gradients for planar polygons */ 1957 1961 _GlideRoot.curTriSizeNoGradient = _GlideRoot.curTriSize - (params<<3); 1958 1962 1959 1963 #ifdef GLIDE_DEBUG 1960 1964 GDBG_INFO((282, "DataList\n")); … … 1963 1967 i,gc->dataList[i].i>>2,gc->dataList[i].addr, 1964 1968 (gc->dataList[i].i & 1) ? "packer" : 1965 p_str[gc->dataList[i].i>>2])); 1969 p_str[gc->dataList[i].i>>2])); 1966 1970 } 1967 1971 #endif … … 1978 1982 GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc)) 1979 1983 { 1980 1984 1981 1985 gc->gcFuncs._grColorCombineDelta0Mode = (void *) 1982 GR_DDNAME(_grColorCombineDelta0Mode); 1986 GR_DDNAME(_grColorCombineDelta0Mode); 1983 1987 gc->gcFuncs._grRebuildDataList = (void *) GR_DDNAME(_grRebuildDataList); 1984 1988 gc->gcFuncs._grTexDetailControl = (void *) GR_DDNAME(_grTexDetailControl); 1985 1989 gc->gcFuncs._grTexDownloadNccTable = (void *) 1986 GR_DDNAME(_grTexDownloadNccTable); 1990 GR_DDNAME(_grTexDownloadNccTable); 1987 1991 gc->gcFuncs._grTexDownloadPalette = (void *) 1988 GR_DDNAME(_grTexDownloadPalette); 1992 GR_DDNAME(_grTexDownloadPalette); 1989 1993 gc->gcFuncs._gumpTexCombineFunction = (void *) 1990 GR_DDNAME(_gumpTexCombineFunction); 1994 GR_DDNAME(_gumpTexCombineFunction); 1991 1995 gc->gcFuncs._grUpdateParamIndex = (void *) 1992 GR_DDNAME(_grUpdateParamIndex); 1993 gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup); 1996 GR_DDNAME(_grUpdateParamIndex); 1997 gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup); 1994 1998 gc->gcFuncs._trisetup_nogradients = (void *) 1995 GR_DDNAME(_trisetup_nogradients); 1996 gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine); 1997 gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint); 1998 gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon); 1999 GR_DDNAME(_trisetup_nogradients); 2000 gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine); 2001 gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint); 2002 gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon); 1999 2003 gc->gcFuncs.grAADrawPolygonVertexList = (void *) 2000 GR_DDNAME(grAADrawPolygonVertexList); 2001 gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle); 2004 GR_DDNAME(grAADrawPolygonVertexList); 2005 gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle); 2002 2006 gc->gcFuncs.grAlphaBlendFunction = (void *) 2003 GR_DDNAME(grAlphaBlendFunction); 2004 gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine); 2007 GR_DDNAME(grAlphaBlendFunction); 2008 gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine); 2005 2009 gc->gcFuncs.grAlphaControlsITRGBLighting = (void *) 2006 GR_DDNAME(grAlphaControlsITRGBLighting); 2010 GR_DDNAME(grAlphaControlsITRGBLighting); 2007 2011 gc->gcFuncs.grAlphaTestFunction = (void *) 2008 GR_DDNAME(grAlphaTestFunction); 2012 GR_DDNAME(grAlphaTestFunction); 2009 2013 gc->gcFuncs.grAlphaTestReferenceValue = (void *) 2010 GR_DDNAME(grAlphaTestReferenceValue); 2011 gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear); 2014 GR_DDNAME(grAlphaTestReferenceValue); 2015 gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear); 2012 2016 gc->gcFuncs.grBufferNumPending = (void *) 2013 GR_DDNAME(grBufferNumPending); 2014 gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap); 2015 gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode); 2016 gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue); 2017 gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow); 2018 gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine); 2019 gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask); 2017 GR_DDNAME(grBufferNumPending); 2018 gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap); 2019 gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode); 2020 gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue); 2021 gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow); 2022 gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine); 2023 gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask); 2020 2024 gc->gcFuncs.grConstantColorValue = (void *) 2021 GR_DDNAME(grConstantColorValue); 2025 GR_DDNAME(grConstantColorValue); 2022 2026 gc->gcFuncs.grConstantColorValue4 = (void *) 2023 GR_DDNAME(grConstantColorValue4); 2024 gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode); 2025 gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel); 2027 GR_DDNAME(grConstantColorValue4); 2028 gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode); 2029 gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel); 2026 2030 gc->gcFuncs.grDepthBufferFunction = (void *) 2027 GR_DDNAME(grDepthBufferFunction); 2031 GR_DDNAME(grDepthBufferFunction); 2028 2032 gc->gcFuncs.grDepthBufferMode = (void *) GR_DDNAME(grDepthBufferMode); 2029 2030 gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask); 2033 2034 gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask); 2031 2035 gc->gcFuncs.grDisableAllEffects = (void *) 2032 GR_DDNAME(grDisableAllEffects); 2033 gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode); 2034 gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine); 2036 GR_DDNAME(grDisableAllEffects); 2037 gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode); 2038 gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine); 2035 2039 gc->gcFuncs.grDrawPlanarPolygon = (void *) 2036 GR_DDNAME(grDrawPlanarPolygon); 2040 GR_DDNAME(grDrawPlanarPolygon); 2037 2041 gc->gcFuncs.grDrawPlanarPolygonVertexList = (void *) 2038 GR_DDNAME(grDrawPlanarPolygonVertexList); 2039 gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint); 2040 gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon); 2042 GR_DDNAME(grDrawPlanarPolygonVertexList); 2043 gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint); 2044 gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon); 2041 2045 gc->gcFuncs.grDrawPolygonVertexList = (void *) 2042 GR_DDNAME(grDrawPolygonVertexList); 2043 gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle); 2044 gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue); 2045 gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode); 2046 gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable); 2046 GR_DDNAME(grDrawPolygonVertexList); 2047 gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle); 2048 gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue); 2049 gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode); 2050 gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable); 2047 2051 gc->gcFuncs.grGammaCorrectionValue = (void *) 2048 GR_DDNAME(grGammaCorrectionValue); 2049 gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState); 2050 gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown); 2052 GR_DDNAME(grGammaCorrectionValue); 2053 gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState); 2054 gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown); 2051 2055 gc->gcFuncs.grLfbConstantAlpha = (void *) 2052 GR_DDNAME(grLfbConstantAlpha); 2056 GR_DDNAME(grLfbConstantAlpha); 2053 2057 gc->gcFuncs.grLfbConstantDepth = (void *) 2054 GR_DDNAME(grLfbConstantDepth); 2058 GR_DDNAME(grLfbConstantDepth); 2055 2059 gc->gcFuncs.grLfbLock = (void *)GR_DDNAME(grLfbLock); 2056 2060 gc->gcFuncs.grLfbUnlock = (void*)GR_DDNAME(grLfbUnlock); 2057 2061 gc->gcFuncs.grLfbWriteColorFormat = (void *) 2058 GR_DDNAME(grLfbWriteColorFormat); 2062 GR_DDNAME(grLfbWriteColorFormat); 2059 2063 gc->gcFuncs.grLfbWriteColorSwizzle = (void *) 2060 GR_DDNAME(grLfbWriteColorSwizzle); 2061 gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer); 2064 GR_DDNAME(grLfbWriteColorSwizzle); 2065 gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer); 2062 2066 gc->gcFuncs.grSstConfigPipeline = (void *) 2063 GR_DDNAME(grSstConfigPipeline); 2064 gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle); 2065 gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy); 2066 gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen); 2067 gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin); 2067 GR_DDNAME(grSstConfigPipeline); 2068 gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle); 2069 gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy); 2070 gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen); 2071 gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin); 2068 2072 gc->gcFuncs.grSstPassthruMode = (void *) GR_DDNAME(grSstPassthruMode); 2069 2070 gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats); 2073 2074 gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats); 2071 2075 gc->gcFuncs.grSstResetPerfStats = (void *) GR_DDNAME(grSstResetPerfStats); 2072 gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus); 2073 gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn); 2074 gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine); 2075 gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode); 2076 gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine); 2076 gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus); 2077 gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn); 2078 gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine); 2079 gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode); 2080 gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine); 2077 2081 gc->gcFuncs.grTexDownloadMipMapLevelPartial = (void *) 2078 GR_DDNAME(grTexDownloadMipMapLevelPartial); 2079 gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode); 2082 GR_DDNAME(grTexDownloadMipMapLevelPartial); 2083 gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode); 2080 2084 gc->gcFuncs.grTexLodBiasValue = (void *) GR_DDNAME(grTexLodBiasValue); 2081 2085 gc->gcFuncs.grTexMipMapMode = (void *) GR_DDNAME(grTexMipMapMode); 2082 gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 2086 gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 2083 2087 gc->gcFuncs.grTexMultibaseAddress = (void *) 2084 GR_DDNAME(grTexMultibaseAddress); 2085 gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable); 2086 gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource); 2087 gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle); 2088 GR_DDNAME(grTexMultibaseAddress); 2089 gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable); 2090 gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource); 2091 gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle); 2088 2092 gc->gcFuncs.guTexSource = (void *) GR_DDNAME(guTexSource); 2089 gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle); 2090 gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom); 2093 gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle); 2094 gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom); 2091 2095 } /* _grInitializeGCFuncs */ 2092 2096 #endif -
trunk/src/opengl/glide/sst1/glide/glfb.c
r2885 r6653 1 /* $Id: glfb.c,v 1.2 2001-09-05 14:30:53 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/sst1/glide/glfb.c,v 1. 1 2000-02-25 00:31:14 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/glfb.c,v 1.2 2001-09-05 14:30:53 bird Exp $ 21 22 ** $Log: glfb.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:14 sandervl 23 ** Revision 1.2 2001-09-05 14:30:53 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:14 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 23 6/30/97 10:51a Dow 27 31 * Changed size check in grLfbLock to warning 28 * 32 * 29 33 * 22 6/03/97 3:50p Pgj 30 34 * fix bugs 580 and 581 31 * 35 * 32 36 * 21 5/05/97 2:25p Hanson 33 37 * Fixed unlock bug with grLfbUnlock. On Rush it would always return 34 38 * false. 35 * 39 * 36 40 * 20 5/02/97 9:43a Dow 37 41 * Changed indentation to match rest of file, made grLfbLock idle on Jr. 38 * 42 * 39 43 * 19 4/08/97 12:47p Jdt 40 44 * Bug in grLfbUnlock() 41 * 45 * 42 46 * 18 4/02/97 3:24a Hanson 43 47 * Fixed bug with locking read of Auxbuffer on SST1 44 * 48 * 45 49 * 17 3/27/97 9:30p Hanson 46 50 * Fixed my mistake of masking out the no idle bit to late in the 47 51 * grLfbUnlock code. 48 * 52 * 49 53 * 16 3/26/97 5:04p Hanson 50 * 54 * 51 55 * 15 3/19/97 1:37a Jdt 52 56 * Added real stride computation. 53 * 57 * 54 58 * 14 3/18/97 9:07p Dow 55 59 * Got rid of #$#%#$ // comments 56 * 60 * 57 61 * 13 3/13/97 1:18a Jdt 58 62 * Re-wrote grLfbWriteRegion to be faster and also be nice to the fifo. 59 63 * Added grLfbReadRegion for sli boards. Need an sli setup on whihc to 60 64 * test. 61 * 65 * 62 66 * 12 3/12/97 2:54p Jdt 63 67 * Fixes for vg96 64 * 68 * 65 69 * 11 3/12/97 11:11a Jdt 66 70 * Fixed format bug. Fixed yorigin problem. Fixed locking bug. 67 * 71 * 68 72 * 10 3/06/97 9:03p Jdt 69 * Removed Watcom Warning. 70 * 73 * Removed Watcom Warning. 74 * 71 75 * 9 3/05/97 9:35p Jdt 72 76 * Added grLfbWriteRegion 73 * 77 * 74 78 * 8 3/04/97 9:08p Dow 75 79 * Neutered multiplatform multiheaded monster 76 * 80 * 77 81 * 7 2/26/97 11:56a Jdt 78 82 * changed lfb api 79 * 83 * 80 84 * 6 12/23/96 1:37p Dow 81 85 * chagnes for multiplatform glide … … 139 143 -------------------------------------------------------------------*/ 140 144 141 GR_ENTRY(grLfbLock, FxBool,( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, FxBool pixelPipeline, GrLfbInfo_t *info ) ) 145 GR_ENTRY(grLfbLock, FxBool,( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, FxBool pixelPipeline, GrLfbInfo_t *info ) ) 142 146 { 143 147 FxBool rv = FXTRUE; 144 148 FxU32 lockIdle; 145 149 146 150 GR_BEGIN_NOFIFOCHECK("grLfbLock",82); 147 151 GDBG_INFO_MORE((gc->myLevel,"(%d,%d,0x%x)\n", type, buffer, info)); 148 152 149 153 GR_CHECK_F( myName, !info, 150 154 "Null info structure passed." ); … … 154 158 GR_CHECK_W(myName, (info->size != sizeof( GrLfbInfo_t )), 155 159 "Invalid size sent to grLfbLock()"); 156 160 157 161 lockIdle = !(type & GR_LFB_NOIDLE); 158 162 type = type & ~(GR_LFB_NOIDLE); 159 163 160 164 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 161 165 { … … 170 174 } else { 171 175 lfbMode = gc->state.fbi_config.lfbMode; 172 lfbMode &= ~( SST_LFB_READBUFSELECT | 176 lfbMode &= ~( SST_LFB_READBUFSELECT | 173 177 SST_LFB_YORIGIN ); 174 178 175 179 GR_SET_EXPECTED_SIZE( 4 ); 176 180 … … 178 182 if ( (gc->scanline_interleaved == FXTRUE) && 179 183 (gc->lfbSliOk==1) ) { 180 GDBG_INFO((83, 184 GDBG_INFO((83, 181 185 "Read lock failure: read lock" 182 186 " disallowed for SLI, use " … … 196 200 break; 197 201 default: 198 GR_CHECK_F( myName, 199 1, 202 GR_CHECK_F( myName, 203 1, 200 204 "illegal buffer parameter passed" ); 201 205 rv = FXFALSE; … … 221 225 FxU32 lfbMode, zaColor, fbzMode; 222 226 223 227 224 228 if ( gc->lockPtrs[type] != (FxU32)-1 ) { 225 229 GDBG_INFO(( 83, "Write failure due to existing lock" )); … … 227 231 } else { 228 232 GR_SET_EXPECTED_SIZE( 12 ); 229 233 230 234 /* 231 235 ** Set up the constant depth register because it may have been … … 237 241 zaColor |= (gc->state.lfb_constant_alpha << SST_ZACOLOR_ALPHA_SHIFT); 238 242 GR_SET( hw->zaColor, zaColor ); 239 243 240 244 /* 241 245 ** disable depth biasing … … 243 247 fbzMode = gc->state.fbi_config.fbzMode; 244 248 fbzMode &= ~( SST_ENZBIAS ); 245 249 246 250 lfbMode = gc->state.fbi_config.lfbMode; 247 251 lfbMode &= ~( SST_LFB_WRITEBUFSELECT | … … 249 253 SST_LFB_FORMAT | 250 254 SST_LFB_ENPIXPIPE ); 251 255 252 256 switch( writeMode ) { 253 257 case GR_LFBWRITEMODE_RESERVED1: … … 287 291 break; 288 292 default: 289 GR_CHECK_F( myName, 290 1, 293 GR_CHECK_F( myName, 294 1, 291 295 "illegal buffer parameter passed" ); 292 296 break; … … 313 317 not have settled in yet, and the pixel may be read in the wrong 314 318 mode. However, the 2 write above help reduce the chance of this. 315 The proper thing to do is to call grSstIdle() here, but that's 319 The proper thing to do is to call grSstIdle() here, but that's 316 320 too slow. 317 321 */ … … 320 324 info->origin = origin; 321 325 info->writeMode = writeMode; 322 326 323 327 switch( lfbMode & SST_LFB_FORMAT ) { 324 328 case SST_LFB_565: … … 336 340 break; 337 341 } 338 339 if ( rv == FXTRUE ) 342 343 if ( rv == FXTRUE ) 340 344 gc->lockPtrs[type] = buffer; 341 345 } … … 348 352 } 349 353 } 350 354 351 355 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 352 356 switch( type ) { … … 358 362 info->lfbPtr = initGetBufferPtr( buffer, &info->strideInBytes ); 359 363 if ( origin != GR_ORIGIN_UPPER_LEFT ) { 360 GDBG_INFO((gc->myLevel, 364 GDBG_INFO((gc->myLevel, 361 365 "Lock failed because of unsu" 362 366 "pported origin." )); … … 364 368 } 365 369 info->origin = GR_ORIGIN_UPPER_LEFT; 366 if ( rv == FXTRUE ) 370 if ( rv == FXTRUE ) 367 371 gc->lockPtrs[type] = buffer; 368 372 } … … 375 379 info->lfbPtr = initGetBufferPtr( buffer, &info->strideInBytes ); 376 380 if ( !info->lfbPtr ) { 377 GDBG_INFO((gc->myLevel, 381 GDBG_INFO((gc->myLevel, 378 382 "Lock failed because buffer doesn't exist" )); 379 383 rv = FXFALSE; 380 384 } 381 385 if ( origin != GR_ORIGIN_UPPER_LEFT ) { 382 GDBG_INFO((gc->myLevel, 386 GDBG_INFO((gc->myLevel, 383 387 "Lock failed because of unsupported origin." )); 384 388 rv = FXFALSE; … … 414 418 415 419 if ( pixelPipeline ) { 416 GDBG_INFO((gc->myLevel, 420 GDBG_INFO((gc->myLevel, 417 421 "Lock failed because pixelpipeline is not available on VG96." )); 418 422 rv = FXFALSE; … … 420 424 info->writeMode = writeMode; 421 425 info->origin = GR_ORIGIN_UPPER_LEFT; 422 if ( rv == FXTRUE ) 426 if ( rv == FXTRUE ) 423 427 gc->lockPtrs[type] = buffer; 424 GDBG_INFO(( gc->myLevel, 428 GDBG_INFO(( gc->myLevel, 425 429 "Write Lock Successful: ptr=0x%.08x stride=%.04d\n", 426 430 info->lfbPtr, … … 445 449 GR_RETURN( rv ); 446 450 } /* grLfbLock */ 447 451 448 452 /*------------------------------------------------------------------- 449 453 Function: grLfbUnlock … … 455 459 Arguments: 456 460 type - type of lock ( read only/write only ) 457 buffer - which buffer to unlock 461 buffer - which buffer to unlock 458 462 Return: 459 463 FXTRUE - success … … 464 468 { 465 469 FxBool rval = FXFALSE; 466 470 467 471 GR_BEGIN_NOFIFOCHECK("grLfbUnLock",83 ); 468 472 GDBG_INFO_MORE((gc->myLevel,"(%d, %d)\n", type, buffer )); 469 473 470 474 type = type & ~(GR_LFB_NOIDLE); 471 472 GR_CHECK_F( myName, 475 476 GR_CHECK_F( myName, 473 477 type != GR_LFB_WRITE_ONLY && 474 478 type != GR_LFB_READ_ONLY, 475 479 "Bad type" ); 476 477 GR_CHECK_F( myName, 480 481 GR_CHECK_F( myName, 478 482 buffer != GR_BUFFER_FRONTBUFFER && 479 483 buffer != GR_BUFFER_BACKBUFFER && 480 484 buffer != GR_BUFFER_AUXBUFFER, 481 485 "Bad buffer" ); 482 483 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 486 487 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 484 488 if ( gc->lockPtrs[type] == (FxU32)buffer ) { 485 489 rval = FXTRUE; … … 493 497 /* Restore depth bias level */ 494 498 GR_SET( hw->zaColor, gc->state.fbi_config.zaColor ); 495 499 496 500 /* turn back on depth biasing */ 497 501 GR_SET( hw->fbzMode, gc->state.fbi_config.fbzMode ); 498 502 499 if ( gc->scanline_interleaved == FXTRUE ) 503 if ( gc->scanline_interleaved == FXTRUE ) 500 504 GR_SET( hw->nopCMD, 0x0 ); 501 505 … … 542 546 GR_SET( hw->lfbMode, lfbMode ); 543 547 gc->state.fbi_config.lfbMode = lfbMode; 544 if ( gc->scanline_interleaved == FXTRUE ) 548 if ( gc->scanline_interleaved == FXTRUE ) 545 549 GR_SET( hw-> nopCMD, 0x0 ); 546 550 GR_END_SLOPPY(); … … 580 584 GR_SET( hw->lfbMode, lfbMode ); 581 585 gc->state.fbi_config.lfbMode = lfbMode; 582 if ( gc->scanline_interleaved == FXTRUE ) 586 if ( gc->scanline_interleaved == FXTRUE ) 583 587 GR_SET( hw-> nopCMD, 0x0 ); 584 588 GR_END_SLOPPY(); … … 599 603 dst_x,dst_y - destination image start coordinates 600 604 src_format - data format of source image 601 src_width, src_height 605 src_width, src_height 602 606 - dimensions of source image 603 607 src_stride - stride of source image in bytes, not meaningful 604 608 for RLE images 605 src_data - pointer to source data memory 609 src_data - pointer to source data memory 606 610 Return: 607 611 FXTRUE succeed 608 612 FXFALSE fail 609 613 -------------------------------------------------------------------*/ 610 GR_ENTRY(grLfbWriteRegion, FxBool, ( GrBuffer_t dst_buffer, 611 FxU32 dst_x, FxU32 dst_y, 612 GrLfbSrcFmt_t src_format, 613 FxU32 src_width, FxU32 src_height, 614 GR_ENTRY(grLfbWriteRegion, FxBool, ( GrBuffer_t dst_buffer, 615 FxU32 dst_x, FxU32 dst_y, 616 GrLfbSrcFmt_t src_format, 617 FxU32 src_width, FxU32 src_height, 614 618 FxI32 src_stride, void *src_data )) 615 619 { … … 617 621 GrLfbInfo_t info; 618 622 GrLfbWriteMode_t writeMode; 619 623 620 624 GR_BEGIN_NOFIFOCHECK("grLfbWriteRegion",82); 621 625 GDBG_INFO_MORE((gc->myLevel, 622 "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n", 623 dst_buffer, dst_x, dst_y, 626 "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n", 627 dst_buffer, dst_x, dst_y, 624 628 src_format, src_width, src_height, 625 629 src_stride, src_data )); 626 630 627 631 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 628 if ( src_format == GR_LFB_SRC_FMT_RLE16 ) 632 if ( src_format == GR_LFB_SRC_FMT_RLE16 ) 629 633 writeMode = GR_LFBWRITEMODE_565; 630 else 634 else 631 635 writeMode = src_format; 632 636 633 637 info.size = sizeof( info ); 634 635 if ( grLfbLock( GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE, 636 dst_buffer, 638 639 if ( grLfbLock( GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE, 640 dst_buffer, 637 641 writeMode, 638 642 GR_ORIGIN_UPPER_LEFT, … … 647 651 FxU32 scanline; /* scanline number */ 648 652 int aligned; /* word aligned? */ 649 650 653 654 651 655 srcData = ( FxU32 * ) src_data; 652 656 dstData = ( FxU32 * ) ( ((char*)info.lfbPtr)+ 653 657 (dst_y*info.strideInBytes) ); 654 658 scanline = src_height; 655 659 656 660 switch( src_format ) { 657 661 /* 16-bit aligned */ … … 674 678 srcData++; 675 679 } 676 680 677 681 if ( ((int)length) & 0x2 ) { 678 682 GR_SET16( (*(FxU16*)&(dstData[0])), … … 681 685 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 682 686 } 683 687 684 688 dstData = (FxU32*)(((char*)dstData)+dstJump); 685 689 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 690 694 GR_SET_EXPECTED_SIZE(length); 691 695 end = (FxU32*)((char*)srcData + length - 2); 692 696 693 697 GR_SET16( (*(FxU16*)&(dstData[0])), 694 698 (*(FxU16*)&(srcData[0])) ); 695 699 dstData = (FxU32*)(((FxU16*)dstData) + 1 ); 696 700 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 697 701 698 702 while( srcData < end ) { 699 703 GR_SET( dstData[0], srcData[0] ); … … 701 705 srcData++; 702 706 } 703 707 704 708 if ( !(length & 0x2) ) { 705 709 GR_SET16( (*(FxU16*)&(dstData[0])), … … 708 712 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 709 713 } 710 714 711 715 dstData = (FxU32*)(((char*)dstData)+dstJump); 712 716 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 751 755 rv = FXFALSE; 752 756 GR_RETURN( rv ); 753 } else 757 } else 754 758 writeMode = src_format; 755 759 756 760 info.size = sizeof( info ); 757 761 758 762 if ( grLfbLock( GR_LFB_WRITE_ONLY, 759 dst_buffer, 763 dst_buffer, 760 764 writeMode, 761 765 GR_ORIGIN_UPPER_LEFT, … … 770 774 FxU32 scanline; /* scanline number */ 771 775 int aligned; /* word aligned? */ 772 773 776 777 774 778 srcData = ( FxU32 * ) src_data; 775 779 dstData = ( FxU32 * ) ( ((char*)info.lfbPtr)+ … … 784 788 while( scanline-- ) { 785 789 end = (FxU32*)((char*)srcData + length - 2); 786 while( srcData < end ) 790 while( srcData < end ) 787 791 *dstData++ = *srcData++; 788 792 789 793 if ( ((int)length) & 0x2 ) { 790 794 *(FxU16*)dstData = *(FxU16*)srcData; … … 792 796 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 793 797 } 794 798 795 799 dstData = (FxU32*)(((char*)dstData)+dstJump); 796 800 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 799 803 while( scanline-- ) { 800 804 end = (FxU32*)((char*)srcData + length - 2); 801 805 802 806 *(FxU16*)dstData = *(FxU16*)srcData; 803 807 dstData = (FxU32*)(((FxU16*)dstData) + 1 ); 804 808 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 805 806 while( srcData < end ) 809 810 while( srcData < end ) 807 811 *dstData++ = *srcData++; 808 812 809 813 if ( !(((int)length) & 0x2) ) { 810 814 *(FxU16*)dstData = *(FxU16*)srcData; … … 812 816 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 813 817 } 814 818 815 819 dstData = (FxU32*)(((char*)dstData)+dstJump); 816 820 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 821 825 rv = FXFALSE; 822 826 } 823 #else 824 # error "No grLfbWriteRegion Implementation for this platform" 827 #else 828 # error "No grLfbWriteRegion Implementation for this platform" 825 829 #endif 826 830 GR_RETURN( rv ); … … 836 840 Grab a rectangle from the frame buffer into user supplied memory 837 841 Arguments: 838 src_buffer - buffer to read from 842 src_buffer - buffer to read from 839 843 src_x - x coordinate of upper left corner rectangle to read 840 844 src_y - y coordinate of upper left corner of rectangle to read … … 847 851 FXFALSE - failure 848 852 -------------------------------------------------------------------*/ 849 GR_ENTRY(grLfbReadRegion, FxBool, ( GrBuffer_t src_buffer, 850 FxU32 src_x, FxU32 src_y, 851 FxU32 src_width, FxU32 src_height, 853 GR_ENTRY(grLfbReadRegion, FxBool, ( GrBuffer_t src_buffer, 854 FxU32 src_x, FxU32 src_y, 855 FxU32 src_width, FxU32 src_height, 852 856 FxU32 dst_stride, void *dst_data )) 853 857 { 854 858 FxBool rv = FXTRUE; 855 859 GrLfbInfo_t info; 856 860 857 861 GR_BEGIN_NOFIFOCHECK("grLfbReadRegion",82); 858 862 GDBG_INFO_MORE((gc->myLevel, … … 860 864 src_buffer, src_x, src_y, 861 865 src_width, src_height, dst_stride, dst_data )); 862 866 863 867 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 864 868 gc->lfbSliOk = 1; 865 869 info.size = sizeof( info ); 866 870 if ( grLfbLock( GR_LFB_READ_ONLY, 867 src_buffer, 871 src_buffer, 868 872 GR_LFBWRITEMODE_ANY, 869 873 GR_ORIGIN_UPPER_LEFT, … … 879 883 int aligned; /* word aligned? */ 880 884 FxU32 odd; /* is src_y odd? ( for sli ) */ 881 885 882 886 dstData = ( FxU32 * ) dst_data; 883 887 srcData = ( FxU32 * ) ( ((char*)info.lfbPtr)+ … … 890 894 aligned = !((int)srcData&0x2); 891 895 odd = (src_y+src_height) & 0x1; 892 896 893 897 if ( aligned ) { 894 898 while( scanline-- ) { … … 902 906 } 903 907 904 while( srcData < end ) 908 while( srcData < end ) 905 909 *dstData++ = *srcData++; 906 910 907 911 if ( ((int)length) & 0x2 ) { 908 912 (*(FxU16*)dstData) = (*(FxU16*)srcData); … … 910 914 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 911 915 } 912 916 913 917 dstData = (FxU32*)(((char*)dstData)+dstJump); 914 918 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 917 921 while( scanline-- ) { 918 922 end = (FxU32*)((char*)srcData + length - 2); 919 923 920 924 if(gc->scanline_interleaved == FXTRUE) { 921 925 if((scanline+odd) & 0x1) … … 937 941 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 938 942 } 939 943 940 944 dstData = (FxU32*)(((char*)dstData)+dstJump); 941 945 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 943 947 } 944 948 grLfbUnlock( GR_LFB_READ_ONLY, src_buffer ); 945 if ( gc->scanline_interleaved ) 949 if ( gc->scanline_interleaved ) 946 950 sst1InitSliPciOwner( gc->base_ptr, SST_SLI_MASTER_OWNPCI ); 947 951 } else { … … 951 955 info.size = sizeof( info ); 952 956 if ( grLfbLock( GR_LFB_READ_ONLY, 953 src_buffer, 957 src_buffer, 954 958 GR_LFBWRITEMODE_ANY, 955 959 GR_ORIGIN_UPPER_LEFT, … … 964 968 FxU32 scanline; /* scanline number */ 965 969 int aligned; /* word aligned? */ 966 970 967 971 dstData = ( FxU32 * ) dst_data; 968 972 srcData = ( FxU32 * ) ( ((char*)info.lfbPtr)+ … … 974 978 srcJump = info.strideInBytes - length; 975 979 aligned = !((int)srcData&0x2); 976 980 977 981 if ( aligned ) { 978 982 while( scanline-- ) { 979 983 end = (FxU32*)((char*)srcData + length - 2); 980 984 981 while( srcData < end ) 985 while( srcData < end ) 982 986 *dstData++ = *srcData++; 983 987 984 988 if ( ((int)length) & 0x2 ) { 985 989 (*(FxU16*)dstData) = (*(FxU16*)srcData); … … 987 991 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 988 992 } 989 993 990 994 dstData = (FxU32*)(((char*)dstData)+dstJump); 991 995 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 994 998 while( scanline-- ) { 995 999 end = (FxU32*)((char*)srcData + length - 2); 996 1000 997 1001 (*(FxU16*)dstData) = (*(FxU16*)srcData); 998 1002 dstData = (FxU32*)(((FxU16*)dstData) + 1 ); … … 1007 1011 srcData = (FxU32*)(((FxU16*)srcData) + 1 ); 1008 1012 } 1009 1013 1010 1014 dstData = (FxU32*)(((char*)dstData)+dstJump); 1011 1015 srcData = (FxU32*)(((char*)srcData)+srcJump); … … 1016 1020 rv = FXFALSE; 1017 1021 } 1018 #else 1019 # error "No grLfbReadRegion Implementation for this platform" 1022 #else 1023 # error "No grLfbReadRegion Implementation for this platform" 1020 1024 #endif 1021 1025 GR_RETURN( rv ); -
trunk/src/opengl/glide/sst1/glide/gmovie.c
r2885 r6653 1 /* $Id: gmovie.c,v 1.2 2001-09-05 14:30:53 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/sst1/glide/gmovie.c,v 1. 1 2000-02-25 00:31:16 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gmovie.c,v 1.2 2001-09-05 14:30:53 bird Exp $ 21 22 ** $Log: gmovie.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:16 sandervl 23 ** Revision 1.2 2001-09-05 14:30:53 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:16 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 3 3/09/97 10:31a Dow 27 31 * Added GR_DIENTRY for di glide functions -
trunk/src/opengl/glide/sst1/glide/gpci.c
r2885 r6653 1 /* $Id: gpci.c,v 1.2 2001-09-05 14:30:53 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/sst1/glide/gpci.c,v 1. 1 2000-02-25 00:31:17 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gpci.c,v 1.2 2001-09-05 14:30:53 bird Exp $ 21 22 ** $Log: gpci.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:17 sandervl 23 ** Revision 1.2 2001-09-05 14:30:53 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:17 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 45 11/01/97 12:11p Pgj 27 31 * glide.dll ---> glide2x.dll 28 * 32 * 29 33 * 44 10/21/97 8:20p Atai 30 34 * initialize vid timing to NLLL 31 * 35 * 32 36 * 43 8/18/97 3:11p Atai 33 37 * fix vg96 fb ram configuration 34 * 38 * 35 39 * 42 7/18/97 5:30p Jdt 36 40 * Fixes for open/shutdown symmetry 37 * 41 * 38 42 * 41 7/12/97 4:58p Dow 39 43 * Added DllMain 40 * 44 * 41 45 * 40 7/07/97 8:33a Jdt 42 46 * New tracing macros. 43 * 47 * 44 48 * 39 6/19/97 7:35p Dow 45 49 * More P6 Stuff 46 * 50 * 47 51 * 38 5/27/97 2:03p Dow 48 52 * added new env variable 49 * 53 * 50 54 * 37 5/19/97 7:35p Pgj 51 55 * Print cogent error message if h/w not found 52 * 56 * 53 57 * 36 4/15/97 12:59p Dow 54 58 * Bandaid for SST96/P6 55 * 59 * 56 60 * 35 4/13/97 8:11p Jdt 57 61 * Change in init.h 58 * 62 * 59 63 * 34 4/13/97 2:06p Pgj 60 64 * eliminate all anonymous unions (use hwDep) 61 * 65 * 62 66 * 33 3/24/97 7:37p Dow 63 67 * Now sets n tmus for hwConfig 64 * 68 * 65 69 * 32 3/18/97 9:08p Dow 66 70 * Added FX_GLIDE_NO_DITHER_SUB environment variable 67 * 71 * 68 72 * 31 3/17/97 6:27a Jdt 69 73 * Removed enumCB and pass 0 to enumHardware. 70 * 74 * 71 75 * 30 3/16/97 12:51a Jdt 72 76 * fix num_sst when detecting vg96 73 * 77 * 74 78 * 29 3/16/97 12:39a Jdt 75 79 * Programmatic type-os 76 * 80 * 77 81 * 28 3/16/97 12:19a Jdt 78 82 * Completely re-wrote grSstDetectResources 79 * 83 * 80 84 * 27 3/06/97 4:54p Dow 81 85 * Fixed SLI 82 * 86 * 83 87 * 26 3/04/97 9:08p Dow 84 88 * Neutered multiplatform multiheaded monster 85 * 89 * 86 90 * 25 3/02/97 7:05p Dow 87 91 * Changes to support DOS DLLs 88 * 92 * 89 93 * 24 2/26/97 2:18p Dow 90 94 * moved all debug set macros to __cdecl 91 * 95 * 92 96 * 23 2/26/97 11:57a Jdt 93 97 * Fixed stack bug, fixed splash screen bug 94 * 98 * 95 99 * 22 2/19/97 4:42p Dow 96 100 * Fixed debug build for Watcom 97 * 101 * 98 102 * 21 2/18/97 10:39a Dow 99 103 * Added call to initRegisters for AT3D 100 * 104 * 101 105 * 20 2/18/97 9:51a Jdt 102 106 * Did some casting to remove warnings. 103 * 107 * 104 108 * 19 2/14/97 12:55p Dow 105 109 * moved vg96 fifo wrap into init code 106 * 110 * 107 111 * 18 2/12/97 8:15p Dow 108 112 * Fixed VG base_pointe 109 * 113 * 110 114 * 17 2/12/97 9:20a Dow 111 115 * Fixed Watcom error wrt GDBG_ERROR call 112 * 116 * 113 117 * 16 2/11/97 6:59p Dow 114 118 * Changes to support vid tiles and ser status 115 * 119 * 116 120 * 15 1/18/97 11:48p Dow 117 121 * Re-added error callback set 118 122 * Added support for GMT's register debugging 119 * 123 * 120 124 * 14 1/14/97 6:41p Dow 121 * 125 * 122 126 * 13 12/23/96 1:37p Dow 123 127 * chagnes for multiplatform glide … … 144 148 #include <windows.h> 145 149 146 BOOL WINAPI 147 DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) 150 BOOL WINAPI 151 DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) 148 152 { 149 153 switch( ul_reason_for_call ) { … … 165 169 break; 166 170 } 167 171 168 172 return TRUE; 169 173 … … 181 185 Discover devices on the PCI bus. 182 186 Discover configuration of detected devices. 183 Initialize all Glide GC's 184 187 Initialize all Glide GC's 188 185 189 Recognized devices depend upon compile time flags 186 187 This code should NOT initialize the hardware 188 any more than is necessary for discovery of 190 191 This code should NOT initialize the hardware 192 any more than is necessary for discovery of 189 193 configuration 190 194 191 195 Arguments: none 192 Return: 196 Return: 193 197 FXTRUE - at least one device was detected 194 198 FXFALSE - no devices were detected. 195 199 -------------------------------------------------------------------*/ 196 FxBool 200 FxBool 197 201 _grSstDetectResources(void) 198 202 { … … 206 210 207 211 _GlideRoot.hwConfig.num_sst = 0; 208 for( ctx = 0, device = 0; 209 device < INIT_MAX_DEVICES; 212 for( ctx = 0, device = 0; 213 device < INIT_MAX_DEVICES; 210 214 device++ ) { 211 215 if ( initGetDeviceInfo( device, &info ) ) { … … 213 217 if ( info.hwClass == INIT_VOODOO ) { 214 218 int tmu; 215 219 216 220 _GlideRoot.hwConfig.SSTs[ctx].type = GR_SSTTYPE_VOODOO; 217 221 218 222 _GlideRoot.GCs[ctx].base_ptr = (FxU32 *)info.hwDep.vgInfo.vgBaseAddr; 219 223 _GlideRoot.GCs[ctx].reg_ptr = (FxU32 *)info.hwDep.vgInfo.vgBaseAddr; … … 228 232 _GlideRoot.GCs[ctx].fbuf_size = info.hwDep.vgInfo.pfxRam; 229 233 _GlideRoot.GCs[ctx].vidTimings = NULL; 230 234 231 235 _GlideRoot.hwConfig.num_sst++; 232 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbiRev = 236 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbiRev = 233 237 info.hwDep.vgInfo.pfxRev; 234 238 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbRam = … … 236 240 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.sliDetect = 237 241 info.hwDep.vgInfo.sliDetect; 238 239 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.nTexelfx = 242 243 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.nTexelfx = 240 244 info.hwDep.vgInfo.nTFX; 241 245 … … 245 249 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev = 246 250 info.hwDep.vgInfo.tfxRev; 247 251 248 252 memset(&_GlideRoot.GCs[ctx].tmu_state[tmu], 0, sizeof(_GlideRoot.GCs[ctx].tmu_state[tmu])); 249 253 _GlideRoot.GCs[ctx].tmu_state[tmu].ncc_mmids[0] = GR_NULL_MIPMAP_HANDLE; … … 272 276 273 277 _GlideRoot.hwConfig.num_sst++; 274 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.nTexelfx = 278 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.nTexelfx = 275 279 info.hwDep.vg96Info.nTFX; 276 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.fbRam = 280 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.fbRam = 277 281 info.hwDep.vg96Info.vg96Ram >> 20; 278 282 _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.tmuConfig.tmuRev = … … 285 289 _GlideRoot.GCs[ctx].tmu_state[0].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE; 286 290 _GlideRoot.GCs[ctx].tmu_state[0].total_mem = info.hwDep.vg96Info.tfxRam<<20; 287 288 _GlideRoot.GCs[ctx].hwDep.sst96Dep.serialStatus = 291 292 _GlideRoot.GCs[ctx].hwDep.sst96Dep.serialStatus = 289 293 (FxU32*)info.regs.hwDep.VG96RegDesc.serialStatus; 290 _GlideRoot.GCs[ctx].hwDep.sst96Dep.fifoApertureBase = 294 _GlideRoot.GCs[ctx].hwDep.sst96Dep.fifoApertureBase = 291 295 (FxU32*)info.regs.hwDep.VG96RegDesc.fifoApertureBase; 292 296 … … 297 301 } 298 302 #else 299 #error "Need to define detection parameters for this device" 303 #error "Need to define detection parameters for this device" 300 304 #endif 301 305 } else { … … 303 307 } 304 308 } 305 309 306 310 return rv; 307 311 } /* _grSstDetectResources */ … … 392 396 393 397 if (getenv("FX_CPU")) _GlideRoot.CPUType = atoi(getenv("FX_CPU")); 394 _GlideRoot.environment.triBoundsCheck = 398 _GlideRoot.environment.triBoundsCheck = 395 399 getenv("FX_GLIDE_BOUNDS_CHECK") != NULL; 396 400 _GlideRoot.environment.swapInterval = -1; 397 401 _GlideRoot.environment.swFifoLWM = -1; 398 _GlideRoot.environment.noSplash = 402 _GlideRoot.environment.noSplash = 399 403 getenv("FX_GLIDE_NO_SPLASH") != NULL; 400 _GlideRoot.environment.shamelessPlug = 404 _GlideRoot.environment.shamelessPlug = 401 405 getenv("FX_GLIDE_SHAMELESS_PLUG") != NULL; 402 406 if (getenv("FX_GLIDE_LWM")) 403 407 _GlideRoot.environment.swFifoLWM = atoi(getenv("FX_GLIDE_LWM")); 404 408 if (getenv("FX_GLIDE_SWAPINTERVAL")) { 405 _GlideRoot.environment.swapInterval = 409 _GlideRoot.environment.swapInterval = 406 410 atoi(getenv("FX_GLIDE_SWAPINTERVAL")); 407 411 if (_GlideRoot.environment.swapInterval < 0) … … 418 422 if (getenv("FX_SNAPSHOT")) 419 423 _GlideRoot.environment.snapshot = atoi(getenv("FX_SNAPSHOT")); 420 424 421 425 GDBG_INFO((80," triBoundsCheck: %d\n",_GlideRoot.environment.triBoundsCheck)); 422 426 GDBG_INFO((80," swapInterval: %d\n",_GlideRoot.environment.swapInterval)); … … 426 430 GDBG_INFO((80," cpu: %d\n",_GlideRoot.CPUType)); 427 431 GDBG_INFO((80," snapshot: %d\n",_GlideRoot.environment.snapshot)); 428 GDBG_INFO((80," disableDitherSub: %d\n",_GlideRoot.environment.disableDitherSub)); 432 GDBG_INFO((80," disableDitherSub: %d\n",_GlideRoot.environment.disableDitherSub)); 429 433 /* GMT: BUG these are hardware dependent and really should come from the init code */ 430 434 _GlideRoot.stats.minMemFIFOFree = 0xffff; … … 685 689 "SWAPPENDCMD", 686 690 "reserved96", 687 691 688 692 "reserved96", 689 693 "reserved96", … … 757 761 iaddr,data,data)); 758 762 } 759 else { 763 else { 760 764 /* check for valid register read */ 761 765 int reg; … … 811 815 iaddr,data,data)); 812 816 } 813 else { 817 else { 814 818 /* check for valid register read */ 815 819 int reg; … … 848 852 #endif /* defined(GLIDE_DEBUG) */ 849 853 850 #if defined( GLIDE_DEBUG ) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 854 #if defined( GLIDE_DEBUG ) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 851 855 852 856 extern char *regNames[]; … … 865 869 FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax; 866 870 if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) { 867 GDBG_ERROR( "SET GW CMD", 871 GDBG_ERROR( "SET GW CMD", 868 872 "Fifo address 0x%x out of range(0x%x, 0x%x)\n", 869 addr, 873 addr, 870 874 gc->fifoData.hwDep.vg96FIFOData.fifoVirt, 871 875 gc->fifoData.hwDep.vg96FIFOData.fifoMax ); 872 876 } 873 877 874 878 } 875 879 /* validate alignment */ … … 880 884 } 881 885 /* validate enable bit */ 882 if ( ! (data&0x80000000) ) { 886 if ( ! (data&0x80000000) ) { 883 887 GDBG_ERROR( "SET GW CMD", 884 888 "Fifo command 0x%x missing flag bit\n", … … 886 890 } 887 891 /* validate reserved bits */ 888 if ( data&0x7fE00300 ) { 892 if ( data&0x7fE00300 ) { 889 893 GDBG_ERROR( "SET GW CMD", 890 894 "Fifo command 0x%x reserved bits set!\n", … … 892 896 } 893 897 894 GDBG_INFO((128, 898 GDBG_INFO((128, 895 899 "Writing Group Write Command: 0x%x\n", 896 900 data )); 897 GDBG_INFO((128, 901 GDBG_INFO((128, 898 902 " FIFO ADDR: 0x%.08x\n", addr )); 899 903 /* dump chip field */ … … 901 905 FxU32 field = ( (data<<2) & 0xf0000 ) >> 16; 902 906 GDBG_INFO((128, " Chip Field: 0x%x\n", field )); 903 } 907 } 904 908 /* dump wrap field */ 905 909 { … … 924 928 FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax; 925 929 if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) { 926 GDBG_ERROR( "SET GW CMD", 930 GDBG_ERROR( "SET GW CMD", 927 931 "Fifo address 0x%x out of range(0x%x, 0x%x)\n", 928 addr, 932 addr, 929 933 gc->fifoData.hwDep.vg96FIFOData.fifoVirt, 930 934 gc->fifoData.hwDep.vg96FIFOData.fifoMax ); 931 935 } 932 936 933 937 } 934 938 /* validate alignment */ … … 938 942 addr ); 939 943 } 940 GDBG_INFO((128, 944 GDBG_INFO((128, 941 945 "Writing Group Write Header: 0x%x\n", 942 946 data )); 943 GDBG_INFO((128, 947 GDBG_INFO((128, 944 948 " FIFO ADDR: 0x%.08x\n", addr )); 945 949 /* validate bits - at least one must be set*/ … … 976 980 FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax; 977 981 if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) { 978 GDBG_ERROR( "SET GW CMD", 982 GDBG_ERROR( "SET GW CMD", 979 983 "Fifo address 0x%x out of range(0x%x, 0x%x)\n", 980 addr, 984 addr, 981 985 gc->fifoData.hwDep.vg96FIFOData.fifoVirt, 982 986 gc->fifoData.hwDep.vg96FIFOData.fifoMax ); 983 987 } 984 988 985 989 } 986 990 /* validate alignment */ … … 994 998 GDBG_ERROR( "SET GW ENTRY", 995 999 "Group write entry attempted outside of a packet\n" ); 996 } 997 GDBG_INFO((128, 1000 } 1001 GDBG_INFO((128, 998 1002 "Writing Group Write Entry\n" )); 999 GDBG_INFO((128, 1003 GDBG_INFO((128, 1000 1004 " FIFO ADDR: 0x%.08x\n", addr )); 1001 1005 /* decode write */ … … 1005 1009 bit = 1; 1006 1010 write = 0; 1007 1011 1008 1012 while( bit ) { 1009 1013 if ( bit & thisMask ) { … … 1014 1018 reg++; 1015 1019 } 1016 1020 1017 1021 if ( bit ) { 1018 GDBG_INFO((128, 1022 GDBG_INFO((128, 1019 1023 " REG: %s DATA: 0x%x(%f)\n", 1020 1024 regNames[reg], … … 1022 1026 *(float*)&data )); 1023 1027 } else { 1024 GDBG_INFO((128, 1028 GDBG_INFO((128, 1025 1029 " PADDING\n" )); 1026 1030 } -
trunk/src/opengl/glide/sst1/glide/gsplash.c
r2885 r6653 1 /* $Id: gsplash.c,v 1.2 2001-09-05 14:30:53 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/sst1/glide/gsplash.c,v 1. 1 2000-02-25 00:31:17 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gsplash.c,v 1.2 2001-09-05 14:30:53 bird Exp $ 21 22 ** $Log: gsplash.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:17 sandervl 23 ** Revision 1.2 2001-09-05 14:30:53 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:17 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 14 12/19/97 8:09a Peter 27 31 * fog table propogation 28 * 32 * 29 33 * 13 7/07/97 3:05p Dow 30 34 * Moved fouled clears 31 * 35 * 32 36 * 12 3/18/97 9:07p Dow 33 37 * Got rid of #$#%#$ // comments 34 * 38 * 35 39 * 11 3/16/97 12:42a Jdt 36 40 * Removed watcom warning 37 * 41 * 38 42 * 10 3/13/97 10:53p Jdt 39 43 * Rewrote with simple optimizations. Changed prototype for 40 44 * multi-resolution, and running as a better shameless plug. 41 * 45 * 42 46 * 9 3/13/97 2:52a Jdt 43 47 * Added arguments to splash. 44 * 48 * 45 49 * 8 3/09/97 10:31a Dow 46 50 * Added GR_DIENTRY for di glide functions 47 * 51 * 48 52 * 7 3/01/97 6:24p Jdt 49 53 * Made splash force yorigin. 50 * 54 * 51 55 * 6 1/02/97 1:06p Dow 52 56 * Fixed state bug 53 * 57 * 54 58 * 3 11/17/96 11:16p Garymct 55 59 * Updated grSplash code to set all of the necessary state itself rather … … 119 123 -----------------------------*/ 120 124 /* xScale, xOffset, yScale, yOffset */ 121 static float viewPort[4] = { 122 480.0f, 320.0f, 123 480.0f, 240.0f 125 static float viewPort[4] = { 126 480.0f, 320.0f, 127 480.0f, 240.0f 124 128 }; 125 129 … … 239 243 240 244 static void vecMatMult( float *dstVec, float *srcVec, float *matrix ) { 241 dstVec[0] = 245 dstVec[0] = 242 246 srcVec[0] * matrix[0] + 243 247 srcVec[1] * matrix[4] + 244 248 srcVec[2] * matrix[8] + 245 249 matrix[12]; 246 247 dstVec[1] = 250 251 dstVec[1] = 248 252 srcVec[0] * matrix[1] + 249 253 srcVec[1] * matrix[5] + 250 254 srcVec[2] * matrix[9] + 251 255 matrix[13]; 252 253 dstVec[2] = 256 257 dstVec[2] = 254 258 srcVec[0] * matrix[2] + 255 259 srcVec[1] * matrix[6] + … … 259 263 260 264 static void normMatMult( float *dstVec, float *srcVec, float *matrix ) { 261 dstVec[0] = 265 dstVec[0] = 262 266 srcVec[0] * matrix[0] + 263 267 srcVec[1] * matrix[4] + 264 268 srcVec[2] * matrix[8]; 265 266 dstVec[1] = 269 270 dstVec[1] = 267 271 srcVec[0] * matrix[1] + 268 272 srcVec[1] * matrix[5] + 269 273 srcVec[2] * matrix[9]; 270 271 dstVec[2] = 274 275 dstVec[2] = 272 276 srcVec[0] * matrix[2] + 273 277 srcVec[1] * matrix[6] + … … 303 307 } 304 308 305 static void setupMaterial( int material_index ) { 309 static void setupMaterial( int material_index ) { 306 310 switch( material_index ) { 307 311 case 0: /* 3d */ … … 329 333 GR_COMBINE_OTHER_TEXTURE, 330 334 FXFALSE ); 331 } 335 } 332 336 break; 333 337 case 1: /* fx */ … … 365 369 } 366 370 367 static void calculateIntensity( int material_index, 368 Vector intensity_factor, 369 371 static void calculateIntensity( int material_index, 372 Vector intensity_factor, 373 int frame ) { 370 374 switch( material_index ) { 371 375 case 0: … … 410 414 int i; 411 415 FxBool aa_a, aa_b, aa_c; 412 416 413 417 for( facenum = 0; facenum < num_faces[objnum]; facenum++ ) { 414 418 material_index = face[objnum][facenum].mat_index; … … 419 423 prev_mat_index = material_index; 420 424 } 421 425 422 426 if( ( material_index != 0 ) && ( pass == 2 ) ) 423 427 continue; 424 428 425 429 aa_a = aa_b = aa_c = FXFALSE; 426 430 if( face[objnum][facenum].aa_edge_flags & 4 ) … … 430 434 if( face[objnum][facenum].aa_edge_flags & 1 ) 431 435 aa_c = FXTRUE; 432 436 433 437 for( i = 0; i < 3; i++ ) { 434 438 float *transformed_vert, *transformed_norm; … … 436 440 int vertnum; 437 441 float factor; 438 442 439 443 vertnum = face[objnum][facenum].v[i]; 440 444 transformed_vert = transformed_verts[vertnum]; 441 445 transformed_norm = transformed_norms[vertnum]; 442 446 v = &vert[objnum][vertnum]; 443 447 444 448 gvert[i].x = transformed_vert[0]; 445 449 gvert[i].y = transformed_vert[1]; … … 448 452 gvert[i].tmuvtx[0].sow = v->s * gvert[i].oow; 449 453 gvert[i].tmuvtx[0].tow = v->t * gvert[i].oow; 450 451 factor = 452 ( ( light[0] * transformed_norm[0] + 453 light[1] * transformed_norm[1] + 454 455 factor = 456 ( ( light[0] * transformed_norm[0] + 457 light[1] * transformed_norm[1] + 454 458 light[2] * transformed_norm[2] ) + 1.0f ) * 127.5f; 455 459 … … 459 463 gvert[i].a = 255.0f; 460 464 } 461 465 462 466 if( pass == 2 ) { 463 467 for( i = 0; i < 3; i++ ) { 464 468 float *transformed_norm; 465 466 transformed_norm = 469 470 transformed_norm = 467 471 transformed_norms[face[objnum][facenum].v[i]]; 468 469 gvert[i].tmuvtx[0].sow = gvert[i].oow * 472 473 gvert[i].tmuvtx[0].sow = gvert[i].oow * 470 474 ( 128.0f + transformed_norm[0] * 128.0f ); 471 gvert[i].tmuvtx[0].tow = gvert[i].oow * 475 gvert[i].tmuvtx[0].tow = gvert[i].oow * 472 476 ( 128.0f + transformed_norm[1] * 128.0f ); 473 477 474 478 gvert[i].r = intensity_factor[0] * 255.0f; 475 479 gvert[i].g = intensity_factor[1] * 255.0f; 476 480 gvert[i].b = intensity_factor[2] * 255.0f; 477 } 478 481 } 482 479 483 grDrawTriangle( &gvert[0], &gvert[1], &gvert[2] ); 480 484 481 485 continue; 482 486 } 483 484 grAlphaBlendFunction( GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, 487 488 grAlphaBlendFunction( GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, 485 489 GR_BLEND_ONE, GR_BLEND_ZERO ); 486 490 /* Do this if 3D. */ 487 491 if( material_index == 0 ) { 488 492 /* 489 * Draw the textured 3D without specular. 493 * Draw the textured 3D without specular. 490 494 */ 491 495 sourceTexture( &textImage ); … … 497 501 FXFALSE ); 498 502 #endif 499 grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 503 grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 500 504 aa_a, aa_b, aa_c ); 501 505 } else if( material_index != 1 ) { … … 507 511 aa_a, aa_b, aa_c ); 508 512 } 509 513 510 514 if( do_phong && ( material_index != 0 ) ) { 511 /* 515 /* 512 516 * figure out texture coords in [0..255.0f] based on the normal 513 517 * the specular highlight. … … 515 519 for( i = 0; i < 3; i++ ) { 516 520 float *transformed_norm; 517 518 transformed_norm = 521 522 transformed_norm = 519 523 transformed_norms[face[objnum][facenum].v[i]]; 520 521 gvert[i].tmuvtx[0].sow = gvert[i].oow * 524 525 gvert[i].tmuvtx[0].sow = gvert[i].oow * 522 526 ( 128.0f + transformed_norm[0] * 128.0f ); 523 gvert[i].tmuvtx[0].tow = gvert[i].oow * 527 gvert[i].tmuvtx[0].tow = gvert[i].oow * 524 528 ( 128.0f + transformed_norm[1] * 128.0f ); 525 529 526 530 gvert[i].r = intensity_factor[0] * 255.0f; 527 531 gvert[i].g = intensity_factor[1] * 255.0f; 528 532 gvert[i].b = intensity_factor[2] * 255.0f; 529 } 530 grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 533 } 534 grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 531 535 aa_a, aa_b, aa_c ); 532 536 } … … 534 538 } 535 539 536 static void intersectLineWithZPlane( Vector result, Vector p1, 540 static void intersectLineWithZPlane( Vector result, Vector p1, 537 541 Vector p2, float z ) { 538 542 float t; 539 543 540 544 t = ( z - p1[2] ) / ( p2[2] - p1[2] ); 541 545 result[0] = p1[0] + ( p2[0] - p1[0] ) * t; … … 548 552 } 549 553 550 static void drawShadow( int frame, int shadow_object_index, 554 static void drawShadow( int frame, int shadow_object_index, 551 555 int receiver_object_index, Vector light_position ) { 552 556 float *shadow_object_matrix; … … 555 559 Vector projected_view_verts[4]; 556 560 int i; 557 561 558 562 Vector local_verts[4] = { 559 563 { -280.0f, 0.0f, -160.0f }, 560 564 { -280.0f, 0.0f, 150.0f }, 561 565 { 280.0f, 0.0f, 150.0f }, 562 { 280.0f, 0.0f, -160.0f } 566 { 280.0f, 0.0f, -160.0f } 563 567 }; 564 568 565 569 float texcoords[4][2] = { 566 570 { 10.5f, 127.5f }, … … 569 573 { 255.0f, 127.5f } 570 574 }; 571 575 572 576 GrVertex gvert[4]; 573 577 GrVertex projected_gvert[4]; 574 578 GrVertex light_gvert; 575 579 576 580 /* 577 * The point relative to the back part of the shield that 581 * The point relative to the back part of the shield that 578 582 * the shadow is going to be projected onto. 579 583 */ 580 584 Vector shadow_light; 581 585 582 586 shadow_light[0] = light_position[0]; 583 587 shadow_light[1] = light_position[1]; 584 588 shadow_light[2] = light_position[2]; 585 589 586 590 shadow_object_matrix = &mat[frame][shadow_object_index][0]; 587 591 receiver_object_matrix = &mat[frame][receiver_object_index][0]; 588 592 589 593 /* 590 * Offset the light by the Z position of 594 * Offset the light by the Z position of 591 595 * the backplane that we are projected 592 596 * onto. 593 597 */ 594 598 shadow_light[2] += receiver_object_matrix[14]; 595 599 596 600 for( i = 0; i < 4; i++ ) { 597 601 vecMatMult( view_verts[i], local_verts[i], shadow_object_matrix ); 598 602 599 603 /* 600 * project . . . 604 * project . . . 601 605 */ 602 606 gvert[i].oow = 1.0f / view_verts[i][2]; 603 gvert[i].x = 604 view_verts[i][0] * gvert[i].oow * viewPort[0] + 607 gvert[i].x = 608 view_verts[i][0] * gvert[i].oow * viewPort[0] + 605 609 viewPort[1] + SNAP_BIAS; 606 gvert[i].y = 607 view_verts[i][1] * gvert[i].oow * viewPort[2] + 610 gvert[i].y = 611 view_verts[i][1] * gvert[i].oow * viewPort[2] + 608 612 viewPort[3] + SNAP_BIAS; 609 613 610 614 /* 611 615 * Set up texture coordinates. … … 614 618 gvert[i].tmuvtx[0].tow = texcoords[i][1] * gvert[i].oow; 615 619 } 616 617 620 621 618 622 /* 619 623 * Intersect each line formed by the light source and a 620 * particular corner of the shadow object with the 624 * particular corner of the shadow object with the 621 625 * plane which the texture is to be projected onto. 622 626 */ … … 624 628 Vector tmpvect; 625 629 float q; 626 627 intersectLineWithZPlane( projected_view_verts[i], 628 shadow_light, 629 view_verts[i], 630 631 intersectLineWithZPlane( projected_view_verts[i], 632 shadow_light, 633 view_verts[i], 630 634 receiver_object_matrix[14] - 26.0f ); 631 635 projected_gvert[i].oow = 1.0f / projected_view_verts[i][2]; 632 projected_gvert[i].x = 636 projected_gvert[i].x = 633 637 projected_view_verts[i][0] * projected_gvert[i].oow * viewPort[0] + 634 638 viewPort[1] + SNAP_BIAS; 635 projected_gvert[i].y = 639 projected_gvert[i].y = 636 640 projected_view_verts[i][1] * projected_gvert[i].oow * viewPort[2] + 637 641 viewPort[3] + SNAP_BIAS; 638 642 639 643 tmpvect[0] = projected_view_verts[i][0] - shadow_light[0]; 640 644 tmpvect[1] = projected_view_verts[i][1] - shadow_light[1]; 641 645 tmpvect[2] = projected_view_verts[i][2] - shadow_light[2]; 642 646 q = vectorMag( tmpvect ); 643 647 644 648 /* 645 649 * Set up texture coordinates. 646 650 */ 647 651 projected_gvert[i].tmuvtx[0].oow = projected_gvert[i].oow * q; 648 projected_gvert[i].tmuvtx[0].sow = 652 projected_gvert[i].tmuvtx[0].sow = 649 653 texcoords[i][0] * projected_gvert[i].oow; 650 projected_gvert[i].tmuvtx[0].tow = 654 projected_gvert[i].tmuvtx[0].tow = 651 655 texcoords[i][1] * projected_gvert[i].oow; 652 656 } 653 657 654 658 light_gvert.oow = 1.0f / shadow_light[2]; 655 light_gvert.x = shadow_light[0] * light_gvert.oow * viewPort[0] + 659 light_gvert.x = shadow_light[0] * light_gvert.oow * viewPort[0] + 656 660 viewPort[1] + SNAP_BIAS; 657 light_gvert.y = shadow_light[1] * light_gvert.oow * viewPort[2] + 661 light_gvert.y = shadow_light[1] * light_gvert.oow * viewPort[2] + 658 662 viewPort[3] + SNAP_BIAS; 659 663 660 664 /* 661 665 * Draw a segment between the light and the point which hits … … 668 672 FXFALSE ); 669 673 sourceTexture( &shadowImage ); 670 674 671 675 grAlphaBlendFunction( GR_BLEND_DST_COLOR, GR_BLEND_ZERO, 672 676 GR_BLEND_ONE, GR_BLEND_ZERO ); 673 674 675 grDrawTriangle( &projected_gvert[0], 676 &projected_gvert[1], 677 678 679 grDrawTriangle( &projected_gvert[0], 680 &projected_gvert[1], 677 681 &projected_gvert[2] ); 678 grDrawTriangle( &projected_gvert[0], 679 &projected_gvert[2], 682 grDrawTriangle( &projected_gvert[0], 683 &projected_gvert[2], 680 684 &projected_gvert[3] ); 681 grDrawTriangle( &projected_gvert[0], 682 &projected_gvert[2], 685 grDrawTriangle( &projected_gvert[0], 686 &projected_gvert[2], 683 687 &projected_gvert[1] ); 684 grDrawTriangle( &projected_gvert[0], 685 &projected_gvert[3], 688 grDrawTriangle( &projected_gvert[0], 689 &projected_gvert[3], 686 690 &projected_gvert[2] ); 687 691 688 692 grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ZERO, 689 693 GR_BLEND_ONE, GR_BLEND_ZERO ); 690 694 691 695 } 692 696 … … 726 730 727 731 /* Check Screen Dimensions and Check Avail of Depth Buffer */ 728 if ( (x > gc->state.screen_width) || 732 if ( (x > gc->state.screen_width) || 729 733 ((x+w) > gc->state.screen_width) || 730 734 ( y > gc->state.screen_height ) || 731 ((y+h) > gc->state.screen_height ) ) 735 ((y+h) > gc->state.screen_height ) ) 732 736 return; 733 737 if ( gc->state.screen_height == 640 ) { … … 745 749 y = (( gc->state.screen_height - 1.0f ) - (h-1.0f) ) - y; 746 750 } 747 751 748 752 viewPort[0] = w * ( 480.0f / 640.0f ); 749 753 viewPort[1] = x + ( w / 2.0f ); … … 775 779 GR_BLEND_ONE, GR_BLEND_ZERO ); 776 780 if ( useTextures ) 777 grTexCombine( GR_TMU0, 781 grTexCombine( GR_TMU0, 778 782 GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, 779 783 GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE, … … 794 798 // grClipWindow( (int)x, (int)y, (int)(x+w), (int)(y+h) ); 795 799 grFogColorValue( 0x0 ); 796 800 797 801 fadeInFrames = (int)(((float)total_num_frames) * FADEIN_END_PERCENT); 798 fadeOutFrames = (int)(((float)total_num_frames) * 802 fadeOutFrames = (int)(((float)total_num_frames) * 799 803 (1.0f - FADEOUT_BEGIN_PERCENT)); 800 804 … … 802 806 for( frame = 1; frame < total_num_frames; frame++ ) { 803 807 int i; 804 808 805 809 /* Set Fog Value For This Frame */ 806 810 if( frame < fadeInFrames ) { 807 unsigned char fval = 808 ((unsigned char)255) - 809 ((unsigned char)( 255.0f * 810 (float)(frame+1) / 811 unsigned char fval = 812 ((unsigned char)255) - 813 ((unsigned char)( 255.0f * 814 (float)(frame+1) / 811 815 (float)fadeInFrames )); 812 816 for( i = 0; i < kInternalFogTableEntryCount; i++ ) … … 816 820 fog = 1; 817 821 } else if( frame > total_num_frames-fadeOutFrames ) { 818 unsigned char fval = 819 ((unsigned char)255) - 822 unsigned char fval = 823 ((unsigned char)255) - 820 824 (unsigned char)(255.0f* 821 825 ((float)(total_num_frames-frame))/ 822 826 ((float)fadeOutFrames)); 823 for( i = 0; i < kInternalFogTableEntryCount; i++ ) 827 for( i = 0; i < kInternalFogTableEntryCount; i++ ) 824 828 fogTable[i] = fval; 825 829 grFogMode( GR_FOG_WITH_TABLE ); … … 831 835 } 832 836 grBufferClear( 0x00000000, 0, GR_WDEPTHVALUE_FARTHEST ); 833 837 834 838 pass = 1; 835 839 … … 843 847 xfAndProj( frame, 2 ); 844 848 drawFaces( frame, 2 ); 845 849 846 850 /* yellow and white part of shield. */ 847 851 xfAndProj( frame, 0 ); … … 878 882 } else { /* Render One Frame */ 879 883 frame = ((_frame>>1) % SPIN_FRAMES)+SPIN_START; 880 884 881 885 grColorMask( FXFALSE, FXFALSE ); 882 886 grBufferClear( 0x00000000, 0, GR_WDEPTHVALUE_FARTHEST ); 883 887 grColorMask( FXTRUE, FXFALSE ); 884 888 885 889 pass = 0xbeef; 886 890 887 891 /* 3Dfx logo */ 888 892 xfAndProj( frame, 1 ); 889 893 drawFaces( frame, 1 ); 890 894 } 891 895 892 896 /* 893 897 * Clean up after yourself! -
trunk/src/opengl/glide/sst1/glide/gsst.c
r2885 r6653 1 /* $Id: gsst.c,v 1.2 2001-09-05 14:30:54 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/sst1/glide/gsst.c,v 1. 1 2000-02-25 00:31:17 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gsst.c,v 1.2 2001-09-05 14:30:54 bird Exp $ 21 22 ** $Log: gsst.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:17 sandervl 23 ** Revision 1.2 2001-09-05 14:30:54 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:17 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 ** 29 ** 26 30 ** 79 7/06/98 3:05p Peter 27 31 ** grSstWinOpen fails triple buffering 28 ** 32 ** 29 33 ** 78 6/04/98 12:13p Peter 30 34 ** splash dll rename 31 ** 35 ** 32 36 ** 77 3/16/98 3:20p Atai 33 37 ** fixed glide in a window bug. OEM DLL code bails out if res can not be 34 38 ** found 35 ** 39 ** 36 40 ** 76 3/02/98 10:42a Atai 37 41 ** remove oemvidtiming for DOS 38 ** 42 ** 39 43 ** 75 2/24/98 10:59a Atai 40 44 ** modify for oem dll 41 ** 45 ** 42 46 ** 74 2/23/98 11:03a Peter 43 ** 47 ** 44 48 ** 73 2/12/98 8:21p Pgj 45 ** 49 ** 46 50 ** 72 2/12/98 6:48p Atai 47 51 ** fix typo 48 ** 52 ** 49 53 ** 71 2/12/98 4:01p Atai 50 54 ** change refresh rate if oemdll updated for tv out 51 * 55 * 52 56 * 70 1/12/98 10:25p Dow 53 57 * H3D Stereo Support 54 * 58 * 55 59 * 69 1/06/98 3:44p Atai 56 60 * fixed tv out related stuff for dos build. 57 * 61 * 58 62 * 68 12/19/97 11:04a Atai 59 63 * oeminit dll stuff 60 * 64 * 61 65 * 67 12/19/97 10:23a Dow 62 66 * Splash Screen stuff 63 * 67 * 64 68 * 66 12/03/97 9:36a Dow 65 69 * Fixed bug in grSstIsBusy() 66 * 70 * 67 71 * 65 12/02/97 7:20p Dow 68 72 * Added code for new splash screen 69 * 73 * 70 74 * 64 10/21/97 8:20p Atai 71 75 * added parameter for vid timing 72 * 76 * 73 77 * 63 10/06/97 1:14p Atai 74 78 * fix bug 824. added sli resolution checking 75 * 79 * 76 80 * 62 9/19/97 1:24p Peter 77 81 * more test27 fun 78 * 82 * 79 83 * 61 9/11/97 1:33p Atai 80 84 * In grSstWinOpen(), checking (nColBuffers+nAuxBuffers) for 81 85 * GR_RESOLUTION_800x600 and GR_RESOLUTION_856x480 82 * 86 * 83 87 * 60 9/10/97 10:13p Peter 84 88 * fifo logic from GaryT, non-normalized fp first cut 85 * 89 * 86 90 * 59 9/07/97 12:25p Pgj 87 * 91 * 88 92 * 58 9/07/97 12:14p Pgj 89 93 * fix bug 697 90 * 94 * 91 95 * 57 8/19/97 8:55p Peter 92 96 * lots of stuff, hopefully no muckage 93 * 97 * 94 98 * 56 7/09/97 10:18a Dow 95 99 * Further Nudge Of Love adjustments 96 * 100 * 97 101 * 55 7/07/97 3:05p Dow 98 102 * Moved some state BEFORE splash screen 99 * 103 * 100 104 * 54 6/26/97 3:09p Dow 101 105 * removed warning 102 * 106 * 103 107 * 53 6/24/97 3:40p Dow 104 108 * Protected Nude of Love 105 * 109 * 106 110 * 52 6/22/97 10:19a Dow 107 111 * Set cpuType filed inf fifoInfo before calling initEnableTransport 108 * 112 * 109 113 * 51 6/21/97 1:05p Dow 110 114 * Made it use the NUDGE_OF_LOVE macro 111 * 115 * 112 116 * 50 6/21/97 12:15p Dow 113 117 * Moved 128 DWORD nudge of love into grSstStatus() 114 * 118 * 115 119 * 49 6/21/97 11:39a Dow 116 120 * Fixed debug assertion 117 * 121 * 118 122 * 48 6/19/97 7:35p Dow 119 123 * More P6 Stuff 120 * 124 * 121 125 * 47 6/11/97 5:30p Pgj 122 126 * fix bug 594 (grSstPerfStats() returns inaccurate data on SLI systems) 123 * 127 * 124 128 * 46 6/05/97 11:15p Pgj 125 * 129 * 126 130 * 45 5/30/97 8:53a Dow 127 131 * Protected int10Called set in grSstWinOpen 128 * 132 * 129 133 * 44 5/28/97 2:11p Dow 130 134 * int10h handler 131 * 135 * 132 136 * 43 5/27/97 2:03p Dow 133 137 * added check for new env variable 134 * 138 * 135 139 * 42 5/22/97 11:25a Dow 136 140 * Fixed bogus polling for idle. 137 * 141 * 138 142 * 41 5/21/97 9:52a Jdt 139 143 * Added grSstControl() implementation for SST-1. 140 * 144 * 141 145 * 40 5/05/97 2:22p Dow 142 146 * Protected previous checkin with SST96 to avoid errors when compiling 143 147 * SST1 144 * 148 * 145 149 * 39 5/05/97 1:35p Dow 146 150 * Changed grSstControl to modify clip1 instead of clip0 147 * 151 * 148 152 * 38 5/04/97 12:48p Dow 149 153 * made grSstControl change clipLeftRight and clipBottomTop via direct 150 154 * writes. 151 * 155 * 152 156 * 37 5/02/97 2:11p Pgj 153 157 * screen_width/height now FxU32 154 * 158 * 155 159 * 36 4/15/97 12:59p Dow 156 160 * Fixed clipping problem 157 * 161 * 158 162 * 35 4/13/97 8:11p Jdt 159 163 * Change in init.h 160 * 164 * 161 165 * 34 4/13/97 2:06p Pgj 162 166 * eliminate all anonymous unions (use hwDep) 163 * 167 * 164 168 * 33 3/20/97 2:18a Dow 165 169 * added a fixme 166 * 170 * 167 171 * 32 3/19/97 10:43p Dow 168 172 * windowsInit stuff 169 * 173 * 170 174 * 31 3/19/97 1:37a Jdt 171 175 * Added some stride computation 172 * 176 * 173 177 * 30 3/18/97 9:55p Jdt 174 178 * Moved resolution guessing into init lib. 175 * 179 * 176 180 * 29 3/17/97 6:28a Jdt 177 181 * Rewrite of grSstWinOpen with new init code in mind. 178 * 182 * 179 183 * 28 3/16/97 12:39a Jdt 180 184 * Moved over to serialstatus stored in hwDep... 181 * 185 * 182 186 * 27 3/14/97 2:36a Murali 183 187 * Removed printfs(), and GDBG_INFO won't work at this stage. 184 * 188 * 185 189 * 26 3/13/97 11:02p Jdt 186 190 * Added new splash in. 187 * 191 * 188 192 * 25 3/13/97 5:54a Murali 189 193 * Second set of changes for WinGlide. 190 * 194 * 191 195 * 24 3/13/97 2:51a Jdt 192 196 * First step towards windowed splash 193 * 197 * 194 198 * 23 3/05/97 2:18p Murali 195 199 * Preliminary changes for Glide in a window. 196 * 200 * 197 201 * 22 3/04/97 9:08p Dow 198 202 * Neutered multiplatform multiheaded monster 199 * 203 * 200 204 * 21 2/26/97 11:58a Jdt 201 205 * Fixed grsstopen and grSstorigin 202 * 206 * 203 207 * 20 2/19/97 4:41p Dow 204 208 * Changed status read to use serial status on SST96 205 * 209 * 206 210 * 19 2/14/97 12:55p Dow 207 211 * moved vg96 fifo wrap into init code 208 * 212 * 209 213 * 18 1/14/97 10:48a Dow 210 214 * Modified grSstStatus to work w/ VG96 211 215 * Made grSstIdle work with either VG or VG96 (via Init HAL) 212 * 216 * 213 217 * 17 12/23/96 1:37p Dow 214 218 * chagnes for multiplatform glide 215 * 219 * 216 220 * 16 11/24/96 9:35a Tarolli 217 221 * it now calls sst1InitNumBoardsInSystem(); instead of doing the work 218 222 * itself 219 * 223 * 220 224 * 15 11/15/96 4:05p Jdt 221 225 * Dllable for vg96 … … 230 234 #include <sst1vid.h> 231 235 232 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 236 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 233 237 #include <init.h> 234 238 #endif … … 248 252 #include <dos.h> 249 253 /* int 10h interrupt handler */ 250 void __interrupt __far 254 void __interrupt __far 251 255 _grInt10Handler() { 252 256 #define FN_NAME "_grInt10Handler" … … 283 287 static patColor disableColor[2] = {PAT_BLACK,PAT_BLACK}; // turn off adapter 284 288 285 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 289 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 286 290 static patColor enableColor[2] = {PAT_YELLOW,PAT_BLACK}; // use top and bottom mode 1 287 291 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) … … 318 322 319 323 static void initState(void) { 320 grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 324 grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 321 325 GR_BLEND_ONE, GR_BLEND_ZERO ); 322 326 grAlphaTestFunction( GR_CMP_ALWAYS ); … … 379 383 } /* setup regs for pageflipping */ 380 384 #endif 381 385 382 386 grDepthBufferFunction( GR_CMP_ALWAYS ); 383 387 grDepthMask( FXFALSE ); 384 388 385 389 grColorCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, 386 390 GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_NONE, … … 392 396 lineLeft.z = lineRight.z = 0.f; 393 397 lineLeft.ooz = lineRight.ooz = 65535.f; 394 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 398 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 395 399 lineLeft.y = lineRight.y = 2.f; 396 400 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 397 401 lineLeft.y = lineRight.y = grSstScreenHeight() - H3DHEIGHT_FROM_REZ(gc->grSstRez) + 2.f; 398 402 #endif 399 403 400 404 grColorMask(FXTRUE,0); 401 405 grDepthBufferFunction( GR_CMP_ALWAYS ); … … 416 420 drawlinefb(&lineLeft, &lineRight); 417 421 lineLeft.y = ++lineRight.y; 418 422 419 423 grConstantColorValue( 0 ); 420 424 drawlinefb(&lineLeft, &lineRight); 421 425 lineLeft.y = ++lineRight.y; 422 426 } 423 427 424 428 for (line = 0; line < 2; line++) { 425 429 grConstantColorValue( patColorToGR(enable?(getGetIntKeyValue("\\SOFTWARE\\H3D\\TBMODE")==1?enableColor[line]:enableColor2[line]):disableColor[line],format) ); 426 430 drawlinefb(&lineLeft, &lineRight); 427 431 lineLeft.y = ++lineRight.y; 428 432 429 433 grConstantColorValue( 0 ); 430 434 drawlinefb(&lineLeft, &lineRight); … … 433 437 434 438 // wait for adapter sync-up 435 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 439 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 436 440 for(line = 40; line>0; line--) { 437 441 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) … … 453 457 grGlideSetState(&state); // restore app. state 454 458 455 // restore 459 // restore 456 460 #if (GLIDE_PLATFORM & GLIDE_HW_SST1) 457 461 if (GR_RESOLUTION_IS_AUTOFLIPPED(gc->grSstRez)) { … … 489 493 Initialize the selected SST 490 494 491 Initialization has 4 Steps 492 493 Video Init - 495 Initialization has 4 Steps 496 497 Video Init - 494 498 In the full screen case this includes setting the requested 495 resolution/refresh state and allocating any necessary OS 496 resource for the GC. 499 resolution/refresh state and allocating any necessary OS 500 resource for the GC. 497 501 498 502 In the windowed case, this involves acquiring all necessary 499 503 surfaces for rendering, back buffer and memory fifo 500 504 501 Also perform any work necessary to enable access to 3D 505 Also perform any work necessary to enable access to 3D 502 506 registers 503 507 … … 505 509 Assuming video registers are in a reset state, initialize 506 510 the appropriate command transport mechanism. All writes 507 to hardware prior to this action are direct writes, 511 to hardware prior to this action are direct writes, 508 512 afterwards, most commands will go throught the command 509 513 transport 510 514 511 GC Init - 515 GC Init - 512 516 Initialize the current GC based on the user requested 513 517 open parameters and command transport data reported 514 518 during initialization. 515 519 516 3D State Init - 517 Push an initial state onto all of the 3D state registers. 518 520 3D State Init - 521 Push an initial state onto all of the 3D state registers. 522 519 523 Arguments: 520 hwnd - pointer to a window handle or null. If NULL, then 524 hwnd - pointer to a window handle or null. If NULL, then 521 525 the application window handle will be inferred though 522 526 the GetActiveWindow() api. … … 540 544 FXTRUE - glide successfully acquired the necessary resources and a 541 545 is ready for rendering 542 FXFALSE - glide was unsuccessful in getting the necessary resources, 546 FXFALSE - glide was unsuccessful in getting the necessary resources, 543 547 or the requested configuration is unavailble on the host 544 548 hardware - any calls to glide rendering routines will result 545 549 in undefined behavior. 546 550 -------------------------------------------------------------------*/ 547 GR_ENTRY(grSstWinOpen, FxBool, ( 551 GR_ENTRY(grSstWinOpen, FxBool, ( 548 552 FxU32 hWnd, 549 GrScreenResolution_t resolution, 550 GrScreenRefresh_t refresh, 551 GrColorFormat_t format, 552 GrOriginLocation_t origin, 553 GrScreenResolution_t resolution, 554 GrScreenRefresh_t refresh, 555 GrColorFormat_t format, 556 GrOriginLocation_t origin, 553 557 int nColBuffers, 554 558 int nAuxBuffers)) … … 559 563 int xres, yres, fbStride; 560 564 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 561 FARPROC 562 oemInitMapBoard = NULL, 563 oemInitSetVideo = NULL, 565 FARPROC 566 oemInitMapBoard = NULL, 567 oemInitSetVideo = NULL, 564 568 oemInitVideoTiming = NULL; 565 569 OemInitInfo oemi; … … 579 583 #if (GLIDE_PLATFORM & GLIDE_HW_SST1) 580 584 /* The current init code does not do triple buffering, and we would 581 * have the same bug as v2 for lfb reads when triple buffering if 585 * have the same bug as v2 for lfb reads when triple buffering if 582 586 * we added this back. 583 587 */ 584 588 rv = (nColBuffers < 3); 585 589 if (!rv) { 586 GDBG_INFO(( gc->myLevel, 590 GDBG_INFO(( gc->myLevel, 587 591 "grSstWinOpen failed because sst1 cannot really triple buffer\n")); 588 goto BAILOUT; 592 goto BAILOUT; 589 593 } 590 594 #endif /* (GLIDE_PLATFORM & GLIDE_HW_SST1) */ … … 602 606 (initMapBoard(_GlideRoot.current_sst) != NULL))) return FXFALSE; 603 607 } 604 608 605 609 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && (!defined(GLIDE_DEBUG) || (GLIDE_DEBUG == 0)) 606 610 /* … … 631 635 Validate and Parse Arguments 632 636 ------------------------------------------------------*/ 633 /* 634 FIXME!! jdt 635 636 There needs to be one large table of resolutions vs. 637 /* 638 FIXME!! jdt 639 640 There needs to be one large table of resolutions vs. 637 641 nColBuffers vs. nAuxBuffers that specifies required 638 642 ram and vald/invalid configurations … … 679 683 } 680 684 #endif 681 682 #if ( 1 ) 685 686 #if ( 1 ) 683 687 /*------------------------------------------------------ 684 688 Video Init … … 688 692 ** initialize video timing data for oemdll 689 693 ** if tv out component exist, the oem dll need to modify the vidtiming 690 ** data in oemi. Glide will take the changes and pass it to 694 ** data in oemi. Glide will take the changes and pass it to 691 695 ** sst1InitVideoBuffers() 692 696 */ … … 707 711 oemi.vid.clkFreq16bpp = tvVidtiming.clkFreq16bpp; 708 712 oemi.vid.clkFreq24bpp = tvVidtiming.clkFreq24bpp; 709 713 710 714 if (gc->oemInit) { 711 if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) && 715 if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) && 712 716 (oemInitMapBoard)) 713 717 oemvidtiming = oemInitVideoTiming(&oemi); … … 734 738 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 735 739 if (oemvidtiming) 736 rv = initSetVideo( hWnd, resolution, 737 oemi.vid.refresh, format, origin, 740 rv = initSetVideo( hWnd, resolution, 741 oemi.vid.refresh, format, origin, 738 742 nColBuffers, nAuxBuffers, 739 743 &xres, &yres, &fbStride, &tvVidtiming ); 740 744 else 741 745 #endif 742 rv = initSetVideo( hWnd, resolution, 743 refresh, format, origin, 746 rv = initSetVideo( hWnd, resolution, 747 refresh, format, origin, 744 748 nColBuffers, nAuxBuffers, 745 749 &xres, &yres, &fbStride, _GlideRoot.GCs[_GlideRoot.current_sst].vidTimings ); 746 750 if ( !rv ) goto BAILOUT; 747 GDBG_INFO((gc->myLevel, 751 GDBG_INFO((gc->myLevel, 748 752 " Video init succeeded. xRes = %.04d, yRes = %.04d\n", 749 753 xres, yres )); … … 751 755 #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) 752 756 if (gc->oemInit) { 753 if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) && 757 if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) && 754 758 (oemInitMapBoard)) 755 759 oemInitSetVideo(&oemi); … … 772 776 gc->nopCMD = FXFALSE; 773 777 774 # if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 775 grHints( GR_HINT_FIFOCHECKHINT, 778 # if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 779 grHints( GR_HINT_FIFOCHECKHINT, 776 780 fifoInfo.hwDep.vgFIFOData.memFifoStatusLwm + 0x100 ); 777 781 _grReCacheFifo( 0 ); … … 782 786 gc->hwDep.sst96Dep.int10Called = FXFALSE; 783 787 gc->hwDep.sst96Dep.prevInt10 = NULL; 784 GDBG_INFO((80, "Storing old int 10h interrupt handler (0x%x)\n", gc->hwDep.sst96Dep.prevInt10)); 788 GDBG_INFO((80, "Storing old int 10h interrupt handler (0x%x)\n", gc->hwDep.sst96Dep.prevInt10)); 785 789 786 790 GDBG_INFO((80, "Overriding int 10h interrupt handler\n")); 787 791 _dos_setvect(0x10, _grInt10Handler); 788 792 #endif 789 793 790 794 gc->fifoData = fifoInfo; 791 795 792 GDBG_INFO((120, "After Init: fifoPtr = 0x%x\n", 796 GDBG_INFO((120, "After Init: fifoPtr = 0x%x\n", 793 797 fifoInfo.hwDep.vg96FIFOData.fifoPtr )); 794 798 GDBG_INFO((120, "After Init: fifoSize = 0x%x\n", … … 825 829 gc->lfbSliOk = 0; 826 830 gc->fbStride = fbStride; 827 831 828 832 /* Initialize the read/write registers to all 0 */ 829 833 gc->state.fbi_config.fbzColorPath = 0; … … 840 844 gc->state.fbi_config.color0 = 0; 841 845 gc->state.fbi_config.color1 = 0; 842 for (tmu = 0; tmu < gc->num_tmu; tmu += 1) 846 for (tmu = 0; tmu < gc->num_tmu; tmu += 1) 843 847 { 844 848 FxU32 textureMode = (FxU32)SST_SEQ_8_DOWNLD; 845 if ( (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type == 846 GR_SSTTYPE_VOODOO ) && 849 if ( (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type == 850 GR_SSTTYPE_VOODOO ) && 847 851 (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev == 848 852 0 ) ) … … 862 866 gc->state.tmu_config[tmu].evenOdd = GR_MIPMAPLEVELMASK_BOTH; 863 867 gc->state.tmu_config[tmu].nccTable = GR_NCCTABLE_NCC0; 864 } 868 } 865 869 866 870 /*------------------------------------------------------ 867 3D State Init 871 3D State Init 868 872 ------------------------------------------------------*/ 869 873 GDBG_INFO((gc->myLevel, " 3D State Init\n" )); 870 gc->state.fbi_config.fbzMode = 871 SST_ENRECTCLIP | 872 SST_ENZBIAS | 874 gc->state.fbi_config.fbzMode = 875 SST_ENRECTCLIP | 876 SST_ENZBIAS | 873 877 SST_DRAWBUFFER_BACK; 874 878 875 879 grHints(GR_HINT_ALLOW_MIPMAP_DITHER, 0); 876 880 grSstOrigin( origin ); 877 grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 881 grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 878 882 GR_BLEND_ONE, GR_BLEND_ZERO ); 879 883 grAlphaTestFunction( GR_CMP_ALWAYS ); … … 881 885 grChromakeyMode( GR_CHROMAKEY_DISABLE ); 882 886 grConstantColorValue( ( FxU32 ) ~0 ); 883 grClipWindow( 0, 0, gc->state.screen_width, 887 grClipWindow( 0, 0, gc->state.screen_width, 884 888 gc->state.screen_height ); 885 889 _grColorCombineDelta0Mode( FXFALSE ); … … 910 914 grTexClampMode( GR_TMU2, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP ); 911 915 grTexDetailControl( GR_TMU2, 0, 1, 1.0F ); 912 grTexFilterMode( GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 916 grTexFilterMode( GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 913 917 GR_TEXTUREFILTER_POINT_SAMPLED ); 914 918 grTexLodBiasValue( GR_TMU2, 0.0F); … … 921 925 grTexClampMode( GR_TMU1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP ); 922 926 grTexDetailControl( GR_TMU1, 0, 1, 1.0F ); 923 grTexFilterMode( GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 927 grTexFilterMode( GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 924 928 GR_TEXTUREFILTER_POINT_SAMPLED ); 925 929 grTexLodBiasValue( GR_TMU1, 0.0F); … … 931 935 grTexClampMode( GR_TMU0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP ); 932 936 grTexDetailControl( GR_TMU0, 0, 1, 1.0F ); 933 grTexFilterMode( GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 937 grTexFilterMode( GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 934 938 GR_TEXTUREFILTER_POINT_SAMPLED ); 935 939 grTexLodBiasValue( GR_TMU0, 0.0F); … … 969 973 if (fxSplash = GetProcAddress(newSplash, "_fxSplash@16")) { 970 974 fxSplash(hWnd, gc->state.screen_width, 971 gc->state.screen_height, nAuxBuffers); 972 _GlideRoot.environment.noSplash = 1; 973 } 975 gc->state.screen_height, nAuxBuffers); 976 _GlideRoot.environment.noSplash = 1; 977 } 974 978 } 975 979 } … … 978 982 /* If it's still 0, then do the old one */ 979 983 if (!_GlideRoot.environment.noSplash) { 980 grSplash(0.0f, 0.0f, 984 grSplash(0.0f, 0.0f, 981 985 (float) gc->state.screen_width, 982 986 (float) gc->state.screen_height, … … 1001 1005 Shutdown has 4 steps 1002 1006 1003 3D Idle 1007 3D Idle 1004 1008 the 3D engine must be idled to make sure that there are no 1005 1009 commands executing in the transport when the registers are … … 1037 1041 GDBG_INFO(( gc->myLevel, " 3D Idle\n" )); 1038 1042 initIdle(); 1039 1043 1040 1044 /*-------------------------- 1041 1045 GC Reset … … 1044 1048 gc->open = FXFALSE; 1045 1049 gc->closedP = FXTRUE; 1046 1050 1047 1051 /*-------------------------- 1048 1052 Command Transport Disable … … 1050 1054 GDBG_INFO(( gc->myLevel, " Command Transport Disable\n" )); 1051 1055 initDisableTransport(); 1052 1056 1053 1057 #if (GLIDE_PLATFORM & GLIDE_OS_DOS32) && (GLIDE_PLATFORM & GLIDE_HW_SST96) && defined(GLIDE_DEBUG) 1054 1058 GDBG_INFO((80, "Restoring int 10h interrupt handler (0x%x)\n", gc->hwDep.sst96Dep.prevInt10)); … … 1057 1061 1058 1062 /*-------------------------- 1059 Video Restore 1063 Video Restore 1060 1064 --------------------------*/ 1061 1065 GDBG_INFO(( gc->myLevel, " Restore Video\n" )); … … 1069 1073 #endif 1070 1074 } 1071 1075 1072 1076 GR_END(); 1073 1077 #undef FN_NAME 1074 1078 } /* grSstWinClose */ 1075 1079 1076 GR_ENTRY(grSstControl, FxBool, ( GrControl_t code )) 1080 GR_ENTRY(grSstControl, FxBool, ( GrControl_t code )) 1077 1081 { 1078 #define FN_NAME "grSstControl" 1082 #define FN_NAME "grSstControl" 1079 1083 1080 1084 GR_DCL_GC; 1081 1085 GDBG_INFO((41, "%s: code = 0x%x, windowsInit = %d\n", FN_NAME, 1082 1086 code, _GlideRoot.windowsInit)); 1083 1084 if (_GlideRoot.windowsInit) { 1087 1088 if (_GlideRoot.windowsInit) { 1085 1089 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 1086 1090 /* For VG96, windows haven't been created, so there's no point 1087 * trying to control it. 1091 * trying to control it. 1088 1092 */ 1089 1093 /* Believe it or not, the following code really should be bracketed … … 1098 1102 clipLeftRight, clipBottomTop; 1099 1103 FxU32 nTries; 1100 1104 1101 1105 GR_BEGIN_NOFIFOCHECK(FN_NAME,80); 1102 1106 1103 1107 /* We're either cleaning up or closed so forget about this one. */ 1104 1108 if (gc->closedP) goto __done; … … 1113 1117 } 1114 1118 #endif 1115 1119 1116 1120 GDBG_INFO((80, "%s: initControl returned 0x%x\n", FN_NAME, xRes)); 1117 1121 1118 1122 if (!xRes) return FXFALSE; 1119 1123 1120 1124 yRes = xRes >> 16; 1121 1125 xRes = xRes & 0xffff; 1122 1126 1123 1127 /* !! FIXME +++ this call should properly update the gc->fbStride, 1124 1128 this information is known only to the init layer and needs to be 1125 1129 exposed, it is only really necessary to lfblock right now, 1126 1130 and therefore is returned by initGetBufferPtr */ 1127 1131 1128 1132 gc->state.screen_width = xRes; 1129 1133 gc->state.screen_height = yRes; 1130 1134 1131 1135 /* Wait for Idle. */ 1132 1136 1133 1137 nTries = 0; 1134 1138 do { 1135 1139 if (nTries++ > 999) { 1136 GDBG_INFO((80, "%s: returning FALSE after %d checks for idle\n", 1140 GDBG_INFO((80, "%s: returning FALSE after %d checks for idle\n", 1137 1141 FN_NAME, nTries)); 1138 1142 return FXFALSE; … … 1140 1144 1141 1145 status = GET(hw->status); 1142 1146 1143 1147 } while (status & 0x1); 1144 1148 … … 1166 1170 return ctrlflag; 1167 1171 #endif 1168 1172 1169 1173 } 1170 1174 GDBG_INFO((41, "%s: Returning TRUE\n", FN_NAME)); 1171 1175 return FXTRUE; 1172 1176 1173 1177 } /* grSstControl */ 1174 1178 1175 1179 /*--------------------------------------------------------------------------- 1176 1180 ** grSstPerfStats 1177 */ 1181 */ 1178 1182 1179 1183 GR_ENTRY(grSstPerfStats, void, (GrSstPerfStats_t *pStats)) … … 1225 1229 } 1226 1230 #endif 1227 1231 1228 1232 GR_END(); 1229 1233 } /* grSstPerfStats */ … … 1252 1256 GR_BEGIN_NOFIFOCHECK( "grSstStatus", 85 ); 1253 1257 1254 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 1258 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 1255 1259 P6_NUDGE_OF_LOVE; 1256 1260 #endif … … 1309 1313 if ((busy = initBusy()) == FXFALSE) 1310 1314 gc->nopCMD = FXFALSE; 1311 1315 1312 1316 GDBG_INFO((84,"grSstIsBusy() => 0x%x\n",busy)); 1313 1317 … … 1404 1408 switch (chip) { 1405 1409 case GR_TMU0: 1406 case GR_TMU1: 1410 case GR_TMU1: 1407 1411 case GR_TMU2: 1408 1412 hw = SST_TMU(hw,chip); -
trunk/src/opengl/glide/sst1/glide/gtex.c
r2885 r6653 1 /* $Id: gtex.c,v 1.2 2001-09-05 14:30:54 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/sst1/glide/gtex.c,v 1. 1 2000-02-25 00:31:19 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gtex.c,v 1.2 2001-09-05 14:30:54 bird Exp $ 21 22 ** $Log: gtex.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:19 sandervl 23 ** Revision 1.2 2001-09-05 14:30:54 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:19 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 12 3/04/97 9:08p Dow 27 31 * Neutered multiplatform multiheaded monster 28 * 32 * 29 33 * 11 3/03/97 10:58a Jdt 30 34 * Fixe for 2-pass trilinear 31 * 35 * 32 36 * 10 12/23/96 1:37p Dow 33 37 * chagnes for multiplatform glide … … 63 67 GDBG_INFO_MORE((gc->myLevel,"(%d, %d,%d)\n",tmu,s_clamp_mode,t_clamp_mode)); 64 68 GR_CHECK_TMU(myName, tmu); 65 69 66 70 texturemode = gc->state.tmu_config[tmu].textureMode; 67 71 texturemode &= ~( SST_TCLAMPS | SST_TCLAMPT ); … … 88 92 GR_BEGIN("grTexCombine",88,8+2*PACKER_WORKAROUND_SIZE); 89 93 GDBG_INFO_MORE((gc->myLevel,"(%d, %d,%d, %d,%d, %d,%d)\n", 90 tmu, rgb_function, rgb_factor, 94 tmu, rgb_function, rgb_factor, 91 95 alpha_function, alpha_factor, 92 96 rgb_invert, alpha_invert)); … … 111 115 "unsupported texture alpha combine scale factor" ); 112 116 113 /* tmuMask tells grColorCombineFunction what to turn off an on if 117 /* tmuMask tells grColorCombineFunction what to turn off an on if 114 118 the ccFunc requires texture mapping */ 115 119 texturemode = gc->state.tmu_config[tmu].textureMode; … … 149 153 150 154 /* setup core color combine unit bits */ 151 155 152 156 switch ( rgb_function ) 153 157 { … … 204 208 break; 205 209 } 206 210 207 211 switch ( alpha_function ) 208 212 { … … 259 263 break; 260 264 } 261 262 /* Hack to enable TWO-PASS Trilinear 263 265 266 /* Hack to enable TWO-PASS Trilinear 267 264 268 */ 265 269 if ( texturemode & SST_TRILINEAR ) { … … 333 337 { 334 338 FxU32 tLod; 335 339 336 340 GR_BEGIN("grTexLodBiasValue",88,4+2*PACKER_WORKAROUND_SIZE); 337 341 GDBG_INFO_MORE((gc->myLevel,"(%d,%g)\n",tmu,fvalue)); 338 342 GR_CHECK_TMU(myName,tmu); 339 343 340 344 tLod = gc->state.tmu_config[tmu].tLOD; 341 345 tLod &= ~( SST_LODBIAS ); … … 357 361 Description: 358 362 Sets the mip map mode for the specified TMU 359 "Ex" because glide's grTexMipMapMode is inadequate for 363 "Ex" because glide's grTexMipMapMode is inadequate for 360 364 low level texture memory management 361 365 Arguments: 362 366 tmu - tmu to update 363 mmMode - mipmap mode 367 mmMode - mipmap mode 364 368 One of: 365 369 GR_MIPMAP_DISABLE … … 382 386 GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d)\n",tmu,mmMode,lodBlend)); 383 387 GR_CHECK_TMU(myName,tmu); 384 388 385 389 /*-------------------------------------------------------------- 386 390 Get Current tLod and texMode register values … … 413 417 case GR_MIPMAP_NEAREST: 414 418 /*---------------------------------------------------------- 415 Set LODMIN and LODMAX in the tLod register to the 419 Set LODMIN and LODMAX in the tLod register to the 416 420 actual min and max LODs of the current texture. 417 421 ----------------------------------------------------------*/ … … 424 428 } 425 429 gc->state.tmu_config[tmu].mmMode = mmMode; 426 430 427 431 /*-------------------------------------------------------------- 428 432 Fix trilinear and evenOdd bits - … … 431 435 full textures. The assumption here is that the only reason 432 436 you would ever set up Multiply by LODFRAC w/o REVERSE BLEND 433 is for the ODD pass of trilinear. 437 is for the ODD pass of trilinear. 434 438 --------------------------------------------------------------*/ 435 439 if ( lodBlend ) { … … 442 446 } 443 447 tLod |= _gr_evenOdd_xlate_table[gc->state.tmu_config[tmu].evenOdd]; 444 448 445 449 /*-------------------------------------------------------------- 446 450 Write State To Hardware and Update Glide Shadow State … … 492 496 { 493 497 FxU32 texMode; 494 498 495 499 GR_BEGIN("grTexNCCTable",88,4+2*PACKER_WORKAROUND_SIZE); 496 500 GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu)); … … 502 506 ------------------------------------------------------------------*/ 503 507 gc->state.tmu_config[tmu].nccTable = table; 504 508 505 509 /*------------------------------------------------------------------ 506 510 Grab shadow texMode, update TexMode, update shadow/real register … … 510 514 if ( table ) 511 515 texMode |= SST_TNCCSELECT; 512 else 516 else 513 517 texMode &= ~(SST_TNCCSELECT); 514 518 … … 536 540 the selected texture 537 541 One of: 538 GR_MIPMAPLEVELMASK_EVEN 542 GR_MIPMAPLEVELMASK_EVEN 539 543 GR_MIPMAPLEVELMASK_ODD 540 544 GR_MIPMAPLEVELMASK_BOTH … … 558 562 GR_CHECK_F( myName, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid"); 559 563 GR_CHECK_F( myName, !info, "invalid info pointer" ); 560 564 561 565 /*------------------------------------------------------------- 562 566 Update Texture Unit State 563 567 -------------------------------------------------------------*/ 564 gc->state.tmu_config[tmu].smallLod = info->smallLod; 565 gc->state.tmu_config[tmu].largeLod = info->largeLod; 566 gc->state.tmu_config[tmu].evenOdd = evenOdd; 567 568 gc->state.tmu_config[tmu].smallLod = info->smallLod; 569 gc->state.tmu_config[tmu].largeLod = info->largeLod; 570 gc->state.tmu_config[tmu].evenOdd = evenOdd; 571 568 572 /*------------------------------------------------------------- 569 573 Calculate Base Address 570 574 -------------------------------------------------------------*/ 571 575 baseAddress = _grTexCalcBaseAddress( startAddress, 572 info->largeLod, 576 info->largeLod, 573 577 info->aspectRatio, 574 578 info->format, … … 580 584 texMode &= ~SST_TFORMAT; 581 585 texMode |= ( info->format << SST_TFORMAT_SHIFT ) | SST_TPERSP_ST | SST_TCLAMPW; 582 586 583 587 /*------------------------------------------------------------- 584 588 Compute TLOD (keep LODBIAS in tact) … … 588 592 SST_LOD_TSPLIT | SST_LOD_ODD | SST_LOD_S_IS_WIDER); 589 593 tLod |= SST_TLOD_MINMAX_INT(info->largeLod, 590 gc->state.tmu_config[tmu].mmMode==GR_MIPMAP_DISABLE ? 594 gc->state.tmu_config[tmu].mmMode==GR_MIPMAP_DISABLE ? 591 595 info->largeLod : info->smallLod); 592 596 tLod |= _gr_evenOdd_xlate_table[evenOdd]; … … 600 604 GR_SET( hw->tLOD , tLod ); 601 605 PACKER_WORKAROUND; 602 606 603 607 /* update shadows */ 604 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 605 gc->state.tmu_config[tmu].textureMode = texMode; 606 gc->state.tmu_config[tmu].tLOD = tLod; 607 608 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 609 gc->state.tmu_config[tmu].textureMode = texMode; 610 gc->state.tmu_config[tmu].tLOD = tLod; 611 608 612 GR_END(); 609 613 } /* grTexSource */ … … 627 631 { 628 632 FxU32 tLod; 629 633 630 634 GR_BEGIN("grTexMultibase",88,4+PACKER_WORKAROUND_SIZE); 631 635 GDBG_INFO_MORE((gc->myLevel,"(%d,%d)\n",tmu,enable)); 632 636 GR_CHECK_TMU(myName,tmu); 633 637 634 638 tLod = gc->state.tmu_config[tmu].tLOD; 635 639 if ( enable ) … … 663 667 GR_TEXBASE_64 664 668 GR_TEXBASE_32_TO_1 665 startAddress - start address that data was downloaded to 669 startAddress - start address that data was downloaded to 666 670 hardware with using grTexDownload/Level 667 671 info - pointer to GrTexInfo structure containing … … 682 686 GR_CHECK_F( myName, evenOdd > 0x3, "evenOdd mask invalid" ); 683 687 GR_CHECK_F( myName, info, "invalid info pointer" ); 684 688 685 689 686 690 /* Write relevant registers out to hardware and shadows */ … … 695 699 evenOdd ) >> 3; 696 700 GR_SET( hw->texBaseAddr , baseAddress ); 697 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 701 gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 698 702 break; 699 703 case GR_TEXBASE_128: … … 704 708 evenOdd ) >> 3; 705 709 GR_SET( hw->texBaseAddr1 , baseAddress ); 706 gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 710 gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 707 711 break; 708 712 case GR_TEXBASE_64: … … 713 717 evenOdd ) >> 3; 714 718 GR_SET( hw->texBaseAddr2 , baseAddress ); 715 gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 719 gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 716 720 break; 717 721 case GR_TEXBASE_32_TO_1: … … 722 726 evenOdd ) >> 3; 723 727 GR_SET( hw->texBaseAddr38 , baseAddress ); 724 gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress; 728 gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress; 725 729 break; 726 730 } … … 736 740 ** debugging purposes. GMT: obsolete, please remove 737 741 */ 738 void 742 void 739 743 _grTexForceLod( GrChipID_t tmu, int value ) 740 744 { -
trunk/src/opengl/glide/sst1/glide/gtexdl.c
r2885 r6653 1 /* $Id: gtexdl.c,v 1.2 2001-09-05 14:30:55 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/sst1/glide/gtexdl.c,v 1. 1 2000-02-25 00:31:19 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gtexdl.c,v 1.2 2001-09-05 14:30:55 bird Exp $ 21 22 ** $Log: gtexdl.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:19 sandervl 23 ** Revision 1.2 2001-09-05 14:30:55 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:19 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 28 6/19/97 7:35p Dow 27 31 * More P6 Stuff 28 * 32 * 29 33 * 27 6/10/97 3:59p Garymct 30 34 * Fixed a bug in a sanity checking macro. 31 * 35 * 32 36 * 26 6/10/97 11:09a Pgj 33 37 * fix 8-bit & optimize 34 * 38 * 35 39 * 25 6/08/97 11:06p Pgj 36 40 * use Group Write for Texture Downloads 37 * 41 * 38 42 * 24 5/09/97 5:12p Jdt 39 43 * Removed redundant download of NCC Table 40 * 44 * 41 45 * 23 3/18/97 9:07p Dow 42 46 * Got rid of #$#%#$ // comments 43 * 47 * 44 48 * 22 3/15/97 8:08p Jdt 45 49 * Moved grTexDownloadTable into this file as it not precisely DI. 46 * 50 * 47 51 * 21 3/04/97 9:08p Dow 48 52 * Neutered multiplatform multiheaded monster 49 * 53 * 50 54 * 20 2/26/97 11:58a Jdt 51 55 * fixed a warning 52 * 56 * 53 57 * 19 2/19/97 4:25p Hanson 54 58 * Added Gary T's changes to the expected size value for texture downloads 55 * 59 * 56 60 * 18 2/18/97 9:52a Jdt 57 61 * Fixed some warnings. 58 * 62 * 59 63 * 17 2/12/97 2:09p Hanson 60 * Hopefully removed the rest of my muckage. 61 * 64 * Hopefully removed the rest of my muckage. 65 * 62 66 * 16 2/12/97 12:34p Dow 63 67 * Fixed Hanson muckage 64 * 68 * 65 69 * 15 2/12/97 12:03p Hanson 66 70 * Adjusted Convert and download code for Descent 67 * 71 * 68 72 * 14 2/12/97 11:30a Hanson 69 73 * Added ConvertRle function 70 * 74 * 71 75 * 13 1/27/97 2:29p Murali 72 76 * Changed texture download code to help compiler use registers optimally. 73 * 77 * 74 78 * 12 12/23/96 1:37p Dow 75 79 * chagnes for multiplatform glide 76 * 80 * 77 81 * 11 11/18/96 9:13a Sellers 78 82 * fixed bug in checking for crossing of 2 MByte texture boundry … … 102 106 int i; 103 107 FxU32 *hwNCC; 104 108 105 109 GR_BEGIN_NOFIFOCHECK("_grTexDownloadNccTable",89); 106 110 GDBG_INFO_MORE((gc->myLevel,"(%d,%d, 0x%x, %d,%d)\n",tmu,which,table,start,end)); … … 187 191 thisLod - lod constant that describes the mipmap level 188 192 to be downloaded 189 largeLod - largest level of detail in complete mipmap to 193 largeLod - largest level of detail in complete mipmap to 190 194 be downloaded at startAddress of which level to 191 195 be downloaded is a part … … 195 199 the selected texture 196 200 One of: 197 GR_MIPMAPLEVELMASK_EVEN 201 GR_MIPMAPLEVELMASK_EVEN 198 202 GR_MIPMAPLEVELMASK_ODD 199 203 GR_MIPMAPLEVELMASK_BOTH … … 205 209 GR_ENTRY(grTexDownloadMipMapLevelPartial, void, ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data, int t, int max_t )) 206 210 { 207 const FxU8 *src8 = ( const FxU8 * ) data; 211 const FxU8 *src8 = ( const FxU8 * ) data; 208 212 const FxU16 *src16 = ( const FxU16 * ) data; 209 213 FxI32 sh, bytesPerTexel; … … 255 259 GR_ASSERT(( (max_s) & (max_s -1) ) == 0); 256 260 257 261 258 262 /*------------------------------------------------------------ 259 263 Compute Base Address Given Start Address Offset 260 264 ------------------------------------------------------------*/ 261 265 baseAddress = _grTexCalcBaseAddress( startAddress, 262 largeLod, 266 largeLod, 263 267 aspectRatio, 264 268 format, … … 271 275 tmu_baseaddress = (FxU32)gc->tex_ptr; 272 276 tmu_baseaddress += (((FxU32)tmu)<<21) + (((FxU32)thisLod)<<17); 273 274 /*------------------------------------------------------------ 275 Compute pertinant contents of tLOD and texMode registers 277 278 /*------------------------------------------------------------ 279 Compute pertinant contents of tLOD and texMode registers 276 280 ------------------------------------------------------------*/ 277 281 tLod = SST_TLOD_MINMAX_INT(largeLod,GR_LOD_1); … … 317 321 SET_TRAM( tex_address, *(const FxU8*) src8); 318 322 src8 += 1; 319 tex_address += (1 << 9); 323 tex_address += (1 << 9); 320 324 } 321 325 break; … … 326 330 SET_TRAM( tex_address, *(const FxU16*) src8); 327 331 src8 += 2; 328 tex_address += (1 << 9); 332 tex_address += (1 << 9); 329 333 } 330 334 break; … … 335 339 SET_TRAM( tex_address, *(const FxU32*) src8); 336 340 src8 += 4; 337 tex_address += (1 << 9); 341 tex_address += (1 << 9); 338 342 } 339 343 break; … … 356 360 src8 += 8; 357 361 } 358 } 362 } 359 363 } else { /* New TMUs */ 360 364 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) … … 416 420 src8 += 8; 417 421 } 418 } 422 } 419 423 #endif 420 424 } 421 425 break; 422 426 } 423 } else { 427 } else { 424 428 425 429 /*------------------------------------------------------------ … … 434 438 SET_TRAM( tex_address, *src16 ); 435 439 src16 += 1; 436 tex_address += (1 << 9); 440 tex_address += (1 << 9); 437 441 } 438 442 break; … … 443 447 SET_TRAM( tex_address, *(const FxU32 *)src16 ); 444 448 src16 += 2; 445 tex_address += (1 << 9); 449 tex_address += (1 << 9); 446 450 } 447 451 break; … … 505 509 } 506 510 } /* end switch( width ) */ 507 511 508 512 /* Flush the write buffers after the texture downloads */ 509 513 P6FENCE; … … 564 568 P6FENCE; 565 569 GR_END(); 566 } /* _grTexDownloadPalette */ 570 } /* _grTexDownloadPalette */ 567 571 568 572 569 573 #ifndef __linux__ 570 /* 574 /* 571 575 Let me take this opportunity to register my formal opposition to 572 576 this function. Either we do this or we don't. Let's not hack like … … 592 596 /* make sure even number */ 593 597 width&=0xFFFFFFFE; 594 598 595 599 max_s=width>>1; 596 600 max_t=height; 597 601 598 602 GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d)\n", 599 603 tmu,startAddress,thisLod,largeLod,aspectRatio, … … 622 626 if ( !(evenOdd & (thisLod & 0x1 ? GR_MIPMAPLEVELMASK_ODD:GR_MIPMAPLEVELMASK_EVEN))) 623 627 goto all_done; 624 628 625 629 /*------------------------------------------------------------ 626 630 Compute Base Address Given Start Address Offset 627 631 ------------------------------------------------------------*/ 628 632 baseAddress = _grTexCalcBaseAddress( startAddress, 629 largeLod, 633 largeLod, 630 634 aspectRatio, 631 635 format, … … 638 642 tmu_baseaddress = (FxU32)gc->tex_ptr; 639 643 tmu_baseaddress += (((FxU32)tmu)<<21) + (((FxU32)thisLod)<<17); 640 641 /*------------------------------------------------------------ 642 Compute pertinant contents of tLOD and texMode registers 644 645 /*------------------------------------------------------------ 646 Compute pertinant contents of tLOD and texMode registers 643 647 ------------------------------------------------------------*/ 644 648 tLod = SST_TLOD_MINMAX_INT(largeLod,GR_LOD_1); -
trunk/src/opengl/glide/sst1/glide/gu.c
r2885 r6653 1 /* $Id: gu.c,v 1.2 2001-09-05 14:30:55 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/sst1/glide/gu.c,v 1. 1 2000-02-25 00:31:19 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gu.c,v 1.2 2001-09-05 14:30:55 bird Exp $ 21 22 ** $Log: gu.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:19 sandervl 23 ** Revision 1.2 2001-09-05 14:30:55 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:19 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 12 12/19/97 8:09a Peter 27 31 * fog table propogation 28 * 32 * 29 33 * 11 3/09/97 10:31a Dow 30 34 * Added GR_DIENTRY for di glide functions 31 * 35 * 32 36 * 10 3/05/97 9:36p Jdt 33 37 * Added guEncodeRLE16 34 * 38 * 35 39 * 9 12/23/96 1:37p Dow 36 40 * chagnes for multiplatform glide … … 161 165 grColorCombine( GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_NONE, FXTRUE ); 162 166 break; 163 167 164 168 default: 165 169 GR_CHECK_F("grColorCombineFunction", 1, "unsupported color combine function"); … … 196 200 */ 197 201 GR_DIENTRY(guFogGenerateExp, void, 198 ( GrFog_t fogtable[kInternalFogTableEntryCount], float density )) 202 ( GrFog_t fogtable[kInternalFogTableEntryCount], float density )) 199 203 { 200 204 int i; … … 255 259 ** guFogGenerateLinear 256 260 */ 257 GR_DIENTRY(guFogGenerateLinear, void, 261 GR_DIENTRY(guFogGenerateLinear, void, 258 262 ( GrFog_t fogtable[kInternalFogTableEntryCount], 259 263 float nearZ, float farZ )) … … 412 416 413 417 srcPixels+=length; 414 sourceImageSizeInWords-=length; 418 sourceImageSizeInWords-=length; 415 419 } 416 420 } else { … … 428 432 byteCount+=4; 429 433 srcPixels+=length; 430 sourceImageSizeInWords-=length; 434 sourceImageSizeInWords-=length; 431 435 } 432 436 } -
trunk/src/opengl/glide/sst1/glide/guclip.c
r2885 r6653 1 /* $Id: guclip.c,v 1.2 2001-09-05 14:30:55 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/sst1/glide/guclip.c,v 1. 1 2000-02-25 00:31:19 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/guclip.c,v 1.2 2001-09-05 14:30:55 bird Exp $ 21 22 ** $Log: guclip.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:19 sandervl 23 ** Revision 1.2 2001-09-05 14:30:55 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:19 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 6 8/14/97 5:32p Pgj 27 31 * remove dead code per GMT 28 * 32 * 29 33 * 5 6/27/97 4:16p Atai 30 34 * fixed guDrawTriangleWithClip bug (#484) by removing +1.0F and -1.0F in 31 35 * intersectTop(), intersectBottom(), intersectLeft(), and 32 36 * intersectRight() routine 33 * 37 * 34 38 * 4 3/09/97 10:31a Dow 35 39 * Added GR_DIENTRY for di glide functions … … 54 58 isect->b = a->b + d * ( b->b - a->b ); 55 59 } 56 60 57 61 if (gc->state.paramIndex & STATE_REQUIRES_IT_ALPHA) { 58 62 isect->a = a->a + d * ( b->a - a->a ); … … 98 102 } /* calcParams */ 99 103 100 static void 104 static void 101 105 intersectTop( const GrVertex *a, const GrVertex *b, GrVertex *intersect ) 102 106 { … … 104 108 float 105 109 d = ( gc->state.clipwindowf_ymin - a->y ) / ( b->y - a->y ); 106 110 107 111 intersect->x = a->x + d * ( b->x - a->x ); 108 intersect->y = gc->state.clipwindowf_ymin; 109 112 intersect->y = gc->state.clipwindowf_ymin; 113 110 114 calcParams(a, b, intersect, d); 111 115 … … 118 122 float 119 123 d = ( gc->state.clipwindowf_ymax - 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_ymax; 126 intersect->y = gc->state.clipwindowf_ymax; 123 127 124 128 calcParams(a, b, intersect, d); … … 132 136 float 133 137 d = ( gc->state.clipwindowf_xmax - a->x ) / ( b->x - a->x ); 134 135 intersect->x = gc->state.clipwindowf_xmax; 138 139 intersect->x = gc->state.clipwindowf_xmax; 136 140 intersect->y = a->y + d * ( b->y - a->y ); 137 141 … … 146 150 float 147 151 d = ( gc->state.clipwindowf_xmin - a->x ) / ( b->x - a->x ); 148 152 149 153 intersect->x = gc->state.clipwindowf_xmin; 150 154 intersect->y = a->y + d * ( b->y - a->y ); … … 160 164 return (( p->y > gc->state.clipwindowf_ymin ) ? FXTRUE : FXFALSE); 161 165 } /* aboveYMin */ 162 166 163 167 164 168 static FxBool … … 202 206 int 203 207 j; 204 208 205 209 *outlength = 0; 206 210 207 211 s = invertexarray[inlength-1]; 208 212 for ( j = 0; j < inlength; j++ ) { … … 291 295 input_array[1] = *b; 292 296 input_array[2] = *c; 293 297 294 298 shClipPolygon( input_array, output_array, 3, &outlength, belowXMax, intersectRight ); 295 299 shClipPolygon( output_array, output_array2, outlength, &outlength, belowYMax, intersectBottom ); 296 300 shClipPolygon( output_array2, output_array, outlength, &outlength, aboveXMin, intersectLeft ); 297 301 shClipPolygon( output_array, output_array2, outlength, &outlength, aboveYMin, intersectTop ); 298 302 299 303 /* 300 304 ** snap vertices then decompose the n-gon into triangles … … 360 364 input_array[1] = *b; 361 365 input_array[2] = *c; 362 366 363 367 shClipPolygon( input_array, output_array, 3, &outlength, belowXMax, intersectRight ); 364 368 shClipPolygon( output_array, output_array2, outlength, &outlength, belowYMax, intersectBottom ); 365 369 shClipPolygon( output_array2, output_array, outlength, &outlength, aboveXMin, intersectLeft ); 366 370 shClipPolygon( output_array, output_array2, outlength, &outlength, aboveYMin, intersectTop ); 367 371 368 372 /* 369 373 ** snap vertices then decompose the n-gon into triangles -
trunk/src/opengl/glide/sst1/glide/gump.c
r2885 r6653 1 /* $Id: gump.c,v 1.2 2001-09-05 14:30:56 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/sst1/glide/gump.c,v 1. 1 2000-02-25 00:31:19 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gump.c,v 1.2 2001-09-05 14:30:56 bird Exp $ 21 22 ** $Log: gump.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:19 sandervl 23 ** Revision 1.2 2001-09-05 14:30:56 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:19 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 7 11/12/97 5:11p Pgj 27 31 * stubs for evil guFb{Read|Write}Region() 28 * 32 * 29 33 * 6 3/09/97 10:31a Dow 30 34 * Added GR_DIENTRY for di glide functions 31 * 35 * 32 36 * 5 12/23/96 1:37p Dow 33 37 * chagnes for multiplatform glide … … 62 66 } 63 67 64 GR_DIENTRY(guMPTexCombineFunction, void, 68 GR_DIENTRY(guMPTexCombineFunction, void, 65 69 ( GrMPTextureCombineFnc_t tc_fnc )) 66 70 { … … 69 73 } 70 74 71 GR_DIENTRY(guMPTexSource, void, 75 GR_DIENTRY(guMPTexSource, void, 72 76 ( GrChipID_t virtual_tmu, GrMipMapId_t mmid )) 73 77 { -
trunk/src/opengl/glide/sst1/glide/gutex.c
r2885 r6653 1 /* $Id: gutex.c,v 1.2 2001-09-05 14:30:56 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/sst1/glide/gutex.c,v 1. 1 2000-02-25 00:31:20 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gutex.c,v 1.2 2001-09-05 14:30:56 bird Exp $ 21 22 ** $Log: gutex.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:20 sandervl 23 ** Revision 1.2 2001-09-05 14:30:56 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:20 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 7 3/04/97 9:08p Dow 27 31 * Neutered multiplatform multiheaded monster 28 * 32 * 29 33 * 6 12/23/96 1:37p Dow 30 34 * chagnes for multiplatform glide 31 * 35 * 32 36 * 5 11/18/96 9:14a Sellers 33 37 * added checking for crossing of 2 MByte texture boundry … … 99 103 100 104 oldtexMode = gc->state.tmu_config[tmu].textureMode; 101 oldtexMode &= ~( SST_TFORMAT | SST_TCLAMPT | 102 SST_TCLAMPS | SST_TNCCSELECT | 103 SST_TLODDITHER | SST_TCLAMPW | 104 SST_TMAGFILTER | SST_TMINFILTER | 105 oldtexMode &= ~( SST_TFORMAT | SST_TCLAMPT | 106 SST_TCLAMPS | SST_TNCCSELECT | 107 SST_TLODDITHER | SST_TCLAMPW | 108 SST_TMAGFILTER | SST_TMINFILTER | 105 109 SST_TRILINEAR ); 106 110 texMode |= oldtexMode; … … 108 112 texMode &= ~SST_TLODDITHER; 109 113 110 /* 111 ** Download the NCC table, if needed. 114 /* 115 ** Download the NCC table, if needed. 112 116 */ 113 117 if ( … … 165 169 gc->state.tmu_config[tmu].textureMode = texMode; 166 170 gc->state.tmu_config[tmu].tLOD = tLod; 167 171 168 172 GR_END(); 169 173 } /* guTexSource */ -
trunk/src/opengl/glide/sst1/glide/gxdraw.c
r2885 r6653 1 /* $Id: gxdraw.c,v 1.2 2001-09-05 14:30:56 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/sst1/glide/gxdraw.c,v 1. 1 2000-02-25 00:31:20 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gxdraw.c,v 1.2 2001-09-05 14:30:56 bird Exp $ 21 22 ** $Log: gxdraw.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:20 sandervl 23 ** Revision 1.2 2001-09-05 14:30:56 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:20 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 36 9/19/97 12:38p Peter 27 31 * asm rush trisetup vs alt fifo 28 * 32 * 29 33 * 35 9/10/97 10:13p Peter 30 34 * fifo logic from GaryT, non-normalized fp first cut 31 * 35 * 32 36 * 34 8/19/97 8:55p Peter 33 37 * lots of stuff, hopefully no muckage 34 * 38 * 35 39 * 33 8/01/97 11:49a Dow 36 40 * Added conventional FIFO accounting 37 * 41 * 38 42 * 32 7/07/97 3:43p Jdt 39 43 * Fixes to trisetup_nogradients 40 * 44 * 41 45 * 31 7/07/97 2:14p Jdt 42 46 * Mods to drawtriangle for parity with asm 43 * 47 * 44 48 * 30 7/07/97 8:33a Jdt 45 49 * New tracing macros. 46 * 50 * 47 51 * 29 7/04/97 12:08p Dow 48 52 * Fixed chip field muckage 49 * 53 * 50 54 * 28 7/01/97 7:44a Jdt 51 55 * Separated SST-1 and SST-96 trisetup implementations. 52 * 56 * 53 57 * 27 6/30/97 3:30p Jdt 54 58 * Fixed Watcom Wart. 55 * 59 * 56 60 * 26 6/30/97 3:23p Jdt 57 61 * rollback 58 * 62 * 59 63 * 24 6/29/97 11:49p Jdt 60 64 * First pass at triangle setup optimization for SST96 61 * 65 * 62 66 * 23 6/20/97 5:53p Dow 63 67 * Change for subtle chip field bug 64 * 68 * 65 69 * 22 6/18/97 5:54p Dow 66 70 * P6 adjustments 67 * 71 * 68 72 * 21 5/27/97 11:37p Pgj 69 73 * Fix for Bug report 545 70 * 74 * 71 75 * 20 4/13/97 2:06p Pgj 72 76 * eliminate all anonymous unions (use hwDep) 73 * 77 * 74 78 * 19 3/21/97 12:42p Dow 75 79 * Made STWHints not send the Bend Over Baby Packet to FBI Jr. 76 * 80 * 77 81 * 18 3/04/97 9:45p Dow 78 82 * More neutering of the multiheaded... 79 * 83 * 80 84 * 17 3/04/97 9:08p Dow 81 85 * Neutered multiplatform multiheaded monster 82 * 86 * 83 87 * 16 2/14/97 12:55p Dow 84 88 * moved vg96 fifo wrap into init code 85 * 89 * 86 90 * 15 12/23/96 1:37p Dow 87 91 * chagnes for multiplatform glide … … 99 103 #ifdef GDBG_INFO_ON 100 104 /* Some debugging information */ 101 static char *indexNames[] = { 105 static char *indexNames[] = { 102 106 "GR_VERTEX_X_OFFSET", /* 0 */ 103 107 "GR_VERTEX_Y_OFFSET", /* 1 */ … … 115 119 "GR_VERTEX_TOW_TMU1_OFFSET", /* 13 */ 116 120 "GR_VERTEX_OOW_TMU1_OFFSET" /* 14 */ 117 }; 121 }; 118 122 #endif 119 123 … … 129 133 ** the starting point. 130 134 ** 131 */ 135 */ 132 136 133 137 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) … … 145 149 struct dataList_s *dlp; 146 150 volatile FxU32 *fifoPtr; 147 151 148 152 culltest = gc->state.cull_mode; /* 1 if negative, 0 if positive */ 149 153 _GlideRoot.stats.trisProcessed++; 150 154 151 155 /* 152 156 ** Sort the vertices. … … 154 158 ** clockwise), we need to change the area of the triangle. Note 155 159 ** that we know the first two elements are X & Y by looking at the 156 ** grVertex structure. 160 ** grVertex structure. 157 161 */ 158 162 ay = *(int *)&va->y; … … 199 203 dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET]; 200 204 dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET]; 201 205 202 206 dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET]; 203 207 dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET]; 204 208 205 209 /* this is where we store the area */ 206 210 _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB; 207 211 208 212 /* Zero-area triangles are BAD!! */ 209 213 j = *(long *)&_GlideRoot.pool.ftemp1; 210 214 if ((j & 0x7FFFFFFF) == 0) 211 215 return 0; 212 216 213 217 /* Backface culling, use sign bit as test */ 214 218 if (gc->state.cull_mode != GR_CULL_DISABLE) { … … 217 221 } 218 222 } 219 223 220 224 /* Fence On P6 If Necessary */ 221 225 if ( _GlideRoot.CPUType == 6 ) { … … 225 229 gc->hwDep.sst96Dep.writesSinceFence = 0; 226 230 } 227 gc->hwDep.sst96Dep.writesSinceFence += 231 gc->hwDep.sst96Dep.writesSinceFence += 228 232 _GlideRoot.curTriSize>>2; 229 233 } … … 238 242 #endif 239 243 } 240 244 241 245 GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize); 242 246 243 247 /* Grab fifo pointer into a local */ 244 248 fifoPtr = gc->fifoData.hwDep.vg96FIFOData.fifoPtr; 245 249 246 250 /* Settle Bookeeping */ 247 251 gc->fifoData.hwDep.vg96FIFOData.fifoSize -= _GlideRoot.curTriSize; 248 252 gc->fifoData.hwDep.vg96FIFOData.fifoPtr += _GlideRoot.curTriSize>>2; 249 253 250 254 /* Start first group write packet */ 251 255 SET_GW_CMD( fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand ); … … 260 264 dlp = gc->dataList; 261 265 i = dlp->i; 262 266 263 267 /* write out X & Y for vertex B */ 264 268 FSET_GW_ENTRY( fifoPtr, 4, fb[0] ); … … 284 288 fp = dlp->addr; 285 289 /* chip field change */ 286 if (i & 1) 290 if (i & 1) 287 291 goto secondary_packet; 288 292 else { 289 293 float dpAB, dpBC,dpdx, dpdy; 290 294 291 295 dpBC = FARRAY(fb,i); 292 296 dpdx = FARRAY(fa,i); … … 308 312 FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 ); 309 313 fifoPtr+=1; 310 314 311 315 if (((FxU32)fifoPtr) & 0x7) { 312 316 FSET_GW_ENTRY( fifoPtr, 0, 0.0f ); … … 317 321 318 322 GR_CHECK_SIZE(); 319 323 320 324 _GlideRoot.stats.trisDrawn++; 321 325 … … 329 333 } 330 334 /* Start new packet 331 note, there can only ever be two different packets 335 note, there can only ever be two different packets 332 336 using gwHeaderNum++ would be more general, but this 333 337 reflects the actual implementation */ … … 376 380 float *fp; 377 381 struct dataList_s *dlp; 378 382 379 383 culltest = gc->state.cull_mode; /* 1 if negative, 0 if positive */ 380 384 _GlideRoot.stats.trisProcessed++; 381 385 382 386 /* 383 387 ** Sort the vertices. … … 385 389 ** clockwise), we need to change the area of the triangle. Note 386 390 ** that we know the first two elements are X & Y by looking at the 387 ** grVertex structure. 391 ** grVertex structure. 388 392 */ 389 393 ay = *(int *)&va->y; … … 432 436 dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET]; 433 437 dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET]; 434 438 435 439 dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET]; 436 440 dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET]; 437 441 438 442 /* this is where we store the area */ 439 443 _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB; 440 444 441 445 /* Zero-area triangles are BAD!! */ 442 446 j = *(long *)&_GlideRoot.pool.ftemp1; 443 447 if ((j & 0x7FFFFFFF) == 0) 444 448 return 0; 445 449 446 450 /* Backface culling, use sign bit as test */ 447 451 if (gc->state.cull_mode != GR_CULL_DISABLE) { … … 450 454 } 451 455 } 452 456 453 457 GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize); 454 458 455 459 ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1; 456 460 /* GMT: note that we spread out our PCI writes */ … … 461 465 dlp = gc->dataList; 462 466 i = dlp->i; 463 467 464 468 /* write out X & Y for vertex B */ 465 469 GR_SETF( hw->FvB.x, fb[GR_VERTEX_X_OFFSET] ); 466 470 GR_SETF( hw->FvB.y, fb[GR_VERTEX_Y_OFFSET] ); 467 471 468 472 /* write out X & Y for vertex C */ 469 473 GR_SETF( hw->FvC.x, fc[GR_VERTEX_X_OFFSET] ); … … 481 485 #define FARRAY(p,i) (*(float *)((i)+(int)(p))) 482 486 483 /* 487 /* 484 488 ** The src vector contains offsets from fa, fb, and fc to for which 485 489 ** gradients need to be calculated, and is null-terminated. … … 536 540 ** Also we assume we don't have to test for backface triangles - this is 537 541 ** typically done outside this routine, as in grDrawPlanarPolygon 538 */ 542 */ 539 543 540 544 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) … … 558 562 ** clockwise), we need to change the area of the triangle. Note 559 563 ** that we know the first two elements are X & Y by looking at the 560 ** grVertex structure. 564 ** grVertex structure. 561 565 */ 562 566 ay = *(int *)&va->y; … … 617 621 if ( _GlideRoot.CPUType == 6 ) { 618 622 /* In the macro there is a slop of 4 DWORDS that I have removed */ 619 if ( (gc->hwDep.sst96Dep.writesSinceFence + 623 if ( (gc->hwDep.sst96Dep.writesSinceFence + 620 624 ( _GlideRoot.curTriSizeNoGradient >> 2 )) > 128 ) { 621 625 P6FENCE; 622 626 gc->hwDep.sst96Dep.writesSinceFence = 0; 623 627 } 624 gc->hwDep.sst96Dep.writesSinceFence += 628 gc->hwDep.sst96Dep.writesSinceFence += 625 629 _GlideRoot.curTriSizeNoGradient>>2; 626 630 } … … 650 654 dlp = gc->dataList; 651 655 i = dlp->i; 652 656 653 657 /* write out X & Y for vertex B */ 654 658 FSET_GW_ENTRY( fifoPtr, 4, fb[0] ); … … 668 672 while (i) { 669 673 fp = dlp->addr; 670 if (i & 1) 674 if (i & 1) 671 675 goto secondary_packet; 672 676 else { … … 703 707 704 708 /* Start new packet 705 note, there can only ever be two different packets 709 note, there can only ever be two different packets 706 710 using gwHeaderNum++ would be more general, but this 707 711 reflects the actual implementation */ … … 749 753 ** clockwise), we need to change the area of the triangle. Note 750 754 ** that we know the first two elements are X & Y by looking at the 751 ** grVertex structure. 755 ** grVertex structure. 752 756 */ 753 757 ay = *(int *)&va->y; … … 819 823 return 0; 820 824 } 821 825 822 826 /* write out X & Y for vertex C */ 823 827 GR_SETF( hw->FvC.x, fc[GR_VERTEX_X_OFFSET] ); … … 830 834 #define FARRAY(p,i) (*(float *)((i)+(int)(p))) 831 835 832 /* 836 /* 833 837 ** The src vector contains offsets from fa, fb, and fc to for which 834 838 ** gradients need to be calculated, and is null-terminated. -
trunk/src/opengl/glide/sst1/glide/splshdat.c
r2885 r6653 1 /* $Id: splshdat.c,v 1.2 2001-09-05 14:30:57 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/sst1/glide/splshdat.c,v 1. 1 2000-02-25 00:31:21 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/splshdat.c,v 1.2 2001-09-05 14:30:57 bird Exp $ 21 22 ** $Log: splshdat.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:21 sandervl 23 ** Revision 1.2 2001-09-05 14:30:57 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:21 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** … … 3578 3582 }; 3579 3583 3580 static Vert *vert[] = { 3584 static Vert *vert[] = { 3581 3585 vert_0, 3582 3586 vert_1, … … 3590 3594 }; 3591 3595 3592 static Face *face[] = { 3596 static Face *face[] = { 3593 3597 face_0, 3594 3598 face_1, … … 4594 4598 } 4595 4599 }; 4596 #define RAW_NAME text_3dfinfo_raw 4597 #define IMAGE_NAME text_3dfinfo_image 4600 #define RAW_NAME text_3dfinfo_raw 4601 #define IMAGE_NAME text_3dfinfo_image 4598 4602 unsigned char RAW_NAME[] = { 4599 4603 0x40, … … 11122 11126 }; 11123 11127 11124 #undef RAW_NAME 11125 #undef IMAGE_NAME 11126 #define RAW_NAME hilite_3dfinfo_raw 11127 #define IMAGE_NAME hilite_3dfinfo_image 11128 #undef RAW_NAME 11129 #undef IMAGE_NAME 11130 #define RAW_NAME hilite_3dfinfo_raw 11131 #define IMAGE_NAME hilite_3dfinfo_image 11128 11132 unsigned char RAW_NAME[] = { 11129 11133 0x20, … … 13556 13560 }; 13557 13561 13558 #undef RAW_NAME 13559 #undef IMAGE_NAME 13560 #define RAW_NAME shadow_3dfinfo_raw 13561 #define IMAGE_NAME shadow_3dfinfo_image 13562 #undef RAW_NAME 13563 #undef IMAGE_NAME 13564 #define RAW_NAME shadow_3dfinfo_raw 13565 #define IMAGE_NAME shadow_3dfinfo_image 13562 13566 unsigned char RAW_NAME[] = { 13563 13567 0x40, … … 17358 17362 }; 17359 17363 17360 #undef RAW_NAME 17361 #undef IMAGE_NAME 17364 #undef RAW_NAME 17365 #undef IMAGE_NAME -
trunk/src/opengl/glide/sst1/glide/sst96.c
r2885 r6653 1 /* $Id: sst96.c,v 1.2 2001-09-05 14:30:58 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/sst1/glide/sst96.c,v 1. 1 2000-02-25 00:31:23 sandervlExp $21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/sst96.c,v 1.2 2001-09-05 14:30:58 bird Exp $ 21 22 ** $Log: sst96.c,v $ 22 ** Revision 1.1 2000-02-25 00:31:23 sandervl 23 ** Revision 1.2 2001-09-05 14:30:58 bird 24 ** Added $Id:$ keyword. 25 ** 26 ** Revision 1.1 2000/02/25 00:31:23 sandervl 23 27 ** Created new Voodoo 1 Glide dir 24 28 ** 25 * 29 * 26 30 * 20 9/19/97 12:38p Peter 27 31 * asm rush trisetup vs alt fifo 28 * 32 * 29 33 * 19 9/12/97 12:56p Dow 30 34 * Protected JUJU code 31 * 35 * 32 36 * 18 9/11/97 2:22p Atai 33 37 * fixed muckage 34 * 38 * 35 39 * 17 9/10/97 10:15p Peter 36 40 * fifo logic from GaryT 37 * 41 * 38 42 * 16 8/19/97 8:55p Peter 39 43 * lots of stuff, hopefully no muckage 40 * 44 * 41 45 * 15 8/01/97 11:49a Dow 42 46 * Allowed for non4K fifo wraps 43 * 47 * 44 48 * 14 7/08/97 1:29p Jdt 45 49 * Fixed watcom muckage 46 * 50 * 47 51 * 13 7/04/97 12:08p Dow 48 52 * Modified GWP debugging 49 * 53 * 50 54 * 12 6/20/97 5:54p Dow 51 55 * Moved grDebugGroupWriteHeader in here. 52 * 56 * 53 57 * 11 6/18/97 5:54p Dow 54 58 * P6 adjustments 55 * 59 * 56 60 * 10 5/27/97 2:03p Dow 57 61 * added new assertion 58 * 62 * 59 63 * 9 5/04/97 12:49p Dow 60 64 * Moved texture downloads to level 195, like on SST1 61 * 65 * 62 66 * 8 4/13/97 2:06p Pgj 63 67 * eliminate all anonymous unions (use hwDep) 64 * 68 * 65 69 * 7 3/16/97 12:39a Jdt 66 70 * initWrapFifo only neads fifodata... 67 * 71 * 68 72 * 6 3/04/97 9:12p Dow 69 73 * Neutered mutiplatform multiheaded monster. 70 * 74 * 71 75 * 5 2/18/97 9:53a Jdt 72 76 * Removed some unecessary declarations. 73 * 77 * 74 78 * 4 2/14/97 12:55p Dow 75 79 * moved vg96 fifo wrap into init code 76 * 80 * 77 81 * 3 2/11/97 6:59p Dow 78 82 * Changes to support vid tiles and ser status 79 * 83 * 80 84 * 2 1/14/97 10:49a Dow 81 85 * Changed all output to use GDBG_INFO 82 86 * Renabled some messages 83 * 87 * 84 88 * 1 12/23/96 1:39p Dow 85 89 * Changes for multiplatform … … 369 373 #if defined(GDBG_INFO_ON) && (GLIDE_PLATFORM & GLIDE_HW_SST96) 370 374 void 371 _grDebugGroupWriteHeader(FxU32 header, FxU32 address) 375 _grDebugGroupWriteHeader(FxU32 header, FxU32 address) 372 376 { 373 377 #define FN_NAME "_grDebugGroupWriteHeader" … … 389 393 GDBG_INFO((128, "PCI Address: 0x%x\n", (address & 0xfffff) << 2)); 390 394 GDBG_INFO((128, "Chip Field: 0x%x\n", (address >> 14) & 0xf)); 391 395 392 396 offset = (address & ~(0xf << 14)) & 0xfffff; 393 397 index = offset; 394 398 395 399 if (offset < 0x100 ) { /* It's state or triangle */ 396 400 397 401 GDBG_INFO((128, "Start: 0x%s (0x%x)\n", regNames[index], index)); 398 402 GDBG_INFO((128, "Mask: 0x%x\n", header)); 399 403 400 404 while (lheader) { 401 405 if (lheader & 0x1) { … … 420 424 421 425 GDBG_INFO((128, "%s: %d bits of mask 0x%x were set\n", FN_NAME, 422 nBits, header)); 426 nBits, header)); 423 427 424 428 GR_ASSERT(nBits); … … 435 439 index = GEN_INDEX(addr); 436 440 char 437 *regName; 441 *regName; 438 442 439 443 regName = (index <= 0xff) ? regNames[index] : "TRAM"; 440 441 if (index <= 0xff) { 444 445 if (index <= 0xff) { 442 446 GDBG_INFO((120, "Storing to FIFO:\n")); 443 447 GDBG_INFO((120, "\tReg Name: %s\n", regName)); … … 457 461 index = GEN_INDEX(addr); 458 462 char 459 *regName; 463 *regName; 460 464 461 465 if (index <= 0xff) { 462 466 463 467 regName = regNames[index]; 464 468 465 469 GDBG_INFO((120, "Storing to FIFO:\n")); 466 470 GDBG_INFO((120, "\tReg Name: %s\n", regName)); … … 475 479 GDBG_INFO((195, "\tFIFO Ptr: 0x%x\n", fifoPtr)); 476 480 GDBG_INFO((120, "\tFIFO Test: 0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoSize)); 477 } 481 } 478 482 } /* _grFifoFWriteDebug */ 479 483 480 484 481 485 /*-------------------------------------------------------------------------- 482 ** _grSst96PCIFifoEmpty 486 ** _grSst96PCIFifoEmpty 483 487 */ 484 488 FxBool … … 495 499 if (SST96_PCI_FIFO_EMPTY(hw)) 496 500 return FXTRUE; 497 501 498 502 if (!(++count % COUNT_PATIENCE_VALUE)) { 499 503 GDBG_INFO((120, "Losing Patients after %d tries\n", COUNT_PATIENCE_VALUE)); … … 501 505 } 502 506 } 503 return FXFALSE; 507 return FXFALSE; 504 508 } /* _grSst96PCIFifoEmpty */ 505 509 … … 509 513 510 514 void GR_CDECL 511 _grSst96FifoMakeRoom(void) 515 _grSst96FifoMakeRoom(void) 512 516 { 513 517 GR_DCL_GC; 514 518 #ifdef SST96_ALT_FIFO_WRAP 515 519 /* NB: W/ the alternate fifo wrapping stuff on only the asm 516 * tri-setup uses this routine. 520 * tri-setup uses this routine. 517 521 */ 518 522 gc->fifoData.hwDep.vg96FIFOData.blockSize = _GlideRoot.curTriSize; … … 546 550 GDBG_INFO((120, "\tReg Val: 0x%x\n", regVal)); 547 551 } 548 552 549 553 return regVal; 550 554 … … 695 699 fifoStartGC = (FxU32) gc->fifoData.hwDep.vg96FIFOData.fifoVirt - (FxU32) gc->base_ptr; 696 700 fifoWrPtrGC = (FxU32) gc->fifoData.hwDep.vg96FIFOData.fifoPtr - (FxU32) gc->base_ptr; 697 701 698 702 /* Deduce relevant data from registers */ 699 703 fifoStartHW = FIFO_BOT_BYTES(fbiJrInit3); -
trunk/src/opengl/glide/sst1/init/h3drvr.c
r2885 r6653 1 /* $Id: h3drvr.c,v 1.2 2001-09-05 14:31:00 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:31:26 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:00 $ 23 24 ** 24 25 */ … … 56 57 static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) { 57 58 return 0; 58 } 59 } 59 60 60 61 static FxU32 FX_CALL status( void ) { 61 62 return 0; 62 } 63 } 63 64 64 65 static FxBool FX_CALL busy(void) { 65 66 return 0; 66 } 67 } 67 68 68 69 static void FX_CALL idle( void ) { -
trunk/src/opengl/glide/sst1/init/init.c
r2885 r6653 1 /* $Id: init.c,v 1.2 2001-09-05 14:31:00 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:31:26 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:00 $ 23 24 ** 24 25 */ … … 99 100 if ( !libInitialized ) { 100 101 101 /* When initializing the Library snoop out all 3Dfx devices 102 /* When initializing the Library snoop out all 3Dfx devices 102 103 and fill a static data structure with pertinant data. */ 103 104 … … 128 129 hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr = 129 130 (FxU32)sst1InitMapBoard( numSst1s ); 130 hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr = 131 hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr = 131 132 (FxU32*)hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr; 132 133 numSst1s++; … … 177 178 _outp(0x3d4, 0x3f); 178 179 regVal = _inp(0x3d5); 179 180 180 181 if (!(regVal & (1 << 2))) /* we're not there */ 181 182 continue; … … 196 197 #endif 197 198 198 hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr = 199 hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr = 199 200 (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.partnerRegPtr; 200 hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = 201 hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = 201 202 (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.baseAddress; 202 203 203 204 numDevicesInSystem++; 204 } 205 } 205 206 #else 206 207 # error "Do hardware enumeration for this chip!" … … 208 209 } 209 210 } 210 211 211 212 212 213 /* Sanity Check for SLI detection */ … … 228 229 libInitialized = FXTRUE; 229 230 } 230 231 231 232 if ( cb ) { 232 233 for( device = 0; device < numDevicesInSystem; device++ ) { 233 234 cb( &hwInfo[device] ); 234 } 235 } 235 236 } 236 237 return; … … 242 243 volatile FxU32* retVal = NULL; 243 244 FxBool okP = (boardNum < INIT_MAX_DEVICES); 244 245 245 246 if (okP) { 246 247 InitDeviceInfo* infoP = (hwInfo + boardNum); 247 248 const FxU32 vId = infoP->vendorID; 248 249 const FxU32 dId = infoP->deviceID; 249 250 250 251 #if defined(SST1) 251 252 okP = ((vId == TDFXVID) && … … 294 295 pciClose(); 295 296 libInitialized = FXFALSE; 296 } 297 } 297 298 } /* initClose */ 298 299 … … 334 335 Implementor(s): jdt 335 336 Library: init 336 Description: 337 Selects a 3Dfx device ( potentially from among many in the system ) and 337 Description: 338 Selects a 3Dfx device ( potentially from among many in the system ) and 338 339 initializes the internal init driver functions with behavior appropriate 339 340 to the type of the selected device. … … 346 347 347 348 FxBool 348 initDeviceSelect( FxU32 devNumber ) 349 initDeviceSelect( FxU32 devNumber ) 349 350 { 350 351 FxBool rv = FXFALSE; 351 352 352 353 if ( devNumber < numDevicesInSystem ) { 353 354 context = &contexts[hwInfo[devNumber].hwClass]; 354 355 context->info = hwInfo[devNumber]; 355 356 rv = FXTRUE; 356 } 357 357 } 358 358 359 return rv; 359 360 … … 390 391 prior to rendering. 391 392 Arguments: 392 hwnd - pointer to a window handle or null. If NULL, then 393 hwnd - pointer to a window handle or null. If NULL, then 393 394 the application window handle will be inferred though 394 395 the GetActiveWindow() api. … … 431 432 FxBool rv; 432 433 if ( context ) { 433 rv = context->setVideo( hWnd, sRes, vRefresh, cFormat, 434 rv = context->setVideo( hWnd, sRes, vRefresh, cFormat, 434 435 yOrigin, nColBuffers, nAuxBuffers, 435 436 xres, yres, fbStride, vidTimings); … … 454 455 -------------------------------------------------------------------*/ 455 456 void initRestoreVideo( void ) { 456 if ( context ) 457 if ( context ) 457 458 context->restoreVideo(); 458 459 } /* initRestoreVideo */ … … 464 465 Library: init 465 466 Description: 466 Enable the command transport mechanism for the underlying 467 Enable the command transport mechanism for the underlying 467 468 hardware and return information about accessing the transport 468 469 to the caller … … 496 497 -------------------------------------------------------------------*/ 497 498 void initDisableTransport( void ) { 498 if ( context ) 499 if ( context ) 499 500 context->disableTransport(); 500 501 } /* initDisableTransport */ … … 506 507 Library: init 507 508 Description: 508 Initiate a buffer swap. 509 Arguments: 509 Initiate a buffer swap. 510 Arguments: 510 511 code - code describing type of swap, wether to sync to vretrace, how 511 512 many vretraces to wait, etc. … … 567 568 Library: init 568 569 Description: 569 Returns only when graphics pipeline is completely idle. 570 Returns only when graphics pipeline is completely idle. 570 571 May hang software if hardware is permanently busy. 571 572 Arguments: … … 587 588 Get the current pointer to a particular buffer 588 589 Arguments: 589 buffer - which buffer to get pointer to 590 buffer - which buffer to get pointer to 590 591 Return: 591 592 integer pointer … … 602 603 Date: 2/25 603 604 Implementor(s): jdt 604 Library: init 605 Library: init 605 606 Description: 606 607 Sets the current render buffer … … 638 639 Library: init 639 640 Description: 640 CYA function so that emergency functionality may be added w/o 641 CYA function so that emergency functionality may be added w/o 641 642 corrupting dll interface 642 643 Arguments: … … 658 659 Description: 659 660 This will re-attach new buffers for the rendering context, used 660 typically only in a windowing system where buffers need to move 661 typically only in a windowing system where buffers need to move 661 662 and resize. Also, implicitly detach old associated buffers. 662 663 Arguments: -
trunk/src/opengl/glide/sst1/init/init96/dxdrvr.c
r2885 r6653 1 /* $Id: dxdrvr.c,v 1.2 2001-09-05 14:31:01 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 ** $Log: dxdrvr.c,v $ 21 ** Revision 1.1 2000-02-25 00:31:28 sandervl 22 ** Revision 1.2 2001-09-05 14:31:01 bird 23 ** Added $Id:$ keyword. 24 ** 25 ** Revision 1.1 2000/02/25 00:31:28 sandervl 22 26 ** Created new Voodoo 1 Glide dir 23 27 ** 24 * 28 * 25 29 * 34 1/12/98 10:22p Dow 26 30 * H3D Stereo Support 27 * 31 * 28 32 * 33 11/06/97 9:51a Jdt 29 33 * Fixes window resize events to not crash/hang 30 * 34 * 31 35 * 32 10/01/97 3:21p Atai 32 36 * fix 819, DOS tests flicker on glide 33 * 37 * 34 38 * 31 9/08/97 12:05p Atai 35 39 * fixed resize problem in dxControl() 36 * 40 * 37 41 * 30 8/28/97 10:24a Odo 38 42 * moved debugging varaible 39 * 43 * 40 44 * 29 8/27/97 10:32a Dow 41 45 * added more debugging info 42 * 46 * 43 47 * 28 8/21/97 4:24p Dow 44 48 * Fixed @#$%! C++ Comments, Added Debugging info 45 49 ** 46 ** $Revision: 1. 1 $47 ** $Date: 200 0-02-25 00:31:28 $50 ** $Revision: 1.2 $ 51 ** $Date: 2001-09-05 14:31:01 $ 48 52 ** 49 53 */ … … 87 91 88 92 #if defined( __WIN32__) && defined(INIT_ACCESS_DDRAW) 89 #define WIN32_LEAN_AND_MEAN 90 #include <windows.h> 91 #include <ddraw.h> 93 #define WIN32_LEAN_AND_MEAN 94 #include <windows.h> 95 #include <ddraw.h> 92 96 93 97 #define NUM_BUFS 6 … … 95 99 static HWND hWndApp = 0; 96 100 static FxU32 FifoOffset = 0; 97 static FxU32 Width = 0; 101 static FxU32 Width = 0; 98 102 static FxU32 Height = 0; 99 103 static FxBool IsFullScreen = 0; … … 133 137 { 134 138 DDSURFACEDESC ddsd; 135 139 136 140 ddsd.dwSize = sizeof(ddsd); 137 if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL) 141 if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL) 138 142 !=DD_OK) { 139 143 return ErrorMessage(hWndApp, "_dxSurfaceToBufDesc: DdrawSurface Lock failed\n"); 140 144 } 141 145 142 146 /* pDesc->bufType should be filled in by caller */ 143 147 pDesc->bufOffset = (FxU32) (ddsd.lpSurface); /* virtual address. */ 144 148 pDesc->bufStride = (FxI32) (ddsd.lPitch); /* in bytes */ 145 149 pDesc->bufBPP = (FxI32) 16; 146 150 147 151 IDirectDrawSurface2_Unlock(lpSurf, NULL); 148 152 return FXTRUE; … … 163 167 InitBufDesc_t *dScreen = &pDesc[4]; 164 168 InitBufDesc_t *dTriple = &pDesc[5]; 165 169 166 170 GDBG_INFO((80, "_dxDDrawToGlide entry\n")); 167 171 168 172 /* Initialize all descriptors. */ 169 173 dScreen->bufMagic = VG96_BUF_MAGIC; … … 172 176 dScreen->bufStride = 0; 173 177 dScreen->bufBPP = 0; 174 178 175 179 /* Get info about screen (primary display) */ 176 180 dScreen->bufType = INIT_BUFFER_SCREENBUFFER; 177 181 if (!_dxSurfaceToBufDesc( lpFront, dScreen)) 178 182 return ErrorMessage(hWndApp, "Couldn't get Screen Info"); 179 183 180 184 *dFront = *dBack = *dAux = *dFifo = 181 185 *dTriple = 182 186 *dScreen; 183 187 184 188 dFront->bufType = INIT_BUFFER_FRONTBUFFER; 185 189 … … 188 192 if (!_dxSurfaceToBufDesc( lpBack, dBack)) 189 193 return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info"); 190 194 191 195 /* Get info about aux buffer */ 192 196 dAux->bufType = INIT_BUFFER_AUXBUFFER; 193 if (!_dxSurfaceToBufDesc( lpAux, dAux)) 197 if (!_dxSurfaceToBufDesc( lpAux, dAux)) 194 198 return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info"); 195 199 196 200 /* Get info about triple buffer */ 197 201 if (tripleBuffering) { … … 205 209 dFifo->bufOffset = FifoOffset; 206 210 dFifo->bufStride = 65536 << 1; /* Fixme!!! what's this? */ 207 211 208 212 /* Now convert buf addresses for draw buffers into video memory offsets */ 209 213 dFront->bufOffset -= dScreen->bufOffset; … … 212 216 if (tripleBuffering) 213 217 dTriple->bufOffset -= dScreen->bufOffset; 214 218 215 219 GDBG_INFO((80, "_dxDDrawToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset)); 216 220 GDBG_INFO((80, "_dxDDrawToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset)); … … 243 247 { 244 248 DDSURFACEDESC ddsd; 245 249 246 250 #ifdef H3D 247 GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d, pageFlip=%d\n", 251 GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d, pageFlip=%d\n", 248 252 hWndApp, IsFullScreen, xRes, yRes, vRefresh, pageFlip)); 249 253 #else 250 GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 254 GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 251 255 hWndApp, IsFullScreen, xRes, yRes, vRefresh)); 252 256 #endif 253 257 254 258 if (lpDD1 == NULL) { 255 259 if (DirectDrawCreate( NULL, &lpDD1, NULL ) != DD_OK) { … … 262 266 } 263 267 264 if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2, 268 if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2, 265 269 (LPVOID*)&lpDD) !=DD_OK) { 266 270 … … 272 276 GDBG_INFO((80, "_dxAS: DDraw2 Obj created!\n")); 273 277 } 274 278 275 279 /* 276 280 * Make sure this is done after creating direct draw object!!! … … 281 285 FifoOffset = init96GetFBVram() - 65536*3; /* fixme!!! why 3? */ 282 286 } 283 287 284 288 /* 285 289 * If there are any previously allocated surfaces, free them now … … 291 295 if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); 292 296 if( lpFront ) IDirectDrawSurface2_Release( lpFront ); 293 297 294 298 lpClipper = NULL; 295 299 lpFront = NULL; … … 297 301 lpTriple = NULL; 298 302 lpAux = NULL; 299 303 300 304 if ( !IsFullScreen ) { /* In a window */ 301 305 … … 307 311 return ErrorMessage(hWndApp, "Couldn't get display mode!"); 308 312 309 if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2) 313 if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2) 310 314 return ErrorMessage(hWndApp, "Display is not in 16bpp format!"); 311 315 … … 317 321 ddsd.dwFlags = DDSD_CAPS; 318 322 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE; 319 320 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 323 324 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 321 325 return ErrorMessage(hWndApp, "Couldn't allocate primary surface!"); 322 326 … … 324 328 xRes, yRes, ddsd.lPitch)); 325 329 /* From jdt */ 326 if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK) 330 if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK) 327 331 return ErrorMessage(hWndApp, "Create Clipper failed!\n"); 328 332 329 if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK) 333 if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK) 330 334 return ErrorMessage(hWndApp, "Clipper SethWnd failed!\n"); 331 335 332 if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK) 336 if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK) 333 337 return ErrorMessage(hWndApp, "Set Clipper failed!\n"); 334 338 … … 341 345 ddsd.ddsCaps.dwCaps = 342 346 DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; 343 344 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) 347 348 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) 345 349 return ErrorMessage(hWndApp, "Couldn't allocate secondary surface!" ); 346 350 347 351 GDBG_INFO((80, "_dxAS: Back buffer allocated!\n")); 348 352 349 /* 350 * Always allocate Aux Buffer Surface 353 /* 354 * Always allocate Aux Buffer Surface 351 355 * XXX - (use nAuxBuffers, and deal with 8bpp for alpha) 352 356 */ … … 357 361 ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY 358 362 | DDSCAPS_3DDEVICE; 359 360 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 363 364 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 361 365 return ErrorMessage(hWndApp, "Couldn't allocate aux surface" ); 362 366 … … 364 368 365 369 } else { 366 370 367 371 /* Full screen - Set Exclusive Mode, change resolution, */ 368 372 GDBG_INFO((80, "_dxAS: Setting Full screen exclusive mode!\n")); 369 370 if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp, 373 374 if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp, 371 375 DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ) != DD_OK) 372 376 return ErrorMessage(hWndApp, "Couldn't set cooperative level!"); 373 377 374 378 if (IDirectDraw2_SetDisplayMode( lpDD, xRes, yRes, 16, 0,0) != DD_OK) 375 379 return ErrorMessage(hWndApp, "Couldn't set display mode!"); 376 380 377 381 /* Allocate Front/Back Buffer Surfaces, skip triple buffer XXX */ 378 382 ddsd.dwSize = sizeof( ddsd ); 379 383 ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; 380 384 ddsd.dwBackBufferCount = 1; 381 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | 382 DDSCAPS_FLIP | 385 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | 386 DDSCAPS_FLIP | 383 387 DDSCAPS_COMPLEX | 384 388 DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; 385 386 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 389 390 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 387 391 return ErrorMessage(hWndApp, "Couldn't allocate primary surface!"); 388 392 389 393 /* Get back buffer information */ 390 394 ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; 391 if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps, 395 if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps, 392 396 &lpBack) != DD_OK) 393 397 return ErrorMessage(hWndApp, "Couldn't get back buffer info!\n"); 394 398 395 399 GDBG_INFO((80, "_dxAS: Full Screen: front/back buffer allocated!\n")); 396 400 397 401 /* Allocate Aux Buffer Surface - XXX */ 398 402 ddsd.dwSize = sizeof( ddsd ); … … 400 404 ddsd.dwWidth = xRes; 401 405 ddsd.dwHeight = yRes; 402 ddsd.ddsCaps.dwCaps = 406 ddsd.ddsCaps.dwCaps = 403 407 DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; 404 405 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 408 409 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 406 410 return ErrorMessage(hWndApp, "Couldn't allocate aux surface" ); 407 411 408 412 GDBG_INFO((80, "_dxAS: Full Screen: aux buffer allocated!\n")); 409 413 410 414 /* 411 415 * Triple buffer hack: full-screen only for now. Allocate as Aux DD surf, … … 414 418 */ 415 419 if (tripleBuffering) { 416 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK) 420 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK) 417 421 return ErrorMessage(hWndApp, "Couldn't allocate triple buffer" ); 418 422 … … 420 424 } 421 425 } 422 426 423 427 /* Convert direct draw surfaces to Glide's idea of buffer descriptors */ 424 428 return _dxDDrawToGlideDesc(pDesc); … … 432 436 const char *errorMessage = "no error"; 433 437 434 /* for now this is a goddamn baseball bat 438 /* for now this is a goddamn baseball bat 435 439 it can be trimmed down */ 436 440 if ( !IsFullScreen ) { /* this *REALLY* should be called for fullscreen */ … … 440 444 if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); 441 445 if( lpFront ) IDirectDrawSurface2_Release( lpFront ); 442 446 443 447 lpClipper = NULL; 444 448 lpFront = NULL; … … 446 450 lpTriple = NULL; 447 451 lpAux = NULL; 448 452 449 453 /* Verify screen pixel format is 16bpp, and set cooperative level */ 450 454 ddsd.dwSize = sizeof( ddsd ); … … 454 458 ddsd.dwFlags = DDSD_CAPS; 455 459 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE; 456 460 457 461 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) { 458 462 errorMessage = "Couldn't allocate primary surface!"; … … 484 488 ddsd.ddsCaps.dwCaps = 485 489 DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; 486 490 487 491 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) { 488 492 errorMessage = "Couldn't allocate secondary surface!"; … … 490 494 } 491 495 492 /* 493 * Always allocate Aux Buffer Surface 496 /* 497 * Always allocate Aux Buffer Surface 494 498 * XXX - (use nAuxBuffers, and deal with 8bpp for alpha) 495 499 */ … … 500 504 ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY 501 505 | DDSCAPS_3DDEVICE; 502 506 503 507 if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) { 504 508 errorMessage = "Couldn't allocate aux surface"; … … 531 535 { 532 536 if (lpDD == NULL) return TRUE; 533 537 534 538 if (IDirectDrawSurface2_IsLost(lpFront) == DDERR_SURFACELOST) { 535 if (IDirectDrawSurface2_Restore(lpFront) != DD_OK) 539 if (IDirectDrawSurface2_Restore(lpFront) != DD_OK) 536 540 return ErrorMessage(hWndApp, "Front Buffer restore failure\n"); 537 541 } 538 542 539 543 if (!IsFullScreen) { 540 544 if (IDirectDrawSurface2_IsLost(lpBack) == DDERR_SURFACELOST) { 541 if (IDirectDrawSurface2_Restore(lpBack) != DD_OK) 545 if (IDirectDrawSurface2_Restore(lpBack) != DD_OK) 542 546 return ErrorMessage(hWndApp, "Back Buffer restore failure\n"); 543 547 } 544 548 } 545 549 546 550 if (IDirectDrawSurface2_IsLost(lpAux) == DDERR_SURFACELOST) { 547 if (IDirectDrawSurface2_Restore(lpAux) != DD_OK) 551 if (IDirectDrawSurface2_Restore(lpAux) != DD_OK) 548 552 return ErrorMessage(hWndApp, "Aux Buffer restore failure\n"); 549 553 } 550 554 551 555 if (!IsFullScreen) { 552 556 if (IDirectDrawSurface2_IsLost(lpTriple) == DDERR_SURFACELOST) { 553 if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK) 557 if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK) 554 558 return ErrorMessage(hWndApp, "Back Buffer restore failure\n"); 555 559 } 556 560 } 557 561 558 562 GDBG_INFO((80, "_dxRS: restore surfaces OK\n")); 559 563 return _dxDDrawToGlideDesc(pDesc); … … 587 591 588 592 /* 589 * Get ourselves a valid window handle 593 * Get ourselves a valid window handle 590 594 */ 591 595 hWndApp = (hWindow == 0) ? GetActiveWindow() : (HWND) hWindow; … … 615 619 if ((sRes < GR_RESOLUTION_MIN) || 616 620 (sRes > GR_RESOLUTION_MAX) && 617 (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) 621 (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) 618 622 #else 619 623 if ((sRes < GR_RESOLUTION_320x200) || 620 (sRes > GR_RESOLUTION_512x256)) 624 (sRes > GR_RESOLUTION_512x256)) 621 625 #endif 622 626 return ErrorMessage(hWndApp, "Bad Fullscreen resolution"); … … 659 663 GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType)); 660 664 GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset)); 661 GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); 665 GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); 662 666 GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP)); 663 667 } … … 668 672 669 673 if ( curHALData->initSetVideo ) { 670 curHALData->initSetVideo( sRes, vRefresh, 674 curHALData->initSetVideo( sRes, vRefresh, 671 675 (FxU32*)width, (FxU32*)height ); 672 676 } … … 683 687 RECT rect; 684 688 int i; 685 689 686 690 GDBG_INFO((80, "dxControl: code = %d\n", code)); 687 691 688 692 /* dx is not initizized */ 689 693 if ( lpDD== NULL ) { 690 694 return TRUE; 691 695 } 692 696 693 697 /* Why was I called? */ 694 698 switch(code) { … … 698 702 Width = rect.right; 699 703 Height = rect.bottom; 700 GDBG_INFO((120, "W and H changed to %d %d\n", 701 Width, Height)); 704 GDBG_INFO((120, "W and H changed to %d %d\n", 705 Width, Height)); 702 706 703 707 if (!_dxReallocSurfaces(Width, Height, 0, BufDesc)) { … … 731 735 GDBG_INFO((80, "dxControl: code = %d, w = %d, h = %d\n", code, 732 736 Width, Height)); 733 737 734 738 return FXTRUE; 735 739 } /* dxControl */ … … 759 763 lpDD1 = NULL; 760 764 } 761 765 762 766 lpClipper = NULL; 763 767 lpFront = NULL; … … 766 770 lpAux = NULL; 767 771 lpDD = NULL; 768 772 769 773 #endif /* 0 */ 770 774 GDBG_INFO((80, "dxClose: Returning TRUE\n")); … … 778 782 static POINT point; 779 783 static HRESULT hr; 780 784 781 785 GDBG_INFO((80, "dxSwap:\n")); 782 786 if ( !IsFullScreen ) { … … 787 791 src.top = 0; 788 792 src.bottom = Height-1; 789 793 790 794 dest = src; 791 795 point.x = 0; … … 797 801 dest.bottom += point.y; 798 802 799 hr = IDirectDrawSurface_Blt( lpFront, 803 hr = IDirectDrawSurface_Blt( lpFront, 800 804 &dest, 801 805 lpBack, … … 803 807 DDBLT_WAIT, 804 808 NULL ); 805 809 806 810 while( IDirectDrawSurface_GetBltStatus( lpFront, DDGBS_ISBLTDONE ) != 807 811 DD_OK ); 808 812 809 813 if ( hr != DD_OK ) { 810 814 ErrorMessage(hWndApp, "Couldn't blit!\n"); … … 812 816 } 813 817 return; 814 818 815 819 } /* dxSwap */ 816 820 #else /* it's either DOS or the Hoopti Lab Setup */ … … 880 884 break; 881 885 } 882 886 883 887 884 888 #define WAITLOOP {\ … … 893 897 894 898 if ( curHALData->initSetVideo ) { 895 rv = curHALData->initSetVideo( sRes, vRefresh, 899 rv = curHALData->initSetVideo( sRes, vRefresh, 896 900 (FxU32*)width, (FxU32*)height ); 897 901 if ( !rv ) goto BAIL; 898 902 } 899 903 900 904 /* Initialize all descriptors. */ 901 905 dFront->bufMagic = VG96_BUF_MAGIC; … … 952 956 #ifdef GDBG_INFO_ON 953 957 { 954 int i; 958 int i; 955 959 956 960 for (i = 0; i < 5; i++) { … … 959 963 GDBG_INFO((80, "%s: pBufDesc.bufType = %s\n", 960 964 FN_NAME, bufTypeNames[pBufDesc[i].bufType])); 961 GDBG_INFO((80, "%s: pBufDesc.bufOffset = 0x%x\n", 965 GDBG_INFO((80, "%s: pBufDesc.bufOffset = 0x%x\n", 962 966 FN_NAME, pBufDesc[i].bufOffset )); 963 GDBG_INFO((80, "%s: pBufDesc.bufStride = 0x%x\n", 967 GDBG_INFO((80, "%s: pBufDesc.bufStride = 0x%x\n", 964 968 FN_NAME, pBufDesc[i].bufStride)); 965 969 GDBG_INFO((80, "%s: pBufDesc.bufBPP = 0x%x\n", -
trunk/src/opengl/glide/sst1/init/init96/init96.c
r2885 r6653 1 /* $Id: init96.c,v 1.2 2001-09-05 14:31:01 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 ** $Revision: 1. 1 $20 ** $Date: 200 0-02-25 00:31:28 $20 ** $Revision: 1.2 $ 21 ** $Date: 2001-09-05 14:31:01 $ 21 22 ** 22 23 */ 23 static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1. 1$";24 static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1.2 $"; 24 25 25 26 /* ANSI Headers */ … … 113 114 114 115 115 #define RFB 0 116 #define RFB 0 116 117 #define DFB 1 117 118 118 119 119 120 extern FxBool tripleBuffering; 120 121 … … 173 174 oldVidMode; 174 175 175 static FxU32 176 devNum, 176 static FxU32 177 devNum, 177 178 physAddr, 178 179 fifoMTRRNum = 0xffffffff; … … 181 182 #ifdef GDBG_INFO_ON 182 183 /* NOTE: 183 184 184 185 This array is HIGHLY important to debugging. Delete it at your 185 186 extreme peril. … … 449 450 #ifdef GDBG_INFO_ON 450 451 FxU32 451 get96(FxU32 *addr) 452 get96(FxU32 *addr) 452 453 { 453 454 FxU32 … … 495 496 496 497 static FxBool 497 init96LoadBufRegs(int nBuffers, 498 InitBufDesc_t *pBufDesc, 499 int xRes, int yRes, 498 init96LoadBufRegs(int nBuffers, 499 InitBufDesc_t *pBufDesc, 500 int xRes, int yRes, 500 501 InitRegisterDesc *rd); 501 502 … … 512 513 SET(sstPtr->vC.x, x); 513 514 SET(sstPtr->vC.y, y+XY_ONE*tSize/2); 514 515 515 516 SET(sstPtr->s, 0); 516 517 SET(sstPtr->t, 0); … … 561 562 562 563 *(texAddr + (8 << 15)) = init; 563 /* 564 /* 564 565 write to 2 consequtive locations in lod0 to alter the data 565 on the memory signals 566 on the memory signals 566 567 */ 567 568 WAITLOOP; 568 *(texAddr + (0)) = 0xffffffff; 569 *(texAddr + (0)) = 0xffffffff; 569 570 WAITLOOP; 570 571 *(texAddr + (1)) = 0xffffffff; 571 572 572 573 WAITLOOP; 573 574 … … 592 593 { 593 594 FxU32 data; 594 595 595 596 if(myGetenv(("SST96_TMUMEM_SIZE"))) { 596 597 *TmuMemorySize = atoi(myGetenv(("SST96_TMUMEM_SIZE"))); … … 605 606 /* set lod8 */ 606 607 SET(sstPtr->tLOD, ((8 << 2) | (8 << 7))); 607 608 /* 608 609 /* 609 610 first see if we have 4 Mbytes by writing a texel at 2MB followed by 610 611 a texel at 1MB and 0MB and then rendering using the texel at 2MB … … 617 618 data = sense(sstbase,info,tmu,0x200000, SENSE1); 618 619 if (data) { 619 *TmuMemorySize = 4; 620 *TmuMemorySize = 4; 620 621 return(FXTRUE); 621 622 } … … 630 631 } 631 632 } 632 633 633 634 data = sense(sstbase,info,tmu,0x000000, SENSE0); 634 635 if (data) { 635 636 data = sense(sstbase,info,tmu,0x000000, SENSE1); 636 637 if (data) { 637 *TmuMemorySize = 1; 638 *TmuMemorySize = 1; 638 639 return(FXTRUE); 639 640 } … … 641 642 642 643 #undef WAITLOOP 643 644 644 645 return(FXFALSE); 645 646 } … … 653 654 sst96InitGetTmuInfo(FxU32 *sstbase, VG96Info *info) 654 655 { 655 sstPtr = 656 sstPtr = 656 657 (volatile Sstregs *)(SST96_COMMAND_REGS(sstbase)); 657 658 … … 684 685 685 686 VG96Info *vg96Info = (VG96Info *) info; 686 687 687 688 FxU32 688 689 vendorID = vID, 689 690 deviceID = dID; 690 691 691 692 GDBG_INFO((80, "SST-96 Initialization code %s\n", revString)); 692 693 693 694 /* Watcom warning suppression */ 694 695 revString[0] = revString[0]; … … 696 697 /* !!! FIXME hack for vxd bug */ 697 698 putenv( "SST_DUALHEAD=1" ); 698 699 699 700 switch (vID) { 700 701 case AT3DVID: … … 710 711 711 712 GDBG_INFO((80, "init96MapBoard: Mapping card into linear memory\n")); 712 713 713 714 regDesc->hwDep.VG96RegDesc.baseAddress = 714 715 pciMapCardMulti( vendorID, deviceID, curHALData->memSize, &devNum, 0 , 0); … … 741 742 sstHW = regDesc->hwDep.VG96RegDesc.baseAddress; 742 743 743 GDBG_INFO((80, "%s: Mapped Voodoo Rush board at 0x%x\n", 744 GDBG_INFO((80, "%s: Mapped Voodoo Rush board at 0x%x\n", 744 745 FN_NAME, regDesc->hwDep.VG96RegDesc.baseAddress)); 745 746 … … 750 751 751 752 GDBG_INFO((88, "init96MapBoard sstHW = %x\n", sstHW)); 752 753 753 754 /* CHD NOTE: The routine init96SetupRendering MUST Be called from this 754 755 routine or all hell brakes loose. … … 761 762 GrScreenResolution_t res = GR_RESOLUTION_640x480; 762 763 static void init96SetupRendering(InitRegisterDesc *regDesc, 763 764 GrScreenResolution_t sRes); 764 765 765 766 if (curHALData->initAperture) … … 769 770 if ( !rv ) 770 771 return FXFALSE; 771 772 772 773 init96SetupRendering(regDesc, res); 773 774 774 775 sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info); 775 776 } … … 779 780 /* In dos mode, we do it the way it is supposed to be. 780 781 In windows mode, calling initEnableRegs() will change the clock 781 rate and it makes the refresh looks bad. So we still use the 782 rate and it makes the refresh looks bad. So we still use the 782 783 init96SetVideo() to set up the rendering mode etc. 783 784 */ … … 791 792 union REGS 792 793 inR, outR; 793 794 794 795 inR.w.ax = 0x4f03; 795 796 int386(0x10, &inR, &outR); 796 797 797 798 oldVidMode = outR.w.bx; 798 799 GDBG_INFO((80, "%s: Saving Current video mode (0x%x).\n", 799 FN_NAME, oldVidMode)); 800 FN_NAME, oldVidMode)); 800 801 } 801 802 802 803 if ( !rv ) 803 804 return FXFALSE; 804 805 805 806 if ( curHALData->initEnableRegs ) 806 807 rv = curHALData->initEnableRegs( regDesc ); 807 808 if ( !rv ) 808 809 return FXFALSE; 809 810 810 811 init96SetupRendering(regDesc, res); 811 812 812 813 sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info); 813 814 } … … 817 818 GrScreenResolution_t res = GR_RESOLUTION_NONE; 818 819 init96SetVideo(0, res, 819 0, 2, 1, 820 0, 2, 1, 820 821 2, 1, regDesc, 821 822 &xres, &yres, &fbStride ); … … 827 828 828 829 GDBG_INFO((80, "init96MapBoard: returning FXTRUE\n")); 829 830 830 831 return FXTRUE; 831 832 … … 852 853 }\ 853 854 } 854 #endif 855 #endif 855 856 856 857 #define SWAPPENDING(status) ((status & 0x70) >> 4) … … 862 863 Library: Init Code for 96 863 864 Description: 864 865 865 866 Arguments: 866 867 867 868 Return: 868 869 -------------------------------------------------------------------*/ … … 874 875 875 876 sstHW = regDesc->hwDep.VG96RegDesc.baseAddress; 876 sstPtr = 877 sstPtr = 877 878 (volatile Sstregs *)(SST96_COMMAND_REGS(regDesc->hwDep.VG96RegDesc.baseAddress)); 878 879 … … 882 883 GDBG_INFO((80, "%s: Software reset\n", FN_NAME)); 883 884 SET(sstHW[0x90 + 0x100000], 0xf601); /* (0xf601) init0, sw reset. */ 884 885 885 886 WAITLOOP; 886 887 … … 889 890 SET(sstHW[0x100000 + 0x94], 0); 890 891 SET(sstHW[0x100000 + 0x93], 0); 891 892 892 893 GDBG_INFO((80, "%s: Setting up Mem FIFO\n", FN_NAME)); 893 894 … … 895 896 896 897 SET(sstHW[0x92 + 0x100000], regVal); 897 898 /* Off for Host Blt, On for LFB command traffic 898 899 /* Off for Host Blt, On for LFB command traffic 899 900 Low Priority Request Aging - wait 64 cycles 900 901 before answering low priority requests from … … 903 904 [24] - PUMA Texture Address Space Mode - 0x1 - 2MB 904 905 [23] - PUMA Texture Base Address Mode - 0x1 - 6MB 905 [12:7] - PUMA Low Priority Grant Limit Cnt - 0x0 906 [6] - PUMA Low Prorirty Grant Limit Enable - 0x0 906 [12:7] - PUMA Low Priority Grant Limit Cnt - 0x0 907 [6] - PUMA Low Prorirty Grant Limit Enable - 0x0 907 908 [5:0] - PUMA Low Priority Request Delay Cnt - 0x1f - 32 ccls 908 909 Setting to 0x3f ( max ) seems to cripple windows/d3d … … 910 911 */ 911 912 GDBG_INFO((80, "%s: Setting low priority request aging.\n", FN_NAME)); 912 /* 913 * If we're running at a high resolution, don't starve AT3D's 913 /* 914 * If we're running at a high resolution, don't starve AT3D's 914 915 * video refresh. XXX FIXME for AT3d only 915 916 */ … … 926 927 SET(sstHW[0x91 + 0x100000],regVal); 927 928 } 928 929 /* Come out of Reset 929 930 /* Come out of Reset 930 931 [17] - Serial Status Xfer Mode - 0x0 - rising edge 931 932 [16:12] - TREX-To-FBI High Water Mark - 0xf 932 933 [11:8] - TREX-To-FBI Bus Clock Delay - 0x6 933 */ 934 934 */ 935 935 936 GDBG_INFO((80, "%s: Coming out of FBI reset\n", FN_NAME)); 936 937 GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600); 937 938 SET(sstHW[0x90 + 0x100000], regVal); /* Bit 1 disables tmu */ 938 939 939 940 WAITLOOP; 940 941 … … 942 943 { 943 944 FxU32 trexinit0, trexinit1; 944 945 945 946 if(myGetenv(("SST_TREX0INIT0"))) { 946 947 sscanf(myGetenv(("SST_TREX0INIT0")), "%i", &trexinit0); … … 948 949 trexinit0 = 0x05441; /* TREXINIT0 */ 949 950 } 950 951 951 952 if(myGetenv(("SST_TREX0INIT1"))) { 952 953 sscanf(myGetenv(("SST_TREX0INIT1")), "%i", &trexinit1); … … 954 955 trexinit1 = 0x3643c; /* TREXINIT1 */ 955 956 } 956 957 957 958 SET(sstHW[0xc7 + 0x100000], trexinit0); /* TREXINIT0 */ 958 959 SET(sstHW[0xc8 + 0x100000], trexinit1); /* TREXINIT1 */ 959 960 } 960 961 961 962 WAITLOOP; 962 963 963 964 #undef FN_NAME 964 965 } /* init96SetupRendering */ … … 970 971 Library: init96 971 972 Description: 972 973 973 974 1 - Set video mode 974 975 2 - Enable Direct Writes to Jr 975 976 3 - Put Jr registers in Reset 976 977 3 - Set up Color Buffer Registers 977 978 978 979 Arguments 979 980 980 981 Return: 981 FXFALSE - fail 982 FXFALSE - fail 982 983 FXTRUE - pass 983 984 -------------------------------------------------------------------*/ 984 INITVG96ENTRY(init96SetVideo, FxBool , 985 INITVG96ENTRY(init96SetVideo, FxBool , 985 986 ( FxU32 hWnd, 986 987 GrScreenResolution_t sRes, … … 1011 1012 GDBG_INFO((80, "%s: %d Color Buffers\n", FN_NAME, nColBuffers)); 1012 1013 1013 GDBG_INFO((80, "(%s) hWnd=%x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n", 1014 GDBG_INFO((80, "(%s) hWnd=%x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n", 1014 1015 FN_NAME, hWnd, sRes, yOrigin, nColBuffers, nAuxBuffers)); 1015 1016 … … 1020 1021 if (curHALData->initAperture) 1021 1022 (*curHALData->initAperture)(regDesc); 1022 1023 1023 1024 #if defined( __DOS32__ ) 1024 1025 { … … 1031 1032 oldVidMode = outR.w.bx; 1032 1033 GDBG_INFO((80, "%s: Saving Current video mode (0x%x).\n", 1033 FN_NAME, oldVidMode)); 1034 } 1035 #endif 1036 1034 FN_NAME, oldVidMode)); 1035 } 1036 #endif 1037 1037 1038 /*------------------------------------- 1038 1039 Set Video Mode … … 1042 1043 this does not have anything to do with directX */ 1043 1044 #ifdef __linux__ 1044 if (!linOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 1045 nColBuffers, nAuxBuffers, bufDesc, 1045 if (!linOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 1046 nColBuffers, nAuxBuffers, bufDesc, 1046 1047 xres, yres, &swapType)) { 1047 1048 #else 1048 if (!dxOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 1049 nColBuffers, nAuxBuffers, bufDesc, 1049 if (!dxOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 1050 nColBuffers, nAuxBuffers, bufDesc, 1050 1051 xres, yres, &swapType)) { 1051 1052 #endif … … 1054 1055 goto BAIL; 1055 1056 } 1056 1057 #ifdef GDBG_INFO_ON 1057 1058 #ifdef GDBG_INFO_ON 1058 1059 for (i = 0; i < nColBuffers; i++) { 1059 1060 GDBG_INFO((80, "%s: bufDesc[%d]:\n", FN_NAME, i)); 1060 1061 GDBG_INFO((80, "%s: bufDesc.bufType = %s\n", 1061 1062 FN_NAME, bufTypeNames[bufDesc[i].bufType])); 1062 GDBG_INFO((80, "%s: bufDesc.bufOffset = 0x%x\n", 1063 GDBG_INFO((80, "%s: bufDesc.bufOffset = 0x%x\n", 1063 1064 FN_NAME, bufDesc[i].bufOffset )); 1064 GDBG_INFO((80, "%s: bufDesc.bufStride = 0x%x\n", 1065 GDBG_INFO((80, "%s: bufDesc.bufStride = 0x%x\n", 1065 1066 FN_NAME, bufDesc[i].bufStride)); 1066 1067 GDBG_INFO((80, "%s: bufDesc.bufBPP = 0x%x\n", … … 1097 1098 FxU32 1098 1099 pending = 7; /* # Swaps pending */ 1099 1100 GDBG_INFO((80, 1101 "%s: Sending %d swapbufferCMDs\n", 1102 FN_NAME, 1100 1101 GDBG_INFO((80, 1102 "%s: Sending %d swapbufferCMDs\n", 1103 FN_NAME, 1103 1104 pending)); 1104 1105 while (pending) { 1105 1106 FxU32 1106 1107 tries = 0; 1107 1108 1108 1109 GDBG_INFO((80, "%s: %d swaps pending\n", FN_NAME, pending)) ; 1109 1110 … … 1117 1118 WAITLOOP; 1118 1119 } 1119 1120 1120 1121 do { 1121 1122 ++tries; 1122 1123 status = sstHW[0x100000]; 1123 1124 1124 1125 GDBG_INFO((120, "%s: Serial status = 0x%x\n", FN_NAME, status)); 1125 1126 pending = SWAPPENDING(status); … … 1131 1132 } while (pending); 1132 1133 } 1133 1134 1134 1135 /* Clear counters with a NOP */ 1135 1136 SET(sstHW[0x42 + 0x100000], 1); /* NOP cmd */ … … 1138 1139 do { 1139 1140 if (nTries > MAXTRIES) { 1140 GDBG_INFO((80, 1141 GDBG_INFO((80, 1141 1142 "%s: Bailing out and returning false after %d checks for idle.\n", FN_NAME, nTries-1)); 1142 1143 return FXFALSE; … … 1144 1145 ++nTries; 1145 1146 status = sstHW[0x100000]; 1146 1147 GDBG_INFO((80, 1148 "%s: Serial status after soft reset: 0x%x\n", 1149 FN_NAME, 1147 1148 GDBG_INFO((80, 1149 "%s: Serial status after soft reset: 0x%x\n", 1150 FN_NAME, 1150 1151 status)); 1151 1152 } while (status & 0x1); 1152 1153 } /* end of swap buffer block */ 1153 1154 1154 1155 1155 1156 if (tripleBuffering) { 1156 1157 GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600); … … 1167 1168 1168 1169 dfbFrontIdx = 0; 1169 dfbBackIdx = 1; 1170 dfbBackIdx = 1; 1170 1171 dfbRenderIdx = dfbBackIdx; 1171 1172 1172 1173 rfbFrontIdx = 0; 1173 rfbBackIdx = 1; 1174 rfbBackIdx = 1; 1174 1175 rfbRenderIdx = rfbBackIdx; 1175 1176 … … 1179 1180 goto BAIL; 1180 1181 } 1181 1182 1182 1183 /*------------------------------------- 1183 1184 Set up Page Flipping … … 1196 1197 if (curHALData->initUseTiles && (swapType == INIT_SWAP_FLIP)) { 1197 1198 #ifdef H3D 1198 (*curHALData->initUseTiles)(regDesc, 1199 (*curHALData->initUseTiles)(regDesc, 1199 1200 buf, 1200 1201 maxBuffer, 1201 1202 bI[0].dfbStride, 1202 *xres, 1203 *xres, 1203 1204 *yres, 1204 1205 GR_RESOLUTION_IS_AUTOFLIPPED(sRes) ); 1205 1206 #else 1206 (*curHALData->initUseTiles)(regDesc, 1207 (*curHALData->initUseTiles)(regDesc, 1207 1208 buf, 1208 1209 maxBuffer, 1209 1210 bI[0].dfbStride, 1210 *xres, 1211 *xres, 1211 1212 *yres ); 1212 1213 #endif … … 1214 1215 } 1215 1216 #endif 1216 1217 1217 1218 *fbStride = (bI[1].dfbStride>>1); 1218 1219 GDBG_INFO(( 200, "frame buffer stride: %d\n", *fbStride )); 1219 1220 1220 1221 BAIL: 1221 1222 return rv; … … 1230 1231 Library: init96 1231 1232 Description: 1232 1233 1233 1234 Disable Direct Hardware Access 1234 1235 Restore the video to it's initial state 1235 1236 1236 1237 Arguments: 1237 1238 none … … 1240 1241 -------------------------------------------------------------------*/ 1241 1242 INITVG96ENTRY(init96RestoreVideo, void, ( InitRegisterDesc *regDesc )) { 1242 #define FN_NAME "init96RestoreVideo" 1243 #define FN_NAME "init96RestoreVideo" 1243 1244 if ( curHALData->initDisableRegs ) 1244 1245 curHALData->initDisableRegs( regDesc ); 1245 1246 #if defined( __WIN32__ ) && !defined( INIT_HOOPTI ) 1246 1247 #if defined( __WIN32__ ) && !defined( INIT_HOOPTI ) 1247 1248 dxClose(); 1248 #elif defined( __DOS32__ ) 1249 #elif defined( __DOS32__ ) 1249 1250 { 1250 1251 static union REGS … … 1270 1271 Library: init96 1271 1272 Description: 1272 1273 Enable the JR command transport and return pertinant fifo 1273 1274 Enable the JR command transport and return pertinant fifo 1274 1275 information to the caller 1275 1276 1276 1277 Arguments: 1277 1278 info - structure to fill with info about the FIFO … … 1280 1281 FXFALSE - fail 1281 1282 -------------------------------------------------------------------*/ 1282 INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc)) 1283 INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc)) 1283 1284 { 1284 1285 #define FN_NAME "init96EnableTransport" … … 1292 1293 PciMemType 1293 1294 fifoMemType; 1294 1295 1295 1296 GDBG_INFO((80, "%s\n", FN_NAME)); 1296 1297 1297 1298 /*------------------------------------------------------------ 1298 1299 Enable the Off Chip Fifo 1299 1300 ------------------------------------------------------------*/ 1300 1301 1301 1302 /* These are defined in sst.c for now */ 1302 1303 lo = (fifoStart >> 12); /* physaddr of 1st 4k page */ … … 1304 1305 sz = (hi - lo + 1) << 12; /* bytes */ 1305 1306 th = (hi - lo) - 3; /* threshold, in 4k pages. */ 1306 1307 1307 1308 /* Generate virtual addresses for the pointers. */ 1308 1309 fifovirt = (FxU32 *)&sstHW[lo << 10]; … … 1310 1311 fifomax = sz; 1311 1312 fifocur = 0; 1312 1313 1313 1314 fifoptr = fifovirt; 1314 1315 fifosize = 4096; /* initially, set to 4k */ 1315 1316 1316 1317 fifolfb = 1; 1317 1318 1318 1319 /* First disable the off-chip fifo */ 1319 1320 GDBG_INFO((80, "%s: Disabling off-chip FIFO\n", FN_NAME)); 1320 1321 SET(sstHW[0x100000 + 0x93], 0); 1321 1322 1322 1323 /* FbijrInit4 - 0x94 - entry count */ 1323 1324 SET(sstHW[0x100000 + 0x94], 0); 1324 1325 1325 1326 /* FbijrInit5 - 0x95 - read pointer */ 1326 1327 SET(sstHW[0x100000 + 0x95], lo << 9); 1327 1328 1328 /* Default size to page checking mode. 1329 /* Default size to page checking mode. 1329 1330 * 1330 1331 * NB: This will get overwritten later if we're using … … 1340 1341 info->hwDep.vg96FIFOData.fifoLfb = fifolfb; 1341 1342 1342 /* Set up alternate wrapping values. 1343 /* Set up alternate wrapping values. 1343 1344 * 1344 1345 * NB: This *MUST* come before the processor dependent … … 1375 1376 1376 1377 /* 1377 ** NOTE TO ALL FOOLS WHO TREAD HERE 1378 ** 1378 ** NOTE TO ALL FOOLS WHO TREAD HERE 1379 ** 1379 1380 ** It is VITALLY important to enable the FIFO AFTER the 1380 1381 ** P6 Lag Of Love(tm), instead of before, otherwise the FIFO will … … 1387 1388 1388 1389 /* Set the fifo ptr now that we really know where its going to start 1389 * for the client code. 1390 * for the client code. 1390 1391 */ 1391 1392 info->hwDep.vg96FIFOData.fifoPtr = (FxU32*)fifoptr; … … 1426 1427 Return: 1427 1428 -------------------------------------------------------------------*/ 1428 INITVG96ENTRY(init96DisableTransport, void, ( void )) 1429 INITVG96ENTRY(init96DisableTransport, void, ( void )) 1429 1430 { 1430 1431 #define FN_NAME "init96DisableTransport" 1431 1432 while (*(volatile FxU32 *)sstPtr & 1); 1432 1433 1433 1434 SET(sstHW[0x100000 + 0x90], 0xf601); /* (0xf601) init0, sw reset. */ 1434 1435 SET(sstHW[0x100000 + 0x95], 0); … … 1503 1504 1504 1505 sstPtr->swappendCMD = 0x1; 1505 1506 1506 1507 1507 1508 if (gotEnv == FXFALSE) { … … 1552 1553 CRTC_GET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow); 1553 1554 serialOverflow &= 0xF0; 1554 1555 1555 1556 /* Make sure scanout within active display */ 1556 1557 do { 1557 1558 INP(VGA_INPUT_STATUS_1C, tmp); 1558 1559 } while (tmp & VIS1C_PIXEL_DISPLAY_INACTIVE); 1559 1560 1560 1561 /* Set serial address */ 1561 1562 /* For some reason unknown to me, this is set to the byte offset / 4, 1562 1563 or perhaps the offset in dwords */ 1563 1564 1564 1565 /* Top nibble */ 1565 1566 tmp = (FxU8) ((offset >> (2+16)) & 0x0F); 1566 1567 CRTC_SET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow | tmp); 1567 1568 1568 1569 /* Middle byte */ 1569 1570 tmp = (FxU8) ((offset >> (2+8)) & 0xFF); 1570 1571 CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_HI_INDEX, tmp); 1571 1572 1572 1573 /* Low byte */ 1573 1574 tmp = (FxU8) ((offset >> 2) & 0xFF); 1574 1575 CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_LO_INDEX, tmp); 1575 1576 1576 1577 /* Save away */ 1577 1578 do { … … 1584 1585 #endif 1585 1586 #endif 1586 1587 1587 1588 /* dpc - 26 jan 1998 1588 1589 * Some hw, macronix, requires that we diddle w/ even more bits 1589 * when we do the swap. 1590 * when we do the swap. 1590 1591 */ 1591 1592 if(curHALData->initSwapTiles != NULL) (*curHALData->initSwapTiles)(rd); 1592 1593 1593 1594 ADVANCE_BUFFERS(rfb); 1594 1595 … … 1597 1598 bI[rfbRenderIdx].rfb)); 1598 1599 wcb( (FxU32*)&(sstPtr->colBufferSetup), bI[rfbRenderIdx].rfb ); 1599 1600 1600 1601 1601 1602 } else { … … 1623 1624 Library: Init Code for VG96 1624 1625 Description: 1625 1626 1626 1627 Arguments: 1627 1628 1628 1629 Return: 1629 1630 -------------------------------------------------------------------*/ … … 1655 1656 #define LFB_OFFSET( X ) ( X & 0x3fffff ) 1656 1657 1657 INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes)) 1658 INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes)) 1658 1659 { 1659 1660 #define FN_NAME "init96GetBufferPtr" … … 1698 1699 Date: 2/25 1699 1700 Implementor(s): jdt 1700 Library: init96 1701 Library: init96 1701 1702 Description: 1702 1703 Set the current render buffer … … 1706 1707 none 1707 1708 -------------------------------------------------------------------*/ 1708 INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb)) 1709 INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb)) 1709 1710 { 1710 1711 #define FN_NAME "init96RenderBuffer" … … 1737 1738 none 1738 1739 -------------------------------------------------------------------*/ 1739 INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb)) 1740 INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb)) 1740 1741 { 1741 1742 #define FN_NAME "init96Origin" … … 1781 1782 1782 1783 GDBG_INFO((80, "(%s)\n", FN_NAME)); 1783 1784 1784 1785 if ( !sstHW ) return FXFALSE; 1785 1786 … … 1813 1814 (*((volatile FxU32*)(((FxU32)(__regP)) + (0x95 << 12))) << 3)) 1814 1815 1815 INITVG96ENTRY(init96WrapFIFO, 1816 FxBool, 1816 INITVG96ENTRY(init96WrapFIFO, 1817 FxBool, 1817 1818 (InitRegisterDesc* rd, InitFIFOData* fifoP)) 1818 1819 { … … 1826 1827 1827 1828 { 1828 const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr, 1829 const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr, 1829 1830 fifoP->hwDep.vg96FIFOData.roomToEnd) - 1830 1831 fifoP->hwDep.vg96FIFOData.fifoSize); 1831 1832 1832 1833 fifoP->hwDep.vg96FIFOData.roomToReadPtr -= writes; 1833 1834 fifoP->hwDep.vg96FIFOData.roomToEnd -= writes; … … 1843 1844 const FxU32 curReadPtr = SST96_HW_FIFO(sstHW, sstPtr); 1844 1845 const FxU32 curReadDist = curReadPtr - lastHwRead; 1845 1846 1846 1847 roomToReadPtr += curReadDist; 1847 1848 if (lastHwRead > curReadPtr) roomToReadPtr += fifoP->hwDep.vg96FIFOData.fifoMax; … … 1850 1851 } 1851 1852 1852 GDBG_INFO((80, FN_NAME"_Wait : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 1853 GDBG_INFO((80, FN_NAME"_Wait : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 1853 1854 (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize, 1854 1855 fifoP->hwDep.vg96FIFOData.roomToReadPtr, … … 1870 1871 #else 1871 1872 #define JU_JU_STALL /* Do Nothing */ 1872 #endif 1873 #endif 1873 1874 { 1874 1875 volatile FxU32* fifoPtr = fifoP->hwDep.vg96FIFOData.fifoPtr; … … 1886 1887 volatile FxU32* serialStatus = 1887 1888 fifoP->hwDep.vg96FIFOData.regDesc->hwDep.VG96RegDesc.serialStatus; 1888 1889 1889 1890 if ((*serialStatus & 0x80) != 0x00) { 1890 1891 GDBG_INFO((85, FN_NAME": fifo close to full. Waiting(0x%X)...\n", numJuJuStalls)); … … 1900 1901 #undef kFifoPadDelay 1901 1902 1902 GDBG_INFO((80, FN_NAME"_Wrap : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 1903 GDBG_INFO((80, FN_NAME"_Wrap : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 1903 1904 (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize, 1904 1905 fifoP->hwDep.vg96FIFOData.roomToReadPtr, 1905 1906 fifoP->hwDep.vg96FIFOData.roomToEnd)); 1906 1907 1907 1908 fifoP->hwDep.vg96FIFOData.roomToReadPtr -= fifoP->hwDep.vg96FIFOData.roomToEnd; 1908 1909 fifoP->hwDep.vg96FIFOData.roomToEnd = fifoP->hwDep.vg96FIFOData.fifoMax; 1909 1910 /* Reset fifo ptr to start */ 1910 1911 /* Reset fifo ptr to start */ 1911 1912 fifoP->hwDep.vg96FIFOData.fifoPtr = fifoP->hwDep.vg96FIFOData.fifoVirt; 1912 1913 goto again; 1913 1914 } 1914 1915 1915 1916 /* compute room left */ 1916 1917 fifoP->hwDep.vg96FIFOData.roomToEnd -= blockSize; … … 1918 1919 fifoP->hwDep.vg96FIFOData.fifoSize = MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr, 1919 1920 fifoP->hwDep.vg96FIFOData.roomToEnd) + blockSize; 1920 1921 1921 1922 GDBG_INFO((80, FN_NAME": (0x%X : 0x%X) : (0x%X : 0x%X) : 0x%X\n", 1922 1923 (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize, … … 1931 1932 return FXTRUE; 1932 1933 #undef FN_NAME 1933 } 1934 } 1934 1935 #else /* !SST96_ALT_FIFO_WRAP */ 1935 1936 … … 1951 1952 #define FN_NAME "init96FIFOWait" 1952 1953 volatile FxU32 *pstatus; 1953 1954 1954 1955 1955 1956 /* Check for more room. */ 1956 1957 pstatus = (volatile FxU32 *) rd->hwDep.VG96RegDesc.serialStatus; 1957 1958 1958 1959 if (*pstatus & 0x80) { /* 0x80 is the FIFO threshold */ 1959 1960 int timeout; … … 1965 1966 if (*pstatus & 0x80) { 1966 1967 GDBG_INFO((80, "Lost patience in %s. Status is 0x%x\n", 1967 FN_NAME, *pstatus)); 1968 FN_NAME, *pstatus)); 1968 1969 goto again; 1969 1970 } 1970 1971 } 1971 #undef FN_NAME 1972 #undef FN_NAME 1972 1973 } /* init96FIFOWait */ 1973 1974 … … 1988 1989 #define FN_NAME "init96WrapFIFO" 1989 1990 FxBool rVal; 1990 1991 1991 1992 GDBG_INFO((80,"%s\n", FN_NAME)); 1992 1993 1993 1994 while (fifoData->hwDep.vg96FIFOData.fifoSize > 0) { 1994 1995 *fifoData->hwDep.vg96FIFOData.fifoPtr++ = 0L; 1995 1996 fifoData->hwDep.vg96FIFOData.fifoSize -= 4; 1996 1997 } 1997 1998 1998 1999 1999 2000 fifoData->hwDep.vg96FIFOData.fifoCur += 4096; 2000 2001 2001 2002 /* Wrap back to beginning? */ 2002 2003 if (fifoData->hwDep.vg96FIFOData.fifoCur >= fifoData->hwDep.vg96FIFOData.fifoMax ) { 2003 2004 static int fifowraps = 0; 2004 2005 2005 2006 fifoData->hwDep.vg96FIFOData.fifoCur = 0; 2006 2007 if ((fifowraps = (fifowraps + 1) & 0xf) == 0) { 2007 GDBG_INFO((80, "%s: Wrapping %s FIFO\n", 2008 FN_NAME, 2009 (fifoData->hwDep.vg96FIFOData.fifoLfb 2010 ? "LFB" 2008 GDBG_INFO((80, "%s: Wrapping %s FIFO\n", 2009 FN_NAME, 2010 (fifoData->hwDep.vg96FIFOData.fifoLfb 2011 ? "LFB" 2011 2012 : "Video Aperture"))); 2012 2013 } 2013 2014 2014 if (fifoData->hwDep.vg96FIFOData.fifoLfb) 2015 if (fifoData->hwDep.vg96FIFOData.fifoLfb) 2015 2016 fifoData->hwDep.vg96FIFOData.fifoPtr = fifoData->hwDep.vg96FIFOData.fifoVirt; 2016 2017 } 2017 2018 2018 2019 /* */ 2019 2020 { 2020 2021 FxU32 2021 2022 fbiJrInit5; 2022 2023 2023 2024 GDBG_INFO((125, "%s: Write = 0x%x\n", FN_NAME, 2024 2025 (FxU32) fifoData->hwDep.vg96FIFOData.fifoPtr - 2025 2026 (FxU32) fifoData->hwDep.vg96FIFOData.fifoVirt)); 2026 2027 2027 2028 fbiJrInit5 = *((volatile FxU32 *) (((FxU32) sstPtr) + (0x95 << 12))); 2028 2029 … … 2045 2046 2046 2047 GDBG_INFO((80, "%s: Got more room.\n", FN_NAME)); 2047 2048 2048 2049 /* At this point, we have atleast 1 more page of fifo. */ 2049 2050 fifoData->hwDep.vg96FIFOData.fifoSize = 4096; 2050 2051 2051 2052 rVal = FXTRUE; 2052 2053 2053 2054 GDBG_INFO((80, "%s: returning %s\n", FN_NAME, rVal ? "FXTRUE" : "FXFALSE")); 2054 2055 2055 2056 return rVal; 2056 2057 2057 2058 #undef FN_NAME 2058 2059 } /* init96WrapFIFO */ … … 2060 2061 #endif /* !SST96_ALT_FIFO_WRAP */ 2061 2062 2062 /* 2063 * This function is used only locally, so none of Chris's decorations 2063 /* 2064 * This function is used only locally, so none of Chris's decorations 2064 2065 * Load colbufSetup and auxBufSetup registers, given a InitBufDesc_t 2065 2066 */ 2066 static FxBool 2067 static FxBool 2067 2068 init96LoadBufRegs(int nBuffers, InitBufDesc_t *pBufDesc, int xRes, 2068 int yRes, InitRegisterDesc *rd) 2069 int yRes, InitRegisterDesc *rd) 2069 2070 { 2070 2071 #define FN_NAME "init96LoadBufRegs" … … 2075 2076 InitBufDesc_t *pFifo = NULL; 2076 2077 int i; 2077 2078 2078 2079 GDBG_INFO((80, "(%s) w = %d, h = %d, n = %d\n", 2079 2080 FN_NAME, xRes, yRes, nBuffers)); 2080 2081 2081 2082 if ( !sstHW ) return FXFALSE; 2082 2083 2083 2084 /* Take pBufDesc apart */ 2084 2085 while (nBuffers-- > 0) { 2085 2086 switch (pBufDesc->bufType) { 2086 2087 case INIT_BUFFER_FRONTBUFFER: 2087 GDBG_INFO((80, "%s: %s: 0x%x\n", 2088 GDBG_INFO((80, "%s: %s: 0x%x\n", 2088 2089 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc)); 2089 2090 pFront = pBufDesc; 2090 2091 break; 2091 2092 case INIT_BUFFER_BACKBUFFER: 2092 GDBG_INFO((80, "%s: %s: 0x%x\n", 2093 GDBG_INFO((80, "%s: %s: 0x%x\n", 2093 2094 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc)); 2094 2095 pBack = pBufDesc; 2095 2096 break; 2096 2097 case INIT_BUFFER_AUXBUFFER: 2097 GDBG_INFO((80, "%s: %s: 0x%x\n", 2098 GDBG_INFO((80, "%s: %s: 0x%x\n", 2098 2099 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc)); 2099 pAux = pBufDesc; 2100 pAux = pBufDesc; 2100 2101 break; 2101 case INIT_BUFFER_FIFOBUFFER: 2102 GDBG_INFO((80, "%s: %s: 0x%x\n", 2102 case INIT_BUFFER_FIFOBUFFER: 2103 GDBG_INFO((80, "%s: %s: 0x%x\n", 2103 2104 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc)); 2104 2105 pFifo = pBufDesc; 2105 2106 break; 2106 2107 case INIT_BUFFER_TRIPLEBUFFER: 2107 GDBG_INFO((80, "%s: %s: 0x%x\n", 2108 GDBG_INFO((80, "%s: %s: 0x%x\n", 2108 2109 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc)); 2109 2110 pTriple = pBufDesc; … … 2121 2122 GDBG_INFO((80,"pFront = %.08x, pBack = %.08x, pTriple = %.08x, pAux = %.08x, pFifo = %.08x\n", 2122 2123 pFront, pBack, pTriple, pAux, pFifo)); 2123 2124 2124 2125 if (myGetenv("SST96_FORCEALIGN")) { 2125 2126 FxU32 F, B, T, A; 2126 2127 2127 2128 sscanf(myGetenv("SST96_FORCEALIGN"), "%x,%x,%x,%x", &F, &B, &T, &A); 2128 2129 GDBG_INFO((80, "!!!!!GROSS HACK... forcing values!!!!!\n")); … … 2143 2144 if (pFifo) 2144 2145 GDBG_INFO((80,"C = %.08x, s= %6d\n", pFifo ->bufOffset, pFifo ->bufStride)); 2145 2146 2146 2147 /* Fill the arrays here */ 2147 bI[0].dfbBase = pFront->bufOffset; 2148 bI[0].dfbBase = pFront->bufOffset; 2148 2149 bI[0].dfbStride = pFront->bufStride; 2149 2150 bI[0].dfbTop = pFront->bufOffset + (yRes-1) * pFront->bufStride; 2150 2151 2151 2152 bI[1].dfbBase = pBack->bufOffset; 2152 2153 bI[1].dfbStride = pBack->bufStride; … … 2204 2205 fifoEnd = pFifo->bufOffset + pFifo->bufStride; 2205 2206 } 2206 2207 2207 2208 GDBG_INFO((80, "%s: Returning TRUE\n", FN_NAME)); 2208 2209 return FXTRUE; … … 2219 2220 success. Zero is returned of the board is not mapped. 2220 2221 XXX This should be refined in the future. XXX 2221 2222 2222 2223 Arguments: none 2223 2224 2224 2225 Return: n, where n == available VRAM in bytes on the board 2225 2226 -------------------------------------------------------------------*/ -
trunk/src/opengl/glide/sst1/init/init96/initmcrx.c
r2885 r6653 1 /* $Id: initmcrx.c,v 1.2 2001-09-05 14:31:02 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:31:31 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:02 $ 23 24 ** 24 25 */ 25 static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1. 1$";26 static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1.2 $"; 26 27 27 28 #include <3dfx.h> … … 85 86 Library: Init Code for MCRX 86 87 Description: 87 88 88 89 Arguments: 89 90 90 91 Return: 91 92 address of mcrxHALData … … 106 107 Initialize rd pointers to access apertures 107 108 Arguments: 108 109 109 110 Return: 110 111 -------------------------------------------------------------------*/ … … 121 122 0x2000000 - 0x20000); 122 123 123 GDBG_INFO((80, "%s: Setting partnerRegPtr to 0x%x\n", 124 GDBG_INFO((80, "%s: Setting partnerRegPtr to 0x%x\n", 124 125 FN_NAME, rd->hwDep.VG96RegDesc.partnerRegPtr)); 125 126 126 127 #if 1 127 128 rd->hwDep.VG96RegDesc.serialStatus = (FxU32 *) … … 137 138 rd->hwDep.VG96RegDesc.fifoApertureBase = 138 139 (FxU32 *) (((FxU32)rd->hwDep.VG96RegDesc.baseAddress) + 0x400000); 139 140 140 141 GDBG_INFO((80, "%s: returning TRUE\n", FN_NAME)); 141 142 142 143 return rVal; 143 144 … … 146 147 147 148 /* FIXME !! jdt - need to add more resolutions to dos */ 148 INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr )) 149 INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr )) 149 150 { 150 151 #define FN_NAME "initMCRXSetVideo" 151 152 FxBool rv = FXTRUE; 152 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 153 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 153 154 union REGS r0, r1; 154 155 #endif 155 156 156 157 GDBG_INFO((80, "%s: \n", FN_NAME)); 157 158 158 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 159 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 159 160 switch( res ) { 160 161 case GR_RESOLUTION_320x200: … … 215 216 216 217 #endif 217 GDBG_INFO((80, "%s: returning %s\n", FN_NAME, rv?"TRUE":"FALSE")); 218 GDBG_INFO((80, "%s: returning %s\n", FN_NAME, rv?"TRUE":"FALSE")); 218 219 return rv; 219 #undef FN_NAME 220 #undef FN_NAME 220 221 } /* initMCRXSetVideo */ 221 222 … … 228 229 229 230 Do all setup necessary to enable direct writes to JR Space 230 231 231 232 Arguments: 232 233 rd - pointer to register description 233 234 234 235 Return: 235 236 True if success, False if Failure 236 237 -------------------------------------------------------------------*/ 237 INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd)) 238 INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd)) 238 239 { 239 240 #define FN_NAME "initMCRXEnableRegs" 240 FxU32 241 FxU32 241 242 tmp; 242 243 FxU8 … … 256 257 GDBG_INFO((80, "%s: Save Extended Registers Protection State\n", 257 258 FN_NAME)); 258 259 259 260 OUTP(0x3d4, 0x19); 260 261 INP(0x3d5, protState); … … 273 274 OUTP(0x3C4, 0x1B); 274 275 INP(0x3C5, rd->hwDep.VG96RegDesc.mclockLo); 275 GDBG_INFO((80, "%s: mclock registers: (0x%X : 0x%X)\n", FN_NAME, 276 GDBG_INFO((80, "%s: mclock registers: (0x%X : 0x%X)\n", FN_NAME, 276 277 (FxU32)rd->hwDep.VG96RegDesc.mclockHi, (FxU32)rd->hwDep.VG96RegDesc.mclockHi)); 277 278 278 279 GDBG_INFO((80, "%s: Enabling FBI Jr.\n", FN_NAME)); 279 280 OUTPW(0x3C4, 0x001F); … … 311 312 312 313 /* FIXME!!! jdt - puma/ram timing fixes need to go here */ 313 INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd)) 314 INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd)) 314 315 { 315 316 #define FN_NAME "initMCRXDisableRegs" 316 317 FxU8 317 318 seqSave, crtcSave; 318 319 319 320 FxU16 320 321 protState; … … 349 350 CRTC_GET(0x28, tmp); 350 351 GDBG_INFO((80, "%s: crtc 0x28: 0x%X\n", FN_NAME, tmp)); 351 tmp &= ~1; 352 tmp &= ~1; 352 353 CRTC_SET(0x28, tmp); 353 354 … … 358 359 { 359 360 FxU16 tempMclock; 360 361 361 362 GDBG_INFO((80, "%s: Restoring mclock\n", FN_NAME)); 362 363 tempMclock = (0x1A | (rd->hwDep.VG96RegDesc.mclockHi << 8)); 363 364 OUTPW(0x3C4, tempMclock); 364 365 365 366 tempMclock = (0x1B | (rd->hwDep.VG96RegDesc.mclockLo << 8)); 366 367 OUTPW(0x3C4, tempMclock); … … 370 371 OUTPW(0x3C4, 0x001C); 371 372 } 372 373 373 374 GDBG_INFO((80, "%s: Restoring Protection\n", FN_NAME)); 374 375 OUTPW(0x3df, protState); … … 381 382 382 383 return FXTRUE; 383 384 384 385 #undef FN_NAME 385 386 } /* initMCRXDisableRegs */ … … 391 392 Library: Init Code for MCRX 392 393 Description: 393 394 394 395 Arguments: 395 396 396 397 Return: 397 398 -------------------------------------------------------------------*/ … … 408 409 { 0x0d, 0x0c, 0x21 }, 409 410 { 0x71, 0x72, 0x73 }, 410 /* chd - Fixme! 411 /* chd - Fixme! 411 412 * Bogus numbers. Does triple buffering work on Macronix? 412 * 413 * dpc - 23 jan 1998 - 413 * 414 * dpc - 23 jan 1998 - 414 415 * Donny just told me this so hopefully this will work. 415 416 */ … … 438 439 const FxU8 maxBufferBits = (((crtcSwapControl & 0x08) == 0) ? 1 : 2); 439 440 440 crtcSwapStatus = ((crtcSwapStatus & ~0x03) | 441 crtcSwapStatus = ((crtcSwapStatus & ~0x03) | 441 442 ((bufferBits == maxBufferBits) ? 0x00 : bufferBits + 1)); 442 443 CRTC_SET(0x7A, crtcSwapStatus); 443 444 } 444 445 445 446 /* We have no way of knowing that this worked so of course we always 446 447 * return success. … … 456 457 Library: Init Code for MCRX 457 458 Description: 458 459 459 460 Arguments: 460 461 atmm: Pointer to base of MCRX … … 472 473 FxU32 nBuffers, 473 474 FxU32 strideInBytes, 474 FxU32 Width, FxU32 Height, FxU32 PageFlipping)) 475 FxU32 Width, FxU32 Height, FxU32 PageFlipping)) 475 476 #else 476 477 INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd, … … 478 479 FxU32 nBuffers, 479 480 FxU32 strideInBytes, 480 FxU32 Width, FxU32 Height)) 481 FxU32 Width, FxU32 Height)) 481 482 #endif 482 483 { … … 496 497 497 498 const char *envVal; 498 499 499 500 GDBG_INFO((80, "%s:\n", FN_NAME)); 500 501 … … 538 539 * If we are triple buffering we need to enable this on the actual 539 540 * macronix part as well. This is set by enabling bit 3 of the crtc 540 * register. 541 * register. 541 542 */ 542 543 if (nBuffers == 3) tmp |= 0x08; 543 544 mcrxHALData.initSwapTiles = initMCRXSwapTiles; 544 545 545 if (envVal = myGetenv("MRCX_71")) 546 if (envVal = myGetenv("MRCX_71")) 546 547 sscanf(envVal, "%x", &tmp); 547 548 CRTC_SET(0x70, tmp); … … 562 563 #undef FN_NAME 563 564 } /* initMCRXUseTiles */ 564 565 565 566 566 567 /*------------------------------------------------------------------- … … 572 573 573 574 get information about MCRX 574 575 575 576 Arguments: 576 577 info - pointer to info struct 577 578 578 579 Return: 579 580 True if success, False if Failure 580 581 -------------------------------------------------------------------*/ 581 INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info)) 582 INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info)) 582 583 { 583 584 #define FN_NAME "initMCRXGetInfo" … … 594 595 /* Watcom warning suppression */ 595 596 revString[0] = revString[0]; 596 597 597 598 info->vgaChip = 0; 598 599 info->vg96Rev = 0; … … 600 601 info->tfxRev = 1; 601 602 info->tfxRam = 2; 602 603 603 604 info->vg96Ram = (0x100000 << mBytesPow); 604 605 605 606 GDBG_INFO((80, "%s: frame buffer has 0x%x bytes\n", FN_NAME, info->vg96Ram)); 606 607 607 608 return FXTRUE; 608 609 609 610 #undef FN_NAME 610 611 } /* initMCRXGetInfo */ -
trunk/src/opengl/glide/sst1/init/init96/lindrvr.c
r2885 r6653 1 /* $Id: lindrvr.c,v 1.2 2001-09-05 14:31:03 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 ** … … 58 59 59 60 #ifndef DUMMY 60 static Display *dpy= 0;61 static int 62 static int 63 static void* 64 static int 65 static GC xgc= 0;61 static Display *dpy = 0; 62 static int screenNum = 0; 63 static int screenWidth = 0; 64 static void* screenPhys = 0; 65 static int screenMem = 0; 66 static GC xgc = 0; 66 67 static Window hWndApp = 0; 67 static FxU32 Width = 0; 68 static FxU32 Width = 0; 68 69 static FxU32 Height = 0; 69 70 static FxBool IsFullScreen = 0; … … 155 156 screenNum=XDefaultScreen(dpy); 156 157 XF86DGAGetVideoLL(dpy, screenNum, (int*)&screenPhys, &screenWidth, &banksize, 157 158 &screenMem); 158 159 screenMem*=1024; 159 160 return FXTRUE; … … 168 169 } 169 170 170 static int 171 static int 171 172 cvtXToGlideDesc(InitBufDesc_t *pDesc) { 172 173 InitBufDesc_t *dFront = &pDesc[0]; … … 200 201 return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info"); 201 202 dBack->bufOffset -= dScreen->bufOffset; 202 203 203 204 /* Get info about aux buffer (pixmap) */ 204 205 dAux->bufType = INIT_BUFFER_AUXBUFFER; 205 if (!cvtAddrToBufDesc(addrAux, dAux)) 206 if (!cvtAddrToBufDesc(addrAux, dAux)) 206 207 return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info"); 207 208 dAux->bufOffset -= dScreen->bufOffset; 208 209 209 210 /* Get info about triple buffer (pixmap if used) */ 210 211 if (tripleBuffering) { … … 219 220 dFifo->bufOffset = (int)addrFifo-dScreen->bufOffset; 220 221 dFifo->bufStride = FIFOSIZE; 221 222 222 223 GDBG_INFO((80, "cvtXToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset)); 223 224 GDBG_INFO((80, "cvtXToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset)); … … 269 270 270 271 static int 271 doAllocPixmaps(int xRes, int yRes, int vRefresh, 272 273 GDBG_INFO((80, "doAllocPixmaps: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 272 doAllocPixmaps(int xRes, int yRes, int vRefresh, 273 InitBufDesc_t *pDesc) { 274 GDBG_INFO((80, "doAllocPixmaps: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 274 275 hWndApp, IsFullScreen, xRes, yRes, vRefresh)); 275 276 … … 277 278 278 279 pixFifo=XCreatePixmap(dpy, hWndApp, screenWidth, 279 280 (FIFOSIZE/2+4096+screenWidth-1)/screenWidth, 16); 280 281 if ((XF86RushLockPixmap(dpy, screenNum, pixFifo, &addrFifo)==FXFALSE) 281 282 || !addrFifo) { … … 289 290 pixBack=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16); 290 291 if ((XF86RushLockPixmap(dpy, screenNum, pixBack, 291 292 &addrBack)==FXFALSE) || !addrBack) { 292 293 doReleasePixmaps(); 293 294 return ErrorMessage(hWndApp, "Failed to lock back pixmap\n"); … … 295 296 pixAux=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16); 296 297 if ((XF86RushLockPixmap(dpy, screenNum, pixAux, 297 298 &addrAux)==FXFALSE) || !addrAux) { 298 299 doReleasePixmaps(); 299 300 return ErrorMessage(hWndApp, "Failed to lock aux pixmap\n"); … … 302 303 pixTriple=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16); 303 304 if ((XF86RushLockPixmap(dpy, screenNum, pixTriple, 304 305 &addrTriple)==FXFALSE) || !addrTriple) { 305 306 doReleasePixmaps(); 306 307 return ErrorMessage(hWndApp, "Failed to lock triple pixmap\n"); … … 311 312 } 312 313 313 static FxBool 314 static FxBool 314 315 getWindowSize(int *width, int *height) { 315 316 XWindowAttributes attr; … … 351 352 352 353 /* 353 * Get ourselves a valid window handle 354 * Get ourselves a valid window handle 354 355 */ 355 356 hWndApp = (Window)hWindow; … … 374 375 375 376 if ((sRes < GR_RESOLUTION_320x200) || 376 (sRes > GR_RESOLUTION_512x256)) 377 (sRes > GR_RESOLUTION_512x256)) 377 378 return ErrorMessage(hWndApp, "Bad Fullscreen resolution"); 378 379 … … 389 390 return ErrorMessage(hWndApp, "Screen depth must be 16\n"); 390 391 if (XF86DGAQueryDirectVideo(dpy, DefaultScreen(dpy), &flags)==False || 391 392 !flags) { 392 393 GDBG_INFO((0, "Could query Direct Video")); 393 394 return ErrorMessage(hWndApp, "Direct video not supported\n"); 394 395 } 395 396 if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numModes, 396 397 &vidModes)==False) { 397 398 return ErrorMessage(hWndApp, "Couldn't query vidmode list\n"); 398 399 return 1; … … 400 401 for (i=0; i<numModes; i++) 401 402 if ((vidModes[i]->hdisplay==Width) && (vidModes[i]->vdisplay==Height)) 402 403 break; 403 404 if (i==numModes) { 404 405 return ErrorMessage(hWndApp, "Server doesn't support requested resolution\n"); 405 406 if (vidModes) { 406 407 407 XFree(vidModes); 408 vidModes=0; 408 409 } 409 410 return 1; … … 429 430 GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType)); 430 431 GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset)); 431 GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); 432 GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); 432 433 GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP)); 433 434 } … … 450 451 451 452 if ( curHALData->initSetVideo ) { 452 curHALData->initSetVideo( sRes, vRefresh, 453 curHALData->initSetVideo( sRes, vRefresh, 453 454 (FxU32*)width, (FxU32*)height ); 454 455 } … … 463 464 { 464 465 int i, w, h; 465 466 466 467 GDBG_INFO((80, "linControl: code = %d\n", code)); 467 468 … … 472 473 getWindowSize(&w, &h); 473 474 if ((Width != w) || (Height != h)) { 474 GDBG_INFO((120, "W and H changed to %d %d\n", 475 Width, Height)); 475 GDBG_INFO((120, "W and H changed to %d %d\n", 476 Width, Height)); 476 477 477 478 if (!doAllocPixmaps(w, h, 0, BufDesc)) { 478 479 480 481 482 483 479 w=Width; 480 h=Height; 481 if (!doAllocPixmaps(w, h, 0, BufDesc)) { 482 /* ErrorMessage(hWndApp, "linControl: Resize failed\n"); */ 483 return FXFALSE; 484 } 484 485 } 485 486 Width = w; … … 512 513 GDBG_INFO((80, "linControl: code = %d, w = %d, h = %d\n", code, 513 514 Width, Height)); 514 515 515 516 return FXTRUE; 516 517 } /* linControl */ -
trunk/src/opengl/glide/sst1/init/initvg/dac.c
r2885 r6653 1 /* $Id: dac.c,v 1.2 2001-09-05 14:31:03 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:31:32 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:03 $ 23 24 ** 24 25 ** Initialization code for initializing supported SST-1 DACs … … 39 40 ** Read external DAC registers 40 41 ** NOTE: The video unit of FBI must be in reset before calling this routine. 41 ** The rendering engines of FBI and TREX must be idle before calling 42 ** The rendering engines of FBI and TREX must be idle before calling 42 43 ** this routine. 43 44 ** fbiInit23 register remapping (PCI config. initEnable[2]=1) must be … … 72 73 ** Write to external DAC registers 73 74 ** NOTE: The video unit of FBI must be in reset before calling this routine. 74 ** The rendering engines of FBI and TREX must be idle before calling 75 ** The rendering engines of FBI and TREX must be idle before calling 75 76 ** this routine. 76 77 ** … … 591 592 { 592 593 float calc; 593 594 594 595 calc = ((float) 14.318 * (float) (m + 2)) / 595 596 ((float) (n + 2) * vcoFreqDivide); -
trunk/src/opengl/glide/sst1/init/initvg/gamma.c
r2885 r6653 1 /* $Id: gamma.c,v 1.2 2001-09-05 14:31:04 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:31:33 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:04 $ 23 24 ** 24 25 ** Initialization code for loading SST-1 gamma tables … … 132 133 else 133 134 sstVideoIsReset = FXFALSE; 134 135 135 136 ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET); 136 137 /* wait for video reset to be deasserted */ … … 147 148 FxU32 gcG = gammaTableG[(x<<3)]; 148 149 FxU32 gcB = gammaTableB[(x<<3)]; 149 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 150 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 150 151 (gcR<<SST_CLUTDATA_RED_SHIFT) | 151 152 (gcG<<SST_CLUTDATA_GREEN_SHIFT) | … … 173 174 } 174 175 175 FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries, 176 FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries, 176 177 FxU32 *r, FxU32 *g, FxU32 *b) 177 178 { … … 213 214 else 214 215 sstVideoIsReset = FXFALSE; 215 216 216 217 ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET); 217 218 /* wait for video reset to be deasserted */ … … 228 229 FxU32 gcG = gammaTableG[(x<<3)]; 229 230 FxU32 gcB = gammaTableB[(x<<3)]; 230 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 231 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 231 232 (gcR<<SST_CLUTDATA_RED_SHIFT) | 232 233 (gcG<<SST_CLUTDATA_GREEN_SHIFT) | -
trunk/src/opengl/glide/sst1/init/initvg/gdebug.c
r2885 r6653 1 /* $Id: gdebug.c,v 1.2 2001-09-05 14:31:04 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:31:33$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:31:04 $ 22 23 */ 23 24 … … 104 105 /* I can't init gdbg_msgfile to stdout since it isn't constant so 105 106 * I do it now */ 106 gdbg_msgfile = stdout; 107 gdbg_msgfile = stdout; 107 108 108 109 done = 1; … … 132 133 gdbg_vprintf (const char *format,va_list args) 133 134 { 134 135 135 136 if (gdbg_msgfile != NULL) { 136 137 if (!UseDebugString) { … … 138 139 vfprintf(gdbg_msgfile,format,args); 139 140 140 fflush(gdbg_msgfile); 141 } 141 fflush(gdbg_msgfile); 142 } 142 143 #ifdef __WIN32__ 143 144 else { … … 262 263 if (outf) gdbg_msgfile = outf; 263 264 return outf != NULL; 264 } 265 } 265 } 266 } -
trunk/src/opengl/glide/sst1/init/initvg/info.c
r2885 r6653 1 /* $Id: info.c,v 1.2 2001-09-05 14:31:04 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:31:33 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:04 $ 23 24 ** 24 25 ** Routines to detect memory size, strapping pin, and other initialization … … 37 38 #define XY_ONE (1<<SST_XY_FRACBITS) 38 39 39 static FxBool 40 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 41 40 static FxBool 41 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 42 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) 42 43 { 43 44 FxU32 rd_x, rd_y; … … 50 51 sst1InitIdle(sstbase); 51 52 if (x & 1) { 52 53 53 INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x)); 54 return(FXFALSE); 54 55 } 55 56 … … 59 60 *b_sum = 0; 60 61 61 for (rd_y = 0; rd_y < 4; rd_y++) { 62 63 if ((rd_x & 1)==0) {/* read 2 pixels at a time */64 65 66 67 68 69 70 71 72 73 74 75 76 62 for (rd_y = 0; rd_y < 4; rd_y++) { /* read 4 scanlines */ 63 for (rd_x = 0; rd_x < 4; rd_x ++) { 64 if ((rd_x & 1)==0) { /* read 2 pixels at a time */ 65 rd_col = 66 IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]); 67 } 68 else rd_col >>= 16; 69 rd_r = ((rd_col >> 11) & 0x1f) << 3; 70 rd_g = ((rd_col >> 5) & 0x3f) << 2; 71 rd_b = ((rd_col >> 0) & 0x1f) << 3; 72 *r_sum += rd_r; 73 *g_sum += rd_g; 74 *b_sum += rd_b; 75 INIT_INFO((4,"%d,%d = rd_col: 0x%04x rgb: %02x %02x %02x\n", 76 rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b)); 77 } 77 78 } 78 79 INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", 79 80 80 *r_sum, *g_sum, *b_sum)); 81 return(FXTRUE); 81 82 } 82 83 … … 117 118 /* init sum array */ 118 119 for (r_sum = 0; r_sum <= 0xfff; r_sum++) { 119 120 120 rb_tbl[r_sum] = -1; 121 g_tbl[r_sum] = -1; 121 122 } 122 123 … … 126 127 /* fill sum array */ 127 128 for (tst_color = 0; tst_color <= 255; tst_color++) { 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 } 151 129 INIT_INFO((2,"tst_color=0x%02x\n", tst_color)); 130 ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color); 131 132 drawTriangle(sst, x,y,36); 133 if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE) 134 return(FXFALSE); 135 136 /* check sums for uniqueness and then store away */ 137 if (r_sum != b_sum) { 138 INIT_PRINTF(("ERROR: b_sum=0x%03x r_sum=0x%03x\n", r_sum, b_sum)); 139 return(FXFALSE); 140 } 141 if (rb_tbl[r_sum] != -1) { 142 INIT_PRINTF(("ERROR: non-unique r/b_sum=0x%03x\n", r_sum)); 143 return(FXFALSE); 144 } 145 rb_tbl[r_sum] = tst_color; 146 if (g_tbl[g_sum] != -1) { 147 INIT_PRINTF(("ERROR: non-unique g_sum=0x%03x\n", g_sum)); 148 return(FXFALSE); 149 } 150 g_tbl[g_sum] = tst_color; 151 } 152 return(FXTRUE); 152 153 } 153 154 … … 158 159 if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1) 159 160 { 160 161 161 INIT_PRINTF(("ERROR: unDither: invalid color sum\n")); 162 return(FXFALSE); 162 163 } 163 164 *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; 164 165 return(FXTRUE); 165 166 } 166 167 … … 179 180 /* render into the frame buffer */ 180 181 ISET(sst->fbzColorPath, 181 182 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 182 183 ISET(sst->texBaseAddr, 0); 183 184 ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS); … … 187 188 readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); 188 189 if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) 189 190 190 return(FXFALSE); 191 if(GETENV(("SST_TMUCFG"))) 191 192 SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig); 192 193 … … 196 197 ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]); 197 198 198 199 return(FXTRUE); 199 200 } 200 201 … … 204 205 205 206 static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, 206 207 FxU32 mem, FxU32 init) 207 208 { 208 209 volatile Sstregs *sst = (Sstregs *) sstbase; … … 214 215 sst1InitIdle(sstbase); 215 216 216 ISET(sst->texBaseAddr, 0x200000>>3); 217 texAddr[0] = SENSE2; 218 ISET(sst->texBaseAddr, 0x100000>>3); 219 texAddr[0] = SENSE1; 220 ISET(sst->texBaseAddr, 0x000000>>3); 221 texAddr[0] = SENSE0; 222 223 ISET(sst->texBaseAddr, mem>>3); 224 drawTriangle(sst,0,0,4); 217 ISET(sst->texBaseAddr, 0x200000>>3); /* set to 2 MB */ 218 texAddr[0] = SENSE2; /* write a random value */ 219 ISET(sst->texBaseAddr, 0x100000>>3); /* set to 1 MB */ 220 texAddr[0] = SENSE1; /* write a random value */ 221 ISET(sst->texBaseAddr, 0x000000>>3); /* set to 0 MB */ 222 texAddr[0] = SENSE0; /* write a random value */ 223 224 ISET(sst->texBaseAddr, mem>>3); /* reset to 2 MB */ 225 drawTriangle(sst,0,0,4); /* draw a 4x4 right triangle */ 225 226 sst1InitIdle(sstbase); 226 227 … … 237 238 FX_EXPORT FxBool FX_CSTYLE 238 239 sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, 239 240 FxU32 *TmuMemorySize) 240 241 { 241 242 FxU32 i,data; … … 244 245 INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); 245 246 246 247 248 249 247 if(GETENV(("SST_TMUMEM_SIZE"))) { 248 *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE"))); 249 return(FXTRUE); 250 } 250 251 251 252 ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); 252 253 ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); 253 254 ISET(sst->fbzColorPath, 254 255 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 255 256 ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE); 256 257 ISET(sst->tLOD, 0); … … 258 259 /* setup all downstream TMUs to be in pass-thru mode */ 259 260 for (i=0; i<tmu; i++) 260 261 ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS); 261 262 262 263 /* first see if we have 4 Mbytes by writing a texel at 2MB followed by … … 278 279 279 280 INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n")); 280 281 return(FXFALSE); 281 282 } 282 283 283 284 /*--------------------------------------------------------------------------- 284 285 NOTES: 285 286 286 assumes that board and registers are initialized 287 destroys part of the framebuffer 287 288 ---------------------------------------------------------------------------*/ 288 289 FX_EXPORT FxBool FX_CSTYLE … … 292 293 293 294 if(initSumTables(sstbase) == FXFALSE) 294 295 return(FXFALSE); 295 296 if(getTmuConfigData(sstbase,info) == FXFALSE) 296 297 298 299 300 301 302 297 return(FXFALSE); 298 299 /* TMU memory speed */ 300 /* tmuClkFixed is no longer used... */ 301 info->tmuClkFixed = 0x0; 302 /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */ 303 info->tmuMemSpeed = 0; 303 304 304 305 /* count the TMUs and verify that all TMUs are the same revision */ … … 306 307 info->numberTmus = 1; 307 308 if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE) 308 309 return(FXFALSE); 309 310 INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); 310 if (info->tmuConfig & FXBIT(6)) { 311 info->numberTmus++;/* increment TMU count */312 trev = (info->tmuConfig>>7) & 0x7;/* get its revision */313 314 315 316 311 if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ 312 info->numberTmus++; /* increment TMU count */ 313 trev = (info->tmuConfig>>7) & 0x7; /* get its revision */ 314 if (info->tmuRevision != trev) { 315 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); 316 return(FXFALSE); 317 } 317 318 if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) 318 319 } 320 if (info->tmuConfig & FXBIT(13)) { 321 info->numberTmus++;/* increment TMU count */322 trev = (info->tmuConfig>>14) & 0x7;/* get its revision */323 324 325 326 319 return(FXFALSE); 320 } 321 if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ 322 info->numberTmus++; /* increment TMU count */ 323 trev = (info->tmuConfig>>14) & 0x7; /* get its revision */ 324 if (info->tmuRevision != trev) { 325 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); 326 return(FXFALSE); 327 } 327 328 if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) 328 329 return(FXFALSE); 329 330 } 330 331 INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); … … 339 340 ** 340 341 */ 341 #define LFB_PUTPIXEL(X, Y, DATA) 342 343 #define LFB_GETPIXEL(X, Y) 344 342 #define LFB_PUTPIXEL(X, Y, DATA) \ 343 ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA) 344 #define LFB_GETPIXEL(X, Y) \ 345 IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)]) 345 346 346 347 static int fbiMemSize(FxU32 *sstbase) 347 348 { 348 349 350 351 352 353 354 355 356 357 358 359 360 349 volatile Sstregs *sst = (Sstregs *) sstbase; 350 volatile unsigned short *lfbptr = (unsigned short *) sstbase; 351 FxU32 init0Save = IGET(sst->fbiInit0); 352 FxU32 init1Save = IGET(sst->fbiInit1); 353 FxU32 init2Save = IGET(sst->fbiInit2); 354 int retval = 0; 355 356 if(GETENV(("SST_FBIMEM_SIZE"))) 357 return(ATOI(GETENV(("SST_FBIMEM_SIZE")))); 358 359 /* Enable dram refresh, disable memory fifo, and setup memory */ 360 /* for rendering */ 361 ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); 361 362 ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); 362 363 364 365 366 367 368 369 370 371 372 363 sst1InitIdleFBI(sstbase); 364 365 /* Setup Basic rendering datapath */ 366 ISET(sst->fbzColorPath, SST_CC_MONE); 367 ISET(sst->fogMode, 0x0); 368 ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT); 369 sst1InitIdleFBI(sstbase); 370 371 if(sst1InitSliDetect(sstbase)) 372 /* SLI cannot support 4 MBytes... */ 373 goto check2MByte; 373 374 sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); 374 375 376 377 378 379 380 381 382 LFB_PUTPIXEL(128, 100, 0xdead);/* maps to row:0x216, col:0x80, bank:0x1 */383 384 385 LFB_PUTPIXEL(200, 200, 0x55aa);/* maps to row:0x23d, col:0x104, bank:0x0 */386 387 388 389 390 391 392 393 394 395 375 sst1InitIdleFBI(sstbase); 376 377 ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | 378 SST_LFB_READDEPTHABUFFER); 379 sst1InitIdleFBI(sstbase); 380 381 /* Check for 4 MBytes... */ 382 /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */ 383 LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */ 384 LFB_PUTPIXEL(0, 0, 0x0); 385 LFB_PUTPIXEL(798, 599, 0xffff); 386 LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */ 387 LFB_PUTPIXEL(20, 20, 0xffff); 388 LFB_PUTPIXEL(400, 400, 0x0); 389 sst1InitIdleFBI(sstbase); 390 if((LFB_GETPIXEL(128, 100) == 0xdead) && 391 (LFB_GETPIXEL(200, 200) == 0x55aa)) { 392 retval = 4; 393 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); 394 sst1InitIdleFBI(sstbase); 395 goto fbiMemSizeDone; 396 } 396 397 397 398 check2MByte: 398 399 399 /* Check for 2 MBytes... */ 400 /* Write to color buffer in 640x480 resolution */ 400 401 sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); 401 402 403 404 LFB_PUTPIXEL(50, 100, 0xdead);/* maps to row:0x1e, col:0x99, bank:0x0 */405 406 407 408 409 410 LFB_PUTPIXEL(178, 436, 0xaa55);/* maps to row:0x11e, col:0x99, bank:0x0 */411 412 413 414 415 416 417 418 419 420 421 402 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | 403 SST_LFB_READFRONTBUFFER); 404 sst1InitIdleFBI(sstbase); 405 LFB_PUTPIXEL(50, 100, 0xdead); /* maps to row:0x1e, col:0x99, bank:0x0 */ 406 LFB_PUTPIXEL(0, 0, 0x0); 407 LFB_PUTPIXEL(638, 479, 0xffff); 408 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER | 409 SST_LFB_READFRONTBUFFER); 410 sst1InitIdleFBI(sstbase); 411 LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */ 412 LFB_PUTPIXEL(20, 20, 0x0); 413 LFB_PUTPIXEL(400, 400, 0xffff); 414 sst1InitIdleFBI(sstbase); 415 if(LFB_GETPIXEL(50, 100) != 0xdead) 416 goto check1MByte; 417 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); 418 sst1InitIdleFBI(sstbase); 419 if(LFB_GETPIXEL(178, 436) == 0xaa55) { 420 retval = 2; 421 goto fbiMemSizeDone; 422 } 422 423 423 424 check1MByte: 424 425 426 427 LFB_PUTPIXEL(10, 10, 0xdead);/* maps to row:0x0, col:0x145, bank:0x0 */428 429 430 LFB_PUTPIXEL(100, 200, 0x5a5a);/* maps to row:0x3c, col:0x112, bank:0x1 */431 432 433 434 435 436 425 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | 426 SST_LFB_READFRONTBUFFER); 427 sst1InitIdleFBI(sstbase); 428 LFB_PUTPIXEL(10, 10, 0xdead); /* maps to row:0x0, col:0x145, bank:0x0 */ 429 LFB_PUTPIXEL(8, 8, 0x0); 430 LFB_PUTPIXEL(340, 340, 0xffff); 431 LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */ 432 LFB_PUTPIXEL(66, 0, 0x0); 433 LFB_PUTPIXEL(360, 360, 0xffff); 434 sst1InitIdleFBI(sstbase); 435 if((LFB_GETPIXEL(10, 10) == 0xdead) && 436 (LFB_GETPIXEL(100, 200) == 0x5a5a)) 437 retval = 1; 437 438 438 439 fbiMemSizeDone: 439 440 441 442 443 444 445 440 /* Restore init registers to original state */ 441 ISET(sst->fbiInit0, init0Save); 442 ISET(sst->fbiInit1, init1Save); 443 ISET(sst->fbiInit2, init2Save); 444 sst1InitIdleFBI(sstbase); 445 446 return(retval); 446 447 } 447 448 … … 449 450 sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) 450 451 { 451 452 volatile Sstregs *sst = (Sstregs *) sstbase; 452 453 453 454 info->fbiMemSize = fbiMemSize(sstbase); 454 455 455 456 456 /* Detect board identification and memory speed */ 457 if(GETENV(("SST_FBICFG"))) 457 458 SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig); 458 459 else 459 460 461 462 463 464 465 466 467 460 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> 461 SST_FBI_MEM_TYPE_SHIFT; 462 463 info->fbiBoardID = (info->fbiConfig >> 2) & 0x1; 464 /* fbiMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */ 465 info->fbiMemSpeed = 0; 466 467 /* Detect scanline interleaving */ 468 info->sstSliDetect = sst1InitSliDetect(sstbase); 468 469 469 470 return FXTRUE; … … 504 505 if(GETENV(("SST_NODEVICEINFO"))) { 505 506 /* fill device info struct with sane values... */ 506 507 508 509 510 511 512 513 514 515 516 507 INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); 508 509 if(GETENV(("SST_FBICFG"))) 510 SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig); 511 else 512 info->fbiConfig = 0x0; 513 514 if(GETENV(("SST_TMUCFG"))) 515 SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig); 516 else 517 info->tmuConfig = 0x0; 517 518 518 519 info->numberTmus = 1; 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 520 if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ 521 info->numberTmus++; 522 if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ 523 info->numberTmus++; 524 525 info->tmuRevision = info->tmuConfig & 0x7; 526 527 if(GETENV(("SST_FBIMEM_SIZE"))) 528 info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE"))); 529 else 530 info->fbiMemSize = 2; 531 532 if(GETENV(("SST_TMUMEM_SIZE"))) 533 info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE"))); 534 else 535 info->tmuMemSize[0] = 2; 536 info->tmuMemSize[1] = info->tmuMemSize[0]; 537 info->tmuMemSize[2] = info->tmuMemSize[0]; 537 538 } else { 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 539 int i; 540 541 for(i=0; i<5; i++) { 542 if(i) 543 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); 544 /* GetFbiInfo() must be called before GetTmuInfo() */ 545 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) 546 continue; 547 /* get the revision ID of each TMU and verify that they are all the 548 same */ 549 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) 550 continue; 551 break; 552 } 553 if(i == 5) 554 return(FXFALSE); 554 555 } 555 556 INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n", … … 568 569 if(sst1InitUseVoodooFile == FXTRUE) { 569 570 if(iniDac == (sst1InitDacStruct *) NULL) 570 571 572 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 573 574 575 576 577 578 579 580 581 582 583 584 571 INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); 572 else 573 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 574 iniDac->dacManufacturer, iniDac->dacDevice)); 575 } else { 576 INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); 577 if(info->fbiDacType == SST_FBI_DACTYPE_ATT) 578 INIT_PRINTF(("AT&T ATT20C409\n")); 579 else if(info->fbiDacType == SST_FBI_DACTYPE_ICS) 580 INIT_PRINTF(("ICS ICS5342\n")); 581 else if(info->fbiDacType == SST_FBI_DACTYPE_TI) 582 INIT_PRINTF(("TI TVP3409\n")); 583 else 584 INIT_PRINTF(("Unknown\n")); 585 } 585 586 INIT_PRINTF(("sst1DeviceInfo: SliDetect:%d\n", info->sstSliDetect)); 586 587 -
trunk/src/opengl/glide/sst1/init/initvg/parse.c
r2885 r6653 1 /* $Id: parse.c,v 1.2 2001-09-05 14:31:05 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:31:34 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:05 $ 23 24 ** 24 25 ** Parsing code for grabbing information from "voodoo.ini" initialization file … … 170 171 /* Override voodoo.ini name */ 171 172 strcpy(filename, getenv("VOODOO_FILE")); 172 if (!(file = fopen(filename, "r"))) 173 if (!(file = fopen(filename, "r"))) 173 174 goto __errExit; 174 175 } else { … … 183 184 while(1) { 184 185 if (!i) { 185 186 186 if ((tmpPtr = strtok(path, ":")) == NULL) 187 break; 187 188 } else { 188 189 189 if ((tmpPtr = strtok(NULL, ":")) == NULL) 190 break; 190 191 } 191 192 strcpy(filename, tmpPtr); 192 193 if (filename[strlen(filename)-1] == '\\') 193 194 sprintf(filename, "%voodoo", filename); 194 195 else 195 196 sprintf(filename, "%s/voodoo", filename); 196 197 i++; 197 198 if ((file = fopen(filename, "r"))) 198 199 break; 199 200 } 200 201 } … … 513 514 break; 514 515 } 515 if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 516 if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 516 517 return(0); 517 518 … … 898 899 * string table has been freed by the c runtime but has not been set 899 900 * to NULL. Bad things happen if this memory has been unmapped by 900 * the system or if the string cannot be found. 901 * the system or if the string cannot be found. 901 902 */ 902 903 { -
trunk/src/opengl/glide/sst1/init/initvg/print.c
r2885 r6653 1 /* $Id: print.c,v 1.2 2001-09-05 14:31:05 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:31:34 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:05 $ 23 24 ** 24 25 ** Print functions for SST-1 Initialization routines … … 46 47 if(firstPass == FXTRUE) { 47 48 firstPass = FXFALSE; 48 49 50 51 52 49 if (sst1InitMsgFile == NULL) 50 { 51 /* I couldn't initialize to stdout because stdout is not constant */ 52 sst1InitMsgFile = stdout; 53 } 53 54 if(GETENV(("SST_INITDEBUG"))) 54 55 printIt = FXTRUE; -
trunk/src/opengl/glide/sst1/init/initvg/sli.c
r2885 r6653 1 /* $Id: sli.c,v 1.2 2001-09-05 14:31:05 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:31:34 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:05 $ 23 24 ** 24 25 ** Initialization code for initializing scanline interleaving … … 84 85 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 85 86 PCICFG_WR(SST1_PCI_INIT_ENABLE, 86 (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); 87 (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); 87 88 ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) | 88 89 (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE)); … … 153 154 /* 16-bit Video Output */ 154 155 ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) & 155 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 156 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 156 157 SST_EN_SCANLINE_INTERLEAVE | 157 158 /* SST_VIDEO_VID_CLK_SLAVE | */ … … 166 167 ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) & 167 168 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 168 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 169 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 169 170 SST_EN_SCANLINE_INTERLEAVE | 170 171 /* SST_VIDEO_VID_CLK_SLAVE | */ … … 274 275 /* 16-bit Video Output */ 275 276 ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) & 276 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 277 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 277 278 SST_EN_SCANLINE_INTERLEAVE | 278 279 SST_VIDEO_VID_CLK_2X | … … 286 287 ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) & 287 288 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 288 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 289 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 289 290 SST_EN_SCANLINE_INTERLEAVE | 290 291 SST_VIDEO_VID_CLK_2X | … … 321 322 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 322 323 PCICFG_WR(SST1_PCI_INIT_ENABLE, 323 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 324 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 324 325 MasterPhysAddr = sst1CurrentBoard->physAddr; 325 326 sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */ … … 332 333 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 333 334 PCICFG_WR(SST1_PCI_INIT_ENABLE, 334 ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); 335 ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); 335 336 /* Map both boards to same Master physical address */ 336 337 PCICFG_WR(PCI_BASE_ADDRESS_0, MasterPhysAddr); … … 432 433 PCICFG_WR(SST1_PCI_INIT_ENABLE, 433 434 (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV | 434 SST_INITWR_EN | SST_PCI_FIFOWR_EN)); 435 SST_INITWR_EN | SST_PCI_FIFOWR_EN)); 435 436 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */ 436 437 ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & … … 438 439 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 439 440 PCICFG_WR(SST1_PCI_INIT_ENABLE, 440 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 441 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 441 442 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */ 442 443 sst1InitIdle((FxU32 *) sstSlave); -
trunk/src/opengl/glide/sst1/init/initvg/sst1init.c
r2885 r6653 1 /* 1 /* $Id: sst1init.c,v 1.2 2001-09-05 14:31:06 bird Exp $ */ 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:31:35 $21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:31:06 $ 22 23 ** 23 24 */ … … 28 29 ** NOTE: This code must compiled with optimizations DISABLED!! 29 30 ** 30 ** The following environment variables can optionally be used to alter 31 ** The following environment variables can optionally be used to alter 31 32 ** functionality (A value of X is a "don't care"): 32 33 ** … … 203 204 &sst1InitDeviceNumber, j, 0); 204 205 #else 205 sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard, 206 sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard, 206 207 &sst1InitDeviceNumber, j, 0); 207 208 #endif /* DIRECTX */ … … 331 332 sst1InitReturnStatus(sstbase); 332 333 sst1InitReturnStatus(sstbase); 333 334 334 335 /* Adjust Fbi-to-Trex clock delay value */ 335 336 /* Adjust Trex-to-Fbi FIFO */ … … 486 487 (tf2_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT); 487 488 } 488 INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 489 INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 489 490 sst1CurrentBoard->tmuInit1[2])); 490 491 … … 709 710 } 710 711 #ifdef __DOS32__ 711 /* 712 /* 712 713 * HACK alert. -MS 713 714 * 714 715 * There's a pciClose(), but nobody calls it. This is needed by the 715 716 * DOS DPMI services to close fxmemmap.vxd. 716 * 717 * 717 718 * We need to move this to the "appropriate" place, wherever that may be. 718 719 */ … … 762 763 return(FXFALSE); 763 764 sst1CurrentBoard->initGrxClkDone = 0; 764 765 765 766 if((++n > 1) || !SliEnable) 766 767 break; … … 877 878 } 878 879 879 static FxU32 880 static FxU32 880 881 mtrr; 881 882 … … 886 887 ** 887 888 */ 888 FX_EXPORT void FX_CSTYLE 889 FX_EXPORT void FX_CSTYLE 889 890 sst1InitCachingOn(void) 890 891 { 891 FxU32 892 FxU32 892 893 physAddr; 893 894 FxBool … … 909 910 else 910 911 return; /* It's already there. We're done. */ 911 912 912 913 if (res) 913 914 pciSetMTRR(mtrr, physAddr, 0x1000000, PciMemTypeWriteCombining); -
trunk/src/opengl/glide/sst1/init/initvg/util.c
r2885 r6653 1 /* $Id: util.c,v 1.2 2001-09-05 14:31:06 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:31:35 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:06 $ 23 24 ** 24 25 ** Utility routines for SST-1 Initialization code … … 225 226 if(enable) { 226 227 /* VGA controls monitor */ 227 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 228 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 228 229 sst1CurrentBoard->vgaPassthruEnable); 229 230 ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN); 230 231 } else { 231 232 /* SST-1 controls monitor */ 232 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 233 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 233 234 sst1CurrentBoard->vgaPassthruDisable); 234 235 ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_BLANK_EN); -
trunk/src/opengl/glide/sst1/init/initvg/video.c
r2885 r6653 1 /* $Id: video.c,v 1.2 2001-09-05 14:31:07 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:31:35 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:07 $ 23 24 ** 24 25 ** Initialization code for initializing SST-1 video unit … … 348 349 /* Reset Video Refresh Unit */ 349 350 ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET); 350 351 351 352 /* Enable video clock */ 352 353 if(SLI_DRIVEOK()) { … … 400 401 /* Setup SST memory mapper for desired resolution */ 401 402 if(sst1CurrentBoard->fbiMemSize == 4) 402 sst1InitSetResolution(sstbase, sstVideoRez, 1); 403 sst1InitSetResolution(sstbase, sstVideoRez, 1); 403 404 else 404 sst1InitSetResolution(sstbase, sstVideoRez, 0); 405 sst1InitSetResolution(sstbase, sstVideoRez, 0); 405 406 406 407 if((GETENV(("SST_TRIPLE_BUFFER"))) || … … 506 507 if(sst1CurrentBoard->fbiMemSize == 1 && sstVideoRez->xDimension > 512) 507 508 n = 0; 508 509 509 510 if(n) { 510 511 sst1CurrentBoard->fbiMemoryFifoEn = 1; … … 530 531 INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n", 531 532 sst1CurrentBoard->memFifoStatusLwm, 532 sst1CurrentBoard->memFifoStatusLwm)); 533 sst1CurrentBoard->memFifoStatusLwm)); 533 534 534 535 vInClkDel = 0; … … 781 782 ** Video Timing Structure 782 783 */ 783 FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 784 FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 784 785 GrScreenRefresh_t screenRefresh) 785 786 { … … 995 996 ** 996 997 */ 997 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 998 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 998 999 sst1VideoTimingStruct *sstVideoRez, FxU32 Banked) 999 1000 { … … 1089 1090 ** sst1InitSetTripleBuffering(): 1090 1091 ** Specify Video Triple Buffering 1091 ** NOTE: sst1InitSetTripleBuffering() must be called prior to calling 1092 ** NOTE: sst1InitSetTripleBuffering() must be called prior to calling 1092 1093 ** sst1InitVideo() to properly setup Video Triple Buffering 1093 1094 ** -
trunk/src/opengl/glide/sst1/init/vg96drvr.c
r2885 r6653 1 /* $Id: vg96drvr.c,v 1.2 2001-09-05 14:31:00 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:31:27 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:00 $ 23 24 ** 24 25 */ … … 50 51 int *fbStride, 51 52 sst1VideoTimingStruct *vidTimings) { 52 return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin, 53 return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin, 53 54 nColBuffers, nAuxBuffers, 54 55 &context->info.regs, … … 72 73 init96Swap( code, &context->info.regs, context->writeMethod ); 73 74 return INIT_SWAP_FLIP; 74 } 75 } 75 76 76 77 static FxU32 status( void ) { 77 78 return *(context->info.regs.hwDep.VG96RegDesc.serialStatus); 78 } 79 } 79 80 80 81 static FxBool busy(void) { … … 84 85 85 86 return rv; 86 } 87 } 87 88 88 89 static void idle( void ) { … … 111 112 FxBool rv = FXFALSE; 112 113 GDBG_INFO((80, "vg96drvr: control: code = %d\n", code)); 113 if (context) 114 if (context) 114 115 rv = init96Control( code, &context->info.regs); 115 116 return rv; … … 160 161 context->initGammaTable = gammatable; 161 162 context->findVidTimingStruct = findvidtiming; 162 } 163 } 163 164 #else 164 165 /* I've got to stub this one to get the Voodoo Graphics glide to link */ … … 184 185 context->gammaRGB = NULL; 185 186 context->initGammaTable = NULL; 186 context->findVidTimingStruct = NULL; 187 context->findVidTimingStruct = NULL; 187 188 188 189 } -
trunk/src/opengl/glide/sst1/init/vgdrvr.c
r2885 r6653 1 /* $Id: vgdrvr.c,v 1.2 2001-09-05 14:31:01 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:31:27 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:01 $ 23 24 ** 24 25 */ … … 45 46 static int _w[] = {320,320,400,512,640,640,640,640,800,960,856,512}; 46 47 static int _h[] = {200,240,256,384,200,350,400,480,600,720,480,256}; 47 48 48 49 rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr, 49 50 sRes, 50 vRefresh, 51 vRefresh, 51 52 vidTimings ); 52 53 … … 58 59 rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.slaveBaseAddr, 59 60 sRes, 60 vRefresh, 61 vRefresh, 61 62 vidTimings ); 62 63 if ( !rv ) goto BAIL; … … 88 89 89 90 if ( info ) { 90 rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr, 91 rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr, 91 92 &sstInfo ); 92 93 info->hwDep.vgFIFOData.memFifoStatusLwm = sstInfo.memFifoStatusLwm; … … 103 104 static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) { 104 105 return INIT_SWAP_FLIP; 105 } 106 } 106 107 107 108 static FxU32 FX_CALL status( void ) { 108 109 return sst1InitReturnStatus((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr); 109 } 110 } 110 111 111 112 static FxBool FX_CALL busy(void) { 112 113 FxU32 stat = status(); 113 114 FxBool ret = (stat & SST_BUSY) ? FXTRUE : FXFALSE; 114 115 115 116 return ret; 116 } 117 } 117 118 118 119 static void FX_CALL idle( void ) { -
trunk/src/opengl/glide/sst1/initterm.cpp
r5135 r6653 1 /* $Id: initterm.cpp,v 1.5 2001-09-05 14:30:48 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/sst1/texus/3df.c
r2885 r6653 1 /* $Id: 3df.c,v 1.2 2001-09-05 14:31:07 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/sst1/texus/clamp.c
r2885 r6653 1 /* $Id: clamp.c,v 1.2 2001-09-05 14:31:08 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:31:36$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:08 $ 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/sst1/texus/dequant.c
r2885 r6653 1 /* $Id: dequant.c,v 1.2 2001-09-05 14:31:08 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:31:37$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:08 $ 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/sst1/texus/diffuse.c
r2885 r6653 1 /* $Id: diffuse.c,v 1.2 2001-09-05 14:31:09 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:31:37$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:09 $ 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/sst1/texus/gldutil.c
r2885 r6653 1 /* $Id: gldutil.c,v 1.2 2001-09-05 14:31:10 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:31:37$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:10 $ 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/sst1/texus/mipmap.c
r2885 r6653 1 /* $Id: mipmap.c,v 1.2 2001-09-05 14:31:10 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:31:37$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:10 $ 23 24 */ 24 25 -
trunk/src/opengl/glide/sst1/texus/ncc.c
r2885 r6653 1 /* $Id: ncc.c,v 1.2 2001-09-05 14:31:11 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:31:37$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:31:11 $ 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/sst1/texus/nccnnet.c
r2885 r6653 1 /* $Id: nccnnet.c,v 1.2 2001-09-05 14:31:11 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:31:38$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:11 $ 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/sst1/texus/pal256.c
r2885 r6653 1 /* $Id: pal256.c,v 1.2 2001-09-05 14:31:12 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/sst1/texus/ppm.c
r2885 r6653 1 /* $Id: ppm.c,v 1.2 2001-09-05 14:31:12 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:31:38$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:12 $ 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/sst1/texus/quantize.c
r2885 r6653 1 /* $Id: quantize.c,v 1.2 2001-09-05 14:31:12 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:31:38$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:12 $ 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/sst1/texus/read.c
r2885 r6653 1 /* $Id: read.c,v 1.2 2001-09-05 14:31:13 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:31:38$21 ** $Revision: 1.2 $ 22 ** $Date: 2001-09-05 14:31:13 $ 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/sst1/texus/resample.c
r2885 r6653 1 /* $Id: resample.c,v 1.2 2001-09-05 14:31:13 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:31:39$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:13 $ 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/sst1/texus/rgt.c
r2885 r6653 1 /* $Id: rgt.c,v 1.2 2001-09-05 14:31:14 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:31:39$22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:31:14 $ 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++ ) {
Note:
See TracChangeset
for help on using the changeset viewer.