Ignore:
Timestamp:
Sep 5, 2001, 4:31:14 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

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/*
    23 * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 * 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
    89 * 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 *
    1112 * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213 * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415 * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516 * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16  * THE UNITED STATES. 
    17  * 
     17 * THE UNITED STATES.
     18 *
    1819 * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920 */
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 2     3/04/97 9:08p Dow
    2731 * Neutered multiplatform multiheaded monster
    28  * 
     32 *
    2933 * 1     12/23/96 1:39p Dow
    3034 * Changes for multiplatform
     
    4953/*
    5054** _gumpTexCombineFunction
    51 **                                                         
     55**
    5256** Sets the texture combine function.  For a dual TMU system this function
    5357** will configure the TEXTUREMODE registers as appropriate.  For a
     
    114118      texmode |= ( SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD |
    115119                   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 );
    117121    }
    118122    break;
     
    180184  case GR_MPTEXTURECOMBINE_SUBTRACT:
    181185    /*
    182        tmu0: other - local 
     186       tmu0: other - local
    183187       tmu1: local
    184188       doesn't work, alpha blender can't subtract
     
    319323      */
    320324
    321      
     325
    322326      fbzcolorpath &= ~(SST_CC_ADD_CLOCAL | SST_CC_ADD_ALOCAL | SST_CC_SUB_CLOCAL);
    323327      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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 10    6/18/97 5:54p Dow
    2731 * P6 adjustments
    28  * 
     32 *
    2933 * 9     3/13/97 2:51a Jdt
    3034 * Removed splash from grGlideInit().
    31  * 
     35 *
    3236 * 8     3/09/97 10:31a Dow
    3337 * Added GR_DIENTRY for di glide functions
    34  * 
     38 *
    3539 * 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 *
    3842 * 6     2/12/97 11:25a Hanson
    39  * 
     43 *
    4044 * 5     1/18/97 11:38p Dow
    4145 * Removed _curGCFuncs Global (moved into _GlideRoot)
    42  * 
     46 *
    4347 * 4     1/16/97 3:37p Dow
    4448 * Added _curGCFuncs global
    45  * 
     49 *
    4650 * 3     1/14/97 10:44a Dow
    4751 * Modified grGlideInit to only call sstopen if splash screen is going to
    4852 * happen && HW != SST96
    49  * 
     53 *
    5054 * 2     1/09/97 10:50a Dow
    5155 * disabled splash screen for sst-96
    52  * 
     56 *
    5357 * 1     12/23/96 1:39p Dow
    5458 * Changes for multiplatform
    55  * 
     59 *
    5660 * 32    11/17/96 11:16p Garymct
    5761 * Updated grSplash code to set all of the necessary state itself rather
    5862 * than expecting the caller to do so.
    59  * 
     63 *
    6064 * 31    11/18/96 1:37a Tarolli
    6165 * fixed grAlphaBlendFunction warning bug
    62  * 
     66 *
    6367 * 29    11/15/96 3:40p Jdt
    6468 * Fixed SST-96 build.
    65  * 
     69 *
    6670 * 28    11/15/96 3:24p Tarolli
    6771 * renamed version.h to rcver.h ,  added some alpha blend function
     
    175179**
    176180*/
    177 void 
     181void
    178182_grSwizzleColor( GrColor_t *color )
    179183{
    180184  GR_DCL_GC;
    181185  unsigned long red, green, blue, alpha;
    182  
     186
    183187  switch( gc->state.color_format ) {
    184188  case GR_COLORFORMAT_ARGB:
     
    252256        gc->state.checkFifo = FXTRUE;
    253257        /* swFifoLWM is kept internally in bytes, hints are in fifo
    254            entries */ 
     258           entries */
    255259        if (_GlideRoot.environment.swFifoLWM >= 0)
    256260          gc->hwDep.sst1Dep.swFifoLWM =
     
    280284{
    281285  GDBG_INIT();
    282  
     286
    283287  GDBG_INFO((80,"grGlideInit()\n"));
    284288  _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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 5     8/14/97 7:02p Pgj
    2731 * per GMT
    28  * 
     32 *
    2933 * 4     5/05/97 4:24p Pgj
    3034 * Neuter guTexDownloadMipMap error message
    31  * 
     35 *
    3236 * 3     3/18/97 9:07p Dow
    3337 * Got rid of #$#%#$ // comments
    34  * 
     38 *
    3539 * 2     3/09/97 10:31a Dow
    3640 * Added GR_DIENTRY for di glide functions
    37  * 
     41 *
    3842 * 1     12/23/96 1:39p Dow
    3943 * Changes for multiplatform
     
    98102   */
    99103  GR_CHECK_F(myName, small_lod < large_lod, "smallest_lod is larger than large_lod");
    100  
     104
    101105  info.smallLod = small_lod;
    102106  info.largeLod = large_lod;
     
    111115    (gc->tmu_state[tmu].freemem_base + memrequired > 0x200000))
    112116    gc->tmu_state[tmu].freemem_base = 0x200000;
    113  
     117
    114118  /*
    115119   ** If we have enough memory and a free mip map handle then go for it
    116120   */
    117121  memavail = guTexMemQueryAvail( tmu );
    118  
     122
    119123  if ( memavail < memrequired )
    120124    return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
    121  
     125
    122126  if (gc->mm_table.free_mmid >= MAX_MIPMAPS_PER_SST )
    123127    return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
    124  
     128
    125129  /*
    126130   ** Allocate the mip map id
     
    131135   ** calculate baseAddress (where LOD 0 would go)
    132136   */
    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,
    137141                                       odd_even_mask );
    138142
    139143  GDBG_INFO((gc->myLevel,"  baseAddress = 0x%x (in bytes)\n",baseAddress));
    140  
     144
    141145  /*
    142146   ** reduce available memory to reflect allocation
     
    157161                (magfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0)
    158162                );
    159  
     163
    160164  clampMode = (
    161165               (s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) |
    162166               (t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
    163                ); 
    164  
     167               );
     168
    165169  /*
    166170   ** Create the tTextureMode register value for this mip map
     
    171175  texturemode |= filterMode;
    172176  texturemode |= clampMode;
    173  
     177
    174178  if ( mipmap_mode == GR_MIPMAP_NEAREST_DITHER )
    175179    texturemode |= SST_TLODDITHER;
    176  
     180
    177181  if ( trilinear ) {
    178182      texturemode |= SST_TRILINEAR;
     
    184188        tLod |= SST_LOD_TSPLIT;
    185189  }
    186  
     190
    187191  /*
    188192   ** Fill in the mm_table data for this mip map
     
    210214  gc->mm_table.data[mmid].width          = width;
    211215  gc->mm_table.data[mmid].height         = height;
    212  
     216
    213217  GR_RETURN(mmid);
    214218} /* guTexAllocateMemory */
     
    221225  int texturemode      = 0;
    222226  int tLod             = 0;
    223   FxU32 
     227  FxU32
    224228    filterMode,                 /* filter mode bits of texturemode */
    225229    clampMode;                  /* clamp mode bits of texturemode */
     
    234238               (mminfo->t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
    235239               );
    236    
     240
    237241  /*
    238242   ** build up tTextureMode
     
    268272
    269273/*---------------------------------------------------------------------------
    270 **  guTexChangeAttributes 
     274**  guTexChangeAttributes
    271275*/
    272276GR_DIENTRY(guTexChangeAttributes, FxBool, ( GrMipMapId_t mmid,
     
    332336/*---------------------------------------------------------------------------
    333337** grTexCombineFunction - obsolete
    334 **                             
     338**
    335339*/
    336340GR_DIENTRY(grTexCombineFunction, void,
    337            (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 
     341           (GrChipID_t tmu, GrTextureCombineFnc_t tc))
    338342{
    339343  guTexCombineFunction( tmu, tc );
     
    342346/*---------------------------------------------------------------------------
    343347** guTexCombineFunction
    344 **                             
     348**
    345349** Sets the texture combine function.  For a dual TMU system this function
    346350** will configure the TEXTUREMODE registers as appropriate.  For a
     
    421425** to be in row major order from largest mip map to smallest mip map.
    422426*/
    423 GR_DIENTRY(guTexDownloadMipMap, void, 
     427GR_DIENTRY(guTexDownloadMipMap, void,
    424428           (GrMipMapId_t mmid, const void *src, const GuNccTable
    425429            *ncc_table ) )
     
    472476  const  GrMipMapInfo *mminfo;
    473477  GR_DCL_GC;
    474  
     478
    475479  GDBG_INFO((99,"guTexDownloadMipMapLevel(%d,%d,0x%x)\n",mmid,lod,src_base));
    476480  GR_ASSERT(src_base != NULL);
     
    546550{
    547551  int i;
    548  
     552
    549553  GR_BEGIN_NOFIFOCHECK("guTexMemReset",99);
    550554  GDBG_INFO_MORE((gc->myLevel,"()\n"));
     
    552556  memset( gc->mm_table.data, 0, sizeof( gc->mm_table.data ) );
    553557  gc->mm_table.free_mmid = 0;
    554  
     558
    555559  for ( i = 0; i < gc->num_tmu; i++ ) {
    556560    gc->state.current_mm[i] = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
    557561    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] =
    561565      gc->tmu_state[i].ncc_table[1] = 0;
    562566  }
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 9     8/13/97 8:51a Pgj
    2731 * Fix Bug 710
    28  * 
     32 *
    2933 * 8     7/24/97 10:55a Dow
    3034 * Fixed bogus check in grSstQueryHardware
    31  * 
     35 *
    3236 * 7     5/02/97 2:07p Pgj
    3337 * grSstScreenWidth/Height now FxU32
    34  * 
     38 *
    3539 * 6     3/17/97 6:25a Jdt
    3640 * Added initDeviceSelect to grSstSelect()
    37  * 
     41 *
    3842 * 5     3/09/97 10:31a Dow
    3943 * Added GR_DIENTRY for di glide functions
    40  * 
     44 *
    4145 * 4     3/04/97 9:08p Dow
    4246 * Neutered multiplatform multiheaded monster
    43  * 
     47 *
    4448 * 3     1/18/97 11:39p Dow
    4549 * Changed location of _curGCFuncs
    46  * 
     50 *
    4751 * 2     1/16/97 3:39p Dow
    4852 * Added ref to _curGCFuncs during grSstSelect()
    49  * 
     53 *
    5054 * 1     12/23/96 1:39p Dow
    5155 * Changes for multiplatform
     
    166170#endif
    167171
    168   _GlideRoot.GCs[whichSst].vidTimings = vidTimings;   
     172  _GlideRoot.GCs[whichSst].vidTimings = vidTimings;
    169173} /* grSstVidMode */
    170174
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 11    8/19/97 5:02p Atai
    2731 * delete the hack for 4MB texture memory
    28  * 
     32 *
    2933 * 10    8/14/97 6:45p Pgj
    3034 * Fixed bug per GMT
    31  * 
     35 *
    3236 * 9     8/11/97 3:56p Atai
    3337 * fixed error message
    34  * 
     38 *
    3539 * 8     8/11/97 1:39p Atai
    3640 * step 1: use environment variable to set up texture memory size
    37  * 
     41 *
    3842 * 7     7/18/97 6:46p Jdt
    3943 * Protected access to vgInfo structure
    40  * 
     44 *
    4145 * 6     3/15/97 8:09p Jdt
    4246 * Remove grTexDownloadTable from this file because I added SST-1 only
    4347 * code to it
    44  * 
     48 *
    4549 * 5     3/09/97 10:31a Dow
    4650 * Added GR_DIENTRY for di glide functions
    47  * 
     51 *
    4852 * 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 *
    5155 * 3     2/12/97 12:34p Dow
    5256 * Fixed Hanson muckage
    53  * 
     57 *
    5458 * 2     1/18/97 11:41p Dow
    5559 * Fixed Gary's "Last C Bug" analog
    5660 * Fixed usage of _grMipMapOffset_Tsplit
    57  * 
     61 *
    5862 * 1     12/23/96 1:39p Dow
    5963 * Changes for multiplatform
     
    8185
    8286/* size in texels  */
    83 FxU32 _grMipMapHostSize[4][16] = 
     87FxU32 _grMipMapHostSize[4][16] =
    8488{
    8589  {                             /* 1:1 aspect ratio */
     
    131135const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2] =
    132136{
    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
    143147   },
    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,
    150154     8   , 2,
    151      4   , 1, 
    152      2   , 1, 
    153      1   , 1 
     155     4   , 1,
     156     2   , 1,
     157     1   , 1
    154158   },
    155    { 
    156      256 , 128, 
    157      128 , 64, 
    158      64  , 32, 
     159   {
     160     256 , 128,
     161     128 , 64,
     162     64  , 32,
    159163     32  , 16,
    160164     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
    165169   },
    166    { 
    167      256 , 256, 
    168      128 , 128, 
     170   {
     171     256 , 256,
     172     128 , 128,
    169173     64  , 64,
    170174     32  , 32,
    171175     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
    176180   },
    177    { 
     181   {
    178182     128, 256,
    179183     64,  128,
    180184     32,  64 ,
    181185     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  ,
    186190     1,   1
    187191   },
     
    192196     8,   32 ,
    193197     4,   16 ,
    194      2,   8  , 
    195      1,   4  , 
    196      1,   2  , 
     198     2,   8  ,
     199     1,   4  ,
     200     1,   2  ,
    197201     1,   1
    198202   },
    199    { 
     203   {
    200204     32,  256,
    201205     16,  128,
     
    203207     4,   32 ,
    204208     2,   16 ,
    205      1,   8  , 
    206      1,   4  , 
     209     1,   8  ,
     210     1,   4  ,
    207211     1,   2  ,
    208212     1,   1
     
    222226};
    223227
    224 FxU32 _gr_evenOdd_xlate_table[] = 
     228FxU32 _gr_evenOdd_xlate_table[] =
    225229{
    226230  0xFFFFFFFF,                      /* invalid */
     
    310314*/
    311315FxU32
    312 _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 
     316_grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod,
    313317                           GrAspectRatio_t aspect, GrTextureFormat_t format,
    314318                           FxU32 evenOdd )
     
    330334    memrequired = 0;
    331335    /* construct XOR mask   */
    332     evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0; 
     336    evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0;
    333337    while (large_lod <= small_lod) {    /* sum up all the mipmap levels */
    334338      if ((large_lod ^ evenOdd) & 1)    /* that match the XOR mask      */
     
    383387    sum_of_lod_sizes = _grMipMapOffset_Tsplit[aspect][large_lod];
    384388  }
    385    
     389
    386390  if ( format >= GR_TEXFMT_16BIT )
    387391    sum_of_lod_sizes <<= 1;
     
    393397*/
    394398GR_DIENTRY(grTexCalcMemRequired, FxU32,
    395            ( GrLOD_t small_lod, GrLOD_t large_lod, 
     399           ( GrLOD_t small_lod, GrLOD_t large_lod,
    396400            GrAspectRatio_t aspect, GrTextureFormat_t format ))
    397401{
    398402  FxU32 memrequired;
    399403
    400   memrequired = _grTexTextureMemRequired(small_lod, large_lod, 
     404  memrequired = _grTexTextureMemRequired(small_lod, large_lod,
    401405                                         aspect, format,
    402406                                         GR_MIPMAPLEVELMASK_BOTH );
     
    417421  FxU32 dmax    = ( FxU32 ) ( detail_max * _GlideRoot.pool.f255 );
    418422  FxU32 dscale  = detail_scale;
    419  
     423
    420424  GR_BEGIN_NOFIFOCHECK("grTexDetailControl",88);
    421425  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%g)\n",tmu,detail_scale,detail_max));
     
    428432  tDetail |= ( ( dmax << SST_DETAIL_MAX_SHIFT ) & SST_DETAIL_MAX );
    429433  tDetail |= ( ( dscale << SST_DETAIL_SCALE_SHIFT ) & SST_DETAIL_SCALE );
    430  
     434
    431435  /* MULTIPLAT */
    432436  _grTexDetailControl( tmu, tDetail );
     
    471475  Library: glide
    472476  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
    476480      of grTexMemRequired() which does not imply any distinction
    477481      between texture memory and system ram )
     
    479483    evenOdd  - which set of mipmap levels are to be stored
    480484                One of:
    481                   GR_MIPMAPLEVELMASK_EVEN 
     485                  GR_MIPMAPLEVELMASK_EVEN
    482486                  GR_MIPMAPLEVELMASK_ODD
    483487                  GR_MIPMAPLEVELMASK_BOTH
     
    485489                of texture
    486490  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
    488492    valid texture memory download location
    489493  -------------------------------------------------------------------*/
     
    494498
    495499  GR_CHECK_F( "grTexTextureMemRequired", !info, "invalid info pointer" );
    496   memrequired = _grTexTextureMemRequired( info->smallLod, info->largeLod, 
     500  memrequired = _grTexTextureMemRequired( info->smallLod, info->largeLod,
    497501                                          info->aspectRatio, info->format,
    498502                                          evenOdd );
    499                        
     503
    500504  GDBG_INFO((88,"grTexTextureMemRequired(%d,0x%x) => 0x%x(%d)\n",
    501505                evenOdd,info,memrequired,memrequired));
     
    526530    none
    527531  -------------------------------------------------------------------*/
    528 GR_DIENTRY(grTexDownloadMipMap, void, 
     532GR_DIENTRY(grTexDownloadMipMap, void,
    529533           ( GrChipID_t tmu, FxU32 startAddress, FxU32
    530534            evenOdd, GrTexInfo  *info ))
     
    543547  GR_CHECK_F( "grTexDownloadMipMap", evenOdd > 0x3, "evenOdd mask invalid" );
    544548  GR_CHECK_F( "grTexDownloadMipMap", !info, "info invalid" );
    545  
     549
    546550  if ((startAddress < 0x200000) && (startAddress + size > 0x200000))
    547551      GrErrorCallback("grTexDownloadMipMap: mipmap "
     
    549553
    550554  src_base = (char *)info->data;
    551  
     555
    552556  /*---------------------------------------------------------------
    553557    Download one mipmap level at a time
    554558    ---------------------------------------------------------------*/
    555559  for( lod = info->largeLod; lod <= info->smallLod; lod++ ) {
    556     grTexDownloadMipMapLevel( tmu, 
    557                               startAddress, 
     560    grTexDownloadMipMapLevel( tmu,
     561                              startAddress,
    558562                              lod,
    559563                              info->largeLod,
     
    562566                              evenOdd,
    563567                              src_base );
    564                
     568
    565569    src_base += _grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod]
    566570                    << (info->format>=GR_TEXFMT_16BIT);
     
    588592  -------------------------------------------------------------------*/
    589593GR_DIENTRY(grTexDownloadTablePartial, void,
    590            ( GrChipID_t tmu, GrTexTable_t type, 
     594           ( GrChipID_t tmu, GrTexTable_t type,
    591595            void *data, int start, int end ))
    592596{
     
    612616** grTexDownloadMipMapLevel
    613617*/
    614 GR_DIENTRY(grTexDownloadMipMapLevel, void, 
     618GR_DIENTRY(grTexDownloadMipMapLevel, void,
    615619           ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod,
    616620            GrLOD_t largeLod, GrAspectRatio_t aspectRatio,
    617             GrTextureFormat_t format, FxU32 evenOdd, void *data )) 
     621            GrTextureFormat_t format, FxU32 evenOdd, void *data ))
    618622{
    619623  GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevel",89);
     
    622626                  format,evenOdd,data));
    623627  grTexDownloadMipMapLevelPartial( tmu, startAddress,
    624                                    thisLod, largeLod, 
     628                                   thisLod, largeLod,
    625629                                   aspectRatio, format,
    626630                                   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 $ */
    12/*
    23 * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 * 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
    89 * 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 *
    1112 * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213 * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415 * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516 * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16  * THE UNITED STATES. 
    17  * 
     17 * THE UNITED STATES.
     18 *
    1819 * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920 *
    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 sandervl Exp $
     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 $
    2122 * $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
    2327 * Created new Voodoo 1 Glide dir
    2428 *
    25  * 
     29 *
    2630 * 1     7/25/97 9:05a Pgj
    2731 * generate fxbldno.h which defines BUILD_NUMBER
     
    3539main(int argc, char **argv)
    3640{
    37     struct tm   locTime;
    38     time_t      sysTime;
    39     char        *build;
     41    struct tm   locTime;
     42    time_t  sysTime;
     43    char    *build;
    4044
    4145    time(&sysTime);
     
    4347
    4448    if (build = getenv("BUILD_NUMBER")) {
    45         printf("#define BUILD_NUMBER    %s\n", build);
     49    printf("#define BUILD_NUMBER    %s\n", build);
    4650    } else {
    47         unsigned short magic;
    48         magic = (locTime.tm_yday << 7) |
    49                 (locTime.tm_hour << 2) |
    50                 (locTime.tm_min / 15);
    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);
    5256    }
    5357    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:11 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:30:50 $
    2223*/
    2324
     
    104105        printf("#define __FX_INLINE_H__\n");
    105106        printf("\n");
    106        
     107
    107108        printf("/* The # of 2-byte entries in the hw fog table */\n");
    108109        printf("#define kInternalFogTableEntryCount 0x%XUL\n",
     
    142143    HWOFFSET (sst,FtriangleCMD,"FTRIANGLECMD\t");
    143144#else
    144 #error "Update fxgasm.c for this chip"   
     145#error "Update fxgasm.c for this chip"
    145146#endif
    146147    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 6     3/09/97 10:31a Dow
    2731 * Added GR_DIENTRY for di glide functions
     
    101105    GR_ASPECT_8x1
    102106  };
    103   CfTableEntry cftable[] = 
     107  CfTableEntry cftable[] =
    104108  {
    105109      { "I8",       GR_TEXFMT_INTENSITY_8,        FXTRUE },
     
    364368       packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+2] ) << 16;
    365369       packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+3] ) << 24;
    366                                            
     370
    367371       info->table.nccTable.packed_data[index] = packedvalue;
    368372    }
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 13    8/21/97 2:26p Atai
    2731 * fix FIFO size
    28  * 
     32 *
    2933 * 12    7/25/97 2:55p Atai
    3034 * Remove slope calculation in edge sense code, use cross product instead.
    3135 * Move grAADrawTriEdgeSense() 1/area calculation after pci write command.
    32  * 
     36 *
    3337 * 11    7/24/97 5:59p Atai
    3438 * optimize grAADrawPoint, grAADrawLine and grAADrawTriangle for sst1
    35  * 
     39 *
    3640 * 10    3/04/97 9:08p Dow
    3741 * Neutered multiplatform multiheaded monster
    38  * 
     42 *
    3943 * 9     12/23/96 1:37p Dow
    4044 * chagnes for multiplatform glide
     
    8084** total = 29 + 3 * n
    8185*/
    82 GR_ENTRY(grAADrawPoint, void, ( const GrVertex *e )) 
     86GR_ENTRY(grAADrawPoint, void, ( const GrVertex *e ))
    8387{
    8488  int i, j;
     
    216220**                                      \ \|
    217221**                                         +F(x2,y2+1.0)
    218 **                                         
     222**
    219223** pci write command (x major line )
    220224** 1st triangle A-B-V2
     
    226230** 4th triangle V1-V2-F
    227231**     5 + n
    228 ** total = 
     232** total =
    229233*/
    230 GR_ENTRY(grAADrawLine, void, ( const GrVertex *v1, const GrVertex *v2 )) 
     234GR_ENTRY(grAADrawLine, void, ( const GrVertex *v1, const GrVertex *v2 ))
    231235{
    232236  float           adx;         /* |dX| */
     
    248252    tv = v1; v1 = v2; v2 = tv;
    249253  }
    250  
     254
    251255  /* compute deltas and absolute deltas */
    252256  dx = adx = v1->x - v2->x;
     
    254258  if ( adx < 0 )
    255259    adx = -adx;
    256  
     260
    257261  if ( adx >= dy ) {           /* X major line */
    258262
     
    284288      else {
    285289        dp = FARRAY(v1,i);
    286         GR_SETF( fp[0], dp );
    287         dp -= FARRAY(v2, i);
    288         GR_SETF( fp[DPDX_OFFSET>>2] , dp * dx);
    289         dlp++;
    290         i = dlp->i;
    291         GR_SETF( fp[DPDY_OFFSET>>2] , _GlideRoot.pool.f0 );
     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 );
    292296      }
    293297    }
     
    330334    grSetVertexParameter(v1);
    331335
    332     GR_SETF( hw->Fdadx , dp ); 
     336    GR_SETF( hw->Fdadx , dp );
    333337    GR_SETF( hw->Fdady , -v2->a );
    334338    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, -dx ) );
     
    354358      fp = dlp->addr;
    355359      if (i & 1) {     /* packer bug check */
    356         if (i & 2) P6FENCE;
    357         GR_SETF( fp[0], 0.0f);
    358         if (i & 2) P6FENCE;
    359         dlp++;
    360         i = dlp->i;
     360    if (i & 2) P6FENCE;
     361    GR_SETF( fp[0], 0.0f);
     362    if (i & 2) P6FENCE;
     363    dlp++;
     364    i = dlp->i;
    361365      }
    362366      else {
    363         dp = FARRAY(v1,i);
    364         GR_SETF( fp[0], dp );
     367    dp = FARRAY(v1,i);
     368    GR_SETF( fp[0], dp );
    365369        dp -= FARRAY(v2, i);
    366         GR_SETF( fp[DPDX_OFFSET>>2] , _GlideRoot.pool.f0);
    367         dlp++;
    368         i = dlp->i;
     370    GR_SETF( fp[DPDX_OFFSET>>2] , _GlideRoot.pool.f0);
     371    dlp++;
     372    i = dlp->i;
    369373        GR_SETF( fp[DPDY_OFFSET>>2] , dp * dy );
    370374      }
     
    468472    if (dx > 0.0f) {
    469473      if (dx >= -dy)    /* X-major line */
    470         sense = (cp > 0) ? aaEdgeSenseTop : aaEdgeSenseBottom;
     474    sense = (cp > 0) ? aaEdgeSenseTop : aaEdgeSenseBottom;
    471475      else              /* Y-major line */
    472         sense = (cp > 0) ? aaEdgeSenseRight : aaEdgeSenseLeft;
     476    sense = (cp > 0) ? aaEdgeSenseRight : aaEdgeSenseLeft;
    473477    }
    474478    else {
    475479      if (dx <= dy)     /* X-major line */
    476         sense = (cp < 0) ? aaEdgeSenseTop : aaEdgeSenseBottom;
     480    sense = (cp < 0) ? aaEdgeSenseTop : aaEdgeSenseBottom;
    477481      else              /* Y-major line */
    478         sense = (cp < 0) ? aaEdgeSenseLeft : aaEdgeSenseRight;
     482    sense = (cp < 0) ? aaEdgeSenseLeft : aaEdgeSenseRight;
    479483    }
    480484  }
     
    492496    dp = a->a * dy;
    493497    GR_SETF( hw->FvC.y, b->y + _GlideRoot.pool.f1);
    494    
     498
    495499    grSetVertexParameter(a);
    496    
     500
    497501    GR_SETF( hw->Fdady, -a->a);
    498502    dp *= m;
    499503    GR_SETF( hw->Fdadx, dp);
    500504    P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
    501      
     505
    502506    dp = b->a * dy;
    503507    GR_SETF( hw->FvB.x, b->x);
     
    506510
    507511    grSetVertexParameter(a);
    508    
     512
    509513    GR_SETF( hw->Fdady, -b->a);
    510514    dp *= m;
    511515    GR_SETF( hw->Fdadx, dp);
    512516    P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) );
    513    
     517
    514518    break;
    515    
     519
    516520  case aaEdgeSenseLeft:
    517521    /* pci comamnd 16 + 2 * n */
     
    520524    GR_SETF( hw->FvB.x, a->x);
    521525    GR_SETF( hw->FvB.y, a->y);
    522     GR_SETF( hw->FvC.y, b->y);   
     526    GR_SETF( hw->FvC.y, b->y);
    523527    m = 1.0f / dy;
    524528    GR_SETF( hw->FvA.x, a->x - _GlideRoot.pool.f1);
     
    532536    GR_SETF( hw->Fdady, dp);
    533537    P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dy ) );
    534    
     538
    535539    GR_SETF( hw->FvA.x, a->x);
    536540    dp = b->a * dx;
     
    545549    GR_SETF( hw->Fdady, dp);
    546550    P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dy ) );
    547    
     551
    548552    break;
    549    
     553
    550554  case aaEdgeSenseBottom:
    551    
     555
    552556    if (dy < -1.0f) {
    553557      /* pci comamnd 17 + 2 * n */
     
    556560      GR_SETF( hw->FvB.x, a->x);
    557561      GR_SETF( hw->FvB.y, a->y);
    558       GR_SETF( hw->FvC.x, b->x);     
     562      GR_SETF( hw->FvC.x, b->x);
    559563      m = 1.0f / dx;
    560564      GR_SETF( hw->FvA.y, a->y - _GlideRoot.pool.f1);
     
    563567      grSetVertexParameter(a);
    564568      GR_SET(hw->Fa, 0);
    565      
     569
    566570      dp = a->a * dy;
    567571      dp *= m;
     
    569573      GR_SETF( hw->Fdady, a->a);
    570574      P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
    571    
     575
    572576      GR_SETF( hw->FvA.y, a->y);
    573577      dp = b->a * dy;
     
    577581      GR_SETF( hw->FvC.y, b->y);
    578582      grSetVertexParameter(a);
    579      
     583
    580584      GR_SETF( hw->Fdady, b->a);
    581585      dp *= m;
     
    588592      GR_SET_EXPECTED_SIZE(8+(_GlideRoot.curTriSizeNoGradient << 1));
    589593      GR_SETF( hw->FvA.x, a->x);
    590       GR_SETF( hw->FvC.x, b->x);     
     594      GR_SETF( hw->FvC.x, b->x);
    591595      GR_SETF( hw->FvC.y, b->y);
    592596      GR_SETF( hw->FvB.x, b->x);
     
    601605      GR_SETF( hw->Fdady, b->a);
    602606      P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) );
    603    
     607
    604608      GR_SETF( hw->FvB.x, a->x);
    605609      GR_SETF( hw->FvB.y, a->y);
    606610      grSetVertexParameter(a);
    607611      GR_SET(hw->Fa, 0);
    608    
     612
    609613      dp = a->a - b->a;
    610614      GR_SETF( hw->Fdady, a->a);
     
    619623      GR_SETF( hw->FvA.x, a->x);
    620624      GR_SETF( hw->FvB.x, b->x);
    621       GR_SETF( hw->FvC.x, a->x);     
     625      GR_SETF( hw->FvC.x, a->x);
    622626      GR_SETF( hw->FvC.y, a->y);
    623627      m = 1.0f / dx;
     
    627631      grSetVertexParameter(a);
    628632      GR_SET(hw->Fa, 0);
    629      
     633
    630634      dp = -a->a * dy * m;
    631635      GR_SETF( hw->Fdadx, dp);
     
    638642      GR_SETF( hw->FvB.y, a->y);
    639643      dp = b->a * dy;
    640       GR_SETF( hw->FvC.x, b->x);     
     644      GR_SETF( hw->FvC.x, b->x);
    641645      GR_SETF( hw->FvC.y, b->y);
    642646
     
    649653      P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
    650654    }
    651    
     655
    652656    break;
    653657  case aaEdgeSenseRight:
     
    670674    GR_SETF( hw->Fdady, dp);
    671675    P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) );
    672    
     676
    673677    GR_SETF( hw->FvA.x, a->x);
    674678    dp = b->a * dx;
     
    677681    GR_SETF( hw->FvB.y, b->y);
    678682    grSetVertexParameter(a);
    679    
     683
    680684    GR_SETF( hw->Fdadx, -b->a);
    681685    dp *= m;
    682686    GR_SETF( hw->Fdady, dp);
    683     P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) );   
     687    P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) );
    684688    break;
    685689  }
     
    690694/*
    691695** aaCalculateSignOfSinTheta
    692 ** 
     696**
    693697*/
    694698float
     
    701705     Now, we make two vectors: ab [x1 y1] and ac [x2 y2]
    702706     Fromt the cross product, we know that
    703      
     707
    704708     x1*y2 - x2*y1 = |ab|*|ac|*sin(theta), where theta is the angle
    705709     between the two lines.  If sin(theta) > 0, c is above the line ab,
     
    708712  x1 = b->x - a->x;
    709713  y1 = b->y - a->y;
    710  
     714
    711715  x2 = c->x - a->x;
    712716  y2 = c->y - a->y;
    713717
    714718  return ((x1 * y2) - (x2 * y1));
    715  
     719
    716720} /* aaCalculateSignOfSinTheta */
    717721#endif
     
    723727**  NOTE:  This doesn't quite work yet
    724728*/
    725 GR_ENTRY(grAADrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVertex *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias ) ) 
     729GR_ENTRY(grAADrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVertex *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias ) )
    726730{
    727731  FxU32
     
    748752    grAADrawTriEdgeSense(a, b, c);
    749753  }
    750  
     754
    751755  if ( bc_antialias ) {
    752756    grAADrawTriEdgeSense(b, c, a);
    753757  }
    754  
     758
    755759  if ( ca_antialias ) {
    756760    grAADrawTriEdgeSense(c, a, b);
     
    768772*/
    769773
    770 GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 
     774GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[]))
    771775{
    772776  int
     
    795799    } else if (i == (nverts - 2)) {
    796800      grAADrawTriEdgeSense(c, a, b);
    797     } 
     801    }
    798802
    799803    grAADrawTriEdgeSense(b, c, a);
     
    808812*/
    809813
    810 GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 
     814GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[]))
    811815{
    812816  int
     
    838842    } else if (i == (nverts - 2)) {
    839843      grAADrawTriEdgeSense(c, a, b);
    840     } 
     844    }
    841845
    842846    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 9     5/02/97 2:08p Pgj
    2731 * screen_width/height now FxU32
    28  * 
     32 *
    2933 * 8     3/16/97 2:24a Jdt
    3034 * Fixed bug.  Didn't initialize info.
    31  * 
     35 *
    3236 * 7     3/12/97 11:51p Jdt
    3337 * Watcom warning.
    34  * 
     38 *
    3539 * 6     3/12/97 4:20p Jdt
    3640 * Fixed for VG96 and optimized SST-1
    37  * 
     41 *
    3842 * 5     2/26/97 11:55a Jdt
    3943 * Updated banner for new lfb api
    40  * 
     44 *
    4145 * 4     12/23/96 1:37p Dow
    4246 * chagnes for multiplatform glide
     
    6670  GDBG_INFO_MORE((gc->myLevel,"()\n"));
    6771
    68 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
     72#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    6973  grGlideGetState( &state );
    7074  grDisableAllEffects();
     
    8488  grClipWindow( 0, 0,
    8589               gc->state.screen_width - 1,
    86                gc->state.screen_height - 1); 
     90               gc->state.screen_height - 1);
    8791  grDepthMask(FXFALSE);
    8892  grDepthBufferFunction(GR_CMP_ALWAYS);
    8993  grDepthBufferMode( GR_DEPTHBUFFER_DISABLE );
    90  
     94
    9195  grChromakeyValue( 0x0000 );
    9296  grChromakeyMode( GR_CHROMAKEY_ENABLE );
     
    97101  info.size = sizeof( info );
    98102  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,
    100104                  FXTRUE, &info ) ) {
    101105      FxU32 *dstData;
     
    114118
    115119      dstData = info.lfbPtr;
    116       dstData = (FxU32*)( ((char*)dstData) + 
     120      dstData = (FxU32*)( ((char*)dstData) +
    117121                          (info.strideInBytes*((scrHeight-1)-banner_height)) +
    118122                          ((scrWidth-banner_width)<<1) );
     
    137141  info.size = sizeof( info );
    138142  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,
    140144                  FXFALSE, &info ) ) {
    141145
     
    155159
    156160      dstData = info.lfbPtr;
    157       dstData = (FxU16*)( ((char*)dstData) + 
     161      dstData = (FxU16*)( ((char*)dstData) +
    158162                          (info.strideInBytes*((scrHeight-1)-banner_height)) +
    159163                          ((scrWidth-banner_width)<<1) );
     
    174178          srcData += srcJump;
    175179      }
    176      
     180
    177181      grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
    178182  }
    179183
    180184#else
    181 #  error "Shameless Plug Unimplemented on this Hardware" 
     185#  error "Shameless Plug Unimplemented on this Hardware"
    182186#endif
    183187
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25 ** 
     29**
    2630** 31    6/02/98 8:03p Peter
    2731** Mmmmm.... points
    28  * 
     32 *
    2933 * 30    9/07/97 1:52p Atai
    3034 * performance tuning for previous check-in
    31  * 
     35 *
    3236 * 29    9/05/97 7:20p Atai
    3337 * fixed bug 764 (grDrawPoint integer snapping).
    34  * 
     38 *
    3539 * 28    6/20/97 5:51p Dow
    3640 * Moved grDebugGroupWriteHEader to sst96.c
    37  * 
     41 *
    3842 * 27    5/27/97 11:37p Pgj
    3943 * Fix for Bug report 545
    40  * 
     44 *
    4145 * 26    5/27/97 2:00p Dow
    4246 * Parenthesized a ternary op in GR_BEGIN to work around a Watcom compiler
    4347 * bug.
    44  * 
     48 *
    4549 * 25    3/21/97 12:42p Dow
    4650 * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
    47  * 
     51 *
    4852 * 24    3/04/97 9:08p Dow
    4953 * Neutered multiplatform multiheaded monster
    50  * 
     54 *
    5155 * 23    2/18/97 9:51a Jdt
    5256 * Ifdefed out some if(0) code to supress watcom warnings
    53  * 
     57 *
    5458 * 22    12/23/96 1:37p Dow
    5559 * chagnes for multiplatform glide
    56  * 
     60 *
    5761 * 21    11/18/96 12:13p Jdt
    5862 * Made all debugging code go through the C-call to the assembly trisetup
    5963 * code.
    60  * 
     64 *
    6165 * 20    11/14/96 11:52p Jdt
    6266 * Fixed Watcom Assembly calling bug
     
    8488/*---------------------------------------------------------------------------
    8589  NOTE: by Gary Tarolli
    86  
     90
    8791  The following code is very carefully scheduled for MSVC4.2 Version 10.20.6166
    8892  The trick is to schedule operations between PCI writes (GR_SET*).
     
    116120   * can change the rounding mode so that it is difficult to get the
    117121   * correct truncation/ceiling operation w/ a simple adjustment to
    118    * the bias. 
     122   * the bias.
    119123   *
    120124   * NB: The constant kNumMantissaBits defines how many bits of
     
    145149
    146150  _GlideRoot.stats.pointsDrawn++;
    147  
     151
    148152  /* draw a little triangle, with the lower left corner at pixel center */
    149153  GR_SET( hw->vA.x, x );
    150154  GR_SET( hw->vA.y, y );
    151  
     155
    152156  x += (0x01UL << (21UL - kNumMantissaBits));
    153157  GR_SET( hw->vB.x, x );
     
    168172      if (i & 2) P6FENCE;
    169173    }
    170     else 
     174    else
    171175      GR_SETF( *dlp->addr, FARRAY(p,i) );
    172176    dlp++;
     
    250254      GR_SETF(hw->FvC.x,dp)
    251255       _GlideRoot.stats.linesDrawn++;
    252      
     256
    253257     GR_SETF(hw->FvA.y,a->y - _GlideRoot.pool.fHalf);
    254258
     
    296300     _GlideRoot.stats.linesDrawn++;
    297301     GR_SETF(hw->FvC.y,dp);
    298      
     302
    299303     GR_SETF(hw->FvA.x,a->x - _GlideRoot.pool.fHalf);
    300304
     
    304308     i = dlp->i;
    305309     GR_SETF(hw->FvC.x,dp + _GlideRoot.pool.fHalf);
    306        
     310
    307311     while (i) {
    308312       fp = dlp->addr;
     
    325329     }
    326330     P6FENCE_CMD( GR_SET( hw->triangleCMD, 0xFFFFFFFF) );
    327      
     331
    328332     GR_SETF(hw->FvB.x,a->x + _GlideRoot.pool.fHalf);
    329333     GR_SETF(hw->FvB.y,a->y);
     
    382386#endif /* GLIDE_DEBUG */
    383387
    384   /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 
     388  /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */
    385389  TRISETUP( a, b, c );
    386390
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    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 sandervl Exp $
     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 $
    2223** $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
    2428** Created new Voodoo 1 Glide dir
    2529**
    26  * 
     30 *
    2731 * 10    6/03/97 11:57p Pgj
    2832 * fix bug 558
    29  * 
     33 *
    3034 * 9     5/28/97 2:10p Dow
    3135 * Some mode setting, other cleanup
    32  * 
     36 *
    3337 * 8     5/27/97 2:02p Dow
    3438 * added _grAssert
    35  * 
     39 *
    3640 * 7     5/20/97 9:47a Pgj
    3741 * Use OutputDebugString for non-fatal errors under windows
    38  * 
     42 *
    3943 * 6     5/19/97 7:35p Pgj
    4044 * Print cogent error message if h/w not found
    41  * 
     45 *
    4246 * 5     3/09/97 10:31a Dow
    4347 * Added GR_DIENTRY for di glide functions
    44  * 
     48 *
    4549 * 4     12/23/96 1:37p Dow
    4650 * chagnes for multiplatform glide
     
    133137    grGlideShutdown();
    134138
    135 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) && (GLIDE_PLATFORM & GLIDE_OS_DOS32)   
     139#if (GLIDE_PLATFORM & GLIDE_HW_SST96) && (GLIDE_PLATFORM & GLIDE_OS_DOS32)
    136140    {
    137141      /* Set Mode 3 before going */
    138142      union REGS
    139143        inR, outR;
    140      
     144
    141145      inR.w.ax = 0x0003;
    142146      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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25 ** 
     29**
    2630** 78    1/21/98 2:25p Peter
    2731** fixed assertion muckage
    28  * 
     32 *
    2933 * 77    1/12/98 10:25p Dow
    3034 * H3D Stereo Support
    31  * 
     35 *
    3236 * 76    1/07/98 9:58a Jdt
    3337 * Include Z in datalist for GR_COMBINE_LOCAL_DEPTH...Fixes Bug 1084
    34  * 
     38 *
    3539 * 75    12/19/97 8:09a Peter
    3640 * fog table propogation
    37  * 
     41 *
    3842 * 74    9/24/97 7:02p Atai
    3943 * 1. use initStatus() instead of grSstStatus() in grBufferNumPending
    4044 * 2. add one p6 nudge code in grBufferSwap()
    41  * 
     45 *
    4246 * 73    9/07/97 12:14p Pgj
    4347 * fix bug 660
    44  * 
     48 *
    4549 * 72    9/05/97 4:46p Peter
    4650 * fixed fifo silliness, sorry
    47  * 
     51 *
    4852 * 71    8/19/97 8:55p Peter
    4953 * lots of stuff, hopefully no muckage
    50  * 
     54 *
    5155 * 70    8/17/97 10:04p Pgj
    5256 * Fix bug 735
    53  * 
     57 *
    5458 * 69    8/01/97 11:48a Dow
    5559 * Added a size check for debugging
    56  * 
     60 *
    5761 * 68    7/20/97 2:05p Dow
    5862 * Hopefully worked around VSYNC bug
    59  * 
     63 *
    6064 * 67    7/18/97 6:48p Jdt
    6165 * grGlideShutdown now unsets _GlideRoot.initialized, further open/close
    6266 * symmetry fix
    63  * 
     67 *
    6468 * 66    7/09/97 10:18a Dow
    6569 * Further Nudge Of Love adjustments
    66  * 
     70 *
    6771 * 65    7/04/97 12:08p Dow
    6872 * Separated SST96 & SST1 versions of grRebuildDataList, fixed chip field
    6973 * muckage
    70  * 
     74 *
    7175 * 64    6/30/97 6:43p Dow
    7276 * Added more blank lines
    73  * 
     77 *
    7478 * 63    6/29/97 11:47p Jdt
    7579 * Adjustments for triangle optimization
    76  * 
     80 *
    7781 * 62    6/29/97 1:58p Dow
    7882 * Fixed busted ifdef
    79  * 
     83 *
    8084 * 61    6/26/97 3:09p Dow
    8185 * protected P6 stuff
    82  * 
     86 *
    8387 * 60    6/20/97 5:52p Dow
    8488 * Changes to make chip field work
    85  * 
     89 *
    8690 * 59    6/19/97 7:35p Dow
    8791 * More P6 Stuff
    88  * 
     92 *
    8993 * 58    6/18/97 6:08p Dow
    9094 * Fixed bogus call to gdbg_error
    91  * 
     95 *
    9296 * 57    6/18/97 5:54p Dow
    9397 * P6 adjustments
    94  * 
     98 *
    9599 * 56    6/12/97 5:19p Pgj
    96100 * Fix bug 578
    97  * 
     101 *
    98102 * 55    5/27/97 11:37p Pgj
    99103 * Fix for Bug report 545
    100  * 
     104 *
    101105 * 54    5/22/97 2:18p Pgj
    102106 * maxx --> maxy
    103  * 
     107 *
    104108 * 53    5/11/97 11:27p Pgj
    105109 * bug report 1152
    106  * 
     110 *
    107111 * 52    5/04/97 12:47p Dow
    108112 * Moved ClipWindow sanity check to internal routine as grSstControl needs
    109113 * it.
    110  * 
     114 *
    111115 * 51    5/02/97 2:09p Pgj
    112116 * grClipWindow sanity checks coords (intersect w/screen rect)
    113  * 
     117 *
    114118 * 50    3/24/97 2:00p Dow
    115119 * Fixed some chip field problems
    116  * 
     120 *
    117121 * 49    3/22/97 7:04p Dow
    118122 * Fixed chip field
    119  * 
     123 *
    120124 * 48    3/21/97 12:58p Dow
    121125 * Fixed error for SST1
    122  * 
     126 *
    123127 * 47    3/21/97 12:42p Dow
    124128 * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
    125  * 
     129 *
    126130 * 46    3/19/97 10:42p Dow
    127131 * Dither subtraction sense, windowsInit
    128  * 
     132 *
    129133 * 45    3/18/97 9:08p Dow
    130134 * Added FX_GLIDE_NO_DITHER_SUB environment variable
    131  * 
     135 *
    132136 * 44    3/17/97 6:26a Jdt
    133137 * Re-worked grGlideShutdown()
    134  * 
     138 *
    135139 * 43    3/07/97 2:51p Jdt
    136140 * Fix for SST96 register offsets.
    137  * 
     141 *
    138142 * 42    3/07/97 2:29p Dow
    139143 * Maybe fixed lines
    140  * 
     144 *
    141145 * 41    3/05/97 1:07p Dow
    142146 * Clipping and origin changes for SST98
    143  * 
     147 *
    144148 * 40    3/04/97 9:08p Dow
    145149 * Neutered multiplatform multiheaded monster
    146  * 
     150 *
    147151 * 39    3/01/97 2:48p Dow
    148152 * Moved buffer swap count increment so that it works for both VG & VR
    149  * 
     153 *
    150154 * 38    2/26/97 11:56a Jdt
    151155 * Updated lfb api, fixed swapping
    152  * 
     156 *
    153157 * 37    2/18/97 9:51a Jdt
    154158 * Removed a bunch of warnings, no functional changes.
    155  * 
     159 *
    156160 * 36    2/12/97 10:39p Hanson
    157  * 
     161 *
    158162 * 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 *
    161165 * 34    1/14/97 10:45a Dow
    162166 * Added check for pending swaps to grBufferSwap for VG96
    163167 * Modified grBufferNumPending to work with VG96
    164  * 
     168 *
    165169 * 33    12/23/96 1:37p Dow
    166170 * chagnes for multiplatform glide
    167  * 
     171 *
    168172 * 32    11/17/96 11:16p Garymct
    169173 * Updated grSplash code to set all of the necessary state itself rather
    170174 * than expecting the caller to do so.
    171  * 
     175 *
    172176 * 31    11/18/96 1:37a Tarolli
    173177 * fixed grAlphaBlendFunction warning bug
    174  * 
     178 *
    175179 * 29    11/15/96 3:40p Jdt
    176180 * Fixed SST-96 build.
    177  * 
     181 *
    178182 * 28    11/15/96 3:24p Tarolli
    179183 * renamed version.h to rcver.h ,  added some alpha blend function
     
    230234  else
    231235    alphamode |=  SST_ENALPHABLEND;
    232  
     236
    233237  alphamode &= ~( SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT );
    234  
     238
    235239  alphamode |= ( ( ( FxU32 ) rgb_sf ) << SST_RGBSRCFACT_SHIFT ) |
    236240    ( ( ( FxU32 ) rgb_df ) << SST_RGBDSTFACT_SHIFT ) |
    237241      ( ( ( FxU32 ) alpha_sf ) << SST_ASRCFACT_SHIFT ) |
    238242        ( ( ( FxU32 ) alpha_df ) << SST_ADSTFACT_SHIFT );
    239  
     243
    240244  GR_SET( hw->alphaMode, alphamode );
    241245  gc->state.fbi_config.alphaMode = alphamode;
     
    282286                    SST_CCA_ADD_ALOCAL |
    283287                    SST_CCA_INVERT_OUTPUT );
    284  
     288
    285289  /* setup reverse blending first, then strip off the the high bit */
    286290  if ( (factor & 0x8) == 0 )
     
    293297  gc->state.ac_requires_it_alpha = ( local == GR_COMBINE_LOCAL_ITERATED ) |
    294298                                   ( other == GR_COMBINE_OTHER_ITERATED );
    295  
     299
    296300  /* setup scale factor bits */
    297301  fbzColorPath |= factor << SST_CCA_MSELECT_SHIFT;
     
    299303  /* setup local color bits */
    300304  fbzColorPath |= local << SST_ALOCALSELECT_SHIFT;
    301  
     305
    302306  /* setup other color bits */
    303307  fbzColorPath |= other << SST_ASELECT_SHIFT;
    304  
    305  
     308
     309
    306310  /* setup invert output bits */
    307311  if ( invert )
    308312    fbzColorPath |= SST_CCA_INVERT_OUTPUT;
    309  
     313
    310314  /* setup core color combine unit bits */
    311315  switch ( function ) {
     
    313317    fbzColorPath |= SST_CCA_ZERO_OTHER;
    314318    break;
    315    
     319
    316320  case GR_COMBINE_FUNCTION_LOCAL:
    317321  case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
    318322    fbzColorPath |= SST_CCA_ZERO_OTHER | SST_CCA_ADD_ALOCAL;
    319323    break;
    320    
     324
    321325  case GR_COMBINE_FUNCTION_SCALE_OTHER:
    322326    break;
    323    
     327
    324328  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
    325329  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
    326330    fbzColorPath |= SST_CCA_ADD_ALOCAL;
    327331    break;
    328    
     332
    329333  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
    330334    fbzColorPath |= SST_CCA_SUB_CLOCAL;
    331335    break;
    332    
     336
    333337  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
    334338  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
    335339    fbzColorPath |= SST_CCA_SUB_CLOCAL | SST_CCA_ADD_ALOCAL;
    336340    break;
    337    
     341
    338342  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
    339343  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
     
    345349  if ( gc->state.cc_requires_texture || gc->state.ac_requires_texture )
    346350    fbzColorPath |= SST_ENTEXTUREMAP;
    347  
     351
    348352  /* transition into/out of texturing ... add nopCMD */
    349353  if(oldTextureEnabled != (fbzColorPath & SST_ENTEXTUREMAP))
     
    352356   GR_SET( hw->fbzColorPath, fbzColorPath );
    353357  gc->state.fbi_config.fbzColorPath = fbzColorPath;
    354  
     358
    355359  /* setup paramIndex bits */
    356360  _grUpdateParamIndex();
    357   GR_END_SLOPPY(); 
     361  GR_END_SLOPPY();
    358362} /* grAlphaCombine */
    359363
    360364/*---------------------------------------------------------------------------
    361365** grAlphaControlsITRGBLighting
    362 ** 
     366**
    363367** Determines whether the LSB of alpha controls what lighting is used--
    364368** Specifically whether grConstantColorValu or the interated RGB values are used
    365369** during TEXTURE_TIMES_itrgb & TEXTURE_TIMES_ITRGB_DELTA0 color combine modes.
    366370**
    367 */ 
     371*/
    368372
    369373GR_ENTRY(grAlphaControlsITRGBLighting, void, (FxBool enable))
     
    485489    /* Restore fbzMode to previous state */
    486490    GR_SET(hw->fbzMode, gc->state.fbi_config.fbzMode);
    487        
     491
    488492  } else
    489493#endif
     
    528532  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",swapInterval));
    529533
    530 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 
     534#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
    531535  FXUNUSED( vSync );
    532536
     
    570574    pending = grBufferNumPending();
    571575  } while (pending > 3);
    572  
     576
    573577  /* optionally display the 3Dfx powerfield logo overlay */
    574578  if (_GlideRoot.environment.shamelessPlug)
     
    589593  P6_NUDGE_OF_LOVE;
    590594
    591 #elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
     595#elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    592596  /* optionally display the 3Dfx powerfield logo overlay */
    593597  if (_GlideRoot.environment.shamelessPlug)
     
    634638
    635639    /* turn off tracing after frame 0 and the snapshot frame */
    636     if (_GlideRoot.stats.bufferSwaps == 1 || 
     640    if (_GlideRoot.stats.bufferSwaps == 1 ||
    637641        _GlideRoot.stats.bufferSwaps == _GlideRoot.environment.snapshot+1)
    638642    {
     
    652656  grSstStatus();        /* special bug workaround       */
    653657#else
    654 #    error "Need to implement swap." 
     658#    error "Need to implement swap."
    655659#endif /* GLIDE_PLATFORM & GLIDE_HW_SST1 */
    656660
     
    658662
    659663  GR_END();
    660 #undef FN_NAME 
     664#undef FN_NAME
    661665} /* grBufferSwap */
    662666
     
    668672{
    669673  int
    670     pend;                       /* Num Swaps pending */ 
     674    pend;                       /* Num Swaps pending */
    671675  /*
    672676   * For improved speed we take the following steps
     
    762766
    763767  *clipLeftRight =
    764     ( minx << SST_CLIPLEFT_SHIFT ) | ( maxx << SST_CLIPRIGHT_SHIFT ); 
     768    ( minx << SST_CLIPLEFT_SHIFT ) | ( maxx << SST_CLIPRIGHT_SHIFT );
    765769
    766770  *clipBottomTop =
     
    773777  /* Enable clipping */
    774778  *clipLeftRight |= 0x80000000;
    775 #endif 
    776 #undef FN_NAME 
     779#endif
     780#undef FN_NAME
    777781} /* _grClipNormalizeAndGenerateRegValues */
    778782
     
    781785*/
    782786GR_ENTRY(grClipWindow, void, ( FxU32 minx, FxU32 miny, FxU32 maxx,
    783                               FxU32 maxy )) 
     787                              FxU32 maxy ))
    784788{
    785789  FxU32
     
    11071111  case GR_DEPTHBUFFER_DISABLE:
    11081112    break;
    1109    
     1113
    11101114  case GR_DEPTHBUFFER_ZBUFFER:
    11111115    fbzMode |= SST_ENDEPTHBUFFER | SST_ENZBIAS;
     
    13011305  Library: Glide
    13021306  Description:
    1303   Shutdown the Glide Library.  Iterate through all hardware and 
     1307  Shutdown the Glide Library.  Iterate through all hardware and
    13041308  call grSstWinClose().  Call InitShutdown() which unmaps all
    13051309  hardware from linear memory.
     
    13201324    }
    13211325    {
    1322       int i;   
     1326      int i;
    13231327      GR_BEGIN_NOFIFOCHECK("grGlideShutdown",80);
    13241328      GDBG_INFO_MORE((gc->myLevel,"()\n"));
    1325      
     1329
    13261330      for( i = 0; i < _GlideRoot.hwConfig.num_sst; i++ ) {
    13271331        grSstSelect( i );
    13281332        grSstWinClose();
    13291333      }
    1330      
     1334
    13311335      initClose();
    1332      
     1336
    13331337      _grDisplayStats();
    13341338      gc->grSstRez           = GR_RESOLUTION_NONE;
     
    14001404
    14011405  GR_END_SLOPPY();
    1402  
     1406
    14031407#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
    14041408  if (gc->state.fbi_config.fbzMode & SST_YORIGIN)
     
    14291433      FxU32 fbzMode;
    14301434      GR_SET_EXPECTED_SIZE( 4 );
    1431      
     1435
    14321436      fbzMode = gc->state.fbi_config.fbzMode;
    14331437      fbzMode &= ~( SST_DRAWBUFFER );
    14341438      fbzMode |= buffer == GR_BUFFER_FRONTBUFFER ? SST_DRAWBUFFER_FRONT : SST_DRAWBUFFER_BACK;
    1435      
     1439
    14361440      GR_SET( hw->fbzMode, fbzMode );
    14371441      gc->state.fbi_config.fbzMode = fbzMode;
     
    14981502    GR_ASSERT(gc->state.tmuMask < sizeof(paramI_array)/sizeof(paramI_array[0]));
    14991503    paramIndex |= paramI_array[gc->state.tmuMask];
    1500   } 
     1504  }
    15011505
    15021506  /* See if we need iterated RGB */
     
    15091513
    15101514  /* See if we need to iterate alpha based on the value of
    1511      ac_requires_it_alpha */ 
     1515     ac_requires_it_alpha */
    15121516  if (gc->state.ac_requires_it_alpha) {
    15131517    paramIndex |= STATE_REQUIRES_IT_ALPHA;
     
    15181522
    15191523  /* See what fbzColorPath contributes - BUG 1084*/
    1520   if ( ( fbzColorPath & SST_ALOCALSELECT ) == 
     1524  if ( ( fbzColorPath & SST_ALOCALSELECT ) ==
    15211525       ( SST_ALOCAL_Z ) ) {
    15221526      paramIndex |= STATE_REQUIRES_OOZ;
     
    15761580      paramIndex &= ~STATE_REQUIRES_W_TMU0;
    15771581  }
    1578  
     1582
    15791583  /* Turn off ST for TMU1 if TMU0 is active and TMU1 is not different */
    15801584  if (((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQUIRES_ST_TMU1)) ==
     
    15821586      !(hints & GR_STWHINT_ST_DIFF_TMU1))
    15831587    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 */
    15861590  if ((paramIndex & STATE_REQUIRES_W_TMU1) && !(hints & GR_STWHINT_W_DIFF_TMU1))
    15871591    paramIndex &= ~STATE_REQUIRES_W_TMU1;
    15881592
    15891593#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.  */
    15911595  if ((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQURES_ST_TMU1)) &&
    15921596      (paramIndex & STATE_REQUIRES_ST_TMU2) &&
    15931597      !(hints & GR_STWHINT_ST_DIFF_TMU2))
    15941598    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 */
    15971601  if ((paramIndex & STATE_REQUIRES_W_TMU2) && !(hints & GR_STWHINT_W_DIFF_TMU2))
    15981602    paramIndex &= ~STATE_REQUIRES_W_TMU2;
    15991603#endif
    1600  
     1604
    16011605  gc->state.paramIndex = paramIndex;
    16021606
     
    16731677  Sstregs *tmu0;
    16741678  Sstregs *tmu1;
    1675    
     1679
    16761680#ifdef GDBG_INFO_ON
    16771681  static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow",
    16781682                            "s0","t0","w0","s1","t1","w1","s2","t2","w2"};
    16791683#endif
    1680  
     1684
    16811685  GDBG_INFO((80,"_grRebuildDataList() paramHints=0x%x paramIndex=0x%x\n",
    16821686             gc->state.paramHints,gc->state.paramIndex));
    1683  
     1687
    16841688  curTriSize = params = 0;
    16851689  i = gc->state.paramIndex;
    16861690  if (_GlideRoot.CPUType == 6) packMask |= 2;
    1687  
     1691
    16881692  tmu0 = SST_CHIP(hw,0xE); /* tmu 0,1,2 */
    16891693  tmu1 = SST_CHIP(hw,0xC); /* tmu 1,2 */
    1690  
     1694
    16911695  /* init group write data */
    16921696  gwHeaderNum = 0;
     
    16961700     place I can think of to init this for now */
    16971701  gc->hwDep.sst96Dep.gwCommand = GWH_GEN_ADDRESS(&hw->FvA.x);
    1698  
     1702
    16991703  /*
    17001704     ((((FxU32)((FxU32) &hw->FvA.x) - (FxU32) gc->lfb_ptr) >> 2) | 0x100000 | ( 1L << (31) ));
    17011705     */
    1702  
     1706
    17031707  gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] = 0;
    17041708  gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_VTX_BITS;
    1705  
     1709
    17061710  if (i & STATE_REQUIRES_IT_DRGB) {
    17071711    /* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
     
    17181722    gwpSize += 9;
    17191723  }
    1720  
     1724
    17211725  if (i & STATE_REQUIRES_OOZ) {
    17221726    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOZ_OFFSET<<2;
     
    17281732    gwpSize += 3;
    17291733  }
    1730  
     1734
    17311735  if (i & STATE_REQUIRES_IT_ALPHA) {
    17321736    gc->dataList[curTriSize + 0].i    = GR_VERTEX_A_OFFSET<<2;
     
    17381742    gwpSize += 3;
    17391743  }
    1740  
     1744
    17411745  /* TMU1 --------------------------------- */
    17421746  /* always output to ALL chips, saves from having to change CHIP field */
     
    17521756    gwpSize += 6;
    17531757  }
    1754  
     1758
    17551759  /* we squeeze FBI.OOW in here for sequential writes in the simple case */
    17561760  if (i & STATE_REQUIRES_OOW_FBI) {
     
    17721776    gc->dataList[curTriSize + 1].i    = GR_VERTEX_OOW_TMU0_OFFSET<<2;
    17731777    gc->dataList[curTriSize + 1].addr = 0L;
    1774    
     1778
    17751779    if (gwpSize & 1)
    17761780      ++gwpSize;              /* Justify your love */
    17771781    gwpSize += 5;             /* 2 header + grads */
    1778    
     1782
    17791783    ++gwHeaderNum;
    17801784    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_W_BITS;
     
    17821786    params += 1;
    17831787  }
    1784  
     1788
    17851789  gc->dataList[curTriSize++].i = 0;     /* terminate the list with 0,*      */
    17861790  /* followed by the FtriangleCMD reg */
    17871791  gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */
    17881792  gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD;
    1789  
     1793
    17901794  /* 6 X,Y values plus AREA = 7, plus parameters */
    17911795  if (gwHeaderNum) {
     
    18031807    if (gwpSize & 1)
    18041808      ++gwpSize;                /* justify the fifo */
    1805   }   
     1809  }
    18061810
    18071811  _GlideRoot.curTriSize = gwpSize << 2; /* GR.curTriSize in bytes */
     
    18091813  /* Need to know tri size without gradients for planar polygons */
    18101814  _GlideRoot.curTriSizeNoGradient = _GlideRoot.curTriSize - (params<<3);
    1811  
     1815
    18121816#ifdef GDBG_INFO_ON
    18131817  GDBG_INFO((282, "DataList\n"));
     
    18341838  Sstregs *tmu0;
    18351839  Sstregs *tmu1;
    1836    
     1840
    18371841#ifdef GLIDE_DEBUG
    18381842  static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow",
    18391843                            "s0","t0","w0","s1","t1","w1","s2","t2","w2"};
    18401844#endif
    1841  
     1845
    18421846  GDBG_INFO((80,"_grRebuildDataList() paramHints=0x%x paramIndex=0x%x\n",
    18431847             gc->state.paramHints,gc->state.paramIndex));
    1844  
     1848
    18451849  curTriSize = params = 0;
    18461850  i = gc->state.paramIndex;
     
    18501854                                   register mappings */
    18511855#endif /* GLIDE_USE_ALT_REGMAP */
    1852  
     1856
    18531857  tmu0 = SST_CHIP(hw,0xE); /* tmu 0,1,2 */
    18541858  tmu1 = SST_CHIP(hw,0xC); /* tmu 1,2 */
    1855  
     1859
    18561860  if (i & STATE_REQUIRES_IT_DRGB) {
    18571861    /* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
     
    18651869    params += 3;
    18661870  }
    1867  
     1871
    18681872  if (i & STATE_REQUIRES_OOZ) {
    18691873    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOZ_OFFSET<<2;
     
    18721876    params += 1;
    18731877  }
    1874  
     1878
    18751879  if (i & STATE_REQUIRES_IT_ALPHA) {
    18761880    gc->dataList[curTriSize + 0].i    = GR_VERTEX_A_OFFSET<<2;
     
    18791883    params += 1;
    18801884  }
    1881  
     1885
    18821886  /* TMU1 --------------------------------- */
    18831887  /* always output to ALL chips, saves from having to change CHIP field */
     
    18901894    params += 2;
    18911895  }
    1892  
     1896
    18931897  /* we squeeze FBI.OOW in here for sequential writes in the simple case */
    18941898  if (i & STATE_REQUIRES_OOW_FBI) {
     
    19071911    params += 1;
    19081912  }
    1909  
     1913
    19101914  /* TMU1 --------------------------------- */
    19111915  if (i & STATE_REQUIRES_ST_TMU1) {
     
    19211925  }
    19221926  else packerFlag = 1;
    1923  
     1927
    19241928  if (i & STATE_REQUIRES_W_TMU1) {
    19251929    if (packerFlag) {
     
    19361940  error WRITE THIS CODE;
    19371941#endif
    1938  
     1942
    19391943  /* if last write was not to chip 0 */
    19401944  if ( SST_CHIP_MASK & (FxU32)gc->dataList[curTriSize-1].addr ) {
    19411945    /* flag write as a packer bug fix  */
    1942     gc->dataList[curTriSize].i = packMask; 
     1946    gc->dataList[curTriSize].i = packMask;
    19431947    gc->dataList[curTriSize].addr = (float *)_GlideRoot.packerFixAddress;
    19441948    curTriSize++;
    19451949  }
    19461950
    1947  
     1951
    19481952  gc->dataList[curTriSize++].i = 0; /* terminate the list with 0,*      */
    19491953                                /* followed by the FtriangleCMD reg */
    19501954  gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */
    19511955  gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD;
    1952  
     1956
    19531957  /* 6 X,Y values plus AREA = 7, plus parameters */
    19541958  _GlideRoot.curTriSize = (6 + curTriSize + (params<<1)) <<2;
     
    19561960  /* Need to know tri size without gradients for planar polygons */
    19571961  _GlideRoot.curTriSizeNoGradient = _GlideRoot.curTriSize - (params<<3);
    1958  
     1962
    19591963#ifdef GLIDE_DEBUG
    19601964  GDBG_INFO((282, "DataList\n"));
     
    19631967               i,gc->dataList[i].i>>2,gc->dataList[i].addr,
    19641968               (gc->dataList[i].i & 1) ? "packer" :
    1965                p_str[gc->dataList[i].i>>2])); 
     1969               p_str[gc->dataList[i].i>>2]));
    19661970  }
    19671971#endif
     
    19781982GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc))
    19791983{
    1980  
     1984
    19811985  gc->gcFuncs._grColorCombineDelta0Mode = (void *)
    1982     GR_DDNAME(_grColorCombineDelta0Mode); 
     1986    GR_DDNAME(_grColorCombineDelta0Mode);
    19831987  gc->gcFuncs._grRebuildDataList = (void *) GR_DDNAME(_grRebuildDataList);
    19841988  gc->gcFuncs._grTexDetailControl = (void *) GR_DDNAME(_grTexDetailControl);
    19851989  gc->gcFuncs._grTexDownloadNccTable = (void *)
    1986     GR_DDNAME(_grTexDownloadNccTable); 
     1990    GR_DDNAME(_grTexDownloadNccTable);
    19871991  gc->gcFuncs._grTexDownloadPalette = (void *)
    1988     GR_DDNAME(_grTexDownloadPalette); 
     1992    GR_DDNAME(_grTexDownloadPalette);
    19891993  gc->gcFuncs._gumpTexCombineFunction = (void *)
    1990     GR_DDNAME(_gumpTexCombineFunction); 
     1994    GR_DDNAME(_gumpTexCombineFunction);
    19911995  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);
    19941998  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);
    19992003  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);
    20022006  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);
    20052009  gc->gcFuncs.grAlphaControlsITRGBLighting = (void *)
    2006     GR_DDNAME(grAlphaControlsITRGBLighting); 
     2010    GR_DDNAME(grAlphaControlsITRGBLighting);
    20072011  gc->gcFuncs.grAlphaTestFunction = (void *)
    2008     GR_DDNAME(grAlphaTestFunction); 
     2012    GR_DDNAME(grAlphaTestFunction);
    20092013  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);
    20122016  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);
    20202024  gc->gcFuncs.grConstantColorValue = (void *)
    2021     GR_DDNAME(grConstantColorValue); 
     2025    GR_DDNAME(grConstantColorValue);
    20222026  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);
    20262030  gc->gcFuncs.grDepthBufferFunction = (void *)
    2027     GR_DDNAME(grDepthBufferFunction); 
     2031    GR_DDNAME(grDepthBufferFunction);
    20282032  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);
    20312035  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);
    20352039  gc->gcFuncs.grDrawPlanarPolygon = (void *)
    2036     GR_DDNAME(grDrawPlanarPolygon); 
     2040    GR_DDNAME(grDrawPlanarPolygon);
    20372041  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);
    20412045  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);
    20472051  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);
    20512055  gc->gcFuncs.grLfbConstantAlpha = (void *)
    2052     GR_DDNAME(grLfbConstantAlpha); 
     2056    GR_DDNAME(grLfbConstantAlpha);
    20532057  gc->gcFuncs.grLfbConstantDepth = (void *)
    2054     GR_DDNAME(grLfbConstantDepth); 
     2058    GR_DDNAME(grLfbConstantDepth);
    20552059  gc->gcFuncs.grLfbLock = (void *)GR_DDNAME(grLfbLock);
    20562060  gc->gcFuncs.grLfbUnlock = (void*)GR_DDNAME(grLfbUnlock);
    20572061  gc->gcFuncs.grLfbWriteColorFormat = (void *)
    2058     GR_DDNAME(grLfbWriteColorFormat); 
     2062    GR_DDNAME(grLfbWriteColorFormat);
    20592063  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);
    20622066  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);
    20682072  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);
    20712075  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);
    20772081  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);
    20802084  gc->gcFuncs.grTexLodBiasValue = (void *) GR_DDNAME(grTexLodBiasValue);
    20812085  gc->gcFuncs.grTexMipMapMode = (void *) GR_DDNAME(grTexMipMapMode);
    2082   gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 
     2086  gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase);
    20832087  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);
    20882092  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);
    20912095} /* _grInitializeGCFuncs */
    20922096#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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 23    6/30/97 10:51a Dow
    2731 * Changed size check in grLfbLock to warning
    28  * 
     32 *
    2933 * 22    6/03/97 3:50p Pgj
    3034 * fix bugs 580 and 581
    31  * 
     35 *
    3236 * 21    5/05/97 2:25p Hanson
    3337 * Fixed unlock bug with grLfbUnlock. On Rush it would always return
    3438 * false.
    35  * 
     39 *
    3640 * 20    5/02/97 9:43a Dow
    3741 * Changed indentation to match rest of file, made grLfbLock idle on Jr.
    38  * 
     42 *
    3943 * 19    4/08/97 12:47p Jdt
    4044 * Bug in grLfbUnlock()
    41  * 
     45 *
    4246 * 18    4/02/97 3:24a Hanson
    4347 * Fixed bug with locking read of Auxbuffer on SST1
    44  * 
     48 *
    4549 * 17    3/27/97 9:30p Hanson
    4650 * Fixed my mistake of masking out the no idle bit to late in the
    4751 * grLfbUnlock code.
    48  * 
     52 *
    4953 * 16    3/26/97 5:04p Hanson
    50  * 
     54 *
    5155 * 15    3/19/97 1:37a Jdt
    5256 * Added real stride computation.
    53  * 
     57 *
    5458 * 14    3/18/97 9:07p Dow
    5559 * Got rid of #$#%#$ // comments
    56  * 
     60 *
    5761 * 13    3/13/97 1:18a Jdt
    5862 * Re-wrote grLfbWriteRegion to be faster and also be nice to the fifo.
    5963 * Added grLfbReadRegion for sli boards.  Need an sli setup on whihc to
    6064 * test.
    61  * 
     65 *
    6266 * 12    3/12/97 2:54p Jdt
    6367 * Fixes for vg96
    64  * 
     68 *
    6569 * 11    3/12/97 11:11a Jdt
    6670 * Fixed format bug.  Fixed yorigin problem. Fixed locking bug.
    67  * 
     71 *
    6872 * 10    3/06/97 9:03p Jdt
    69  * Removed Watcom Warning. 
    70  * 
     73 * Removed Watcom Warning.
     74 *
    7175 * 9     3/05/97 9:35p Jdt
    7276 * Added grLfbWriteRegion
    73  * 
     77 *
    7478 * 8     3/04/97 9:08p Dow
    7579 * Neutered multiplatform multiheaded monster
    76  * 
     80 *
    7781 * 7     2/26/97 11:56a Jdt
    7882 * changed lfb api
    79  * 
     83 *
    8084 * 6     12/23/96 1:37p Dow
    8185 * chagnes for multiplatform glide
     
    139143  -------------------------------------------------------------------*/
    140144
    141 GR_ENTRY(grLfbLock, FxBool,( GrLock_t type, GrBuffer_t buffer,  GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,  FxBool pixelPipeline, GrLfbInfo_t *info ) ) 
     145GR_ENTRY(grLfbLock, FxBool,( GrLock_t type, GrBuffer_t buffer,  GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,  FxBool pixelPipeline, GrLfbInfo_t *info ) )
    142146{
    143147  FxBool rv = FXTRUE;
    144148  FxU32  lockIdle;
    145  
     149
    146150  GR_BEGIN_NOFIFOCHECK("grLfbLock",82);
    147151  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,0x%x)\n", type, buffer, info));
    148  
     152
    149153  GR_CHECK_F( myName, !info,
    150154             "Null info structure passed." );
     
    154158  GR_CHECK_W(myName, (info->size != sizeof( GrLfbInfo_t )),
    155159             "Invalid size sent to grLfbLock()");
    156  
     160
    157161  lockIdle = !(type & GR_LFB_NOIDLE);
    158162  type = type & ~(GR_LFB_NOIDLE);
    159  
     163
    160164#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    161165  {
     
    170174        } else {
    171175          lfbMode = gc->state.fbi_config.lfbMode;
    172           lfbMode &= ~( SST_LFB_READBUFSELECT | 
     176          lfbMode &= ~( SST_LFB_READBUFSELECT |
    173177                       SST_LFB_YORIGIN );
    174                    
     178
    175179          GR_SET_EXPECTED_SIZE( 4 );
    176180
     
    178182          if ( (gc->scanline_interleaved == FXTRUE) &&
    179183              (gc->lfbSliOk==1) ) {
    180             GDBG_INFO((83, 
     184            GDBG_INFO((83,
    181185                       "Read lock failure: read lock"
    182186                       " disallowed for SLI, use "
     
    196200            break;
    197201          default:
    198             GR_CHECK_F( myName, 
    199                        1, 
     202            GR_CHECK_F( myName,
     203                       1,
    200204                       "illegal buffer parameter passed" );
    201205            rv = FXFALSE;
     
    221225        FxU32 lfbMode, zaColor, fbzMode;
    222226
    223                
     227
    224228        if ( gc->lockPtrs[type] != (FxU32)-1 ) {
    225229          GDBG_INFO(( 83, "Write failure due to existing lock" ));
     
    227231        } else {
    228232          GR_SET_EXPECTED_SIZE( 12 );
    229                    
     233
    230234          /*
    231235           ** Set up the constant depth register because it may have been
     
    237241          zaColor |= (gc->state.lfb_constant_alpha << SST_ZACOLOR_ALPHA_SHIFT);
    238242          GR_SET( hw->zaColor, zaColor );
    239                    
     243
    240244          /*
    241245           ** disable depth biasing
     
    243247          fbzMode = gc->state.fbi_config.fbzMode;
    244248          fbzMode &= ~( SST_ENZBIAS );
    245                    
     249
    246250          lfbMode = gc->state.fbi_config.lfbMode;
    247251          lfbMode &= ~( SST_LFB_WRITEBUFSELECT |
     
    249253                       SST_LFB_FORMAT         |
    250254                       SST_LFB_ENPIXPIPE );
    251                    
     255
    252256          switch( writeMode ) {
    253257          case GR_LFBWRITEMODE_RESERVED1:
     
    287291            break;
    288292          default:
    289             GR_CHECK_F( myName, 
    290                        1, 
     293            GR_CHECK_F( myName,
     294                       1,
    291295                       "illegal buffer parameter passed" );
    292296            break;
     
    313317             not have settled in yet, and the pixel may be read in the wrong
    314318             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
    316320             too slow.
    317321             */
     
    320324          info->origin    = origin;
    321325          info->writeMode = writeMode;
    322                    
     326
    323327          switch( lfbMode & SST_LFB_FORMAT ) {
    324328          case SST_LFB_565:
     
    336340            break;
    337341          }
    338                    
    339           if ( rv == FXTRUE ) 
     342
     343          if ( rv == FXTRUE )
    340344            gc->lockPtrs[type] = buffer;
    341345        }
     
    348352    }
    349353  }
    350  
     354
    351355#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
    352356  switch( type ) {
     
    358362      info->lfbPtr = initGetBufferPtr( buffer, &info->strideInBytes );
    359363      if ( origin != GR_ORIGIN_UPPER_LEFT ) {
    360         GDBG_INFO((gc->myLevel, 
     364        GDBG_INFO((gc->myLevel,
    361365                   "Lock failed because of unsu"
    362366                   "pported origin." ));
     
    364368      }
    365369      info->origin = GR_ORIGIN_UPPER_LEFT;
    366       if ( rv == FXTRUE ) 
     370      if ( rv == FXTRUE )
    367371        gc->lockPtrs[type] = buffer;
    368372    }
     
    375379      info->lfbPtr = initGetBufferPtr( buffer, &info->strideInBytes );
    376380      if ( !info->lfbPtr ) {
    377         GDBG_INFO((gc->myLevel, 
     381        GDBG_INFO((gc->myLevel,
    378382                   "Lock failed because buffer doesn't exist" ));
    379383        rv = FXFALSE;
    380384      }
    381385      if ( origin != GR_ORIGIN_UPPER_LEFT ) {
    382         GDBG_INFO((gc->myLevel, 
     386        GDBG_INFO((gc->myLevel,
    383387                   "Lock failed because of unsupported origin." ));
    384388        rv = FXFALSE;
     
    414418
    415419      if ( pixelPipeline ) {
    416         GDBG_INFO((gc->myLevel, 
     420        GDBG_INFO((gc->myLevel,
    417421                   "Lock failed because pixelpipeline is not available on VG96." ));
    418422        rv = FXFALSE;
     
    420424      info->writeMode = writeMode;
    421425      info->origin = GR_ORIGIN_UPPER_LEFT;
    422       if ( rv == FXTRUE ) 
     426      if ( rv == FXTRUE )
    423427        gc->lockPtrs[type] = buffer;
    424       GDBG_INFO(( gc->myLevel, 
     428      GDBG_INFO(( gc->myLevel,
    425429                 "Write Lock Successful: ptr=0x%.08x stride=%.04d\n",
    426430                 info->lfbPtr,
     
    445449  GR_RETURN( rv );
    446450} /* grLfbLock */
    447    
     451
    448452/*-------------------------------------------------------------------
    449453  Function: grLfbUnlock
     
    455459  Arguments:
    456460  type - type of lock ( read only/write only )
    457   buffer - which buffer to unlock 
     461  buffer - which buffer to unlock
    458462  Return:
    459463  FXTRUE  - success
     
    464468{
    465469  FxBool rval = FXFALSE;
    466  
     470
    467471  GR_BEGIN_NOFIFOCHECK("grLfbUnLock",83 );
    468472  GDBG_INFO_MORE((gc->myLevel,"(%d, %d)\n", type, buffer ));
    469  
     473
    470474  type = type & ~(GR_LFB_NOIDLE);
    471  
    472   GR_CHECK_F( myName, 
     475
     476  GR_CHECK_F( myName,
    473477             type != GR_LFB_WRITE_ONLY &&
    474478             type != GR_LFB_READ_ONLY,
    475479             "Bad type" );
    476  
    477   GR_CHECK_F( myName, 
     480
     481  GR_CHECK_F( myName,
    478482             buffer != GR_BUFFER_FRONTBUFFER &&
    479483             buffer != GR_BUFFER_BACKBUFFER  &&
    480484             buffer != GR_BUFFER_AUXBUFFER,
    481485             "Bad buffer" );
    482  
    483 #if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
     486
     487#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    484488  if ( gc->lockPtrs[type] == (FxU32)buffer ) {
    485489    rval = FXTRUE;
     
    493497    /* Restore depth bias level */
    494498    GR_SET( hw->zaColor, gc->state.fbi_config.zaColor );
    495  
     499
    496500    /* turn back on depth biasing */
    497501    GR_SET( hw->fbzMode, gc->state.fbi_config.fbzMode );
    498502
    499     if ( gc->scanline_interleaved == FXTRUE ) 
     503    if ( gc->scanline_interleaved == FXTRUE )
    500504      GR_SET( hw->nopCMD, 0x0 );
    501505
     
    542546  GR_SET( hw->lfbMode, lfbMode );
    543547  gc->state.fbi_config.lfbMode = lfbMode;
    544   if ( gc->scanline_interleaved == FXTRUE ) 
     548  if ( gc->scanline_interleaved == FXTRUE )
    545549    GR_SET( hw-> nopCMD, 0x0 );
    546550  GR_END_SLOPPY();
     
    580584  GR_SET( hw->lfbMode, lfbMode );
    581585  gc->state.fbi_config.lfbMode = lfbMode;
    582   if ( gc->scanline_interleaved == FXTRUE ) 
     586  if ( gc->scanline_interleaved == FXTRUE )
    583587    GR_SET( hw-> nopCMD, 0x0 );
    584588  GR_END_SLOPPY();
     
    599603  dst_x,dst_y - destination image start coordinates
    600604  src_format  - data format of source image
    601   src_width, src_height 
     605  src_width, src_height
    602606              - dimensions of source image
    603607  src_stride  - stride of source image in bytes, not meaningful
    604608                for RLE images
    605   src_data    - pointer to source data memory           
     609  src_data    - pointer to source data memory
    606610  Return:
    607611  FXTRUE  succeed
    608612  FXFALSE fail
    609613  -------------------------------------------------------------------*/
    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, 
     614GR_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,
    614618                                     FxI32 src_stride, void *src_data ))
    615619{
     
    617621  GrLfbInfo_t      info;
    618622  GrLfbWriteMode_t writeMode;
    619  
     623
    620624  GR_BEGIN_NOFIFOCHECK("grLfbWriteRegion",82);
    621625  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,
    624628                  src_format, src_width, src_height,
    625629                  src_stride, src_data ));
    626  
     630
    627631#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    628   if ( src_format == GR_LFB_SRC_FMT_RLE16 ) 
     632  if ( src_format == GR_LFB_SRC_FMT_RLE16 )
    629633    writeMode = GR_LFBWRITEMODE_565;
    630   else 
     634  else
    631635    writeMode = src_format;
    632  
     636
    633637  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,
    637641                 writeMode,
    638642                 GR_ORIGIN_UPPER_LEFT,
     
    647651    FxU32 scanline;             /* scanline number */
    648652    int   aligned;              /* word aligned? */
    649    
    650    
     653
     654
    651655    srcData = ( FxU32 * ) src_data;
    652656    dstData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
    653657                           (dst_y*info.strideInBytes) );
    654658    scanline = src_height;
    655    
     659
    656660    switch( src_format ) {
    657661      /* 16-bit aligned */
     
    674678            srcData++;
    675679          }
    676                    
     680
    677681          if ( ((int)length) & 0x2 ) {
    678682            GR_SET16( (*(FxU16*)&(dstData[0])),
     
    681685            srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    682686          }
    683                    
     687
    684688          dstData = (FxU32*)(((char*)dstData)+dstJump);
    685689          srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    690694          GR_SET_EXPECTED_SIZE(length);
    691695          end = (FxU32*)((char*)srcData + length - 2);
    692                    
     696
    693697          GR_SET16( (*(FxU16*)&(dstData[0])),
    694698                   (*(FxU16*)&(srcData[0])) );
    695699          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
    696700          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    697                    
     701
    698702          while( srcData < end ) {
    699703            GR_SET( dstData[0], srcData[0] );
     
    701705            srcData++;
    702706          }
    703                    
     707
    704708          if ( !(length & 0x2) ) {
    705709            GR_SET16( (*(FxU16*)&(dstData[0])),
     
    708712            srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    709713          }
    710                    
     714
    711715          dstData = (FxU32*)(((char*)dstData)+dstJump);
    712716          srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    751755    rv = FXFALSE;
    752756    GR_RETURN( rv );
    753   } else 
     757  } else
    754758    writeMode = src_format;
    755  
     759
    756760  info.size = sizeof( info );
    757  
     761
    758762  if ( grLfbLock( GR_LFB_WRITE_ONLY,
    759                  dst_buffer, 
     763                 dst_buffer,
    760764                 writeMode,
    761765                 GR_ORIGIN_UPPER_LEFT,
     
    770774    FxU32 scanline;             /* scanline number */
    771775    int   aligned;              /* word aligned? */
    772    
    773    
     776
     777
    774778    srcData = ( FxU32 * ) src_data;
    775779    dstData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
     
    784788      while( scanline-- ) {
    785789        end = (FxU32*)((char*)srcData + length - 2);
    786         while( srcData < end ) 
     790        while( srcData < end )
    787791          *dstData++ = *srcData++;
    788                
     792
    789793        if ( ((int)length) & 0x2 ) {
    790794          *(FxU16*)dstData = *(FxU16*)srcData;
     
    792796          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    793797        }
    794                
     798
    795799        dstData = (FxU32*)(((char*)dstData)+dstJump);
    796800        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    799803      while( scanline-- ) {
    800804        end = (FxU32*)((char*)srcData + length - 2);
    801                
     805
    802806        *(FxU16*)dstData = *(FxU16*)srcData;
    803807        dstData = (FxU32*)(((FxU16*)dstData) + 1 );
    804808        srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    805                
    806         while( srcData < end ) 
     809
     810        while( srcData < end )
    807811          *dstData++ = *srcData++;
    808                
     812
    809813        if ( !(((int)length) & 0x2) ) {
    810814          *(FxU16*)dstData = *(FxU16*)srcData;
     
    812816          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    813817        }
    814                
     818
    815819        dstData = (FxU32*)(((char*)dstData)+dstJump);
    816820        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    821825    rv = FXFALSE;
    822826  }
    823 #else 
    824 #  error "No grLfbWriteRegion Implementation for this platform"     
     827#else
     828#  error "No grLfbWriteRegion Implementation for this platform"
    825829#endif
    826830  GR_RETURN( rv );
     
    836840  Grab a rectangle from the frame buffer into user supplied memory
    837841  Arguments:
    838   src_buffer - buffer to read from 
     842  src_buffer - buffer to read from
    839843  src_x      - x coordinate of upper left corner rectangle to read
    840844  src_y      - y coordinate of upper left corner of rectangle to read
     
    847851  FXFALSE - failure
    848852  -------------------------------------------------------------------*/
    849 GR_ENTRY(grLfbReadRegion, FxBool, ( GrBuffer_t src_buffer, 
    850                                     FxU32 src_x, FxU32 src_y, 
    851                                     FxU32 src_width, FxU32 src_height, 
     853GR_ENTRY(grLfbReadRegion, FxBool, ( GrBuffer_t src_buffer,
     854                                    FxU32 src_x, FxU32 src_y,
     855                                    FxU32 src_width, FxU32 src_height,
    852856                                    FxU32 dst_stride, void *dst_data ))
    853857{
    854858  FxBool rv = FXTRUE;
    855859  GrLfbInfo_t info;
    856  
     860
    857861  GR_BEGIN_NOFIFOCHECK("grLfbReadRegion",82);
    858862  GDBG_INFO_MORE((gc->myLevel,
     
    860864                  src_buffer, src_x, src_y,
    861865                  src_width, src_height, dst_stride, dst_data ));
    862  
     866
    863867#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    864868  gc->lfbSliOk = 1;
    865869  info.size = sizeof( info );
    866870  if ( grLfbLock( GR_LFB_READ_ONLY,
    867                  src_buffer, 
     871                 src_buffer,
    868872                 GR_LFBWRITEMODE_ANY,
    869873                 GR_ORIGIN_UPPER_LEFT,
     
    879883    int   aligned;              /* word aligned? */
    880884    FxU32 odd;                  /* is src_y odd? ( for sli ) */
    881    
     885
    882886    dstData = ( FxU32 * ) dst_data;
    883887    srcData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
     
    890894    aligned  = !((int)srcData&0x2);
    891895    odd      = (src_y+src_height) & 0x1;
    892    
     896
    893897    if ( aligned ) {
    894898      while( scanline-- ) {
     
    902906        }
    903907
    904         while( srcData < end ) 
     908        while( srcData < end )
    905909          *dstData++ = *srcData++;
    906                
     910
    907911        if ( ((int)length) & 0x2 ) {
    908912          (*(FxU16*)dstData) = (*(FxU16*)srcData);
     
    910914          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    911915        }
    912                
     916
    913917        dstData = (FxU32*)(((char*)dstData)+dstJump);
    914918        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    917921      while( scanline-- ) {
    918922        end = (FxU32*)((char*)srcData + length - 2);
    919                
     923
    920924        if(gc->scanline_interleaved == FXTRUE) {
    921925          if((scanline+odd) & 0x1)
     
    937941          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    938942        }
    939                
     943
    940944        dstData = (FxU32*)(((char*)dstData)+dstJump);
    941945        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    943947    }
    944948    grLfbUnlock( GR_LFB_READ_ONLY, src_buffer );
    945     if ( gc->scanline_interleaved ) 
     949    if ( gc->scanline_interleaved )
    946950      sst1InitSliPciOwner( gc->base_ptr, SST_SLI_MASTER_OWNPCI );
    947951  } else {
     
    951955  info.size = sizeof( info );
    952956  if ( grLfbLock( GR_LFB_READ_ONLY,
    953                  src_buffer, 
     957                 src_buffer,
    954958                 GR_LFBWRITEMODE_ANY,
    955959                 GR_ORIGIN_UPPER_LEFT,
     
    964968    FxU32 scanline;             /* scanline number */
    965969    int   aligned;              /* word aligned? */
    966    
     970
    967971    dstData = ( FxU32 * ) dst_data;
    968972    srcData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
     
    974978    srcJump  = info.strideInBytes - length;
    975979    aligned  = !((int)srcData&0x2);
    976    
     980
    977981    if ( aligned ) {
    978982      while( scanline-- ) {
    979983        end = (FxU32*)((char*)srcData + length - 2);
    980984
    981         while( srcData < end ) 
     985        while( srcData < end )
    982986          *dstData++ = *srcData++;
    983                
     987
    984988        if ( ((int)length) & 0x2 ) {
    985989          (*(FxU16*)dstData) = (*(FxU16*)srcData);
     
    987991          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    988992        }
    989                
     993
    990994        dstData = (FxU32*)(((char*)dstData)+dstJump);
    991995        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    994998      while( scanline-- ) {
    995999        end = (FxU32*)((char*)srcData + length - 2);
    996                
     1000
    9971001        (*(FxU16*)dstData) = (*(FxU16*)srcData);
    9981002        dstData = (FxU32*)(((FxU16*)dstData) + 1 );
     
    10071011          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
    10081012        }
    1009                
     1013
    10101014        dstData = (FxU32*)(((char*)dstData)+dstJump);
    10111015        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    10161020    rv = FXFALSE;
    10171021  }
    1018 #else 
    1019 #  error "No grLfbReadRegion Implementation for this platform"     
     1022#else
     1023#  error "No grLfbReadRegion Implementation for this platform"
    10201024#endif
    10211025  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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 3     3/09/97 10:31a Dow
    2731 * 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 $ */
    12/*
    23 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 ** 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
    89 ** 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 **
    1112 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16  ** THE UNITED STATES. 
    17  ** 
     17 ** THE UNITED STATES.
     18 **
    1819 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920 **
    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 sandervl Exp $
     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 $
    2122 ** $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
    2327 ** Created new Voodoo 1 Glide dir
    2428 **
    25  * 
     29 *
    2630 * 45    11/01/97 12:11p Pgj
    2731 * glide.dll ---> glide2x.dll
    28  * 
     32 *
    2933 * 44    10/21/97 8:20p Atai
    3034 * initialize vid timing to NLLL
    31  * 
     35 *
    3236 * 43    8/18/97 3:11p Atai
    3337 * fix vg96 fb ram configuration
    34  * 
     38 *
    3539 * 42    7/18/97 5:30p Jdt
    3640 * Fixes for open/shutdown symmetry
    37  * 
     41 *
    3842 * 41    7/12/97 4:58p Dow
    3943 * Added DllMain
    40  * 
     44 *
    4145 * 40    7/07/97 8:33a Jdt
    4246 * New tracing macros.
    43  * 
     47 *
    4448 * 39    6/19/97 7:35p Dow
    4549 * More P6 Stuff
    46  * 
     50 *
    4751 * 38    5/27/97 2:03p Dow
    4852 * added new env variable
    49  * 
     53 *
    5054 * 37    5/19/97 7:35p Pgj
    5155 * Print cogent error message if h/w not found
    52  * 
     56 *
    5357 * 36    4/15/97 12:59p Dow
    5458 * Bandaid for SST96/P6
    55  * 
     59 *
    5660 * 35    4/13/97 8:11p Jdt
    5761 * Change in init.h
    58  * 
     62 *
    5963 * 34    4/13/97 2:06p Pgj
    6064 * eliminate all anonymous unions (use hwDep)
    61  * 
     65 *
    6266 * 33    3/24/97 7:37p Dow
    6367 * Now sets n tmus for hwConfig
    64  * 
     68 *
    6569 * 32    3/18/97 9:08p Dow
    6670 * Added FX_GLIDE_NO_DITHER_SUB environment variable
    67  * 
     71 *
    6872 * 31    3/17/97 6:27a Jdt
    6973 * Removed enumCB and pass 0 to enumHardware.
    70  * 
     74 *
    7175 * 30    3/16/97 12:51a Jdt
    7276 * fix num_sst when detecting vg96
    73  * 
     77 *
    7478 * 29    3/16/97 12:39a Jdt
    7579 * Programmatic type-os
    76  * 
     80 *
    7781 * 28    3/16/97 12:19a Jdt
    7882 * Completely re-wrote grSstDetectResources
    79  * 
     83 *
    8084 * 27    3/06/97 4:54p Dow
    8185 * Fixed SLI
    82  * 
     86 *
    8387 * 26    3/04/97 9:08p Dow
    8488 * Neutered multiplatform multiheaded monster
    85  * 
     89 *
    8690 * 25    3/02/97 7:05p Dow
    8791 * Changes to support DOS DLLs
    88  * 
     92 *
    8993 * 24    2/26/97 2:18p Dow
    9094 * moved all debug set macros to __cdecl
    91  * 
     95 *
    9296 * 23    2/26/97 11:57a Jdt
    9397 * Fixed stack bug, fixed splash screen bug
    94  * 
     98 *
    9599 * 22    2/19/97 4:42p Dow
    96100 * Fixed debug build for Watcom
    97  * 
     101 *
    98102 * 21    2/18/97 10:39a Dow
    99103 * Added call to initRegisters for AT3D
    100  * 
     104 *
    101105 * 20    2/18/97 9:51a Jdt
    102106 * Did some casting to remove warnings.
    103  * 
     107 *
    104108 * 19    2/14/97 12:55p Dow
    105109 * moved vg96 fifo wrap into init code
    106  * 
     110 *
    107111 * 18    2/12/97 8:15p Dow
    108112 * Fixed VG base_pointe
    109  * 
     113 *
    110114 * 17    2/12/97 9:20a Dow
    111115 * Fixed Watcom error wrt GDBG_ERROR call
    112  * 
     116 *
    113117 * 16    2/11/97 6:59p Dow
    114118 * Changes to support vid tiles and ser status
    115  * 
     119 *
    116120 * 15    1/18/97 11:48p Dow
    117121 * Re-added error callback set
    118122 * Added support for GMT's register debugging
    119  * 
     123 *
    120124 * 14    1/14/97 6:41p Dow
    121  * 
     125 *
    122126 * 13    12/23/96 1:37p Dow
    123127 * chagnes for multiplatform glide
     
    144148#include <windows.h>
    145149
    146 BOOL WINAPI 
    147 DllMain(HANDLE hInst, ULONG  ul_reason_for_call, LPVOID lpReserved) 
     150BOOL WINAPI
     151DllMain(HANDLE hInst, ULONG  ul_reason_for_call, LPVOID lpReserved)
    148152{
    149153  switch( ul_reason_for_call ) {
     
    165169    break;
    166170  }
    167  
     171
    168172  return TRUE;
    169173
     
    181185  Discover devices on the PCI bus.
    182186  Discover configuration of detected devices.
    183   Initialize all Glide GC's 
    184  
     187  Initialize all Glide GC's
     188
    185189  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
    189193  configuration
    190  
     194
    191195  Arguments: none
    192   Return: 
     196  Return:
    193197  FXTRUE  - at least one device was detected
    194198  FXFALSE - no devices were detected.
    195199  -------------------------------------------------------------------*/
    196 FxBool 
     200FxBool
    197201_grSstDetectResources(void)
    198202{
     
    206210
    207211  _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;
    210214      device++ ) {
    211215    if ( initGetDeviceInfo( device, &info ) ) {
     
    213217      if ( info.hwClass == INIT_VOODOO ) {
    214218        int tmu;
    215        
     219
    216220        _GlideRoot.hwConfig.SSTs[ctx].type = GR_SSTTYPE_VOODOO;
    217        
     221
    218222        _GlideRoot.GCs[ctx].base_ptr  = (FxU32 *)info.hwDep.vgInfo.vgBaseAddr;
    219223        _GlideRoot.GCs[ctx].reg_ptr   = (FxU32 *)info.hwDep.vgInfo.vgBaseAddr;
     
    228232        _GlideRoot.GCs[ctx].fbuf_size            = info.hwDep.vgInfo.pfxRam;
    229233        _GlideRoot.GCs[ctx].vidTimings           = NULL;
    230        
     234
    231235        _GlideRoot.hwConfig.num_sst++;
    232         _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbiRev = 
     236        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbiRev =
    233237          info.hwDep.vgInfo.pfxRev;
    234238        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbRam =
     
    236240        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.sliDetect =
    237241          info.hwDep.vgInfo.sliDetect;
    238        
    239         _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.nTexelfx = 
     242
     243        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.nTexelfx =
    240244          info.hwDep.vgInfo.nTFX;
    241245
     
    245249          _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev =
    246250            info.hwDep.vgInfo.tfxRev;
    247          
     251
    248252          memset(&_GlideRoot.GCs[ctx].tmu_state[tmu], 0, sizeof(_GlideRoot.GCs[ctx].tmu_state[tmu]));
    249253          _GlideRoot.GCs[ctx].tmu_state[tmu].ncc_mmids[0] = GR_NULL_MIPMAP_HANDLE;
     
    272276
    273277        _GlideRoot.hwConfig.num_sst++;
    274         _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.nTexelfx = 
     278        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.nTexelfx =
    275279          info.hwDep.vg96Info.nTFX;
    276         _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.fbRam = 
     280        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.fbRam =
    277281          info.hwDep.vg96Info.vg96Ram >> 20;
    278282        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.tmuConfig.tmuRev =
     
    285289        _GlideRoot.GCs[ctx].tmu_state[0].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
    286290        _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     =
    289293          (FxU32*)info.regs.hwDep.VG96RegDesc.serialStatus;
    290         _GlideRoot.GCs[ctx].hwDep.sst96Dep.fifoApertureBase = 
     294        _GlideRoot.GCs[ctx].hwDep.sst96Dep.fifoApertureBase =
    291295          (FxU32*)info.regs.hwDep.VG96RegDesc.fifoApertureBase;
    292296
     
    297301      }
    298302#else
    299 #error "Need to define detection parameters for this device"   
     303#error "Need to define detection parameters for this device"
    300304#endif
    301305    } else {
     
    303307    }
    304308  }
    305  
     309
    306310  return rv;
    307311} /* _grSstDetectResources */
     
    392396
    393397  if (getenv("FX_CPU")) _GlideRoot.CPUType = atoi(getenv("FX_CPU"));
    394   _GlideRoot.environment.triBoundsCheck = 
     398  _GlideRoot.environment.triBoundsCheck =
    395399    getenv("FX_GLIDE_BOUNDS_CHECK") != NULL;
    396400  _GlideRoot.environment.swapInterval = -1;
    397401  _GlideRoot.environment.swFifoLWM = -1;
    398   _GlideRoot.environment.noSplash = 
     402  _GlideRoot.environment.noSplash =
    399403    getenv("FX_GLIDE_NO_SPLASH") != NULL;
    400   _GlideRoot.environment.shamelessPlug = 
     404  _GlideRoot.environment.shamelessPlug =
    401405    getenv("FX_GLIDE_SHAMELESS_PLUG") != NULL;
    402406  if (getenv("FX_GLIDE_LWM"))
    403407    _GlideRoot.environment.swFifoLWM = atoi(getenv("FX_GLIDE_LWM"));
    404408  if (getenv("FX_GLIDE_SWAPINTERVAL")) {
    405     _GlideRoot.environment.swapInterval = 
     409    _GlideRoot.environment.swapInterval =
    406410      atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
    407411    if (_GlideRoot.environment.swapInterval < 0)
     
    418422  if (getenv("FX_SNAPSHOT"))
    419423    _GlideRoot.environment.snapshot = atoi(getenv("FX_SNAPSHOT"));
    420  
     424
    421425  GDBG_INFO((80,"    triBoundsCheck: %d\n",_GlideRoot.environment.triBoundsCheck));
    422426  GDBG_INFO((80,"      swapInterval: %d\n",_GlideRoot.environment.swapInterval));
     
    426430  GDBG_INFO((80,"               cpu: %d\n",_GlideRoot.CPUType));
    427431  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));
    429433  /* GMT: BUG these are hardware dependent and really should come from the init code */
    430434  _GlideRoot.stats.minMemFIFOFree = 0xffff;
     
    685689  "SWAPPENDCMD",
    686690  "reserved96",
    687        
     691
    688692  "reserved96",
    689693  "reserved96",
     
    757761                               iaddr,data,data));
    758762  }
    759   else {                       
     763  else {
    760764    /* check for valid register read */
    761765    int reg;
     
    811815                               iaddr,data,data));
    812816  }
    813   else {                       
     817  else {
    814818    /* check for valid register read */
    815819    int reg;
     
    848852#endif /* defined(GLIDE_DEBUG) */
    849853
    850 #if defined( GLIDE_DEBUG ) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 
     854#if defined( GLIDE_DEBUG ) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
    851855
    852856extern char *regNames[];
     
    865869        FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax;
    866870        if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) {
    867             GDBG_ERROR( "SET GW CMD", 
     871            GDBG_ERROR( "SET GW CMD",
    868872                        "Fifo address 0x%x out of range(0x%x, 0x%x)\n",
    869                         addr, 
     873                        addr,
    870874                        gc->fifoData.hwDep.vg96FIFOData.fifoVirt,
    871875                        gc->fifoData.hwDep.vg96FIFOData.fifoMax );
    872876        }
    873                    
     877
    874878    }
    875879    /* validate alignment */
     
    880884    }
    881885    /* validate enable bit */
    882     if ( ! (data&0x80000000) ) { 
     886    if ( ! (data&0x80000000) ) {
    883887        GDBG_ERROR( "SET GW CMD",
    884888                    "Fifo command 0x%x missing flag bit\n",
     
    886890    }
    887891    /* validate reserved bits */
    888     if ( data&0x7fE00300 ) { 
     892    if ( data&0x7fE00300 ) {
    889893        GDBG_ERROR( "SET GW CMD",
    890894                    "Fifo command 0x%x reserved bits set!\n",
     
    892896    }
    893897
    894     GDBG_INFO((128, 
     898    GDBG_INFO((128,
    895899               "Writing Group Write Command: 0x%x\n",
    896900               data ));
    897     GDBG_INFO((128, 
     901    GDBG_INFO((128,
    898902               "  FIFO ADDR: 0x%.08x\n", addr ));
    899903    /* dump chip field */
     
    901905        FxU32 field = ( (data<<2) & 0xf0000 ) >> 16;
    902906        GDBG_INFO((128, "  Chip Field: 0x%x\n", field ));
    903     } 
     907    }
    904908    /* dump wrap field */
    905909    {
     
    924928    FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax;
    925929    if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) {
    926       GDBG_ERROR( "SET GW CMD", 
     930      GDBG_ERROR( "SET GW CMD",
    927931                 "Fifo address 0x%x out of range(0x%x, 0x%x)\n",
    928                  addr, 
     932                 addr,
    929933                 gc->fifoData.hwDep.vg96FIFOData.fifoVirt,
    930934                 gc->fifoData.hwDep.vg96FIFOData.fifoMax );
    931935    }
    932                    
     936
    933937  }
    934938  /* validate alignment */
     
    938942               addr );
    939943  }
    940   GDBG_INFO((128, 
     944  GDBG_INFO((128,
    941945             "Writing Group Write Header: 0x%x\n",
    942946             data ));
    943   GDBG_INFO((128, 
     947  GDBG_INFO((128,
    944948             "  FIFO ADDR: 0x%.08x\n", addr ));
    945949  /* validate bits - at least one must be set*/
     
    976980    FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax;
    977981    if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) {
    978       GDBG_ERROR( "SET GW CMD", 
     982      GDBG_ERROR( "SET GW CMD",
    979983                 "Fifo address 0x%x out of range(0x%x, 0x%x)\n",
    980                  addr, 
     984                 addr,
    981985                 gc->fifoData.hwDep.vg96FIFOData.fifoVirt,
    982986                 gc->fifoData.hwDep.vg96FIFOData.fifoMax );
    983987    }
    984                    
     988
    985989  }
    986990  /* validate alignment */
     
    994998    GDBG_ERROR( "SET GW ENTRY",
    995999               "Group write entry attempted outside of a packet\n" );
    996   }   
    997   GDBG_INFO((128, 
     1000  }
     1001  GDBG_INFO((128,
    9981002             "Writing Group Write Entry\n" ));
    999   GDBG_INFO((128, 
     1003  GDBG_INFO((128,
    10001004             "  FIFO ADDR: 0x%.08x\n", addr ));
    10011005  /* decode write */
     
    10051009    bit   = 1;
    10061010    write = 0;
    1007        
     1011
    10081012    while( bit ) {
    10091013      if ( bit & thisMask ) {
     
    10141018      reg++;
    10151019    }
    1016        
     1020
    10171021    if ( bit ) {
    1018       GDBG_INFO((128, 
     1022      GDBG_INFO((128,
    10191023                 "  REG: %s DATA: 0x%x(%f)\n",
    10201024                 regNames[reg],
     
    10221026                 *(float*)&data ));
    10231027    } else {
    1024       GDBG_INFO((128, 
     1028      GDBG_INFO((128,
    10251029                 "  PADDING\n" ));
    10261030    }
  • 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 $ */
    12/*
    23 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 ** 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
    89 ** 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 **
    1112 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16  ** THE UNITED STATES. 
    17  ** 
     17 ** THE UNITED STATES.
     18 **
    1819 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920 **
    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 sandervl Exp $
     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 $
    2122 ** $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
    2327 ** Created new Voodoo 1 Glide dir
    2428 **
    25  * 
     29 *
    2630 * 14    12/19/97 8:09a Peter
    2731 * fog table propogation
    28  * 
     32 *
    2933 * 13    7/07/97 3:05p Dow
    3034 * Moved fouled clears
    31  * 
     35 *
    3236 * 12    3/18/97 9:07p Dow
    3337 * Got rid of #$#%#$ // comments
    34  * 
     38 *
    3539 * 11    3/16/97 12:42a Jdt
    3640 * Removed watcom warning
    37  * 
     41 *
    3842 * 10    3/13/97 10:53p Jdt
    3943 * Rewrote with simple optimizations.  Changed prototype for
    4044 * multi-resolution, and running as a better shameless plug.
    41  * 
     45 *
    4246 * 9     3/13/97 2:52a Jdt
    4347 * Added arguments to splash.
    44  * 
     48 *
    4549 * 8     3/09/97 10:31a Dow
    4650 * Added GR_DIENTRY for di glide functions
    47  * 
     51 *
    4852 * 7     3/01/97 6:24p Jdt
    4953 * Made splash force yorigin.
    50  * 
     54 *
    5155 * 6     1/02/97 1:06p Dow
    5256 * Fixed state bug
    53  * 
     57 *
    5458 * 3     11/17/96 11:16p Garymct
    5559 * Updated grSplash code to set all of the necessary state itself rather
     
    119123  -----------------------------*/
    120124/* xScale, xOffset, yScale, yOffset */
    121 static float viewPort[4] = { 
    122   480.0f, 320.0f, 
    123   480.0f, 240.0f 
     125static float viewPort[4] = {
     126  480.0f, 320.0f,
     127  480.0f, 240.0f
    124128};
    125129
     
    239243
    240244static void vecMatMult( float *dstVec, float *srcVec, float *matrix ) {
    241   dstVec[0] = 
     245  dstVec[0] =
    242246    srcVec[0] * matrix[0] +
    243247      srcVec[1] * matrix[4] +
    244248        srcVec[2] * matrix[8] +
    245249          matrix[12];
    246    
    247   dstVec[1] = 
     250
     251  dstVec[1] =
    248252    srcVec[0] * matrix[1] +
    249253      srcVec[1] * matrix[5] +
    250254        srcVec[2] * matrix[9] +
    251255          matrix[13];
    252    
    253   dstVec[2] = 
     256
     257  dstVec[2] =
    254258    srcVec[0] * matrix[2] +
    255259      srcVec[1] * matrix[6] +
     
    259263
    260264static void normMatMult( float *dstVec, float *srcVec, float *matrix ) {
    261   dstVec[0] = 
     265  dstVec[0] =
    262266    srcVec[0] * matrix[0] +
    263267      srcVec[1] * matrix[4] +
    264268        srcVec[2] * matrix[8];
    265    
    266   dstVec[1] = 
     269
     270  dstVec[1] =
    267271    srcVec[0] * matrix[1] +
    268272      srcVec[1] * matrix[5] +
    269273        srcVec[2] * matrix[9];
    270    
    271   dstVec[2] = 
     274
     275  dstVec[2] =
    272276    srcVec[0] * matrix[2] +
    273277      srcVec[1] * matrix[6] +
     
    303307}
    304308
    305 static void setupMaterial( int material_index ) { 
     309static void setupMaterial( int material_index ) {
    306310  switch( material_index ) {
    307311  case 0:                       /* 3d */
     
    329333                     GR_COMBINE_OTHER_TEXTURE,
    330334                     FXFALSE );
    331     } 
     335    }
    332336    break;
    333337  case 1:                       /* fx */
     
    365369}
    366370
    367 static void calculateIntensity( int material_index, 
    368                                 Vector intensity_factor,
    369                                 int frame ) {
     371static void calculateIntensity( int material_index,
     372                Vector intensity_factor,
     373                int frame ) {
    370374  switch( material_index ) {
    371375  case 0:
     
    410414  int i;
    411415  FxBool aa_a, aa_b, aa_c;
    412    
     416
    413417  for( facenum = 0; facenum < num_faces[objnum]; facenum++ )  {
    414418    material_index = face[objnum][facenum].mat_index;
     
    419423      prev_mat_index = material_index;
    420424    }
    421        
     425
    422426    if( ( material_index != 0 ) && ( pass == 2 ) )
    423427      continue;
    424          
     428
    425429    aa_a = aa_b = aa_c = FXFALSE;
    426430    if( face[objnum][facenum].aa_edge_flags & 4 )
     
    430434    if( face[objnum][facenum].aa_edge_flags & 1 )
    431435      aa_c = FXTRUE;
    432        
     436
    433437    for( i = 0; i < 3; i++ ) {
    434438      float *transformed_vert, *transformed_norm;
     
    436440      int vertnum;
    437441      float factor;
    438            
     442
    439443      vertnum = face[objnum][facenum].v[i];
    440444      transformed_vert = transformed_verts[vertnum];
    441445      transformed_norm = transformed_norms[vertnum];
    442446      v = &vert[objnum][vertnum];
    443            
     447
    444448      gvert[i].x = transformed_vert[0];
    445449      gvert[i].y = transformed_vert[1];
     
    448452      gvert[i].tmuvtx[0].sow = v->s * gvert[i].oow;
    449453      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] +
    454458           light[2] * transformed_norm[2] ) + 1.0f ) * 127.5f;
    455459
     
    459463      gvert[i].a = 255.0f;
    460464    }
    461        
     465
    462466    if( pass == 2 ) {
    463467      for( i = 0; i < 3; i++ ) {
    464468        float *transformed_norm;
    465                
    466         transformed_norm = 
     469
     470        transformed_norm =
    467471          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 *
    470474          ( 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 *
    472476          ( 128.0f + transformed_norm[1] * 128.0f );
    473                
     477
    474478        gvert[i].r = intensity_factor[0] * 255.0f;
    475479        gvert[i].g = intensity_factor[1] * 255.0f;
    476480        gvert[i].b = intensity_factor[2] * 255.0f;
    477       }                 
    478            
     481      }
     482
    479483      grDrawTriangle( &gvert[0], &gvert[1], &gvert[2] );
    480            
     484
    481485      continue;
    482486    }
    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,
    485489                         GR_BLEND_ONE, GR_BLEND_ZERO );
    486490    /* Do this if 3D. */
    487491    if( material_index == 0 ) {
    488492      /*
    489        * Draw the textured 3D without specular. 
     493       * Draw the textured 3D without specular.
    490494       */
    491495      sourceTexture( &textImage );
     
    497501                     FXFALSE );
    498502#endif
    499       grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 
     503      grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2],
    500504                       aa_a, aa_b, aa_c );
    501505    } else if( material_index != 1 ) {
     
    507511                       aa_a, aa_b, aa_c );
    508512    }
    509        
     513
    510514    if( do_phong && ( material_index != 0 ) ) {
    511       /* 
     515      /*
    512516       * figure out texture coords in [0..255.0f] based on the normal
    513517       * the specular highlight.
     
    515519      for( i = 0; i < 3; i++ ) {
    516520        float *transformed_norm;
    517                
    518         transformed_norm = 
     521
     522        transformed_norm =
    519523          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 *
    522526          ( 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 *
    524528          ( 128.0f + transformed_norm[1] * 128.0f );
    525                
     529
    526530        gvert[i].r = intensity_factor[0] * 255.0f;
    527531        gvert[i].g = intensity_factor[1] * 255.0f;
    528532        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],
    531535                       aa_a, aa_b, aa_c );
    532536    }
     
    534538}
    535539
    536 static void intersectLineWithZPlane( Vector result, Vector p1, 
     540static void intersectLineWithZPlane( Vector result, Vector p1,
    537541                                    Vector p2, float z ) {
    538542  float t;
    539  
     543
    540544  t = ( z - p1[2] ) / ( p2[2] - p1[2] );
    541545  result[0] = p1[0] + ( p2[0] - p1[0] ) * t;
     
    548552}
    549553
    550 static void drawShadow( int frame, int shadow_object_index, 
     554static void drawShadow( int frame, int shadow_object_index,
    551555                       int receiver_object_index, Vector light_position ) {
    552556  float *shadow_object_matrix;
     
    555559  Vector projected_view_verts[4];
    556560  int i;
    557  
     561
    558562  Vector local_verts[4] = {
    559563    { -280.0f, 0.0f, -160.0f },
    560564    { -280.0f, 0.0f,  150.0f },
    561565    {  280.0f, 0.0f,  150.0f },
    562     {  280.0f, 0.0f, -160.0f } 
     566    {  280.0f, 0.0f, -160.0f }
    563567  };
    564  
     568
    565569  float texcoords[4][2] = {
    566570    {  10.5f, 127.5f },
     
    569573    { 255.0f, 127.5f }
    570574  };
    571  
     575
    572576  GrVertex gvert[4];
    573577  GrVertex projected_gvert[4];
    574578  GrVertex light_gvert;
    575  
     579
    576580  /*
    577    * The point relative to the back part of the shield that 
     581   * The point relative to the back part of the shield that
    578582   * the shadow is going to be projected onto.
    579583   */
    580584  Vector shadow_light;
    581  
     585
    582586  shadow_light[0] = light_position[0];
    583587  shadow_light[1] = light_position[1];
    584588  shadow_light[2] = light_position[2];
    585  
     589
    586590  shadow_object_matrix   = &mat[frame][shadow_object_index][0];
    587591  receiver_object_matrix = &mat[frame][receiver_object_index][0];
    588  
     592
    589593  /*
    590    * Offset the light by the Z position of 
     594   * Offset the light by the Z position of
    591595   * the backplane that we are projected
    592596   * onto.
    593597   */
    594598  shadow_light[2] += receiver_object_matrix[14];
    595  
     599
    596600  for( i = 0; i < 4; i++ ) {
    597601    vecMatMult( view_verts[i], local_verts[i], shadow_object_matrix );
    598        
     602
    599603    /*
    600      * project . . . 
     604     * project . . .
    601605     */
    602606    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] +
    605609        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] +
    608612        viewPort[3] + SNAP_BIAS;
    609        
     613
    610614    /*
    611615     * Set up texture coordinates.
     
    614618    gvert[i].tmuvtx[0].tow = texcoords[i][1] * gvert[i].oow;
    615619  }
    616  
    617  
     620
     621
    618622  /*
    619623   * 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
    621625   * plane which the texture is to be projected onto.
    622626   */
     
    624628    Vector tmpvect;
    625629    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],
    630634                            receiver_object_matrix[14] - 26.0f );
    631635    projected_gvert[i].oow = 1.0f / projected_view_verts[i][2];
    632     projected_gvert[i].x = 
     636    projected_gvert[i].x =
    633637      projected_view_verts[i][0] * projected_gvert[i].oow * viewPort[0] +
    634638        viewPort[1] + SNAP_BIAS;
    635     projected_gvert[i].y = 
     639    projected_gvert[i].y =
    636640      projected_view_verts[i][1] * projected_gvert[i].oow * viewPort[2] +
    637641        viewPort[3] + SNAP_BIAS;
    638        
     642
    639643    tmpvect[0] = projected_view_verts[i][0] - shadow_light[0];
    640644    tmpvect[1] = projected_view_verts[i][1] - shadow_light[1];
    641645    tmpvect[2] = projected_view_verts[i][2] - shadow_light[2];
    642646    q = vectorMag( tmpvect );
    643        
     647
    644648    /*
    645649     * Set up texture coordinates.
    646650     */
    647651    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 =
    649653      texcoords[i][0] * projected_gvert[i].oow;
    650     projected_gvert[i].tmuvtx[0].tow = 
     654    projected_gvert[i].tmuvtx[0].tow =
    651655      texcoords[i][1] * projected_gvert[i].oow;
    652656  }
    653  
     657
    654658  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] +
    656660    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] +
    658662    viewPort[3] + SNAP_BIAS;
    659  
     663
    660664  /*
    661665   * Draw a segment between the light and the point which hits
     
    668672                 FXFALSE );
    669673  sourceTexture( &shadowImage );
    670  
     674
    671675  grAlphaBlendFunction( GR_BLEND_DST_COLOR, GR_BLEND_ZERO,
    672676                       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],
    677681                 &projected_gvert[2] );
    678   grDrawTriangle( &projected_gvert[0], 
    679                  &projected_gvert[2], 
     682  grDrawTriangle( &projected_gvert[0],
     683                 &projected_gvert[2],
    680684                 &projected_gvert[3] );
    681   grDrawTriangle( &projected_gvert[0], 
    682                  &projected_gvert[2], 
     685  grDrawTriangle( &projected_gvert[0],
     686                 &projected_gvert[2],
    683687                 &projected_gvert[1] );
    684   grDrawTriangle( &projected_gvert[0], 
    685                  &projected_gvert[3], 
     688  grDrawTriangle( &projected_gvert[0],
     689                 &projected_gvert[3],
    686690                 &projected_gvert[2] );
    687  
     691
    688692  grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ZERO,
    689693                       GR_BLEND_ONE, GR_BLEND_ZERO );
    690  
     694
    691695}
    692696
     
    726730
    727731  /* Check Screen Dimensions and Check Avail of Depth Buffer */
    728   if ( (x > gc->state.screen_width) || 
     732  if ( (x > gc->state.screen_width) ||
    729733      ((x+w) > gc->state.screen_width) ||
    730734      ( y > gc->state.screen_height ) ||
    731       ((y+h) > gc->state.screen_height ) ) 
     735      ((y+h) > gc->state.screen_height ) )
    732736    return;
    733737  if ( gc->state.screen_height == 640 ) {
     
    745749    y = (( gc->state.screen_height - 1.0f ) - (h-1.0f) ) - y;
    746750  }
    747        
     751
    748752  viewPort[0] = w *  ( 480.0f / 640.0f );
    749753  viewPort[1] = x + ( w / 2.0f );
     
    775779                       GR_BLEND_ONE, GR_BLEND_ZERO );
    776780  if ( useTextures )
    777     grTexCombine( GR_TMU0, 
     781    grTexCombine( GR_TMU0,
    778782                 GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
    779783                 GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE,
     
    794798  //    grClipWindow( (int)x, (int)y, (int)(x+w), (int)(y+h) );
    795799  grFogColorValue( 0x0 );
    796  
     800
    797801  fadeInFrames  = (int)(((float)total_num_frames) * FADEIN_END_PERCENT);
    798   fadeOutFrames = (int)(((float)total_num_frames) * 
     802  fadeOutFrames = (int)(((float)total_num_frames) *
    799803                        (1.0f - FADEOUT_BEGIN_PERCENT));
    800804
     
    802806    for( frame = 1; frame < total_num_frames; frame++ ) {
    803807      int i;
    804            
     808
    805809      /* Set Fog Value For This Frame */
    806810      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) /
    811815                             (float)fadeInFrames ));
    812816        for( i = 0; i < kInternalFogTableEntryCount; i++ )
     
    816820        fog = 1;
    817821      } else if( frame > total_num_frames-fadeOutFrames ) {
    818         unsigned char fval = 
    819           ((unsigned char)255) - 
     822        unsigned char fval =
     823          ((unsigned char)255) -
    820824            (unsigned char)(255.0f*
    821825                            ((float)(total_num_frames-frame))/
    822826                            ((float)fadeOutFrames));
    823         for( i = 0; i < kInternalFogTableEntryCount; i++ ) 
     827        for( i = 0; i < kInternalFogTableEntryCount; i++ )
    824828          fogTable[i] = fval;
    825829        grFogMode( GR_FOG_WITH_TABLE );
     
    831835      }
    832836      grBufferClear( 0x00000000, 0, GR_WDEPTHVALUE_FARTHEST );
    833        
     837
    834838      pass = 1;
    835839
     
    843847      xfAndProj( frame, 2 );
    844848      drawFaces( frame, 2 );
    845      
     849
    846850      /* yellow and white part of shield. */
    847851      xfAndProj( frame, 0 );
     
    878882  } else {                      /* Render One Frame */
    879883    frame = ((_frame>>1) % SPIN_FRAMES)+SPIN_START;
    880        
     884
    881885    grColorMask( FXFALSE, FXFALSE );
    882886    grBufferClear( 0x00000000, 0, GR_WDEPTHVALUE_FARTHEST );
    883887    grColorMask( FXTRUE, FXFALSE );
    884        
     888
    885889    pass = 0xbeef;
    886        
     890
    887891    /* 3Dfx logo */
    888892    xfAndProj( frame, 1 );
    889893    drawFaces( frame, 1 );
    890894  }
    891    
     895
    892896  /*
    893897   * 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25 ** 
     29**
    2630** 79    7/06/98 3:05p Peter
    2731** grSstWinOpen fails triple buffering
    28 ** 
     32**
    2933** 78    6/04/98 12:13p Peter
    3034** splash dll rename
    31 ** 
     35**
    3236** 77    3/16/98 3:20p Atai
    3337** fixed glide in a window bug. OEM DLL code bails out if res can not be
    3438** found
    35 ** 
     39**
    3640** 76    3/02/98 10:42a Atai
    3741** remove oemvidtiming for DOS
    38 ** 
     42**
    3943** 75    2/24/98 10:59a Atai
    4044** modify for oem dll
    41 ** 
     45**
    4246** 74    2/23/98 11:03a Peter
    43 ** 
     47**
    4448** 73    2/12/98 8:21p Pgj
    45 ** 
     49**
    4650** 72    2/12/98 6:48p Atai
    4751** fix typo
    48 ** 
     52**
    4953** 71    2/12/98 4:01p Atai
    5054** change refresh rate if oemdll updated for tv out
    51  * 
     55 *
    5256 * 70    1/12/98 10:25p Dow
    5357 * H3D Stereo Support
    54  * 
     58 *
    5559 * 69    1/06/98 3:44p Atai
    5660 * fixed tv out related stuff for dos build.
    57  * 
     61 *
    5862 * 68    12/19/97 11:04a Atai
    5963 * oeminit dll stuff
    60  * 
     64 *
    6165 * 67    12/19/97 10:23a Dow
    6266 * Splash Screen stuff
    63  * 
     67 *
    6468 * 66    12/03/97 9:36a Dow
    6569 * Fixed bug in grSstIsBusy()
    66  * 
     70 *
    6771 * 65    12/02/97 7:20p Dow
    6872 * Added code for new splash screen
    69  * 
     73 *
    7074 * 64    10/21/97 8:20p Atai
    7175 * added parameter for vid timing
    72  * 
     76 *
    7377 * 63    10/06/97 1:14p Atai
    7478 * fix bug 824. added sli resolution checking
    75  * 
     79 *
    7680 * 62    9/19/97 1:24p Peter
    7781 * more test27 fun
    78  * 
     82 *
    7983 * 61    9/11/97 1:33p Atai
    8084 * In grSstWinOpen(), checking (nColBuffers+nAuxBuffers) for
    8185 * GR_RESOLUTION_800x600 and GR_RESOLUTION_856x480
    82  * 
     86 *
    8387 * 60    9/10/97 10:13p Peter
    8488 * fifo logic from GaryT, non-normalized fp first cut
    85  * 
     89 *
    8690 * 59    9/07/97 12:25p Pgj
    87  * 
     91 *
    8892 * 58    9/07/97 12:14p Pgj
    8993 * fix bug 697
    90  * 
     94 *
    9195 * 57    8/19/97 8:55p Peter
    9296 * lots of stuff, hopefully no muckage
    93  * 
     97 *
    9498 * 56    7/09/97 10:18a Dow
    9599 * Further Nudge Of Love adjustments
    96  * 
     100 *
    97101 * 55    7/07/97 3:05p Dow
    98102 * Moved some state BEFORE splash screen
    99  * 
     103 *
    100104 * 54    6/26/97 3:09p Dow
    101105 * removed warning
    102  * 
     106 *
    103107 * 53    6/24/97 3:40p Dow
    104108 * Protected Nude of Love
    105  * 
     109 *
    106110 * 52    6/22/97 10:19a Dow
    107111 * Set cpuType filed inf fifoInfo before calling initEnableTransport
    108  * 
     112 *
    109113 * 51    6/21/97 1:05p Dow
    110114 * Made it use the NUDGE_OF_LOVE macro
    111  * 
     115 *
    112116 * 50    6/21/97 12:15p Dow
    113117 * Moved 128 DWORD nudge of love into grSstStatus()
    114  * 
     118 *
    115119 * 49    6/21/97 11:39a Dow
    116120 * Fixed debug assertion
    117  * 
     121 *
    118122 * 48    6/19/97 7:35p Dow
    119123 * More P6 Stuff
    120  * 
     124 *
    121125 * 47    6/11/97 5:30p Pgj
    122126 * fix bug 594 (grSstPerfStats() returns inaccurate data on SLI systems)
    123  * 
     127 *
    124128 * 46    6/05/97 11:15p Pgj
    125  * 
     129 *
    126130 * 45    5/30/97 8:53a Dow
    127131 * Protected int10Called set in grSstWinOpen
    128  * 
     132 *
    129133 * 44    5/28/97 2:11p Dow
    130134 * int10h handler
    131  * 
     135 *
    132136 * 43    5/27/97 2:03p Dow
    133137 * added check for new env variable
    134  * 
     138 *
    135139 * 42    5/22/97 11:25a Dow
    136140 * Fixed bogus polling for idle.
    137  * 
     141 *
    138142 * 41    5/21/97 9:52a Jdt
    139143 * Added grSstControl() implementation for SST-1.
    140  * 
     144 *
    141145 * 40    5/05/97 2:22p Dow
    142146 * Protected previous checkin with SST96 to avoid errors when compiling
    143147 * SST1
    144  * 
     148 *
    145149 * 39    5/05/97 1:35p Dow
    146150 * Changed grSstControl to modify clip1 instead of clip0
    147  * 
     151 *
    148152 * 38    5/04/97 12:48p Dow
    149153 * made grSstControl change clipLeftRight and clipBottomTop via direct
    150154 * writes.
    151  * 
     155 *
    152156 * 37    5/02/97 2:11p Pgj
    153157 * screen_width/height now FxU32
    154  * 
     158 *
    155159 * 36    4/15/97 12:59p Dow
    156160 * Fixed clipping problem
    157  * 
     161 *
    158162 * 35    4/13/97 8:11p Jdt
    159163 * Change in init.h
    160  * 
     164 *
    161165 * 34    4/13/97 2:06p Pgj
    162166 * eliminate all anonymous unions (use hwDep)
    163  * 
     167 *
    164168 * 33    3/20/97 2:18a Dow
    165169 * added a fixme
    166  * 
     170 *
    167171 * 32    3/19/97 10:43p Dow
    168172 * windowsInit stuff
    169  * 
     173 *
    170174 * 31    3/19/97 1:37a Jdt
    171175 * Added some stride computation
    172  * 
     176 *
    173177 * 30    3/18/97 9:55p Jdt
    174178 * Moved resolution guessing into init lib.
    175  * 
     179 *
    176180 * 29    3/17/97 6:28a Jdt
    177181 * Rewrite of grSstWinOpen with new init code in mind.
    178  * 
     182 *
    179183 * 28    3/16/97 12:39a Jdt
    180184 * Moved over to serialstatus stored in hwDep...
    181  * 
     185 *
    182186 * 27    3/14/97 2:36a Murali
    183187 * Removed printfs(), and GDBG_INFO won't work at this stage.
    184  * 
     188 *
    185189 * 26    3/13/97 11:02p Jdt
    186190 * Added new splash in.
    187  * 
     191 *
    188192 * 25    3/13/97 5:54a Murali
    189193 * Second set of changes for WinGlide.
    190  * 
     194 *
    191195 * 24    3/13/97 2:51a Jdt
    192196 * First step towards windowed splash
    193  * 
     197 *
    194198 * 23    3/05/97 2:18p Murali
    195199 * Preliminary changes for Glide in a window.
    196  * 
     200 *
    197201 * 22    3/04/97 9:08p Dow
    198202 * Neutered multiplatform multiheaded monster
    199  * 
     203 *
    200204 * 21    2/26/97 11:58a Jdt
    201205 * Fixed grsstopen and grSstorigin
    202  * 
     206 *
    203207 * 20    2/19/97 4:41p Dow
    204208 * Changed status read to use serial status on SST96
    205  * 
     209 *
    206210 * 19    2/14/97 12:55p Dow
    207211 * moved vg96 fifo wrap into init code
    208  * 
     212 *
    209213 * 18    1/14/97 10:48a Dow
    210214 * Modified grSstStatus to work w/ VG96
    211215 * Made grSstIdle work with either VG or VG96  (via Init HAL)
    212  * 
     216 *
    213217 * 17    12/23/96 1:37p Dow
    214218 * chagnes for multiplatform glide
    215  * 
     219 *
    216220 * 16    11/24/96 9:35a Tarolli
    217221 * it now calls sst1InitNumBoardsInSystem(); instead of doing the work
    218222 * itself
    219  * 
     223 *
    220224 * 15    11/15/96 4:05p Jdt
    221225 * Dllable for vg96
     
    230234#include <sst1vid.h>
    231235
    232 #if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 
     236#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
    233237#include <init.h>
    234238#endif
     
    248252#include <dos.h>
    249253  /* int 10h interrupt handler */
    250 void __interrupt __far 
     254void __interrupt __far
    251255_grInt10Handler() {
    252256#define FN_NAME "_grInt10Handler"
     
    283287static patColor disableColor[2] = {PAT_BLACK,PAT_BLACK}; // turn off adapter
    284288
    285 #if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
     289#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    286290static patColor enableColor[2] = {PAT_YELLOW,PAT_BLACK}; // use top and bottom mode 1
    287291#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
     
    318322
    319323static void initState(void) {
    320   grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 
     324  grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO,
    321325                        GR_BLEND_ONE, GR_BLEND_ZERO );
    322326  grAlphaTestFunction( GR_CMP_ALWAYS );
     
    379383  } /* setup regs for pageflipping */
    380384#endif
    381    
     385
    382386  grDepthBufferFunction( GR_CMP_ALWAYS );
    383387  grDepthMask( FXFALSE );
    384  
     388
    385389  grColorCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
    386390                  GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_NONE,
     
    392396  lineLeft.z = lineRight.z = 0.f;
    393397  lineLeft.ooz = lineRight.ooz = 65535.f;
    394 #if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
     398#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    395399  lineLeft.y = lineRight.y = 2.f;
    396400#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
    397401  lineLeft.y = lineRight.y = grSstScreenHeight() - H3DHEIGHT_FROM_REZ(gc->grSstRez) + 2.f;
    398402#endif
    399  
     403
    400404  grColorMask(FXTRUE,0);
    401405  grDepthBufferFunction( GR_CMP_ALWAYS );
     
    416420    drawlinefb(&lineLeft, &lineRight);
    417421    lineLeft.y = ++lineRight.y;
    418    
     422
    419423    grConstantColorValue( 0 );
    420424    drawlinefb(&lineLeft, &lineRight);
    421425    lineLeft.y = ++lineRight.y;
    422426  }
    423  
     427
    424428  for (line = 0; line < 2; line++) {
    425429    grConstantColorValue( patColorToGR(enable?(getGetIntKeyValue("\\SOFTWARE\\H3D\\TBMODE")==1?enableColor[line]:enableColor2[line]):disableColor[line],format) );
    426430    drawlinefb(&lineLeft, &lineRight);
    427431    lineLeft.y = ++lineRight.y;
    428    
     432
    429433    grConstantColorValue( 0 );
    430434    drawlinefb(&lineLeft, &lineRight);
     
    433437
    434438  // wait for adapter sync-up
    435 #if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
     439#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
    436440  for(line = 40; line>0; line--) {
    437441#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
     
    453457  grGlideSetState(&state);  // restore app. state
    454458
    455   // restore 
     459  // restore
    456460#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
    457461  if (GR_RESOLUTION_IS_AUTOFLIPPED(gc->grSstRez)) {
     
    489493  Initialize the selected SST
    490494
    491   Initialization has 4 Steps 
    492 
    493   Video Init - 
     495  Initialization has 4 Steps
     496
     497  Video Init -
    494498     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.
    497501
    498502     In the windowed case, this involves acquiring all necessary
    499503     surfaces for rendering, back buffer and memory fifo
    500504
    501      Also perform any work necessary to enable access to 3D 
     505     Also perform any work necessary to enable access to 3D
    502506     registers
    503507
     
    505509     Assuming video registers are in a reset state, initialize
    506510     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,
    508512     afterwards, most commands will go throught the command
    509513     transport
    510514
    511   GC Init - 
     515  GC Init -
    512516     Initialize the current GC based on the user requested
    513517     open parameters and command transport data reported
    514518     during initialization.
    515519
    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
    519523  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
    521525         the application window handle will be inferred though
    522526         the GetActiveWindow() api.
     
    540544  FXTRUE - glide successfully acquired the necessary resources and a
    541545           is ready for rendering
    542   FXFALSE - glide was unsuccessful in getting the necessary resources, 
     546  FXFALSE - glide was unsuccessful in getting the necessary resources,
    543547            or the requested configuration is unavailble on the host
    544548            hardware - any calls to glide rendering routines will result
    545549            in undefined behavior.
    546550  -------------------------------------------------------------------*/
    547 GR_ENTRY(grSstWinOpen, FxBool, ( 
     551GR_ENTRY(grSstWinOpen, FxBool, (
    548552    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,
    553557    int                     nColBuffers,
    554558    int                     nAuxBuffers))
     
    559563  int xres, yres, fbStride;
    560564#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    561   FARPROC 
    562     oemInitMapBoard = NULL, 
    563     oemInitSetVideo = NULL, 
     565  FARPROC
     566    oemInitMapBoard = NULL,
     567    oemInitSetVideo = NULL,
    564568    oemInitVideoTiming = NULL;
    565569  OemInitInfo oemi;
     
    579583#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
    580584  /* 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
    582586   * we added this back.
    583587   */
    584588  rv = (nColBuffers < 3);
    585589  if (!rv) {
    586     GDBG_INFO(( gc->myLevel, 
     590    GDBG_INFO(( gc->myLevel,
    587591                "grSstWinOpen failed because sst1 cannot really triple buffer\n"));
    588     goto BAILOUT; 
     592    goto BAILOUT;
    589593  }
    590594#endif /* (GLIDE_PLATFORM & GLIDE_HW_SST1) */
     
    602606          (initMapBoard(_GlideRoot.current_sst) != NULL))) return FXFALSE;
    603607  }
    604  
     608
    605609#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && (!defined(GLIDE_DEBUG) || (GLIDE_DEBUG == 0))
    606610  /*
     
    631635    Validate and Parse Arguments
    632636    ------------------------------------------------------*/
    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.
    637641     nColBuffers vs. nAuxBuffers that specifies required
    638642     ram and vald/invalid configurations
     
    679683  }
    680684#endif
    681  
    682 #if ( 1 ) 
     685
     686#if ( 1 )
    683687  /*------------------------------------------------------
    684688    Video Init
     
    688692  ** initialize video timing data for oemdll
    689693  ** 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
    691695  ** sst1InitVideoBuffers()
    692696  */
     
    707711      oemi.vid.clkFreq16bpp = tvVidtiming.clkFreq16bpp;
    708712      oemi.vid.clkFreq24bpp = tvVidtiming.clkFreq24bpp;
    709      
     713
    710714      if (gc->oemInit) {
    711         if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) && 
     715        if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) &&
    712716            (oemInitMapBoard))
    713717          oemvidtiming = oemInitVideoTiming(&oemi);
     
    734738#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    735739  if (oemvidtiming)
    736     rv = initSetVideo( hWnd, resolution, 
    737                        oemi.vid.refresh, format, origin, 
     740    rv = initSetVideo( hWnd, resolution,
     741                       oemi.vid.refresh, format, origin,
    738742                       nColBuffers, nAuxBuffers,
    739743                       &xres, &yres, &fbStride, &tvVidtiming );
    740744  else
    741745#endif
    742     rv = initSetVideo( hWnd, resolution, 
    743                        refresh, format, origin, 
     746    rv = initSetVideo( hWnd, resolution,
     747                       refresh, format, origin,
    744748                       nColBuffers, nAuxBuffers,
    745749                       &xres, &yres, &fbStride, _GlideRoot.GCs[_GlideRoot.current_sst].vidTimings );
    746750  if ( !rv ) goto BAILOUT;
    747   GDBG_INFO((gc->myLevel, 
     751  GDBG_INFO((gc->myLevel,
    748752             "  Video init succeeded. xRes = %.04d, yRes = %.04d\n",
    749753             xres, yres ));
     
    751755#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    752756  if (gc->oemInit) {
    753     if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) && 
     757    if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) &&
    754758        (oemInitMapBoard))
    755759      oemInitSetVideo(&oemi);
     
    772776  gc->nopCMD = FXFALSE;
    773777
    774 #  if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
    775   grHints( GR_HINT_FIFOCHECKHINT, 
     778#  if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
     779  grHints( GR_HINT_FIFOCHECKHINT,
    776780           fifoInfo.hwDep.vgFIFOData.memFifoStatusLwm + 0x100 );
    777781  _grReCacheFifo( 0 );
     
    782786  gc->hwDep.sst96Dep.int10Called = FXFALSE;
    783787  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));
    785789
    786790  GDBG_INFO((80, "Overriding int 10h interrupt handler\n"));
    787791  _dos_setvect(0x10, _grInt10Handler);
    788792#endif
    789  
     793
    790794  gc->fifoData = fifoInfo;
    791795
    792   GDBG_INFO((120, "After Init:  fifoPtr  = 0x%x\n", 
     796  GDBG_INFO((120, "After Init:  fifoPtr  = 0x%x\n",
    793797             fifoInfo.hwDep.vg96FIFOData.fifoPtr ));
    794798  GDBG_INFO((120, "After Init:  fifoSize = 0x%x\n",
     
    825829  gc->lfbSliOk = 0;
    826830  gc->fbStride = fbStride;
    827  
     831
    828832  /* Initialize the read/write registers to all 0 */
    829833  gc->state.fbi_config.fbzColorPath  = 0;
     
    840844  gc->state.fbi_config.color0        = 0;
    841845  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)
    843847    {
    844848      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 ) &&
    847851           (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev ==
    848852            0 ) )
     
    862866      gc->state.tmu_config[tmu].evenOdd         = GR_MIPMAPLEVELMASK_BOTH;
    863867      gc->state.tmu_config[tmu].nccTable        = GR_NCCTABLE_NCC0;
    864     } 
     868    }
    865869
    866870  /*------------------------------------------------------
    867     3D State Init 
     871    3D State Init
    868872    ------------------------------------------------------*/
    869873  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    |
    873877    SST_DRAWBUFFER_BACK;
    874  
     878
    875879  grHints(GR_HINT_ALLOW_MIPMAP_DITHER, 0);
    876880  grSstOrigin( origin );
    877   grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 
     881  grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO,
    878882                        GR_BLEND_ONE, GR_BLEND_ZERO );
    879883  grAlphaTestFunction( GR_CMP_ALWAYS );
     
    881885  grChromakeyMode( GR_CHROMAKEY_DISABLE );
    882886  grConstantColorValue( ( FxU32 ) ~0 );
    883   grClipWindow( 0, 0, gc->state.screen_width, 
     887  grClipWindow( 0, 0, gc->state.screen_width,
    884888                gc->state.screen_height );
    885889  _grColorCombineDelta0Mode( FXFALSE );
     
    910914    grTexClampMode( GR_TMU2, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP );
    911915    grTexDetailControl( GR_TMU2, 0, 1, 1.0F );
    912     grTexFilterMode( GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 
     916    grTexFilterMode( GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED,
    913917                     GR_TEXTUREFILTER_POINT_SAMPLED );
    914918    grTexLodBiasValue( GR_TMU2, 0.0F);
     
    921925    grTexClampMode( GR_TMU1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP );
    922926    grTexDetailControl( GR_TMU1, 0, 1, 1.0F );
    923     grTexFilterMode( GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 
     927    grTexFilterMode( GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED,
    924928                     GR_TEXTUREFILTER_POINT_SAMPLED );
    925929    grTexLodBiasValue( GR_TMU1, 0.0F);
     
    931935    grTexClampMode( GR_TMU0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP );
    932936    grTexDetailControl( GR_TMU0, 0, 1, 1.0F );
    933     grTexFilterMode( GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 
     937    grTexFilterMode( GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED,
    934938                     GR_TEXTUREFILTER_POINT_SAMPLED );
    935939    grTexLodBiasValue( GR_TMU0, 0.0F);
     
    969973        if (fxSplash = GetProcAddress(newSplash, "_fxSplash@16")) {
    970974          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        }
    974978      }
    975979    }
     
    978982    /* If it's still 0, then do the old one */
    979983    if (!_GlideRoot.environment.noSplash) {
    980       grSplash(0.0f, 0.0f, 
     984      grSplash(0.0f, 0.0f,
    981985               (float) gc->state.screen_width,
    982986               (float) gc->state.screen_height,
     
    10011005  Shutdown has 4 steps
    10021006
    1003   3D Idle 
     1007  3D Idle
    10041008    the 3D engine must be idled to make sure that there are no
    10051009    commands executing in the transport when the registers are
     
    10371041    GDBG_INFO(( gc->myLevel, "  3D Idle\n" ));
    10381042    initIdle();
    1039    
     1043
    10401044    /*--------------------------
    10411045      GC Reset
     
    10441048    gc->open = FXFALSE;
    10451049    gc->closedP = FXTRUE;
    1046    
     1050
    10471051    /*--------------------------
    10481052      Command Transport Disable
     
    10501054    GDBG_INFO(( gc->myLevel, "  Command Transport Disable\n" ));
    10511055    initDisableTransport();
    1052    
     1056
    10531057#if (GLIDE_PLATFORM & GLIDE_OS_DOS32) && (GLIDE_PLATFORM & GLIDE_HW_SST96) && defined(GLIDE_DEBUG)
    10541058    GDBG_INFO((80, "Restoring int 10h interrupt handler (0x%x)\n", gc->hwDep.sst96Dep.prevInt10));
     
    10571061
    10581062    /*--------------------------
    1059       Video Restore 
     1063      Video Restore
    10601064      --------------------------*/
    10611065    GDBG_INFO(( gc->myLevel, "  Restore Video\n" ));
     
    10691073#endif
    10701074  }
    1071    
     1075
    10721076  GR_END();
    10731077#undef FN_NAME
    10741078} /* grSstWinClose */
    10751079
    1076 GR_ENTRY(grSstControl, FxBool, ( GrControl_t code )) 
     1080GR_ENTRY(grSstControl, FxBool, ( GrControl_t code ))
    10771081{
    1078 #define FN_NAME "grSstControl" 
     1082#define FN_NAME "grSstControl"
    10791083
    10801084  GR_DCL_GC;
    10811085  GDBG_INFO((41, "%s:  code = 0x%x, windowsInit = %d\n", FN_NAME,
    10821086             code, _GlideRoot.windowsInit));
    1083  
    1084   if (_GlideRoot.windowsInit) {   
     1087
     1088  if (_GlideRoot.windowsInit) {
    10851089#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
    10861090    /* For VG96, windows haven't been created, so there's no point
    1087      * trying to control it. 
     1091     * trying to control it.
    10881092     */
    10891093    /* Believe it or not, the following code really should be bracketed
     
    10981102      clipLeftRight, clipBottomTop;
    10991103    FxU32 nTries;
    1100    
     1104
    11011105    GR_BEGIN_NOFIFOCHECK(FN_NAME,80);
    1102    
     1106
    11031107    /* We're either cleaning up or closed so forget about this one. */
    11041108    if (gc->closedP) goto __done;
     
    11131117    }
    11141118#endif
    1115    
     1119
    11161120    GDBG_INFO((80, "%s:  initControl returned 0x%x\n", FN_NAME, xRes));
    11171121
    11181122    if (!xRes) return FXFALSE;
    1119  
     1123
    11201124    yRes = xRes >> 16;
    11211125    xRes = xRes & 0xffff;
    1122  
     1126
    11231127    /* !! FIXME +++ this call should properly update the gc->fbStride,
    11241128       this information is known only to the init layer and needs to be
    11251129       exposed, it is only really necessary to lfblock right now,
    11261130       and therefore is returned by initGetBufferPtr */
    1127  
     1131
    11281132    gc->state.screen_width = xRes;
    11291133    gc->state.screen_height = yRes;
    11301134
    11311135    /* Wait for Idle. */
    1132  
     1136
    11331137    nTries = 0;
    11341138    do {
    11351139      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",
    11371141                   FN_NAME, nTries));
    11381142        return FXFALSE;
     
    11401144
    11411145      status = GET(hw->status);
    1142        
     1146
    11431147    } while (status & 0x1);
    11441148
     
    11661170    return ctrlflag;
    11671171#endif
    1168    
     1172
    11691173  }
    11701174  GDBG_INFO((41, "%s:  Returning TRUE\n", FN_NAME));
    11711175  return FXTRUE;
    1172  
     1176
    11731177} /* grSstControl */
    11741178
    11751179/*---------------------------------------------------------------------------
    11761180**  grSstPerfStats
    1177 */ 
     1181*/
    11781182
    11791183GR_ENTRY(grSstPerfStats, void, (GrSstPerfStats_t *pStats))
     
    12251229  }
    12261230#endif
    1227    
     1231
    12281232  GR_END();
    12291233} /* grSstPerfStats */
     
    12521256  GR_BEGIN_NOFIFOCHECK( "grSstStatus", 85 );
    12531257
    1254 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 
     1258#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
    12551259  P6_NUDGE_OF_LOVE;
    12561260#endif
     
    13091313  if ((busy = initBusy()) == FXFALSE)
    13101314    gc->nopCMD = FXFALSE;
    1311  
     1315
    13121316  GDBG_INFO((84,"grSstIsBusy() => 0x%x\n",busy));
    13131317
     
    14041408  switch (chip) {
    14051409  case GR_TMU0:
    1406   case GR_TMU1: 
     1410  case GR_TMU1:
    14071411  case GR_TMU2:
    14081412    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 12    3/04/97 9:08p Dow
    2731 * Neutered multiplatform multiheaded monster
    28  * 
     32 *
    2933 * 11    3/03/97 10:58a Jdt
    3034 * Fixe for 2-pass trilinear
    31  * 
     35 *
    3236 * 10    12/23/96 1:37p Dow
    3337 * chagnes for multiplatform glide
     
    6367  GDBG_INFO_MORE((gc->myLevel,"(%d, %d,%d)\n",tmu,s_clamp_mode,t_clamp_mode));
    6468  GR_CHECK_TMU(myName, tmu);
    65  
     69
    6670  texturemode  = gc->state.tmu_config[tmu].textureMode;
    6771  texturemode &= ~( SST_TCLAMPS | SST_TCLAMPT );
     
    8892  GR_BEGIN("grTexCombine",88,8+2*PACKER_WORKAROUND_SIZE);
    8993  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,
    9195                 alpha_function, alpha_factor,
    9296                 rgb_invert, alpha_invert));
     
    111115               "unsupported texture alpha combine scale factor" );
    112116
    113   /* tmuMask tells grColorCombineFunction what to turn off an on if 
     117  /* tmuMask tells grColorCombineFunction what to turn off an on if
    114118     the ccFunc requires texture mapping */
    115119  texturemode = gc->state.tmu_config[tmu].textureMode;
     
    149153
    150154  /* setup core color combine unit bits */
    151  
     155
    152156  switch ( rgb_function )
    153157  {
     
    204208    break;
    205209  }
    206  
     210
    207211  switch ( alpha_function )
    208212  {
     
    259263    break;
    260264  }
    261  
    262   /* Hack to enable TWO-PASS Trilinear 
    263      
     265
     266  /* Hack to enable TWO-PASS Trilinear
     267
    264268   */
    265269  if ( texturemode & SST_TRILINEAR ) {
     
    333337{
    334338  FxU32 tLod;
    335  
     339
    336340  GR_BEGIN("grTexLodBiasValue",88,4+2*PACKER_WORKAROUND_SIZE);
    337341  GDBG_INFO_MORE((gc->myLevel,"(%d,%g)\n",tmu,fvalue));
    338342  GR_CHECK_TMU(myName,tmu);
    339  
     343
    340344  tLod = gc->state.tmu_config[tmu].tLOD;
    341345  tLod &= ~( SST_LODBIAS );
     
    357361  Description:
    358362    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
    360364    low level texture memory management
    361365  Arguments:
    362366    tmu       - tmu to update
    363     mmMode   - mipmap mode 
     367    mmMode   - mipmap mode
    364368      One of:
    365369        GR_MIPMAP_DISABLE
     
    382386  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d)\n",tmu,mmMode,lodBlend));
    383387  GR_CHECK_TMU(myName,tmu);
    384  
     388
    385389  /*--------------------------------------------------------------
    386390    Get Current tLod and texMode register values
     
    413417  case GR_MIPMAP_NEAREST:
    414418    /*----------------------------------------------------------
    415       Set LODMIN and LODMAX in the tLod register to the 
     419      Set LODMIN and LODMAX in the tLod register to the
    416420      actual min and max LODs of the current texture.
    417421      ----------------------------------------------------------*/
     
    424428  }
    425429  gc->state.tmu_config[tmu].mmMode = mmMode;
    426  
     430
    427431  /*--------------------------------------------------------------
    428432    Fix trilinear and evenOdd bits -
     
    431435    full textures.  The assumption here is that the only reason
    432436    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.
    434438    --------------------------------------------------------------*/
    435439  if ( lodBlend ) {
     
    442446  }
    443447  tLod |= _gr_evenOdd_xlate_table[gc->state.tmu_config[tmu].evenOdd];
    444  
     448
    445449  /*--------------------------------------------------------------
    446450    Write State To Hardware and Update Glide Shadow State
     
    492496{
    493497  FxU32 texMode;
    494  
     498
    495499  GR_BEGIN("grTexNCCTable",88,4+2*PACKER_WORKAROUND_SIZE);
    496500  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu));
     
    502506    ------------------------------------------------------------------*/
    503507  gc->state.tmu_config[tmu].nccTable = table;
    504  
     508
    505509  /*------------------------------------------------------------------
    506510    Grab shadow texMode, update TexMode, update shadow/real register
     
    510514  if ( table )
    511515    texMode |= SST_TNCCSELECT;
    512   else 
     516  else
    513517    texMode &= ~(SST_TNCCSELECT);
    514518
     
    536540                the selected texture
    537541                One of:
    538                   GR_MIPMAPLEVELMASK_EVEN 
     542                  GR_MIPMAPLEVELMASK_EVEN
    539543                  GR_MIPMAPLEVELMASK_ODD
    540544                  GR_MIPMAPLEVELMASK_BOTH
     
    558562  GR_CHECK_F( myName, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid");
    559563  GR_CHECK_F( myName, !info, "invalid info pointer" );
    560  
     564
    561565  /*-------------------------------------------------------------
    562566    Update Texture Unit State
    563567    -------------------------------------------------------------*/
    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
    568572  /*-------------------------------------------------------------
    569573    Calculate Base Address
    570574    -------------------------------------------------------------*/
    571575  baseAddress = _grTexCalcBaseAddress( startAddress,
    572                                        info->largeLod, 
     576                                       info->largeLod,
    573577                                       info->aspectRatio,
    574578                                       info->format,
     
    580584  texMode &= ~SST_TFORMAT;
    581585  texMode |= ( info->format << SST_TFORMAT_SHIFT ) | SST_TPERSP_ST | SST_TCLAMPW;
    582  
     586
    583587  /*-------------------------------------------------------------
    584588    Compute TLOD (keep LODBIAS in tact)
     
    588592            SST_LOD_TSPLIT | SST_LOD_ODD | SST_LOD_S_IS_WIDER);
    589593  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 ?
    591595                              info->largeLod : info->smallLod);
    592596  tLod |= _gr_evenOdd_xlate_table[evenOdd];
     
    600604  GR_SET( hw->tLOD , tLod );
    601605  PACKER_WORKAROUND;
    602  
     606
    603607  /* 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
    608612  GR_END();
    609613} /* grTexSource */
     
    627631{
    628632  FxU32 tLod;
    629    
     633
    630634  GR_BEGIN("grTexMultibase",88,4+PACKER_WORKAROUND_SIZE);
    631635  GDBG_INFO_MORE((gc->myLevel,"(%d,%d)\n",tmu,enable));
    632636  GR_CHECK_TMU(myName,tmu);
    633  
     637
    634638  tLod  = gc->state.tmu_config[tmu].tLOD;
    635639  if ( enable )
     
    663667             GR_TEXBASE_64
    664668             GR_TEXBASE_32_TO_1
    665     startAddress - start address that data was downloaded to 
     669    startAddress - start address that data was downloaded to
    666670                    hardware with using grTexDownload/Level
    667671    info         - pointer to GrTexInfo structure containing
     
    682686  GR_CHECK_F( myName, evenOdd > 0x3, "evenOdd mask invalid" );
    683687  GR_CHECK_F( myName, info, "invalid info pointer" );
    684  
     688
    685689
    686690  /* Write relevant registers out to hardware and shadows */
     
    695699                                           evenOdd ) >> 3;
    696700      GR_SET( hw->texBaseAddr , baseAddress );
    697       gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 
     701      gc->state.tmu_config[tmu].texBaseAddr = baseAddress;
    698702      break;
    699703    case GR_TEXBASE_128:
     
    704708                                           evenOdd ) >> 3;
    705709      GR_SET( hw->texBaseAddr1 , baseAddress );
    706       gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 
     710      gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress;
    707711      break;
    708712    case GR_TEXBASE_64:
     
    713717                                           evenOdd ) >> 3;
    714718      GR_SET( hw->texBaseAddr2 , baseAddress );
    715       gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 
     719      gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress;
    716720      break;
    717721    case GR_TEXBASE_32_TO_1:
     
    722726                                           evenOdd ) >> 3;
    723727      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;
    725729      break;
    726730  }
     
    736740** debugging purposes.  GMT: obsolete, please remove
    737741*/
    738 void 
     742void
    739743_grTexForceLod( GrChipID_t tmu, int value )
    740744{
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 28    6/19/97 7:35p Dow
    2731 * More P6 Stuff
    28  * 
     32 *
    2933 * 27    6/10/97 3:59p Garymct
    3034 * Fixed a bug in a sanity checking macro.
    31  * 
     35 *
    3236 * 26    6/10/97 11:09a Pgj
    3337 * fix 8-bit & optimize
    34  * 
     38 *
    3539 * 25    6/08/97 11:06p Pgj
    3640 * use Group Write for Texture Downloads
    37  * 
     41 *
    3842 * 24    5/09/97 5:12p Jdt
    3943 * Removed redundant download of NCC Table
    40  * 
     44 *
    4145 * 23    3/18/97 9:07p Dow
    4246 * Got rid of #$#%#$ // comments
    43  * 
     47 *
    4448 * 22    3/15/97 8:08p Jdt
    4549 * Moved grTexDownloadTable into this file as it not precisely DI.
    46  * 
     50 *
    4751 * 21    3/04/97 9:08p Dow
    4852 * Neutered multiplatform multiheaded monster
    49  * 
     53 *
    5054 * 20    2/26/97 11:58a Jdt
    5155 * fixed a warning
    52  * 
     56 *
    5357 * 19    2/19/97 4:25p Hanson
    5458 * Added Gary T's changes to the expected size value for texture downloads
    55  * 
     59 *
    5660 * 18    2/18/97 9:52a Jdt
    5761 * Fixed some warnings.
    58  * 
     62 *
    5963 * 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 *
    6266 * 16    2/12/97 12:34p Dow
    6367 * Fixed Hanson muckage
    64  * 
     68 *
    6569 * 15    2/12/97 12:03p Hanson
    6670 * Adjusted Convert and download code for Descent
    67  * 
     71 *
    6872 * 14    2/12/97 11:30a Hanson
    6973 * Added ConvertRle function
    70  * 
     74 *
    7175 * 13    1/27/97 2:29p Murali
    7276 * Changed texture download code to help compiler use registers optimally.
    73  * 
     77 *
    7478 * 12    12/23/96 1:37p Dow
    7579 * chagnes for multiplatform glide
    76  * 
     80 *
    7781 * 11    11/18/96 9:13a Sellers
    7882 * fixed bug in checking for crossing of 2 MByte texture boundry
     
    102106  int i;
    103107  FxU32 *hwNCC;
    104  
     108
    105109  GR_BEGIN_NOFIFOCHECK("_grTexDownloadNccTable",89);
    106110  GDBG_INFO_MORE((gc->myLevel,"(%d,%d, 0x%x, %d,%d)\n",tmu,which,table,start,end));
     
    187191    thisLod      - lod constant that describes the mipmap level
    188192                    to be downloaded
    189     largeLod     - largest level of detail in complete mipmap to 
     193    largeLod     - largest level of detail in complete mipmap to
    190194                   be downloaded at startAddress of which level to
    191195                   be downloaded is a part
     
    195199                    the selected texture
    196200                    One of:
    197                       GR_MIPMAPLEVELMASK_EVEN 
     201                      GR_MIPMAPLEVELMASK_EVEN
    198202                      GR_MIPMAPLEVELMASK_ODD
    199203                      GR_MIPMAPLEVELMASK_BOTH
     
    205209GR_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 ))
    206210{
    207   const FxU8  *src8  = ( const FxU8  * ) data; 
     211  const FxU8  *src8  = ( const FxU8  * ) data;
    208212  const FxU16 *src16 = ( const FxU16 * ) data;
    209213  FxI32   sh, bytesPerTexel;
     
    255259  GR_ASSERT(( (max_s) & (max_s -1) ) == 0);
    256260
    257  
     261
    258262  /*------------------------------------------------------------
    259263    Compute Base Address Given Start Address Offset
    260264    ------------------------------------------------------------*/
    261265  baseAddress = _grTexCalcBaseAddress( startAddress,
    262                                        largeLod, 
     266                                       largeLod,
    263267                                       aspectRatio,
    264268                                       format,
     
    271275  tmu_baseaddress = (FxU32)gc->tex_ptr;
    272276  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
    276280    ------------------------------------------------------------*/
    277281  tLod = SST_TLOD_MINMAX_INT(largeLod,GR_LOD_1);
     
    317321        SET_TRAM( tex_address, *(const FxU8*) src8);
    318322        src8 += 1;
    319         tex_address += (1 << 9); 
     323        tex_address += (1 << 9);
    320324      }
    321325      break;
     
    326330        SET_TRAM( tex_address, *(const FxU16*) src8);
    327331        src8 += 2;
    328         tex_address += (1 << 9); 
     332        tex_address += (1 << 9);
    329333      }
    330334      break;
     
    335339        SET_TRAM( tex_address, *(const FxU32*) src8);
    336340        src8 += 4;
    337         tex_address += (1 << 9); 
     341        tex_address += (1 << 9);
    338342      }
    339343      break;
     
    356360            src8 += 8;
    357361          }
    358         } 
     362        }
    359363      } else {                      /* New TMUs    */
    360364#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
     
    416420            src8 += 8;
    417421          }
    418         } 
     422        }
    419423#endif
    420424      }
    421425      break;
    422426    }
    423   } else { 
     427  } else {
    424428
    425429    /*------------------------------------------------------------
     
    434438        SET_TRAM( tex_address, *src16 );
    435439        src16 += 1;
    436         tex_address += (1 << 9); 
     440        tex_address += (1 << 9);
    437441      }
    438442      break;
     
    443447        SET_TRAM( tex_address, *(const FxU32 *)src16 );
    444448        src16 += 2;
    445         tex_address += (1 << 9); 
     449        tex_address += (1 << 9);
    446450      }
    447451      break;
     
    505509    }
    506510  } /* end switch( width ) */
    507  
     511
    508512  /* Flush the write buffers after the texture downloads */
    509513  P6FENCE;
     
    564568  P6FENCE;
    565569  GR_END();
    566 } /* _grTexDownloadPalette */ 
     570} /* _grTexDownloadPalette */
    567571
    568572
    569573#ifndef __linux__
    570 /* 
     574/*
    571575   Let me take this opportunity to register my formal opposition to
    572576   this function.  Either we do this or we don't.  Let's not hack like
     
    592596/* make sure even number */
    593597  width&=0xFFFFFFFE;
    594  
     598
    595599  max_s=width>>1;
    596600  max_t=height;
    597  
     601
    598602  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d)\n",
    599603                  tmu,startAddress,thisLod,largeLod,aspectRatio,
     
    622626  if ( !(evenOdd & (thisLod & 0x1 ? GR_MIPMAPLEVELMASK_ODD:GR_MIPMAPLEVELMASK_EVEN)))
    623627      goto all_done;
    624  
     628
    625629  /*------------------------------------------------------------
    626630    Compute Base Address Given Start Address Offset
    627631    ------------------------------------------------------------*/
    628632  baseAddress = _grTexCalcBaseAddress( startAddress,
    629                                        largeLod, 
     633                                       largeLod,
    630634                                       aspectRatio,
    631635                                       format,
     
    638642  tmu_baseaddress = (FxU32)gc->tex_ptr;
    639643  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
    643647    ------------------------------------------------------------*/
    644648  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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 12    12/19/97 8:09a Peter
    2731 * fog table propogation
    28  * 
     32 *
    2933 * 11    3/09/97 10:31a Dow
    3034 * Added GR_DIENTRY for di glide functions
    31  * 
     35 *
    3236 * 10    3/05/97 9:36p Jdt
    3337 * Added guEncodeRLE16
    34  * 
     38 *
    3539 * 9     12/23/96 1:37p Dow
    3640 * chagnes for multiplatform glide
     
    161165    grColorCombine( GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_NONE, FXTRUE );
    162166    break;
    163    
     167
    164168  default:
    165169    GR_CHECK_F("grColorCombineFunction", 1, "unsupported color combine function");
     
    196200*/
    197201GR_DIENTRY(guFogGenerateExp, void,
    198            ( GrFog_t fogtable[kInternalFogTableEntryCount], float density )) 
     202           ( GrFog_t fogtable[kInternalFogTableEntryCount], float density ))
    199203{
    200204  int   i;
     
    255259** guFogGenerateLinear
    256260*/
    257 GR_DIENTRY(guFogGenerateLinear, void, 
     261GR_DIENTRY(guFogGenerateLinear, void,
    258262           ( GrFog_t fogtable[kInternalFogTableEntryCount],
    259263            float nearZ, float farZ ))
     
    412416
    413417            srcPixels+=length;
    414             sourceImageSizeInWords-=length;           
     418            sourceImageSizeInWords-=length;
    415419        }
    416420    } else {
     
    428432            byteCount+=4;
    429433            srcPixels+=length;
    430             sourceImageSizeInWords-=length;           
     434            sourceImageSizeInWords-=length;
    431435        }
    432436    }
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 6     8/14/97 5:32p Pgj
    2731 * remove dead code per GMT
    28  * 
     32 *
    2933 * 5     6/27/97 4:16p Atai
    3034 * fixed guDrawTriangleWithClip bug (#484) by removing +1.0F and -1.0F in
    3135 * intersectTop(), intersectBottom(), intersectLeft(), and
    3236 * intersectRight() routine
    33  * 
     37 *
    3438 * 4     3/09/97 10:31a Dow
    3539 * Added GR_DIENTRY for di glide functions
     
    5458    isect->b = a->b + d * ( b->b - a->b );
    5559  }
    56    
     60
    5761  if (gc->state.paramIndex & STATE_REQUIRES_IT_ALPHA) {
    5862    isect->a        = a->a        + d * ( b->a - a->a );
     
    98102} /* calcParams */
    99103
    100 static void 
     104static void
    101105intersectTop( const GrVertex *a, const GrVertex *b, GrVertex *intersect )
    102106{
     
    104108  float
    105109    d = ( gc->state.clipwindowf_ymin - a->y ) / ( b->y - a->y );
    106  
     110
    107111  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
    110114  calcParams(a, b, intersect, d);
    111115
     
    118122  float
    119123    d = ( gc->state.clipwindowf_ymax - a->y ) / ( b->y - a->y );
    120  
     124
    121125  intersect->x        = a->x        + d * ( b->x - a->x );
    122   intersect->y        = gc->state.clipwindowf_ymax; 
     126  intersect->y        = gc->state.clipwindowf_ymax;
    123127
    124128  calcParams(a, b, intersect, d);
     
    132136  float
    133137    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;
    136140  intersect->y        = a->y        + d * ( b->y - a->y );
    137141
     
    146150  float
    147151    d = ( gc->state.clipwindowf_xmin - a->x ) / ( b->x - a->x );
    148  
     152
    149153  intersect->x        = gc->state.clipwindowf_xmin;
    150154  intersect->y        = a->y        + d * ( b->y - a->y );
     
    160164  return (( p->y > gc->state.clipwindowf_ymin ) ? FXTRUE : FXFALSE);
    161165} /* aboveYMin */
    162      
     166
    163167
    164168static FxBool
     
    202206  int
    203207    j;
    204  
     208
    205209  *outlength = 0;
    206  
     210
    207211  s = invertexarray[inlength-1];
    208212  for ( j = 0; j < inlength; j++ ) {
     
    291295  input_array[1] = *b;
    292296  input_array[2] = *c;
    293  
     297
    294298  shClipPolygon( input_array,   output_array,  3,         &outlength, belowXMax, intersectRight );
    295299  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
    296300  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
    297301  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
    298  
     302
    299303  /*
    300304   ** snap vertices then decompose the n-gon into triangles
     
    360364  input_array[1] = *b;
    361365  input_array[2] = *c;
    362  
     366
    363367  shClipPolygon( input_array,   output_array,  3,         &outlength, belowXMax, intersectRight );
    364368  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
    365369  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
    366370  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
    367  
     371
    368372  /*
    369373   ** 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 7     11/12/97 5:11p Pgj
    2731 * stubs for evil guFb{Read|Write}Region()
    28  * 
     32 *
    2933 * 6     3/09/97 10:31a Dow
    3034 * Added GR_DIENTRY for di glide functions
    31  * 
     35 *
    3236 * 5     12/23/96 1:37p Dow
    3337 * chagnes for multiplatform glide
     
    6266}
    6367
    64 GR_DIENTRY(guMPTexCombineFunction, void, 
     68GR_DIENTRY(guMPTexCombineFunction, void,
    6569           ( GrMPTextureCombineFnc_t tc_fnc ))
    6670{
     
    6973}
    7074
    71 GR_DIENTRY(guMPTexSource, void, 
     75GR_DIENTRY(guMPTexSource, void,
    7276           ( GrChipID_t virtual_tmu, GrMipMapId_t mmid ))
    7377{
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 7     3/04/97 9:08p Dow
    2731 * Neutered multiplatform multiheaded monster
    28  * 
     32 *
    2933 * 6     12/23/96 1:37p Dow
    3034 * chagnes for multiplatform glide
    31  * 
     35 *
    3236 * 5     11/18/96 9:14a Sellers
    3337 * added checking for crossing of 2 MByte texture boundry
     
    99103
    100104  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 |
    105109                   SST_TRILINEAR );
    106110  texMode |= oldtexMode;
     
    108112    texMode &= ~SST_TLODDITHER;
    109113
    110  /* 
    111   **  Download the NCC table, if needed. 
     114 /*
     115  **  Download the NCC table, if needed.
    112116  */
    113117  if (
     
    165169  gc->state.tmu_config[tmu].textureMode = texMode;
    166170  gc->state.tmu_config[tmu].tLOD = tLod;
    167  
     171
    168172  GR_END();
    169173} /* 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 36    9/19/97 12:38p Peter
    2731 * asm rush trisetup vs alt fifo
    28  * 
     32 *
    2933 * 35    9/10/97 10:13p Peter
    3034 * fifo logic from GaryT, non-normalized fp first cut
    31  * 
     35 *
    3236 * 34    8/19/97 8:55p Peter
    3337 * lots of stuff, hopefully no muckage
    34  * 
     38 *
    3539 * 33    8/01/97 11:49a Dow
    3640 * Added conventional FIFO accounting
    37  * 
     41 *
    3842 * 32    7/07/97 3:43p Jdt
    3943 * Fixes to trisetup_nogradients
    40  * 
     44 *
    4145 * 31    7/07/97 2:14p Jdt
    4246 * Mods to drawtriangle for parity with asm
    43  * 
     47 *
    4448 * 30    7/07/97 8:33a Jdt
    4549 * New tracing macros.
    46  * 
     50 *
    4751 * 29    7/04/97 12:08p Dow
    4852 * Fixed chip field muckage
    49  * 
     53 *
    5054 * 28    7/01/97 7:44a Jdt
    5155 * Separated SST-1 and SST-96 trisetup implementations.
    52  * 
     56 *
    5357 * 27    6/30/97 3:30p Jdt
    5458 * Fixed Watcom Wart.
    55  * 
     59 *
    5660 * 26    6/30/97 3:23p Jdt
    5761 * rollback
    58  * 
     62 *
    5963 * 24    6/29/97 11:49p Jdt
    6064 * First pass at triangle setup optimization for SST96
    61  * 
     65 *
    6266 * 23    6/20/97 5:53p Dow
    6367 * Change for subtle chip field bug
    64  * 
     68 *
    6569 * 22    6/18/97 5:54p Dow
    6670 * P6 adjustments
    67  * 
     71 *
    6872 * 21    5/27/97 11:37p Pgj
    6973 * Fix for Bug report 545
    70  * 
     74 *
    7175 * 20    4/13/97 2:06p Pgj
    7276 * eliminate all anonymous unions (use hwDep)
    73  * 
     77 *
    7478 * 19    3/21/97 12:42p Dow
    7579 * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
    76  * 
     80 *
    7781 * 18    3/04/97 9:45p Dow
    7882 * More neutering of the multiheaded...
    79  * 
     83 *
    8084 * 17    3/04/97 9:08p Dow
    8185 * Neutered multiplatform multiheaded monster
    82  * 
     86 *
    8387 * 16    2/14/97 12:55p Dow
    8488 * moved vg96 fifo wrap into init code
    85  * 
     89 *
    8690 * 15    12/23/96 1:37p Dow
    8791 * chagnes for multiplatform glide
     
    99103#ifdef GDBG_INFO_ON
    100104  /* Some debugging information */
    101 static char *indexNames[] = { 
     105static char *indexNames[] = {
    102106  "GR_VERTEX_X_OFFSET",         /* 0 */
    103107  "GR_VERTEX_Y_OFFSET",         /* 1 */
     
    115119  "GR_VERTEX_TOW_TMU1_OFFSET",  /* 13 */
    116120  "GR_VERTEX_OOW_TMU1_OFFSET"  /* 14 */
    117 }; 
     121};
    118122#endif
    119123
     
    129133 **  the starting point.
    130134**
    131 */ 
     135*/
    132136
    133137#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
     
    145149  struct dataList_s *dlp;
    146150  volatile FxU32 *fifoPtr;
    147  
     151
    148152  culltest = gc->state.cull_mode; /* 1 if negative, 0 if positive */
    149153  _GlideRoot.stats.trisProcessed++;
    150  
     154
    151155  /*
    152156   **  Sort the vertices.
     
    154158   **  clockwise), we need to change the area of the triangle.  Note
    155159   **  that we know the first two elements are X & Y by looking at the
    156    **  grVertex structure. 
     160   **  grVertex structure.
    157161   */
    158162  ay = *(int *)&va->y;
     
    199203  dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
    200204  dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
    201  
     205
    202206  dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
    203207  dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
    204  
     208
    205209  /* this is where we store the area */
    206210  _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
    207  
     211
    208212  /* Zero-area triangles are BAD!! */
    209213  j = *(long *)&_GlideRoot.pool.ftemp1;
    210214  if ((j & 0x7FFFFFFF) == 0)
    211215    return 0;
    212  
     216
    213217  /* Backface culling, use sign bit as test */
    214218  if (gc->state.cull_mode != GR_CULL_DISABLE) {
     
    217221    }
    218222  }
    219  
     223
    220224  /* Fence On P6 If Necessary */
    221225  if ( _GlideRoot.CPUType == 6 ) {
     
    225229          gc->hwDep.sst96Dep.writesSinceFence = 0;
    226230      }
    227       gc->hwDep.sst96Dep.writesSinceFence      += 
     231      gc->hwDep.sst96Dep.writesSinceFence      +=
    228232          _GlideRoot.curTriSize>>2;
    229233  }
     
    238242#endif
    239243  }
    240  
     244
    241245  GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
    242246
    243247  /* Grab fifo pointer into a local */
    244248  fifoPtr = gc->fifoData.hwDep.vg96FIFOData.fifoPtr;
    245  
     249
    246250  /* Settle Bookeeping */
    247251  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= _GlideRoot.curTriSize;
    248252  gc->fifoData.hwDep.vg96FIFOData.fifoPtr  += _GlideRoot.curTriSize>>2;
    249  
     253
    250254  /* Start first group write packet */
    251255  SET_GW_CMD(    fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
     
    260264  dlp = gc->dataList;
    261265  i = dlp->i;
    262  
     266
    263267  /* write out X & Y for vertex B */
    264268  FSET_GW_ENTRY( fifoPtr, 4, fb[0] );
     
    284288    fp = dlp->addr;
    285289    /* chip field change */
    286     if (i & 1) 
     290    if (i & 1)
    287291        goto secondary_packet;
    288292    else {
    289293      float dpAB, dpBC,dpdx, dpdy;
    290      
     294
    291295      dpBC = FARRAY(fb,i);
    292296      dpdx = FARRAY(fa,i);
     
    308312  FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
    309313  fifoPtr+=1;
    310  
     314
    311315  if (((FxU32)fifoPtr) & 0x7) {
    312316    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
     
    317321
    318322  GR_CHECK_SIZE();
    319  
     323
    320324  _GlideRoot.stats.trisDrawn++;
    321325
     
    329333  }
    330334  /* Start new packet
    331      note, there can only ever be two different packets 
     335     note, there can only ever be two different packets
    332336     using gwHeaderNum++ would be more general, but this
    333337     reflects the actual implementation */
     
    376380  float *fp;
    377381  struct dataList_s *dlp;
    378  
     382
    379383  culltest = gc->state.cull_mode; /* 1 if negative, 0 if positive */
    380384  _GlideRoot.stats.trisProcessed++;
    381  
     385
    382386  /*
    383387   **  Sort the vertices.
     
    385389   **  clockwise), we need to change the area of the triangle.  Note
    386390   **  that we know the first two elements are X & Y by looking at the
    387    **  grVertex structure. 
     391   **  grVertex structure.
    388392   */
    389393  ay = *(int *)&va->y;
     
    432436  dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
    433437  dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
    434  
     438
    435439  dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
    436440  dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
    437  
     441
    438442  /* this is where we store the area */
    439443  _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
    440  
     444
    441445  /* Zero-area triangles are BAD!! */
    442446  j = *(long *)&_GlideRoot.pool.ftemp1;
    443447  if ((j & 0x7FFFFFFF) == 0)
    444448    return 0;
    445  
     449
    446450  /* Backface culling, use sign bit as test */
    447451  if (gc->state.cull_mode != GR_CULL_DISABLE) {
     
    450454    }
    451455  }
    452  
     456
    453457  GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
    454  
     458
    455459  ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
    456460  /* GMT: note that we spread out our PCI writes */
     
    461465  dlp = gc->dataList;
    462466  i = dlp->i;
    463  
     467
    464468  /* write out X & Y for vertex B */
    465469  GR_SETF( hw->FvB.x, fb[GR_VERTEX_X_OFFSET] );
    466470  GR_SETF( hw->FvB.y, fb[GR_VERTEX_Y_OFFSET] );
    467  
     471
    468472  /* write out X & Y for vertex C */
    469473  GR_SETF( hw->FvC.x, fc[GR_VERTEX_X_OFFSET] );
     
    481485#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
    482486
    483   /* 
     487  /*
    484488  ** The src vector contains offsets from fa, fb, and fc to for which
    485489  **  gradients need to be calculated, and is null-terminated.
     
    536540**  Also we assume we don't have to test for backface triangles - this is
    537541**  typically done outside this routine, as in grDrawPlanarPolygon
    538 */ 
     542*/
    539543
    540544#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
     
    558562  **  clockwise), we need to change the area of the triangle.  Note
    559563  **  that we know the first two elements are X & Y by looking at the
    560   **  grVertex structure. 
     564  **  grVertex structure.
    561565  */
    562566  ay = *(int *)&va->y;
     
    617621  if ( _GlideRoot.CPUType == 6 ) {
    618622      /* 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 +
    620624            ( _GlideRoot.curTriSizeNoGradient >> 2 )) > 128 ) {
    621625          P6FENCE;
    622626          gc->hwDep.sst96Dep.writesSinceFence = 0;
    623627      }
    624       gc->hwDep.sst96Dep.writesSinceFence      += 
     628      gc->hwDep.sst96Dep.writesSinceFence      +=
    625629          _GlideRoot.curTriSizeNoGradient>>2;
    626630  }
     
    650654  dlp = gc->dataList;
    651655  i = dlp->i;
    652  
     656
    653657  /* write out X & Y for vertex B */
    654658  FSET_GW_ENTRY( fifoPtr, 4, fb[0] );
     
    668672  while (i) {
    669673    fp = dlp->addr;
    670     if (i & 1) 
     674    if (i & 1)
    671675        goto secondary_packet;
    672676    else {
     
    703707
    704708  /* Start new packet
    705      note, there can only ever be two different packets 
     709     note, there can only ever be two different packets
    706710     using gwHeaderNum++ would be more general, but this
    707711     reflects the actual implementation */
     
    749753  **  clockwise), we need to change the area of the triangle.  Note
    750754  **  that we know the first two elements are X & Y by looking at the
    751   **  grVertex structure. 
     755  **  grVertex structure.
    752756  */
    753757  ay = *(int *)&va->y;
     
    819823    return 0;
    820824  }
    821  
     825
    822826  /* write out X & Y for vertex C */
    823827  GR_SETF( hw->FvC.x, fc[GR_VERTEX_X_OFFSET] );
     
    830834#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
    831835
    832   /* 
     836  /*
    833837  ** The src vector contains offsets from fa, fb, and fc to for which
    834838  ** 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
     
    35783582};
    35793583
    3580 static Vert *vert[] = { 
     3584static Vert *vert[] = {
    35813585vert_0,
    35823586vert_1,
     
    35903594};
    35913595
    3592 static Face *face[] = { 
     3596static Face *face[] = {
    35933597face_0,
    35943598face_1,
     
    45944598}
    45954599};
    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
    45984602unsigned char RAW_NAME[] = {
    459946030x40,
     
    1112211126};
    1112311127
    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
    1112811132unsigned char RAW_NAME[] = {
    11129111330x20,
     
    1355613560};
    1355713561
    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
    1356213566unsigned char RAW_NAME[] = {
    13563135670x40,
     
    1735817362};
    1735917363
    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    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 sandervl Exp $
     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 $
    2122** $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
    2327** Created new Voodoo 1 Glide dir
    2428**
    25  * 
     29 *
    2630 * 20    9/19/97 12:38p Peter
    2731 * asm rush trisetup vs alt fifo
    28  * 
     32 *
    2933 * 19    9/12/97 12:56p Dow
    3034 * Protected JUJU code
    31  * 
     35 *
    3236 * 18    9/11/97 2:22p Atai
    3337 * fixed muckage
    34  * 
     38 *
    3539 * 17    9/10/97 10:15p Peter
    3640 * fifo logic from GaryT
    37  * 
     41 *
    3842 * 16    8/19/97 8:55p Peter
    3943 * lots of stuff, hopefully no muckage
    40  * 
     44 *
    4145 * 15    8/01/97 11:49a Dow
    4246 * Allowed for non4K fifo wraps
    43  * 
     47 *
    4448 * 14    7/08/97 1:29p Jdt
    4549 * Fixed watcom muckage
    46  * 
     50 *
    4751 * 13    7/04/97 12:08p Dow
    4852 * Modified GWP debugging
    49  * 
     53 *
    5054 * 12    6/20/97 5:54p Dow
    5155 * Moved grDebugGroupWriteHeader in here.
    52  * 
     56 *
    5357 * 11    6/18/97 5:54p Dow
    5458 * P6 adjustments
    55  * 
     59 *
    5660 * 10    5/27/97 2:03p Dow
    5761 * added new assertion
    58  * 
     62 *
    5963 * 9     5/04/97 12:49p Dow
    6064 * Moved texture downloads to level 195, like on SST1
    61  * 
     65 *
    6266 * 8     4/13/97 2:06p Pgj
    6367 * eliminate all anonymous unions (use hwDep)
    64  * 
     68 *
    6569 * 7     3/16/97 12:39a Jdt
    6670 * initWrapFifo only neads fifodata...
    67  * 
     71 *
    6872 * 6     3/04/97 9:12p Dow
    6973 * Neutered mutiplatform multiheaded monster.
    70  * 
     74 *
    7175 * 5     2/18/97 9:53a Jdt
    7276 * Removed some unecessary declarations.
    73  * 
     77 *
    7478 * 4     2/14/97 12:55p Dow
    7579 * moved vg96 fifo wrap into init code
    76  * 
     80 *
    7781 * 3     2/11/97 6:59p Dow
    7882 * Changes to support vid tiles and ser status
    79  * 
     83 *
    8084 * 2     1/14/97 10:49a Dow
    8185 * Changed all output to use GDBG_INFO
    8286 * Renabled some messages
    83  * 
     87 *
    8488 * 1     12/23/96 1:39p Dow
    8589 * Changes for multiplatform
     
    369373#if defined(GDBG_INFO_ON) && (GLIDE_PLATFORM & GLIDE_HW_SST96)
    370374void
    371 _grDebugGroupWriteHeader(FxU32 header, FxU32 address) 
     375_grDebugGroupWriteHeader(FxU32 header, FxU32 address)
    372376{
    373377#define FN_NAME "_grDebugGroupWriteHeader"
     
    389393  GDBG_INFO((128, "PCI Address:  0x%x\n", (address & 0xfffff) << 2));
    390394  GDBG_INFO((128, "Chip Field:   0x%x\n", (address >> 14) & 0xf));
    391            
     395
    392396  offset = (address & ~(0xf << 14)) & 0xfffff;
    393397  index = offset;
    394398
    395399  if (offset < 0x100 ) { /* It's state or triangle */
    396    
     400
    397401    GDBG_INFO((128, "Start:     0x%s (0x%x)\n", regNames[index], index));
    398402    GDBG_INFO((128, "Mask:      0x%x\n", header));
    399    
     403
    400404    while (lheader) {
    401405      if (lheader & 0x1) {
     
    420424
    421425  GDBG_INFO((128, "%s:  %d bits of mask 0x%x were set\n", FN_NAME,
    422              nBits, header)); 
     426             nBits, header));
    423427
    424428  GR_ASSERT(nBits);
     
    435439    index = GEN_INDEX(addr);
    436440  char
    437     *regName; 
     441    *regName;
    438442
    439443  regName = (index <= 0xff) ? regNames[index] : "TRAM";
    440  
    441   if (index <= 0xff) { 
     444
     445  if (index <= 0xff) {
    442446    GDBG_INFO((120, "Storing to FIFO:\n"));
    443447    GDBG_INFO((120, "\tReg Name:    %s\n", regName));
     
    457461    index = GEN_INDEX(addr);
    458462  char
    459     *regName; 
     463    *regName;
    460464
    461465  if (index <= 0xff) {
    462    
     466
    463467    regName = regNames[index];
    464    
     468
    465469    GDBG_INFO((120, "Storing to FIFO:\n"));
    466470    GDBG_INFO((120, "\tReg Name:    %s\n", regName));
     
    475479    GDBG_INFO((195, "\tFIFO Ptr:    0x%x\n", fifoPtr));
    476480    GDBG_INFO((120, "\tFIFO Test:    0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoSize));
    477   } 
     481  }
    478482} /* _grFifoFWriteDebug */
    479483
    480484
    481485/*--------------------------------------------------------------------------
    482 ** _grSst96PCIFifoEmpty 
     486** _grSst96PCIFifoEmpty
    483487*/
    484488FxBool
     
    495499    if (SST96_PCI_FIFO_EMPTY(hw))
    496500      return FXTRUE;
    497    
     501
    498502    if (!(++count % COUNT_PATIENCE_VALUE)) {
    499503      GDBG_INFO((120, "Losing Patients after %d tries\n", COUNT_PATIENCE_VALUE));
     
    501505    }
    502506  }
    503   return FXFALSE; 
     507  return FXFALSE;
    504508} /* _grSst96PCIFifoEmpty */
    505509
     
    509513
    510514void GR_CDECL
    511 _grSst96FifoMakeRoom(void) 
     515_grSst96FifoMakeRoom(void)
    512516{
    513517  GR_DCL_GC;
    514518#ifdef SST96_ALT_FIFO_WRAP
    515519  /* NB: W/ the alternate fifo wrapping stuff on only the asm
    516    * tri-setup uses this routine. 
     520   * tri-setup uses this routine.
    517521   */
    518522  gc->fifoData.hwDep.vg96FIFOData.blockSize = _GlideRoot.curTriSize;
     
    546550    GDBG_INFO((120, "\tReg Val:         0x%x\n", regVal));
    547551  }
    548      
     552
    549553  return regVal;
    550554
     
    695699  fifoStartGC = (FxU32) gc->fifoData.hwDep.vg96FIFOData.fifoVirt - (FxU32) gc->base_ptr;
    696700  fifoWrPtrGC = (FxU32) gc->fifoData.hwDep.vg96FIFOData.fifoPtr - (FxU32) gc->base_ptr;
    697  
     701
    698702  /* Deduce relevant data from registers */
    699703  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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:26 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:00 $
    2324**
    2425*/
     
    5657static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) {
    5758  return 0;
    58 } 
     59}
    5960
    6061static FxU32 FX_CALL status( void ) {
    6162  return 0;
    62 } 
     63}
    6364
    6465static FxBool FX_CALL busy(void) {
    6566  return 0;
    66 } 
     67}
    6768
    6869static 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:26 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:00 $
    2324**
    2425*/
     
    99100  if ( !libInitialized ) {
    100101
    101     /* When initializing the Library snoop out all 3Dfx devices 
     102    /* When initializing the Library snoop out all 3Dfx devices
    102103       and fill a static data structure with pertinant data.  */
    103104
     
    128129              hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr =
    129130                (FxU32)sst1InitMapBoard( numSst1s );
    130               hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr = 
     131              hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr =
    131132                (FxU32*)hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr;
    132133              numSst1s++;
     
    177178            _outp(0x3d4, 0x3f);
    178179            regVal = _inp(0x3d5);
    179            
     180
    180181            if (!(regVal & (1 << 2))) /* we're not there */
    181182              continue;
     
    196197#endif
    197198
    198           hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr = 
     199          hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr =
    199200            (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.partnerRegPtr;
    200           hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = 
     201          hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr =
    201202            (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.baseAddress;
    202          
     203
    203204          numDevicesInSystem++;
    204         } 
     205        }
    205206#else
    206207#  error "Do hardware enumeration for this chip!"
     
    208209      }
    209210    }
    210    
     211
    211212
    212213    /* Sanity Check for SLI detection */
     
    228229    libInitialized = FXTRUE;
    229230  }
    230  
     231
    231232  if ( cb ) {
    232233    for( device = 0; device < numDevicesInSystem; device++ ) {
    233234      cb( &hwInfo[device] );
    234     } 
     235    }
    235236  }
    236237  return;
     
    242243   volatile FxU32* retVal = NULL;
    243244   FxBool okP = (boardNum < INIT_MAX_DEVICES);
    244    
     245
    245246   if (okP) {
    246247      InitDeviceInfo* infoP = (hwInfo + boardNum);
    247248      const FxU32 vId = infoP->vendorID;
    248249      const FxU32 dId = infoP->deviceID;
    249      
     250
    250251#if defined(SST1)
    251252      okP = ((vId == TDFXVID) &&
     
    294295        pciClose();
    295296        libInitialized = FXFALSE;
    296     } 
     297    }
    297298} /* initClose */
    298299
     
    334335  Implementor(s): jdt
    335336  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
    338339  initializes the internal init driver functions with behavior appropriate
    339340  to the type of the selected device.
     
    346347
    347348FxBool
    348 initDeviceSelect( FxU32 devNumber ) 
     349initDeviceSelect( FxU32 devNumber )
    349350{
    350351  FxBool rv = FXFALSE;
    351  
     352
    352353  if ( devNumber < numDevicesInSystem ) {
    353354    context = &contexts[hwInfo[devNumber].hwClass];
    354355    context->info = hwInfo[devNumber];
    355356    rv =  FXTRUE;
    356   } 
    357  
     357  }
     358
    358359  return rv;
    359360
     
    390391        prior to rendering.
    391392  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
    393394         the application window handle will be inferred though
    394395         the GetActiveWindow() api.
     
    431432    FxBool rv;
    432433    if ( context ) {
    433         rv = context->setVideo( hWnd, sRes, vRefresh, cFormat, 
     434        rv = context->setVideo( hWnd, sRes, vRefresh, cFormat,
    434435                                yOrigin, nColBuffers, nAuxBuffers,
    435436                                xres, yres, fbStride, vidTimings);
     
    454455  -------------------------------------------------------------------*/
    455456void initRestoreVideo( void ) {
    456     if ( context ) 
     457    if ( context )
    457458        context->restoreVideo();
    458459} /* initRestoreVideo */
     
    464465  Library: init
    465466  Description:
    466   Enable the command transport mechanism for the underlying 
     467  Enable the command transport mechanism for the underlying
    467468  hardware and return information about accessing the transport
    468469  to the caller
     
    496497  -------------------------------------------------------------------*/
    497498void initDisableTransport( void ) {
    498     if ( context ) 
     499    if ( context )
    499500        context->disableTransport();
    500501} /* initDisableTransport */
     
    506507  Library: init
    507508  Description:
    508   Initiate a buffer swap. 
    509   Arguments: 
     509  Initiate a buffer swap.
     510  Arguments:
    510511  code - code describing type of swap, wether to sync to vretrace, how
    511512         many vretraces to wait, etc.
     
    567568  Library: init
    568569  Description:
    569   Returns only when graphics pipeline is completely idle. 
     570  Returns only when graphics pipeline is completely idle.
    570571  May hang software if hardware is permanently busy.
    571572  Arguments:
     
    587588  Get the current pointer to a particular buffer
    588589  Arguments:
    589   buffer - which buffer to get pointer to 
     590  buffer - which buffer to get pointer to
    590591  Return:
    591592  integer pointer
     
    602603  Date: 2/25
    603604  Implementor(s): jdt
    604   Library: init 
     605  Library: init
    605606  Description:
    606607  Sets the current render buffer
     
    638639  Library: init
    639640  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
    641642  corrupting dll interface
    642643  Arguments:
     
    658659  Description:
    659660        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
    661662        and resize. Also, implicitly detach old associated buffers.
    662663  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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021** $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
    2226** Created new Voodoo 1 Glide dir
    2327**
    24  * 
     28 *
    2529 * 34    1/12/98 10:22p Dow
    2630 * H3D Stereo Support
    27  * 
     31 *
    2832 * 33    11/06/97 9:51a Jdt
    2933 * Fixes window resize events to not crash/hang
    30  * 
     34 *
    3135 * 32    10/01/97 3:21p Atai
    3236 * fix 819, DOS tests flicker on glide
    33  * 
     37 *
    3438 * 31    9/08/97 12:05p Atai
    3539 * fixed resize problem in dxControl()
    36  * 
     40 *
    3741 * 30    8/28/97 10:24a Odo
    3842 * moved debugging varaible
    39  * 
     43 *
    4044 * 29    8/27/97 10:32a Dow
    4145 * added more debugging info
    42  * 
     46 *
    4347 * 28    8/21/97 4:24p Dow
    4448 * Fixed @#$%! C++ Comments, Added Debugging info
    4549**
    46 ** $Revision: 1.1 $
    47 ** $Date: 2000-02-25 00:31:28 $
     50** $Revision: 1.2 $
     51** $Date: 2001-09-05 14:31:01 $
    4852**
    4953*/
     
    8791
    8892#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>
    9296
    9397#define NUM_BUFS 6
     
    9599static HWND                 hWndApp     = 0;
    96100static FxU32                FifoOffset  = 0;
    97 static FxU32                Width       = 0; 
     101static FxU32                Width       = 0;
    98102static FxU32                Height      = 0;
    99103static FxBool               IsFullScreen = 0;
     
    133137{
    134138  DDSURFACEDESC   ddsd;
    135  
     139
    136140  ddsd.dwSize = sizeof(ddsd);
    137   if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL) 
     141  if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL)
    138142      !=DD_OK) {
    139143    return ErrorMessage(hWndApp, "_dxSurfaceToBufDesc: DdrawSurface Lock failed\n");
    140144  }
    141  
     145
    142146  /* pDesc->bufType should be filled in by caller */
    143147  pDesc->bufOffset = (FxU32) (ddsd.lpSurface);        /* virtual address. */
    144148  pDesc->bufStride = (FxI32) (ddsd.lPitch);           /* in bytes         */
    145149  pDesc->bufBPP    = (FxI32) 16;
    146  
     150
    147151  IDirectDrawSurface2_Unlock(lpSurf, NULL);
    148152  return FXTRUE;
     
    163167  InitBufDesc_t   *dScreen = &pDesc[4];
    164168  InitBufDesc_t   *dTriple = &pDesc[5];
    165  
     169
    166170  GDBG_INFO((80, "_dxDDrawToGlide entry\n"));
    167  
     171
    168172  /* Initialize all descriptors. */
    169173  dScreen->bufMagic  = VG96_BUF_MAGIC;
     
    172176  dScreen->bufStride = 0;
    173177  dScreen->bufBPP    = 0;
    174  
     178
    175179  /* Get info about screen (primary display) */
    176180  dScreen->bufType  = INIT_BUFFER_SCREENBUFFER;
    177181  if (!_dxSurfaceToBufDesc( lpFront, dScreen))
    178182    return ErrorMessage(hWndApp, "Couldn't get Screen Info");
    179  
     183
    180184  *dFront = *dBack = *dAux = *dFifo =
    181185  *dTriple =
    182186  *dScreen;
    183  
     187
    184188  dFront->bufType   = INIT_BUFFER_FRONTBUFFER;
    185189
     
    188192  if (!_dxSurfaceToBufDesc( lpBack, dBack))
    189193    return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info");
    190  
     194
    191195  /* Get info about aux buffer */
    192196  dAux->bufType = INIT_BUFFER_AUXBUFFER;
    193   if (!_dxSurfaceToBufDesc( lpAux, dAux)) 
     197  if (!_dxSurfaceToBufDesc( lpAux, dAux))
    194198    return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info");
    195  
     199
    196200  /* Get info about triple buffer */
    197201  if (tripleBuffering) {
     
    205209  dFifo->bufOffset = FifoOffset;
    206210  dFifo->bufStride = 65536 << 1; /* Fixme!!! what's this? */
    207  
     211
    208212  /* Now convert buf addresses for draw buffers into video memory offsets */
    209213  dFront->bufOffset -= dScreen->bufOffset;
     
    212216  if (tripleBuffering)
    213217    dTriple->bufOffset -= dScreen->bufOffset;
    214  
     218
    215219  GDBG_INFO((80, "_dxDDrawToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset));
    216220  GDBG_INFO((80, "_dxDDrawToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
     
    243247{
    244248  DDSURFACEDESC   ddsd;
    245  
     249
    246250#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",
    248252             hWndApp, IsFullScreen, xRes, yRes, vRefresh, pageFlip));
    249253#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",
    251255             hWndApp, IsFullScreen, xRes, yRes, vRefresh));
    252256#endif
    253  
     257
    254258  if (lpDD1 == NULL) {
    255259    if (DirectDrawCreate( NULL, &lpDD1, NULL ) != DD_OK) {
     
    262266  }
    263267
    264   if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2, 
     268  if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2,
    265269                                   (LPVOID*)&lpDD) !=DD_OK) {
    266270
     
    272276    GDBG_INFO((80, "_dxAS: DDraw2 Obj created!\n"));
    273277  }
    274  
     278
    275279  /*
    276280   * Make sure this is done after creating direct draw object!!!
     
    281285    FifoOffset = init96GetFBVram() - 65536*3; /* fixme!!! why 3? */
    282286  }
    283  
     287
    284288  /*
    285289   * If there are any previously allocated surfaces, free them now
     
    291295  if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
    292296  if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
    293  
     297
    294298  lpClipper = NULL;
    295299  lpFront   = NULL;
     
    297301  lpTriple    = NULL;
    298302  lpAux     = NULL;
    299  
     303
    300304  if ( !IsFullScreen ) {        /* In a window */
    301305
     
    307311      return ErrorMessage(hWndApp,  "Couldn't get display mode!");
    308312
    309     if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2) 
     313    if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2)
    310314      return ErrorMessage(hWndApp,  "Display is not in 16bpp format!");
    311315
     
    317321    ddsd.dwFlags        = DDSD_CAPS;
    318322    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)
    321325      return ErrorMessage(hWndApp, "Couldn't allocate primary surface!");
    322326
     
    324328               xRes, yRes, ddsd.lPitch));
    325329    /* From jdt */
    326     if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK) 
     330    if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK)
    327331      return ErrorMessage(hWndApp, "Create Clipper failed!\n");
    328332
    329     if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK) 
     333    if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK)
    330334      return ErrorMessage(hWndApp, "Clipper SethWnd failed!\n");
    331335
    332     if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK) 
     336    if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK)
    333337      return ErrorMessage(hWndApp, "Set Clipper failed!\n");
    334338
     
    341345    ddsd.ddsCaps.dwCaps =
    342346      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)
    345349      return ErrorMessage(hWndApp,  "Couldn't allocate secondary surface!" );
    346350
    347351    GDBG_INFO((80, "_dxAS: Back buffer allocated!\n"));
    348352
    349     /* 
    350      * Always allocate Aux Buffer Surface 
     353    /*
     354     * Always allocate Aux Buffer Surface
    351355     * XXX - (use nAuxBuffers, and deal with 8bpp for alpha)
    352356     */
     
    357361    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
    358362        | DDSCAPS_3DDEVICE;
    359        
    360     if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 
     363
     364    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK)
    361365      return ErrorMessage(hWndApp,  "Couldn't allocate aux surface" );
    362366
     
    364368
    365369  } else {
    366    
     370
    367371    /* Full screen - Set Exclusive Mode, change resolution,  */
    368372    GDBG_INFO((80, "_dxAS: Setting Full screen exclusive mode!\n"));
    369    
    370     if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp, 
     373
     374    if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp,
    371375                                         DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ) != DD_OK)
    372376      return ErrorMessage(hWndApp, "Couldn't set cooperative level!");
    373    
     377
    374378    if (IDirectDraw2_SetDisplayMode( lpDD, xRes, yRes, 16, 0,0) != DD_OK)
    375379      return ErrorMessage(hWndApp,  "Couldn't set display mode!");
    376    
     380
    377381    /* Allocate Front/Back Buffer Surfaces, skip triple buffer XXX */
    378382    ddsd.dwSize            = sizeof( ddsd );
    379383    ddsd.dwFlags           = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
    380384    ddsd.dwBackBufferCount = 1;
    381     ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE | 
    382       DDSCAPS_FLIP | 
     385    ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE |
     386      DDSCAPS_FLIP |
    383387        DDSCAPS_COMPLEX |
    384388          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)
    387391      return ErrorMessage(hWndApp, "Couldn't allocate primary surface!");
    388    
     392
    389393    /* Get back buffer information */
    390394    ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
    391     if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps, 
     395    if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps,
    392396                                               &lpBack) != DD_OK)
    393397      return ErrorMessage(hWndApp, "Couldn't get back buffer info!\n");
    394    
     398
    395399    GDBG_INFO((80, "_dxAS: Full Screen: front/back buffer allocated!\n"));
    396    
     400
    397401    /* Allocate Aux Buffer Surface - XXX */
    398402    ddsd.dwSize         = sizeof( ddsd );
     
    400404    ddsd.dwWidth        = xRes;
    401405    ddsd.dwHeight       = yRes;
    402     ddsd.ddsCaps.dwCaps = 
     406    ddsd.ddsCaps.dwCaps =
    403407      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)
    406410      return ErrorMessage(hWndApp,  "Couldn't allocate aux surface" );
    407411
    408412    GDBG_INFO((80, "_dxAS: Full Screen: aux buffer allocated!\n"));
    409    
     413
    410414/*
    411415 * Triple buffer hack: full-screen only for now.  Allocate as Aux DD surf,
     
    414418 */
    415419    if (tripleBuffering) {
    416       if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK) 
     420      if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK)
    417421        return ErrorMessage(hWndApp,  "Couldn't allocate triple buffer" );
    418422
     
    420424    }
    421425  }
    422  
     426
    423427  /* Convert direct draw surfaces to Glide's idea of buffer descriptors */
    424428  return _dxDDrawToGlideDesc(pDesc);
     
    432436  const char      *errorMessage = "no error";
    433437
    434   /* for now this is a goddamn baseball bat 
     438  /* for now this is a goddamn baseball bat
    435439     it can be trimmed down */
    436440  if ( !IsFullScreen ) { /* this *REALLY* should be called for fullscreen */
     
    440444    if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
    441445    if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
    442    
     446
    443447    lpClipper = NULL;
    444448    lpFront   = NULL;
     
    446450    lpTriple  = NULL;
    447451    lpAux     = NULL;
    448  
     452
    449453    /* Verify screen pixel format is 16bpp, and set cooperative level */
    450454    ddsd.dwSize = sizeof( ddsd );
     
    454458    ddsd.dwFlags        = DDSD_CAPS;
    455459    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
    456        
     460
    457461    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) {
    458462      errorMessage =  "Couldn't allocate primary surface!";
     
    484488    ddsd.ddsCaps.dwCaps =
    485489      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
    486        
     490
    487491    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) {
    488492      errorMessage = "Couldn't allocate secondary surface!";
     
    490494    }
    491495
    492     /* 
    493      * Always allocate Aux Buffer Surface 
     496    /*
     497     * Always allocate Aux Buffer Surface
    494498     * XXX - (use nAuxBuffers, and deal with 8bpp for alpha)
    495499     */
     
    500504    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
    501505        | DDSCAPS_3DDEVICE;
    502        
     506
    503507    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) {
    504508      errorMessage = "Couldn't allocate aux surface";
     
    531535{
    532536  if (lpDD == NULL) return TRUE;
    533  
     537
    534538  if (IDirectDrawSurface2_IsLost(lpFront) == DDERR_SURFACELOST) {
    535     if (IDirectDrawSurface2_Restore(lpFront) != DD_OK) 
     539    if (IDirectDrawSurface2_Restore(lpFront) != DD_OK)
    536540      return ErrorMessage(hWndApp, "Front Buffer restore failure\n");
    537541  }
    538  
     542
    539543  if (!IsFullScreen) {
    540544    if (IDirectDrawSurface2_IsLost(lpBack) == DDERR_SURFACELOST) {
    541       if (IDirectDrawSurface2_Restore(lpBack) != DD_OK) 
     545      if (IDirectDrawSurface2_Restore(lpBack) != DD_OK)
    542546        return ErrorMessage(hWndApp, "Back  Buffer restore failure\n");
    543547    }
    544548  }
    545  
     549
    546550  if (IDirectDrawSurface2_IsLost(lpAux) == DDERR_SURFACELOST) {
    547     if (IDirectDrawSurface2_Restore(lpAux) != DD_OK) 
     551    if (IDirectDrawSurface2_Restore(lpAux) != DD_OK)
    548552      return ErrorMessage(hWndApp, "Aux   Buffer restore failure\n");
    549553  }
    550  
     554
    551555  if (!IsFullScreen) {
    552556    if (IDirectDrawSurface2_IsLost(lpTriple) == DDERR_SURFACELOST) {
    553       if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK) 
     557      if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK)
    554558        return ErrorMessage(hWndApp, "Back  Buffer restore failure\n");
    555559    }
    556560  }
    557  
     561
    558562  GDBG_INFO((80, "_dxRS: restore surfaces OK\n"));
    559563  return _dxDDrawToGlideDesc(pDesc);
     
    587591
    588592  /*
    589    * Get ourselves a valid window handle 
     593   * Get ourselves a valid window handle
    590594   */
    591595  hWndApp = (hWindow == 0) ? GetActiveWindow() : (HWND) hWindow;
     
    615619    if ((sRes <  GR_RESOLUTION_MIN) ||
    616620        (sRes >  GR_RESOLUTION_MAX) &&
    617         (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) 
     621        (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) )
    618622#else
    619623    if ((sRes <  GR_RESOLUTION_320x200) ||
    620         (sRes >  GR_RESOLUTION_512x256)) 
     624        (sRes >  GR_RESOLUTION_512x256))
    621625#endif
    622626      return ErrorMessage(hWndApp, "Bad Fullscreen resolution");
     
    659663    GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType));
    660664    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));
    662666    GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP));
    663667  }
     
    668672
    669673  if ( curHALData->initSetVideo ) {
    670     curHALData->initSetVideo( sRes, vRefresh, 
     674    curHALData->initSetVideo( sRes, vRefresh,
    671675                             (FxU32*)width, (FxU32*)height );
    672676  }
     
    683687  RECT    rect;
    684688  int     i;
    685  
     689
    686690  GDBG_INFO((80, "dxControl: code = %d\n", code));
    687  
     691
    688692  /* dx is not initizized */
    689693  if ( lpDD== NULL ) {
    690694    return TRUE;
    691695  }
    692  
     696
    693697  /* Why was I called? */
    694698  switch(code) {
     
    698702      Width = rect.right;
    699703      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));
    702706
    703707      if (!_dxReallocSurfaces(Width, Height, 0, BufDesc)) {
     
    731735  GDBG_INFO((80, "dxControl: code = %d, w = %d, h = %d\n", code,
    732736             Width, Height));
    733  
     737
    734738  return FXTRUE;
    735739} /* dxControl */
     
    759763    lpDD1     = NULL;
    760764  }
    761  
     765
    762766  lpClipper = NULL;
    763767  lpFront   = NULL;
     
    766770  lpAux     = NULL;
    767771  lpDD      = NULL;
    768  
     772
    769773#endif /* 0 */
    770774  GDBG_INFO((80, "dxClose:  Returning TRUE\n"));
     
    778782  static POINT   point;
    779783  static HRESULT hr;
    780  
     784
    781785  GDBG_INFO((80, "dxSwap:\n"));
    782786  if ( !IsFullScreen ) {
     
    787791    src.top    = 0;
    788792    src.bottom = Height-1;
    789        
     793
    790794    dest = src;
    791795    point.x = 0;
     
    797801    dest.bottom += point.y;
    798802
    799     hr = IDirectDrawSurface_Blt( lpFront, 
     803    hr = IDirectDrawSurface_Blt( lpFront,
    800804                                &dest,
    801805                                lpBack,
     
    803807                                DDBLT_WAIT,
    804808                                NULL );
    805        
     809
    806810    while( IDirectDrawSurface_GetBltStatus( lpFront, DDGBS_ISBLTDONE ) !=
    807811          DD_OK );
    808        
     812
    809813    if ( hr != DD_OK ) {
    810814      ErrorMessage(hWndApp, "Couldn't blit!\n");
     
    812816  }
    813817  return;
    814  
     818
    815819} /* dxSwap */
    816820#else /* it's either DOS or the Hoopti Lab Setup */
     
    880884    break;
    881885  }
    882  
     886
    883887
    884888#define WAITLOOP {\
     
    893897
    894898  if ( curHALData->initSetVideo ) {
    895     rv = curHALData->initSetVideo( sRes, vRefresh, 
     899    rv = curHALData->initSetVideo( sRes, vRefresh,
    896900                                  (FxU32*)width, (FxU32*)height );
    897901    if ( !rv ) goto BAIL;
    898902  }
    899  
     903
    900904  /* Initialize all descriptors. */
    901905  dFront->bufMagic  = VG96_BUF_MAGIC;
     
    952956#ifdef GDBG_INFO_ON
    953957  {
    954     int i; 
     958    int i;
    955959
    956960    for (i = 0; i < 5; i++) {
     
    959963      GDBG_INFO((80, "%s:  pBufDesc.bufType = %s\n",
    960964                 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",
    962966                 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",
    964968                 FN_NAME, pBufDesc[i].bufStride));
    965969      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 $ */
    12/*
    23 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 ** 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
    89 ** 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 **
    1112 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16  ** THE UNITED STATES. 
    17  ** 
     17 ** THE UNITED STATES.
     18 **
    1819 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    19  ** $Revision: 1.1 $
    20  ** $Date: 2000-02-25 00:31:28 $
     20 ** $Revision: 1.2 $
     21 ** $Date: 2001-09-05 14:31:01 $
    2122 **
    2223 */
    23 static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1.1 $";
     24static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1.2 $";
    2425
    2526/* ANSI Headers */
     
    113114
    114115
    115 #define RFB 0 
     116#define RFB 0
    116117#define DFB 1
    117118
    118  
     119
    119120extern FxBool tripleBuffering;
    120121
     
    173174oldVidMode;
    174175
    175 static FxU32 
    176 devNum, 
     176static FxU32
     177devNum,
    177178physAddr,
    178179fifoMTRRNum = 0xffffffff;
     
    181182#ifdef GDBG_INFO_ON
    182183/* NOTE:
    183    
     184
    184185   This array is HIGHLY important to debugging.  Delete it at your
    185186   extreme peril.
     
    449450#ifdef GDBG_INFO_ON
    450451FxU32
    451 get96(FxU32 *addr) 
     452get96(FxU32 *addr)
    452453{
    453454  FxU32
     
    495496
    496497static FxBool
    497 init96LoadBufRegs(int nBuffers, 
    498                   InitBufDesc_t *pBufDesc, 
    499                   int xRes, int yRes, 
     498init96LoadBufRegs(int nBuffers,
     499                  InitBufDesc_t *pBufDesc,
     500                  int xRes, int yRes,
    500501                  InitRegisterDesc *rd);
    501502
     
    512513  SET(sstPtr->vC.x, x);
    513514  SET(sstPtr->vC.y, y+XY_ONE*tSize/2);
    514  
     515
    515516  SET(sstPtr->s, 0);
    516517  SET(sstPtr->t, 0);
     
    561562
    562563  *(texAddr + (8 << 15)) = init;
    563   /* 
     564  /*
    564565     write to 2 consequtive locations in lod0 to alter the data
    565      on the memory signals 
     566     on the memory signals
    566567  */
    567568  WAITLOOP;
    568   *(texAddr + (0)) = 0xffffffff;       
     569  *(texAddr + (0)) = 0xffffffff;
    569570  WAITLOOP;
    570571  *(texAddr + (1)) = 0xffffffff;
    571  
     572
    572573  WAITLOOP;
    573574
     
    592593{
    593594  FxU32 data;
    594  
     595
    595596  if(myGetenv(("SST96_TMUMEM_SIZE"))) {
    596597    *TmuMemorySize = atoi(myGetenv(("SST96_TMUMEM_SIZE")));
     
    605606  /* set lod8 */
    606607  SET(sstPtr->tLOD, ((8 << 2) | (8 << 7)));
    607    
    608   /* 
     608
     609  /*
    609610     first see if we have 4 Mbytes by writing a texel at 2MB followed by
    610611     a texel at 1MB and 0MB and then rendering using the texel at 2MB
     
    617618    data = sense(sstbase,info,tmu,0x200000, SENSE1);
    618619    if (data) {
    619       *TmuMemorySize = 4; 
     620      *TmuMemorySize = 4;
    620621      return(FXTRUE);
    621622    }
     
    630631    }
    631632  }
    632  
     633
    633634  data = sense(sstbase,info,tmu,0x000000, SENSE0);
    634635  if (data) {
    635636    data = sense(sstbase,info,tmu,0x000000, SENSE1);
    636637    if (data) {
    637       *TmuMemorySize = 1; 
     638      *TmuMemorySize = 1;
    638639      return(FXTRUE);
    639640    }
     
    641642
    642643#undef WAITLOOP
    643  
     644
    644645  return(FXFALSE);
    645646}
     
    653654sst96InitGetTmuInfo(FxU32 *sstbase, VG96Info *info)
    654655{
    655   sstPtr = 
     656  sstPtr =
    656657    (volatile Sstregs *)(SST96_COMMAND_REGS(sstbase));
    657658
     
    684685
    685686  VG96Info *vg96Info = (VG96Info *) info;
    686  
     687
    687688  FxU32
    688689    vendorID = vID,
    689690    deviceID = dID;
    690  
     691
    691692  GDBG_INFO((80, "SST-96 Initialization code %s\n", revString));
    692  
     693
    693694  /* Watcom warning suppression */
    694695  revString[0] = revString[0];
     
    696697  /* !!! FIXME hack for vxd bug */
    697698  putenv( "SST_DUALHEAD=1" );
    698  
     699
    699700  switch (vID) {
    700701  case AT3DVID:
     
    710711
    711712  GDBG_INFO((80, "init96MapBoard:  Mapping card into linear memory\n"));
    712  
     713
    713714  regDesc->hwDep.VG96RegDesc.baseAddress =
    714715    pciMapCardMulti( vendorID, deviceID, curHALData->memSize, &devNum, 0 , 0);
     
    741742  sstHW  = regDesc->hwDep.VG96RegDesc.baseAddress;
    742743
    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",
    744745             FN_NAME, regDesc->hwDep.VG96RegDesc.baseAddress));
    745746
     
    750751
    751752  GDBG_INFO((88, "init96MapBoard sstHW = %x\n", sstHW));
    752  
     753
    753754  /* CHD NOTE:  The routine init96SetupRendering MUST Be called from this
    754755     routine or all hell brakes loose.
     
    761762    GrScreenResolution_t    res = GR_RESOLUTION_640x480;
    762763    static void init96SetupRendering(InitRegisterDesc *regDesc,
    763                                      GrScreenResolution_t sRes);
     764                     GrScreenResolution_t sRes);
    764765
    765766    if (curHALData->initAperture)
     
    769770    if ( !rv )
    770771      return FXFALSE;
    771    
     772
    772773    init96SetupRendering(regDesc, res);
    773    
     774
    774775    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
    775776    }
     
    779780    /* In dos mode, we do it the way it is supposed to be.
    780781       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
    782783       init96SetVideo() to set up the rendering mode etc.
    783784       */
     
    791792      union REGS
    792793        inR, outR;
    793      
     794
    794795      inR.w.ax = 0x4f03;
    795796      int386(0x10, &inR, &outR);
    796      
     797
    797798      oldVidMode = outR.w.bx;
    798799      GDBG_INFO((80, "%s:  Saving Current video mode (0x%x).\n",
    799                  FN_NAME, oldVidMode)); 
     800                 FN_NAME, oldVidMode));
    800801    }
    801    
     802
    802803    if ( !rv )
    803804      return FXFALSE;
    804    
     805
    805806    if ( curHALData->initEnableRegs )
    806807      rv = curHALData->initEnableRegs( regDesc );
    807808    if ( !rv )
    808809      return FXFALSE;
    809    
     810
    810811    init96SetupRendering(regDesc, res);
    811    
     812
    812813    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
    813814  }
     
    817818    GrScreenResolution_t    res = GR_RESOLUTION_NONE;
    818819    init96SetVideo(0, res,
    819                    0, 2, 1, 
     820                   0, 2, 1,
    820821                   2, 1, regDesc,
    821822                   &xres, &yres, &fbStride );
     
    827828
    828829  GDBG_INFO((80, "init96MapBoard:  returning FXTRUE\n"));
    829  
     830
    830831  return FXTRUE;
    831832
     
    852853  }\
    853854}
    854 #endif 
     855#endif
    855856
    856857#define SWAPPENDING(status) ((status & 0x70) >> 4)
     
    862863  Library: Init Code for 96
    863864  Description:
    864  
     865
    865866  Arguments:
    866  
     867
    867868  Return:
    868869  -------------------------------------------------------------------*/
     
    874875
    875876  sstHW  = regDesc->hwDep.VG96RegDesc.baseAddress;
    876   sstPtr = 
     877  sstPtr =
    877878    (volatile Sstregs *)(SST96_COMMAND_REGS(regDesc->hwDep.VG96RegDesc.baseAddress));
    878879
     
    882883  GDBG_INFO((80, "%s:  Software reset\n", FN_NAME));
    883884  SET(sstHW[0x90 + 0x100000], 0xf601); /* (0xf601) init0, sw reset. */
    884    
     885
    885886  WAITLOOP;
    886887
     
    889890  SET(sstHW[0x100000 + 0x94], 0);
    890891  SET(sstHW[0x100000 + 0x93], 0);
    891    
     892
    892893  GDBG_INFO((80, "%s:  Setting up Mem FIFO\n", FN_NAME));
    893894
     
    895896
    896897  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
    899900     Low Priority Request Aging - wait 64 cycles
    900901     before answering low priority requests from
     
    903904     [24]   - PUMA Texture Address Space Mode      - 0x1 - 2MB
    904905     [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
    907908     [5:0]  - PUMA Low Priority Request Delay Cnt  - 0x1f - 32 ccls
    908909     Setting to 0x3f ( max ) seems to cripple windows/d3d
     
    910911     */
    911912  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
    914915   * video refresh.   XXX FIXME for AT3d only
    915916   */
     
    926927    SET(sstHW[0x91 + 0x100000],regVal);
    927928  }
    928    
    929   /* Come out of Reset 
     929
     930  /* Come out of Reset
    930931     [17]    - Serial Status Xfer Mode     - 0x0 - rising edge
    931932     [16:12] - TREX-To-FBI High Water Mark - 0xf
    932933     [11:8]  - TREX-To-FBI Bus Clock Delay - 0x6
    933      */   
    934  
     934     */
     935
    935936  GDBG_INFO((80, "%s:  Coming out of FBI reset\n", FN_NAME));
    936937  GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600);
    937938  SET(sstHW[0x90 + 0x100000], regVal); /* Bit 1 disables tmu */
    938    
     939
    939940  WAITLOOP;
    940941
     
    942943  {
    943944    FxU32 trexinit0, trexinit1;
    944        
     945
    945946    if(myGetenv(("SST_TREX0INIT0"))) {
    946947      sscanf(myGetenv(("SST_TREX0INIT0")), "%i", &trexinit0);
     
    948949      trexinit0 = 0x05441;      /* TREXINIT0 */
    949950    }
    950        
     951
    951952    if(myGetenv(("SST_TREX0INIT1"))) {
    952953      sscanf(myGetenv(("SST_TREX0INIT1")), "%i", &trexinit1);
     
    954955      trexinit1 = 0x3643c; /* TREXINIT1 */
    955956    }
    956        
     957
    957958    SET(sstHW[0xc7 + 0x100000], trexinit0); /* TREXINIT0 */
    958959    SET(sstHW[0xc8 + 0x100000], trexinit1); /* TREXINIT1 */
    959960  }
    960  
     961
    961962  WAITLOOP;
    962  
     963
    963964#undef FN_NAME
    964965} /* init96SetupRendering */
     
    970971  Library: init96
    971972  Description:
    972  
     973
    973974  1 - Set video mode
    974975  2 - Enable Direct Writes to Jr
    975976  3 - Put Jr registers in Reset
    976977  3 - Set up Color Buffer Registers
    977  
     978
    978979  Arguments
    979  
     980
    980981  Return:
    981   FXFALSE - fail 
     982  FXFALSE - fail
    982983  FXTRUE  - pass
    983984  -------------------------------------------------------------------*/
    984 INITVG96ENTRY(init96SetVideo, FxBool , 
     985INITVG96ENTRY(init96SetVideo, FxBool ,
    985986              (  FxU32                   hWnd,
    986987               GrScreenResolution_t    sRes,
     
    10111012  GDBG_INFO((80, "%s:  %d Color Buffers\n", FN_NAME, nColBuffers));
    10121013
    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",
    10141015             FN_NAME, hWnd, sRes, yOrigin, nColBuffers, nAuxBuffers));
    10151016
     
    10201021  if (curHALData->initAperture)
    10211022    (*curHALData->initAperture)(regDesc);
    1022  
     1023
    10231024#if defined( __DOS32__ )
    10241025  {
     
    10311032    oldVidMode = outR.w.bx;
    10321033    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
    10371038  /*-------------------------------------
    10381039    Set Video Mode
     
    10421043     this does not have anything to do with directX */
    10431044#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,
    10461047              xres, yres, &swapType)) {
    10471048#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,
    10501051              xres, yres, &swapType)) {
    10511052#endif
     
    10541055    goto BAIL;
    10551056  }
    1056    
    1057 #ifdef GDBG_INFO_ON 
     1057
     1058#ifdef GDBG_INFO_ON
    10581059  for (i = 0; i < nColBuffers; i++) {
    10591060    GDBG_INFO((80, "%s:  bufDesc[%d]:\n", FN_NAME, i));
    10601061    GDBG_INFO((80, "%s:  bufDesc.bufType = %s\n",
    10611062               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",
    10631064               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",
    10651066               FN_NAME, bufDesc[i].bufStride));
    10661067    GDBG_INFO((80, "%s:  bufDesc.bufBPP = 0x%x\n",
     
    10971098    FxU32
    10981099      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,
    11031104               pending));
    11041105    while (pending) {
    11051106      FxU32
    11061107        tries = 0;
    1107                
     1108
    11081109      GDBG_INFO((80, "%s: %d swaps pending\n", FN_NAME, pending))  ;
    11091110
     
    11171118        WAITLOOP;
    11181119      }
    1119                
     1120
    11201121      do {
    11211122        ++tries;
    11221123        status =  sstHW[0x100000];
    1123                    
     1124
    11241125        GDBG_INFO((120, "%s:  Serial status = 0x%x\n", FN_NAME, status));
    11251126        pending = SWAPPENDING(status);
     
    11311132      } while (pending);
    11321133    }
    1133            
     1134
    11341135    /* Clear counters with a NOP */
    11351136    SET(sstHW[0x42 + 0x100000], 1); /* NOP cmd */
     
    11381139    do {
    11391140      if (nTries > MAXTRIES) {
    1140         GDBG_INFO((80, 
     1141        GDBG_INFO((80,
    11411142                   "%s: Bailing out and returning false after %d checks for idle.\n", FN_NAME, nTries-1));
    11421143        return FXFALSE;
     
    11441145      ++nTries;
    11451146      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,
    11501151                 status));
    11511152    } while (status & 0x1);
    11521153  } /* end of swap buffer block */
    11531154
    1154  
     1155
    11551156  if (tripleBuffering) {
    11561157    GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600);
     
    11671168
    11681169  dfbFrontIdx =   0;
    1169   dfbBackIdx  =   1; 
     1170  dfbBackIdx  =   1;
    11701171  dfbRenderIdx =  dfbBackIdx;
    11711172
    11721173  rfbFrontIdx =   0;
    1173   rfbBackIdx  =   1; 
     1174  rfbBackIdx  =   1;
    11741175  rfbRenderIdx =  rfbBackIdx;
    11751176
     
    11791180    goto BAIL;
    11801181  }
    1181  
     1182
    11821183  /*-------------------------------------
    11831184    Set up Page Flipping
     
    11961197    if (curHALData->initUseTiles && (swapType == INIT_SWAP_FLIP)) {
    11971198#ifdef H3D
    1198       (*curHALData->initUseTiles)(regDesc, 
     1199      (*curHALData->initUseTiles)(regDesc,
    11991200                                buf,
    12001201                                maxBuffer,
    12011202                                bI[0].dfbStride,
    1202                                 *xres, 
     1203                                *xres,
    12031204                                *yres,
    12041205                                GR_RESOLUTION_IS_AUTOFLIPPED(sRes) );
    12051206#else
    1206       (*curHALData->initUseTiles)(regDesc, 
     1207      (*curHALData->initUseTiles)(regDesc,
    12071208                                buf,
    12081209                                maxBuffer,
    12091210                                bI[0].dfbStride,
    1210                                 *xres, 
     1211                                *xres,
    12111212                                *yres );
    12121213#endif
     
    12141215  }
    12151216#endif
    1216  
     1217
    12171218  *fbStride = (bI[1].dfbStride>>1);
    12181219  GDBG_INFO(( 200, "frame buffer stride: %d\n", *fbStride ));
    1219  
     1220
    12201221 BAIL:
    12211222  return rv;
     
    12301231  Library: init96
    12311232  Description:
    1232  
     1233
    12331234  Disable Direct Hardware Access
    12341235  Restore the video to it's initial state
    1235  
     1236
    12361237  Arguments:
    12371238  none
     
    12401241  -------------------------------------------------------------------*/
    12411242INITVG96ENTRY(init96RestoreVideo, void, ( InitRegisterDesc *regDesc )) {
    1242 #define FN_NAME "init96RestoreVideo" 
     1243#define FN_NAME "init96RestoreVideo"
    12431244  if ( curHALData->initDisableRegs )
    12441245    curHALData->initDisableRegs( regDesc );
    1245  
    1246 #if  defined( __WIN32__ ) && !defined( INIT_HOOPTI ) 
     1246
     1247#if  defined( __WIN32__ ) && !defined( INIT_HOOPTI )
    12471248  dxClose();
    1248 #elif defined( __DOS32__ ) 
     1249#elif defined( __DOS32__ )
    12491250  {
    12501251    static union REGS
     
    12701271  Library: init96
    12711272  Description:
    1272  
    1273   Enable the JR command transport and return pertinant fifo 
     1273
     1274  Enable the JR command transport and return pertinant fifo
    12741275  information to the caller
    1275  
     1276
    12761277  Arguments:
    12771278  info - structure to fill with info about the FIFO
     
    12801281  FXFALSE - fail
    12811282  -------------------------------------------------------------------*/
    1282 INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc)) 
     1283INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc))
    12831284{
    12841285#define FN_NAME "init96EnableTransport"
     
    12921293  PciMemType
    12931294    fifoMemType;
    1294  
     1295
    12951296  GDBG_INFO((80, "%s\n", FN_NAME));
    1296  
     1297
    12971298  /*------------------------------------------------------------
    12981299    Enable the Off Chip Fifo
    12991300    ------------------------------------------------------------*/
    1300  
     1301
    13011302  /* These are defined in sst.c for now */
    13021303  lo = (fifoStart >> 12);     /* physaddr of 1st 4k page */
     
    13041305  sz = (hi - lo + 1) << 12;   /* bytes */
    13051306  th = (hi - lo) - 3;         /* threshold, in 4k pages. */
    1306  
     1307
    13071308  /* Generate virtual addresses for the pointers. */
    13081309  fifovirt = (FxU32 *)&sstHW[lo << 10];
     
    13101311  fifomax  = sz;
    13111312  fifocur  = 0;
    1312  
     1313
    13131314  fifoptr  = fifovirt;
    13141315  fifosize = 4096;            /* initially, set to 4k */
    1315  
     1316
    13161317  fifolfb = 1;
    1317  
     1318
    13181319  /* First disable the off-chip fifo */
    13191320  GDBG_INFO((80, "%s:  Disabling off-chip FIFO\n", FN_NAME));
    13201321  SET(sstHW[0x100000 + 0x93], 0);
    1321  
     1322
    13221323  /* FbijrInit4 - 0x94 - entry count */
    13231324  SET(sstHW[0x100000 + 0x94], 0);
    1324  
     1325
    13251326  /* FbijrInit5 - 0x95 - read pointer */
    13261327  SET(sstHW[0x100000 + 0x95], lo << 9);
    13271328
    1328   /* Default size to page checking mode. 
     1329  /* Default size to page checking mode.
    13291330   *
    13301331   * NB: This will get overwritten later if we're using
     
    13401341  info->hwDep.vg96FIFOData.fifoLfb  = fifolfb;
    13411342
    1342   /* Set up alternate wrapping values. 
     1343  /* Set up alternate wrapping values.
    13431344   *
    13441345   * NB: This *MUST* come before the processor dependent
     
    13751376
    13761377  /*
    1377   **  NOTE TO ALL FOOLS WHO TREAD HERE     
    1378   ** 
     1378  **  NOTE TO ALL FOOLS WHO TREAD HERE
     1379  **
    13791380  **  It is VITALLY important to enable the FIFO AFTER the
    13801381  **  P6 Lag Of Love(tm), instead of before, otherwise the FIFO will
     
    13871388
    13881389  /* Set the fifo ptr now that we really know where its going to start
    1389    * for the client code. 
     1390   * for the client code.
    13901391   */
    13911392  info->hwDep.vg96FIFOData.fifoPtr  = (FxU32*)fifoptr;
     
    14261427    Return:
    14271428    -------------------------------------------------------------------*/
    1428 INITVG96ENTRY(init96DisableTransport, void, ( void )) 
     1429INITVG96ENTRY(init96DisableTransport, void, ( void ))
    14291430{
    14301431#define FN_NAME "init96DisableTransport"
    14311432  while (*(volatile FxU32 *)sstPtr & 1);
    1432  
     1433
    14331434  SET(sstHW[0x100000 + 0x90], 0xf601); /* (0xf601) init0, sw reset. */
    14341435  SET(sstHW[0x100000 + 0x95], 0);
     
    15031504
    15041505    sstPtr->swappendCMD = 0x1;
    1505    
     1506
    15061507
    15071508    if (gotEnv == FXFALSE) {
     
    15521553    CRTC_GET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow);
    15531554    serialOverflow &= 0xF0;
    1554    
     1555
    15551556    /* Make sure scanout within active display */
    15561557    do {
    15571558      INP(VGA_INPUT_STATUS_1C, tmp);
    15581559    } while (tmp & VIS1C_PIXEL_DISPLAY_INACTIVE);
    1559    
     1560
    15601561    /* Set serial address */
    15611562    /* For some reason unknown to me, this is set to the byte offset / 4,
    15621563       or perhaps the offset in dwords */
    1563    
     1564
    15641565    /* Top nibble */
    15651566    tmp = (FxU8) ((offset >> (2+16)) & 0x0F);
    15661567    CRTC_SET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow | tmp);
    1567    
     1568
    15681569    /* Middle byte */
    15691570    tmp = (FxU8) ((offset >> (2+8)) & 0xFF);
    15701571    CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_HI_INDEX, tmp);
    1571    
     1572
    15721573    /* Low byte */
    15731574    tmp = (FxU8) ((offset >> 2) & 0xFF);
    15741575    CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_LO_INDEX, tmp);
    1575    
     1576
    15761577    /* Save away */
    15771578    do {
     
    15841585#endif
    15851586#endif
    1586    
     1587
    15871588    /* dpc - 26 jan 1998
    15881589     * Some hw, macronix, requires that we diddle w/ even more bits
    1589      * when we do the swap. 
     1590     * when we do the swap.
    15901591     */
    15911592    if(curHALData->initSwapTiles != NULL) (*curHALData->initSwapTiles)(rd);
    1592    
     1593
    15931594    ADVANCE_BUFFERS(rfb);
    15941595
     
    15971598               bI[rfbRenderIdx].rfb));
    15981599    wcb( (FxU32*)&(sstPtr->colBufferSetup), bI[rfbRenderIdx].rfb );
    1599    
     1600
    16001601
    16011602  } else {
     
    16231624  Library: Init Code for VG96
    16241625  Description:
    1625  
     1626
    16261627  Arguments:
    1627  
     1628
    16281629  Return:
    16291630  -------------------------------------------------------------------*/
     
    16551656#define LFB_OFFSET( X ) ( X & 0x3fffff )
    16561657
    1657 INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes)) 
     1658INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes))
    16581659{
    16591660#define FN_NAME "init96GetBufferPtr"
     
    16981699  Date: 2/25
    16991700  Implementor(s): jdt
    1700   Library: init96 
     1701  Library: init96
    17011702  Description:
    17021703  Set the current render buffer
     
    17061707  none
    17071708  -------------------------------------------------------------------*/
    1708 INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb)) 
     1709INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb))
    17091710{
    17101711#define FN_NAME "init96RenderBuffer"
     
    17371738  none
    17381739  -------------------------------------------------------------------*/
    1739 INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb)) 
     1740INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb))
    17401741{
    17411742#define FN_NAME "init96Origin"
     
    17811782
    17821783  GDBG_INFO((80, "(%s)\n", FN_NAME));
    1783  
     1784
    17841785  if ( !sstHW ) return FXFALSE;
    17851786
     
    18131814                                      (*((volatile FxU32*)(((FxU32)(__regP)) + (0x95 << 12))) << 3))
    18141815
    1815 INITVG96ENTRY(init96WrapFIFO, 
    1816               FxBool, 
     1816INITVG96ENTRY(init96WrapFIFO,
     1817              FxBool,
    18171818              (InitRegisterDesc* rd, InitFIFOData* fifoP))
    18181819{
     
    18261827
    18271828  {
    1828     const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr, 
     1829    const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr,
    18291830                              fifoP->hwDep.vg96FIFOData.roomToEnd) -
    18301831                          fifoP->hwDep.vg96FIFOData.fifoSize);
    1831    
     1832
    18321833    fifoP->hwDep.vg96FIFOData.roomToReadPtr -= writes;
    18331834    fifoP->hwDep.vg96FIFOData.roomToEnd -= writes;
     
    18431844      const FxU32 curReadPtr = SST96_HW_FIFO(sstHW, sstPtr);
    18441845      const FxU32 curReadDist = curReadPtr - lastHwRead;
    1845      
     1846
    18461847      roomToReadPtr += curReadDist;
    18471848      if (lastHwRead > curReadPtr) roomToReadPtr += fifoP->hwDep.vg96FIFOData.fifoMax;
     
    18501851    }
    18511852
    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",
    18531854               (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
    18541855               fifoP->hwDep.vg96FIFOData.roomToReadPtr,
     
    18701871#else
    18711872#define JU_JU_STALL /* Do Nothing */
    1872 #endif     
     1873#endif
    18731874      {
    18741875         volatile FxU32* fifoPtr = fifoP->hwDep.vg96FIFOData.fifoPtr;
     
    18861887            volatile FxU32* serialStatus =
    18871888              fifoP->hwDep.vg96FIFOData.regDesc->hwDep.VG96RegDesc.serialStatus;
    1888            
     1889
    18891890            if ((*serialStatus & 0x80) != 0x00) {
    18901891               GDBG_INFO((85, FN_NAME": fifo close to full. Waiting(0x%X)...\n", numJuJuStalls));
     
    19001901#undef kFifoPadDelay
    19011902
    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",
    19031904                 (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
    19041905                 fifoP->hwDep.vg96FIFOData.roomToReadPtr,
    19051906                 fifoP->hwDep.vg96FIFOData.roomToEnd));
    1906      
     1907
    19071908      fifoP->hwDep.vg96FIFOData.roomToReadPtr -= fifoP->hwDep.vg96FIFOData.roomToEnd;
    19081909      fifoP->hwDep.vg96FIFOData.roomToEnd = fifoP->hwDep.vg96FIFOData.fifoMax;
    1909      
    1910       /* Reset fifo ptr to start */ 
     1910
     1911      /* Reset fifo ptr to start */
    19111912      fifoP->hwDep.vg96FIFOData.fifoPtr = fifoP->hwDep.vg96FIFOData.fifoVirt;
    19121913      goto again;
    19131914  }
    1914  
     1915
    19151916  /* compute room left */
    19161917  fifoP->hwDep.vg96FIFOData.roomToEnd -= blockSize;
     
    19181919  fifoP->hwDep.vg96FIFOData.fifoSize = MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr,
    19191920                                           fifoP->hwDep.vg96FIFOData.roomToEnd) + blockSize;
    1920  
     1921
    19211922  GDBG_INFO((80, FN_NAME": (0x%X : 0x%X) : (0x%X : 0x%X) : 0x%X\n",
    19221923             (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
     
    19311932  return FXTRUE;
    19321933#undef FN_NAME
    1933 } 
     1934}
    19341935#else /* !SST96_ALT_FIFO_WRAP */
    19351936
     
    19511952#define FN_NAME "init96FIFOWait"
    19521953  volatile FxU32 *pstatus;
    1953  
     1954
    19541955
    19551956  /* Check for more room. */
    19561957  pstatus = (volatile FxU32 *) rd->hwDep.VG96RegDesc.serialStatus;
    1957  
     1958
    19581959  if (*pstatus & 0x80) {        /* 0x80 is the FIFO threshold */
    19591960    int  timeout;
     
    19651966    if (*pstatus & 0x80) {
    19661967      GDBG_INFO((80, "Lost patience in %s.  Status is 0x%x\n",
    1967                  FN_NAME, *pstatus)); 
     1968                 FN_NAME, *pstatus));
    19681969      goto again;
    19691970    }
    19701971  }
    1971 #undef FN_NAME 
     1972#undef FN_NAME
    19721973} /* init96FIFOWait */
    19731974
     
    19881989#define FN_NAME "init96WrapFIFO"
    19891990  FxBool rVal;
    1990  
     1991
    19911992  GDBG_INFO((80,"%s\n", FN_NAME));
    1992  
     1993
    19931994  while (fifoData->hwDep.vg96FIFOData.fifoSize > 0) {
    19941995    *fifoData->hwDep.vg96FIFOData.fifoPtr++ = 0L;
    19951996    fifoData->hwDep.vg96FIFOData.fifoSize -= 4;
    19961997  }
    1997  
    1998  
     1998
     1999
    19992000  fifoData->hwDep.vg96FIFOData.fifoCur += 4096;
    2000  
     2001
    20012002  /* Wrap back to beginning? */
    20022003  if (fifoData->hwDep.vg96FIFOData.fifoCur >= fifoData->hwDep.vg96FIFOData.fifoMax ) {
    20032004    static int fifowraps = 0;
    2004    
     2005
    20052006    fifoData->hwDep.vg96FIFOData.fifoCur = 0;
    20062007    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"
    20112012                  : "Video Aperture")));
    20122013    }
    20132014
    2014     if (fifoData->hwDep.vg96FIFOData.fifoLfb) 
     2015    if (fifoData->hwDep.vg96FIFOData.fifoLfb)
    20152016      fifoData->hwDep.vg96FIFOData.fifoPtr = fifoData->hwDep.vg96FIFOData.fifoVirt;
    20162017  }
    2017  
     2018
    20182019  /*  */
    20192020  {
    20202021    FxU32
    20212022      fbiJrInit5;
    2022    
     2023
    20232024    GDBG_INFO((125, "%s:  Write = 0x%x\n", FN_NAME,
    20242025               (FxU32) fifoData->hwDep.vg96FIFOData.fifoPtr -
    20252026               (FxU32) fifoData->hwDep.vg96FIFOData.fifoVirt));
    2026    
     2027
    20272028    fbiJrInit5 = *((volatile FxU32 *) (((FxU32) sstPtr) + (0x95 << 12)));
    20282029
     
    20452046
    20462047  GDBG_INFO((80, "%s:  Got more room.\n", FN_NAME));
    2047  
     2048
    20482049  /* At this point, we have atleast 1 more page of fifo. */
    20492050  fifoData->hwDep.vg96FIFOData.fifoSize = 4096;
    2050  
     2051
    20512052  rVal = FXTRUE;
    2052  
     2053
    20532054  GDBG_INFO((80, "%s:  returning %s\n", FN_NAME, rVal ? "FXTRUE" : "FXFALSE"));
    2054  
     2055
    20552056  return rVal;
    2056  
     2057
    20572058#undef FN_NAME
    20582059} /* init96WrapFIFO */
     
    20602061#endif /* !SST96_ALT_FIFO_WRAP */
    20612062
    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
    20642065 * Load colbufSetup and auxBufSetup registers, given a InitBufDesc_t
    20652066 */
    2066 static FxBool 
     2067static FxBool
    20672068init96LoadBufRegs(int nBuffers, InitBufDesc_t *pBufDesc, int xRes,
    2068                   int yRes, InitRegisterDesc *rd) 
     2069                  int yRes, InitRegisterDesc *rd)
    20692070{
    20702071#define FN_NAME "init96LoadBufRegs"
     
    20752076  InitBufDesc_t   *pFifo   = NULL;
    20762077  int i;
    2077    
     2078
    20782079  GDBG_INFO((80, "(%s) w = %d, h = %d, n = %d\n",
    20792080             FN_NAME, xRes, yRes, nBuffers));
    2080    
     2081
    20812082  if ( !sstHW ) return FXFALSE;
    2082    
     2083
    20832084  /* Take pBufDesc apart */
    20842085  while (nBuffers-- > 0) {
    20852086    switch (pBufDesc->bufType) {
    20862087    case INIT_BUFFER_FRONTBUFFER:
    2087       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2088      GDBG_INFO((80, "%s: %s: 0x%x\n",
    20882089                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    20892090      pFront = pBufDesc;
    20902091      break;
    20912092    case INIT_BUFFER_BACKBUFFER:
    2092       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2093      GDBG_INFO((80, "%s: %s: 0x%x\n",
    20932094                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    20942095      pBack  = pBufDesc;
    20952096      break;
    20962097    case INIT_BUFFER_AUXBUFFER:
    2097       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2098      GDBG_INFO((80, "%s: %s: 0x%x\n",
    20982099                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    2099       pAux   = pBufDesc; 
     2100      pAux   = pBufDesc;
    21002101      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",
    21032104                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    21042105      pFifo  = pBufDesc;
    21052106      break;
    21062107    case INIT_BUFFER_TRIPLEBUFFER:
    2107       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2108      GDBG_INFO((80, "%s: %s: 0x%x\n",
    21082109                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    21092110      pTriple = pBufDesc;
     
    21212122  GDBG_INFO((80,"pFront = %.08x, pBack = %.08x, pTriple = %.08x, pAux = %.08x, pFifo = %.08x\n",
    21222123             pFront, pBack, pTriple, pAux, pFifo));
    2123    
     2124
    21242125  if (myGetenv("SST96_FORCEALIGN")) {
    21252126    FxU32 F, B, T, A;
    2126    
     2127
    21272128    sscanf(myGetenv("SST96_FORCEALIGN"), "%x,%x,%x,%x", &F, &B, &T, &A);
    21282129    GDBG_INFO((80, "!!!!!GROSS HACK... forcing values!!!!!\n"));
     
    21432144  if (pFifo)
    21442145    GDBG_INFO((80,"C = %.08x, s= %6d\n", pFifo ->bufOffset, pFifo ->bufStride));
    2145    
     2146
    21462147  /* Fill the arrays here */
    2147   bI[0].dfbBase   = pFront->bufOffset; 
     2148  bI[0].dfbBase   = pFront->bufOffset;
    21482149  bI[0].dfbStride = pFront->bufStride;
    21492150  bI[0].dfbTop    = pFront->bufOffset + (yRes-1) * pFront->bufStride;
    2150    
     2151
    21512152  bI[1].dfbBase   = pBack->bufOffset;
    21522153  bI[1].dfbStride = pBack->bufStride;
     
    22042205    fifoEnd   = pFifo->bufOffset + pFifo->bufStride;
    22052206  }
    2206  
     2207
    22072208  GDBG_INFO((80, "%s:  Returning TRUE\n", FN_NAME));
    22082209  return FXTRUE;
     
    22192220  success. Zero is returned of the board is not mapped.
    22202221  XXX This should be refined in the future. XXX
    2221  
     2222
    22222223  Arguments: none
    2223  
     2224
    22242225  Return: n, where n == available VRAM in bytes on the board
    22252226  -------------------------------------------------------------------*/
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:31 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:02 $
    2324**
    2425*/
    25 static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1.1 $";
     26static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1.2 $";
    2627
    2728#include <3dfx.h>
     
    8586  Library: Init Code for MCRX
    8687  Description:
    87  
     88
    8889  Arguments:
    89  
     90
    9091  Return:
    9192        address of mcrxHALData
     
    106107  Initialize rd pointers to access apertures
    107108  Arguments:
    108  
     109
    109110  Return:
    110111  -------------------------------------------------------------------*/
     
    121122     0x2000000 - 0x20000);
    122123
    123   GDBG_INFO((80, "%s:  Setting partnerRegPtr to 0x%x\n", 
     124  GDBG_INFO((80, "%s:  Setting partnerRegPtr to 0x%x\n",
    124125             FN_NAME, rd->hwDep.VG96RegDesc.partnerRegPtr));
    125  
     126
    126127#if 1
    127128  rd->hwDep.VG96RegDesc.serialStatus = (FxU32 *)
     
    137138  rd->hwDep.VG96RegDesc.fifoApertureBase =
    138139    (FxU32 *) (((FxU32)rd->hwDep.VG96RegDesc.baseAddress) + 0x400000);
    139  
     140
    140141  GDBG_INFO((80, "%s:  returning TRUE\n", FN_NAME));
    141  
     142
    142143  return rVal;
    143144
     
    146147
    147148/* FIXME !! jdt - need to add more resolutions to dos */
    148 INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr )) 
     149INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr ))
    149150{
    150151#define FN_NAME "initMCRXSetVideo"
    151152  FxBool rv = FXTRUE;
    152 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 
     153#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ )
    153154  union REGS r0, r1;
    154155#endif
    155  
     156
    156157  GDBG_INFO((80, "%s: \n", FN_NAME));
    157158
    158 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 
     159#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ )
    159160  switch( res ) {
    160161  case GR_RESOLUTION_320x200:
     
    215216
    216217#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"));
    218219  return rv;
    219 #undef FN_NAME 
     220#undef FN_NAME
    220221} /* initMCRXSetVideo */
    221222
     
    228229
    229230  Do all setup necessary to enable direct writes to JR Space
    230  
     231
    231232  Arguments:
    232233  rd - pointer to register description
    233  
     234
    234235  Return:
    235236  True if success, False if Failure
    236237  -------------------------------------------------------------------*/
    237 INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd)) 
     238INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd))
    238239{
    239240#define FN_NAME "initMCRXEnableRegs"
    240   FxU32 
     241  FxU32
    241242    tmp;
    242243  FxU8
     
    256257  GDBG_INFO((80, "%s:    Save Extended Registers Protection State\n",
    257258             FN_NAME));
    258  
     259
    259260  OUTP(0x3d4, 0x19);
    260261  INP(0x3d5, protState);
     
    273274  OUTP(0x3C4, 0x1B);
    274275  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,
    276277             (FxU32)rd->hwDep.VG96RegDesc.mclockHi, (FxU32)rd->hwDep.VG96RegDesc.mclockHi));
    277  
     278
    278279  GDBG_INFO((80, "%s:  Enabling FBI Jr.\n", FN_NAME));
    279280  OUTPW(0x3C4, 0x001F);
     
    311312
    312313/* FIXME!!! jdt - puma/ram timing fixes need to go here */
    313 INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd)) 
     314INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd))
    314315{
    315316#define FN_NAME "initMCRXDisableRegs"
    316317  FxU8
    317318    seqSave, crtcSave;
    318  
     319
    319320  FxU16
    320321    protState;
     
    349350  CRTC_GET(0x28, tmp);
    350351  GDBG_INFO((80, "%s:  crtc 0x28: 0x%X\n", FN_NAME, tmp));
    351   tmp &= ~1; 
     352  tmp &= ~1;
    352353  CRTC_SET(0x28, tmp);
    353354
     
    358359  {
    359360    FxU16 tempMclock;
    360    
     361
    361362    GDBG_INFO((80, "%s:  Restoring mclock\n", FN_NAME));
    362363    tempMclock = (0x1A | (rd->hwDep.VG96RegDesc.mclockHi << 8));
    363364    OUTPW(0x3C4, tempMclock);
    364    
     365
    365366    tempMclock = (0x1B | (rd->hwDep.VG96RegDesc.mclockLo << 8));
    366367    OUTPW(0x3C4, tempMclock);
     
    370371    OUTPW(0x3C4, 0x001C);
    371372  }
    372  
     373
    373374  GDBG_INFO((80, "%s:  Restoring Protection\n", FN_NAME));
    374375  OUTPW(0x3df, protState);
     
    381382
    382383  return FXTRUE;
    383  
     384
    384385#undef FN_NAME
    385386} /* initMCRXDisableRegs */
     
    391392  Library: Init Code for MCRX
    392393  Description:
    393  
     394
    394395  Arguments:
    395  
     396
    396397  Return:
    397398  -------------------------------------------------------------------*/
     
    408409  { 0x0d, 0x0c, 0x21 },
    409410  { 0x71, 0x72, 0x73 },
    410   /* chd - Fixme! 
     411  /* chd - Fixme!
    411412   * Bogus numbers.  Does triple buffering work on Macronix?
    412    * 
    413    * dpc - 23 jan 1998 - 
     413   *
     414   * dpc - 23 jan 1998 -
    414415   * Donny just told me this so hopefully this will work.
    415416   */
     
    438439    const FxU8 maxBufferBits = (((crtcSwapControl & 0x08) == 0) ? 1 : 2);
    439440
    440     crtcSwapStatus = ((crtcSwapStatus & ~0x03) | 
     441    crtcSwapStatus = ((crtcSwapStatus & ~0x03) |
    441442                      ((bufferBits == maxBufferBits) ? 0x00 : bufferBits + 1));
    442443    CRTC_SET(0x7A, crtcSwapStatus);
    443444  }
    444  
     445
    445446  /* We have no way of knowing that this worked so of course we always
    446447   * return success.
     
    456457  Library: Init Code for MCRX
    457458  Description:
    458  
     459
    459460  Arguments:
    460461  atmm:                 Pointer to base of MCRX
     
    472473                                      FxU32 nBuffers,
    473474                                      FxU32 strideInBytes,
    474                                       FxU32 Width, FxU32 Height, FxU32 PageFlipping)) 
     475                                      FxU32 Width, FxU32 Height, FxU32 PageFlipping))
    475476#else
    476477INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd,
     
    478479                                      FxU32 nBuffers,
    479480                                      FxU32 strideInBytes,
    480                                       FxU32 Width, FxU32 Height)) 
     481                                      FxU32 Width, FxU32 Height))
    481482#endif
    482483{
     
    496497
    497498  const char *envVal;
    498  
     499
    499500  GDBG_INFO((80, "%s:\n", FN_NAME));
    500501
     
    538539   * If we are triple buffering we need to enable this on the actual
    539540   * macronix part as well. This is set by enabling bit 3 of the crtc
    540    * register. 
     541   * register.
    541542   */
    542543  if (nBuffers == 3) tmp |= 0x08;
    543544  mcrxHALData.initSwapTiles = initMCRXSwapTiles;
    544545
    545   if (envVal = myGetenv("MRCX_71")) 
     546  if (envVal = myGetenv("MRCX_71"))
    546547    sscanf(envVal, "%x", &tmp);
    547548  CRTC_SET(0x70, tmp);
     
    562563#undef FN_NAME
    563564} /* initMCRXUseTiles */
    564  
     565
    565566
    566567/*-------------------------------------------------------------------
     
    572573
    573574  get information about MCRX
    574  
     575
    575576  Arguments:
    576577  info - pointer to info struct
    577  
     578
    578579  Return:
    579580  True if success, False if Failure
    580581  -------------------------------------------------------------------*/
    581 INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info)) 
     582INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info))
    582583{
    583584#define FN_NAME "initMCRXGetInfo"
     
    594595  /* Watcom warning suppression */
    595596  revString[0] = revString[0];
    596  
     597
    597598  info->vgaChip = 0;
    598599  info->vg96Rev = 0;
     
    600601  info->tfxRev  = 1;
    601602  info->tfxRam  = 2;
    602  
     603
    603604  info->vg96Ram = (0x100000 << mBytesPow);
    604605
    605606  GDBG_INFO((80, "%s: frame buffer has 0x%x bytes\n", FN_NAME, info->vg96Ram));
    606  
     607
    607608  return FXTRUE;
    608  
     609
    609610#undef FN_NAME
    610611} /* 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
     
    5859
    5960#ifndef DUMMY
    60 static Display              *dpy        = 0;
    61 static int                  screenNum   = 0;
    62 static int                  screenWidth = 0;
    63 static void*                screenPhys  = 0;
    64 static int                  screenMem   = 0;
    65 static GC                   xgc         = 0;
     61static Display          *dpy    = 0;
     62static int          screenNum   = 0;
     63static int          screenWidth = 0;
     64static void*            screenPhys  = 0;
     65static int          screenMem   = 0;
     66static GC           xgc     = 0;
    6667static Window               hWndApp     = 0;
    67 static FxU32                Width       = 0; 
     68static FxU32                Width       = 0;
    6869static FxU32                Height      = 0;
    6970static FxBool               IsFullScreen = 0;
     
    155156  screenNum=XDefaultScreen(dpy);
    156157  XF86DGAGetVideoLL(dpy, screenNum, (int*)&screenPhys, &screenWidth, &banksize,
    157                     &screenMem);
     158            &screenMem);
    158159  screenMem*=1024;
    159160  return FXTRUE;
     
    168169}
    169170
    170 static int 
     171static int
    171172cvtXToGlideDesc(InitBufDesc_t *pDesc) {
    172173  InitBufDesc_t   *dFront  = &pDesc[0];
     
    200201    return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info");
    201202  dBack->bufOffset -= dScreen->bufOffset;
    202  
     203
    203204  /* Get info about aux buffer (pixmap) */
    204205  dAux->bufType = INIT_BUFFER_AUXBUFFER;
    205   if (!cvtAddrToBufDesc(addrAux, dAux)) 
     206  if (!cvtAddrToBufDesc(addrAux, dAux))
    206207    return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info");
    207208  dAux->bufOffset -= dScreen->bufOffset;
    208  
     209
    209210  /* Get info about triple buffer (pixmap if used) */
    210211  if (tripleBuffering) {
     
    219220  dFifo->bufOffset = (int)addrFifo-dScreen->bufOffset;
    220221  dFifo->bufStride = FIFOSIZE;
    221  
     222
    222223  GDBG_INFO((80, "cvtXToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset));
    223224  GDBG_INFO((80, "cvtXToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
     
    269270
    270271static int
    271 doAllocPixmaps(int xRes, int yRes, int vRefresh, 
    272                       InitBufDesc_t *pDesc) {
    273     GDBG_INFO((80, "doAllocPixmaps: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 
     272doAllocPixmaps(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",
    274275             hWndApp, IsFullScreen, xRes, yRes, vRefresh));
    275276
     
    277278
    278279  pixFifo=XCreatePixmap(dpy, hWndApp, screenWidth,
    279                         (FIFOSIZE/2+4096+screenWidth-1)/screenWidth, 16);
     280            (FIFOSIZE/2+4096+screenWidth-1)/screenWidth, 16);
    280281  if ((XF86RushLockPixmap(dpy, screenNum, pixFifo, &addrFifo)==FXFALSE)
    281282      || !addrFifo) {
     
    289290  pixBack=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
    290291  if ((XF86RushLockPixmap(dpy, screenNum, pixBack,
    291                           &addrBack)==FXFALSE) || !addrBack) {
     292              &addrBack)==FXFALSE) || !addrBack) {
    292293    doReleasePixmaps();
    293294    return ErrorMessage(hWndApp, "Failed to lock back pixmap\n");
     
    295296  pixAux=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
    296297  if ((XF86RushLockPixmap(dpy, screenNum, pixAux,
    297                           &addrAux)==FXFALSE) || !addrAux) {
     298              &addrAux)==FXFALSE) || !addrAux) {
    298299    doReleasePixmaps();
    299300    return ErrorMessage(hWndApp, "Failed to lock aux pixmap\n");
     
    302303    pixTriple=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
    303304    if ((XF86RushLockPixmap(dpy, screenNum, pixTriple,
    304                             &addrTriple)==FXFALSE) || !addrTriple) {
     305                &addrTriple)==FXFALSE) || !addrTriple) {
    305306      doReleasePixmaps();
    306307      return ErrorMessage(hWndApp, "Failed to lock triple pixmap\n");
     
    311312}
    312313
    313 static FxBool 
     314static FxBool
    314315getWindowSize(int *width, int *height) {
    315316    XWindowAttributes attr;
     
    351352
    352353    /*
    353      * Get ourselves a valid window handle 
     354     * Get ourselves a valid window handle
    354355     */
    355356    hWndApp = (Window)hWindow;
     
    374375
    375376    if ((sRes <  GR_RESOLUTION_320x200) ||
    376         (sRes >  GR_RESOLUTION_512x256)) 
     377        (sRes >  GR_RESOLUTION_512x256))
    377378      return ErrorMessage(hWndApp, "Bad Fullscreen resolution");
    378379
     
    389390      return ErrorMessage(hWndApp, "Screen depth must be 16\n");
    390391    if (XF86DGAQueryDirectVideo(dpy, DefaultScreen(dpy), &flags)==False ||
    391         !flags) {
     392    !flags) {
    392393      GDBG_INFO((0, "Could query Direct Video"));
    393394      return ErrorMessage(hWndApp, "Direct video not supported\n");
    394395    }
    395396    if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numModes,
    396                                    &vidModes)==False) {
     397                   &vidModes)==False) {
    397398      return ErrorMessage(hWndApp, "Couldn't query vidmode list\n");
    398399      return 1;
     
    400401    for (i=0; i<numModes; i++)
    401402      if ((vidModes[i]->hdisplay==Width) && (vidModes[i]->vdisplay==Height))
    402         break;
     403    break;
    403404    if (i==numModes) {
    404405      return ErrorMessage(hWndApp, "Server doesn't support requested resolution\n");
    405406      if (vidModes) {
    406         XFree(vidModes);
    407         vidModes=0;
     407    XFree(vidModes);
     408    vidModes=0;
    408409      }
    409410      return 1;
     
    429430    GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType));
    430431    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));
    432433    GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP));
    433434  }
     
    450451
    451452  if ( curHALData->initSetVideo ) {
    452     curHALData->initSetVideo( sRes, vRefresh, 
     453    curHALData->initSetVideo( sRes, vRefresh,
    453454                             (FxU32*)width, (FxU32*)height );
    454455  }
     
    463464{
    464465  int     i, w, h;
    465  
     466
    466467  GDBG_INFO((80, "linControl: code = %d\n", code));
    467468
     
    472473    getWindowSize(&w, &h);
    473474    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));
    476477
    477478      if (!doAllocPixmaps(w, h, 0, BufDesc)) {
    478         w=Width;
    479         h=Height;
    480         if (!doAllocPixmaps(w, h, 0, BufDesc)) {
    481           /* ErrorMessage(hWndApp, "linControl: Resize failed\n"); */
    482           return FXFALSE;
    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    }
    484485      }
    485486      Width = w;
     
    512513  GDBG_INFO((80, "linControl: code = %d, w = %d, h = %d\n", code,
    513514             Width, Height));
    514  
     515
    515516  return FXTRUE;
    516517} /* 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:32 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:03 $
    2324**
    2425** Initialization code for initializing supported SST-1 DACs
     
    3940**  Read external DAC registers
    4041**  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
    4243**        this routine.
    4344**        fbiInit23 register remapping (PCI config. initEnable[2]=1) must be
     
    7273**  Write to external DAC registers
    7374**  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
    7576**        this routine.
    7677**
     
    591592    {
    592593        float calc;
    593        
     594
    594595        calc = ((float) 14.318 * (float) (m + 2)) /
    595596            ((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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:33 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:04 $
    2324**
    2425** Initialization code for loading SST-1 gamma tables
     
    132133        else
    133134            sstVideoIsReset = FXFALSE;
    134    
     135
    135136        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
    136137        /* wait for video reset to be deasserted */
     
    147148        FxU32 gcG = gammaTableG[(x<<3)];
    148149        FxU32 gcB = gammaTableB[(x<<3)];
    149         ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
     150        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) |
    150151                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
    151152                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
     
    173174}
    174175
    175 FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries, 
     176FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries,
    176177FxU32 *r, FxU32 *g, FxU32 *b)
    177178{
     
    213214        else
    214215            sstVideoIsReset = FXFALSE;
    215    
     216
    216217        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
    217218        /* wait for video reset to be deasserted */
     
    228229        FxU32 gcG = gammaTableG[(x<<3)];
    229230        FxU32 gcB = gammaTableB[(x<<3)];
    230         ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
     231        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) |
    231232                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
    232233                         (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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:33 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:31:04 $
    2223*/
    2324
     
    104105    /* I can't init gdbg_msgfile to stdout since it isn't constant so
    105106     * I do it now */
    106     gdbg_msgfile = stdout;   
     107    gdbg_msgfile = stdout;
    107108
    108109    done = 1;
     
    132133gdbg_vprintf (const char *format,va_list args)
    133134{
    134  
     135
    135136    if (gdbg_msgfile != NULL) {
    136137        if (!UseDebugString) {
     
    138139            vfprintf(gdbg_msgfile,format,args);
    139140
    140             fflush(gdbg_msgfile);   
    141         } 
     141            fflush(gdbg_msgfile);
     142        }
    142143#ifdef __WIN32__
    143144        else {
     
    262263        if (outf) gdbg_msgfile = outf;
    263264        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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:33 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:04 $
    2324**
    2425** Routines to detect memory size, strapping pin, and other initialization
     
    3738#define XY_ONE (1<<SST_XY_FRACBITS)
    3839
    39 static FxBool 
    40 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 
    41                 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
     40static FxBool
     41readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y,
     42            FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
    4243{
    4344    FxU32 rd_x, rd_y;
     
    5051    sst1InitIdle(sstbase);
    5152    if (x & 1) {
    52         INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
    53         return(FXFALSE);
     53    INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
     54    return(FXFALSE);
    5455    }
    5556
     
    5960    *b_sum = 0;
    6061
    61     for (rd_y = 0; rd_y < 4; rd_y++) {          /* read 4 scanlines */
    62         for (rd_x = 0; rd_x < 4; rd_x ++) {
    63             if ((rd_x & 1)==0) {                /* read 2 pixels at a time */
    64                 rd_col =
    65                   IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);
    66             }
    67             else rd_col >>= 16;
    68             rd_r = ((rd_col >> 11) & 0x1f) << 3;
    69             rd_g = ((rd_col >>  5) & 0x3f) << 2;
    70             rd_b = ((rd_col >>  0) & 0x1f) << 3;
    71             *r_sum += rd_r;
    72             *g_sum += rd_g;
    73             *b_sum += rd_b;
    74             INIT_INFO((4,"%d,%d = rd_col: 0x%04x   rgb: %02x %02x %02x\n",
    75                     rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));
    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    }
    7778    }
    7879    INIT_INFO((3,"sums:  r_sum=0x%03x  g_sum=0x%03x  b_sum=0x%03x\n",
    79                     *r_sum, *g_sum, *b_sum));
    80         return(FXTRUE);
     80            *r_sum, *g_sum, *b_sum));
     81    return(FXTRUE);
    8182}
    8283
     
    117118    /* init sum array */
    118119    for (r_sum = 0; r_sum <= 0xfff; r_sum++) {
    119         rb_tbl[r_sum] = -1;
    120         g_tbl[r_sum] = -1;
     120    rb_tbl[r_sum] = -1;
     121    g_tbl[r_sum] = -1;
    121122    }
    122123
     
    126127    /* fill sum array */
    127128    for (tst_color = 0; tst_color <= 255; tst_color++) {
    128         INIT_INFO((2,"tst_color=0x%02x\n", tst_color));
    129         ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);
    130 
    131         drawTriangle(sst, x,y,36);
    132         if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)
    133                 return(FXFALSE);
    134 
    135         /* check sums for uniqueness and then store away */
    136         if (r_sum != b_sum) {
    137             INIT_PRINTF(("ERROR:  b_sum=0x%03x  r_sum=0x%03x\n", r_sum, b_sum));
    138                 return(FXFALSE);
    139         }
    140         if (rb_tbl[r_sum] != -1) {
    141             INIT_PRINTF(("ERROR:  non-unique r/b_sum=0x%03x\n", r_sum));
    142                 return(FXFALSE);
    143         }
    144         rb_tbl[r_sum] = tst_color;
    145         if (g_tbl[g_sum] != -1) {
    146             INIT_PRINTF(("ERROR:  non-unique g_sum=0x%03x\n", g_sum));
    147                 return(FXFALSE);
    148         }
    149         g_tbl[g_sum] = tst_color;
    150     }
    151         return(FXTRUE);
     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);
    152153}
    153154
     
    158159    if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1)
    159160    {
    160         INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
    161         return(FXFALSE);
     161    INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
     162    return(FXFALSE);
    162163    }
    163164    *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum];
    164         return(FXTRUE);
     165    return(FXTRUE);
    165166}
    166167
     
    179180    /* render into the frame buffer */
    180181    ISET(sst->fbzColorPath,
    181           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     182      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    182183    ISET(sst->texBaseAddr, 0);
    183184    ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS);
     
    187188    readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum);
    188189    if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)
    189                 return(FXFALSE);
    190         if(GETENV(("SST_TMUCFG")))
     190        return(FXFALSE);
     191    if(GETENV(("SST_TMUCFG")))
    191192        SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
    192193
     
    196197    ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]);
    197198
    198         return(FXTRUE);
     199    return(FXTRUE);
    199200}
    200201
     
    204205
    205206static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
    206                    FxU32 mem, FxU32 init)
     207           FxU32 mem, FxU32 init)
    207208{
    208209    volatile Sstregs *sst = (Sstregs *) sstbase;
     
    214215    sst1InitIdle(sstbase);
    215216
    216     ISET(sst->texBaseAddr, 0x200000>>3);        /* set to 2 MB */
    217     texAddr[0] = SENSE2;                /* write a random value */
    218     ISET(sst->texBaseAddr, 0x100000>>3);        /* set to 1 MB */
    219     texAddr[0] = SENSE1;                /* write a random value */
    220     ISET(sst->texBaseAddr, 0x000000>>3);        /* set to 0 MB */
    221     texAddr[0] = SENSE0;                /* write a random value */
    222 
    223     ISET(sst->texBaseAddr, mem>>3);             /* reset to 2 MB */
    224     drawTriangle(sst,0,0,4);            /* draw a 4x4 right triangle */
     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 */
    225226    sst1InitIdle(sstbase);
    226227
     
    237238FX_EXPORT FxBool FX_CSTYLE
    238239sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
    239         FxU32 *TmuMemorySize)
     240    FxU32 *TmuMemorySize)
    240241{
    241242    FxU32 i,data;
     
    244245    INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu));
    245246
    246         if(GETENV(("SST_TMUMEM_SIZE"))) {
    247                 *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE")));
    248                 return(FXTRUE);
    249         }
     247    if(GETENV(("SST_TMUMEM_SIZE"))) {
     248        *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE")));
     249        return(FXTRUE);
     250    }
    250251
    251252    ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER);
    252253    ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK);
    253254    ISET(sst->fbzColorPath,
    254           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     255      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    255256    ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE);
    256257    ISET(sst->tLOD, 0);
     
    258259    /* setup all downstream TMUs to be in pass-thru mode */
    259260    for (i=0; i<tmu; i++)
    260         ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
     261    ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
    261262
    262263    /* first see if we have 4 Mbytes by writing a texel at 2MB followed by
     
    278279
    279280    INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n"));
    280         return(FXFALSE);
     281    return(FXFALSE);
    281282}
    282283
    283284/*---------------------------------------------------------------------------
    284285   NOTES:
    285         assumes that board and registers are initialized
    286         destroys part of the framebuffer
     286    assumes that board and registers are initialized
     287    destroys part of the framebuffer
    287288  ---------------------------------------------------------------------------*/
    288289FX_EXPORT FxBool FX_CSTYLE
     
    292293
    293294    if(initSumTables(sstbase) == FXFALSE)
    294                 return(FXFALSE);
     295        return(FXFALSE);
    295296    if(getTmuConfigData(sstbase,info) == FXFALSE)
    296                 return(FXFALSE);
    297 
    298         /* TMU memory speed */
    299         /* tmuClkFixed is no longer used... */
    300         info->tmuClkFixed = 0x0;
    301         /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
    302         info->tmuMemSpeed = 0;
     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;
    303304
    304305    /* count the TMUs and verify that all TMUs are the same revision */
     
    306307    info->numberTmus = 1;
    307308    if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE)
    308                 return(FXFALSE);
     309        return(FXFALSE);
    309310    INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0]));
    310     if (info->tmuConfig & FXBIT(6)) {           /* if TMU 1 exists */
    311         info->numberTmus++;                     /* increment TMU count */
    312         trev = (info->tmuConfig>>7) & 0x7;      /* get its revision */
    313         if (info->tmuRevision != trev) {
    314             INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
    315             return(FXFALSE);
    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    }
    317318    if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE)
    318                 return(FXFALSE);
    319     }
    320     if (info->tmuConfig & FXBIT(13)) {          /* if TMU 2 exists */
    321         info->numberTmus++;                     /* increment TMU count */
    322         trev = (info->tmuConfig>>14) & 0x7;     /* get its revision */
    323         if (info->tmuRevision != trev) {
    324             INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
    325             return(FXFALSE);
    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    }
    327328    if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE)
    328                 return(FXFALSE);
     329        return(FXFALSE);
    329330    }
    330331    INIT_INFO((1,"numberTMus = %d\n", info->numberTmus));
     
    339340**
    340341*/
    341 #define LFB_PUTPIXEL(X, Y, DATA)        \
    342         ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)
    343 #define LFB_GETPIXEL(X, Y)                      \
    344         IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])
     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)])
    345346
    346347static int fbiMemSize(FxU32 *sstbase)
    347348{
    348         volatile Sstregs *sst = (Sstregs *) sstbase;
    349         volatile unsigned short *lfbptr = (unsigned short *) sstbase;
    350         FxU32 init0Save = IGET(sst->fbiInit0);
    351         FxU32 init1Save = IGET(sst->fbiInit1);
    352         FxU32 init2Save = IGET(sst->fbiInit2);
    353         int retval = 0;
    354 
    355         if(GETENV(("SST_FBIMEM_SIZE")))
    356                 return(ATOI(GETENV(("SST_FBIMEM_SIZE"))));
    357 
    358         /* Enable dram refresh, disable memory fifo, and setup memory */
    359         /* for rendering */
    360         ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);
     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);
    361362    ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH);
    362         sst1InitIdleFBI(sstbase);
    363 
    364         /* Setup Basic rendering datapath */
    365         ISET(sst->fbzColorPath, SST_CC_MONE);
    366         ISET(sst->fogMode, 0x0);
    367         ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);
    368         sst1InitIdleFBI(sstbase);
    369 
    370         if(sst1InitSliDetect(sstbase))
    371                 /* SLI cannot support 4 MBytes... */
    372                 goto check2MByte;
     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;
    373374    sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1);
    374         sst1InitIdleFBI(sstbase);
    375 
    376         ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |
    377                 SST_LFB_READDEPTHABUFFER);
    378         sst1InitIdleFBI(sstbase);
    379 
    380         /* Check for 4 MBytes... */
    381         /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */
    382         LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */
    383         LFB_PUTPIXEL(0, 0, 0x0);
    384         LFB_PUTPIXEL(798, 599, 0xffff);
    385         LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */
    386         LFB_PUTPIXEL(20, 20, 0xffff);
    387         LFB_PUTPIXEL(400, 400, 0x0);
    388         sst1InitIdleFBI(sstbase);
    389         if((LFB_GETPIXEL(128, 100) == 0xdead) &&
    390            (LFB_GETPIXEL(200, 200) == 0x55aa)) {
    391                 retval = 4;
    392                 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
    393                 sst1InitIdleFBI(sstbase);
    394                 goto fbiMemSizeDone;
    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    }
    396397
    397398check2MByte:
    398         /* Check for 2 MBytes... */
    399         /* Write to color buffer in 640x480 resolution */
     399    /* Check for 2 MBytes... */
     400    /* Write to color buffer in 640x480 resolution */
    400401    sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0);
    401         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
    402                 SST_LFB_READFRONTBUFFER);
    403         sst1InitIdleFBI(sstbase);
    404         LFB_PUTPIXEL(50, 100, 0xdead);  /* maps to row:0x1e, col:0x99, bank:0x0 */
    405         LFB_PUTPIXEL(0, 0, 0x0);
    406         LFB_PUTPIXEL(638, 479, 0xffff);
    407         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |
    408                 SST_LFB_READFRONTBUFFER);
    409         sst1InitIdleFBI(sstbase);
    410         LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */
    411         LFB_PUTPIXEL(20, 20, 0x0);
    412         LFB_PUTPIXEL(400, 400, 0xffff);
    413         sst1InitIdleFBI(sstbase);
    414         if(LFB_GETPIXEL(50, 100) != 0xdead)
    415                 goto check1MByte;
    416         ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
    417         sst1InitIdleFBI(sstbase);
    418         if(LFB_GETPIXEL(178, 436) == 0xaa55) {
    419                 retval = 2;
    420                 goto fbiMemSizeDone;
    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    }
    422423
    423424check1MByte:
    424         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
    425                 SST_LFB_READFRONTBUFFER);
    426         sst1InitIdleFBI(sstbase);
    427         LFB_PUTPIXEL(10, 10, 0xdead);   /* maps to row:0x0, col:0x145, bank:0x0 */
    428         LFB_PUTPIXEL(8, 8, 0x0);
    429         LFB_PUTPIXEL(340, 340, 0xffff);
    430         LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */
    431         LFB_PUTPIXEL(66, 0, 0x0);
    432         LFB_PUTPIXEL(360, 360, 0xffff);
    433         sst1InitIdleFBI(sstbase);
    434         if((LFB_GETPIXEL(10, 10) == 0xdead) &&
    435            (LFB_GETPIXEL(100, 200) == 0x5a5a))
    436                 retval = 1;
     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;
    437438
    438439fbiMemSizeDone:
    439         /* Restore init registers to original state */
    440         ISET(sst->fbiInit0, init0Save);
    441         ISET(sst->fbiInit1, init1Save);
    442         ISET(sst->fbiInit2, init2Save);
    443         sst1InitIdleFBI(sstbase);
    444 
    445         return(retval);
     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);
    446447}
    447448
     
    449450sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
    450451{
    451         volatile Sstregs *sst = (Sstregs *) sstbase;
     452    volatile Sstregs *sst = (Sstregs *) sstbase;
    452453
    453454    info->fbiMemSize = fbiMemSize(sstbase);
    454455
    455         /* Detect board identification and memory speed */
    456         if(GETENV(("SST_FBICFG")))
     456    /* Detect board identification and memory speed */
     457    if(GETENV(("SST_FBICFG")))
    457458        SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
    458459    else
    459                 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
    460                         SST_FBI_MEM_TYPE_SHIFT;
    461 
    462         info->fbiBoardID = (info->fbiConfig >> 2) & 0x1;
    463         /* fbiMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
    464         info->fbiMemSpeed = 0;
    465 
    466         /* Detect scanline interleaving */
    467         info->sstSliDetect = sst1InitSliDetect(sstbase);
     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);
    468469
    469470    return FXTRUE;
     
    504505    if(GETENV(("SST_NODEVICEINFO"))) {
    505506        /* fill device info struct with sane values... */
    506         INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));
    507 
    508                 if(GETENV(("SST_FBICFG")))
    509                 SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
    510                 else
    511                 info->fbiConfig = 0x0;
    512 
    513                 if(GETENV(("SST_TMUCFG")))
    514                 SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
    515                 else
    516                 info->tmuConfig = 0x0;
     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;
    517518
    518519        info->numberTmus = 1;
    519         if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */
    520                         info->numberTmus++;
    521             if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */
    522                         info->numberTmus++;
    523 
    524         info->tmuRevision = info->tmuConfig & 0x7;
    525 
    526                 if(GETENV(("SST_FBIMEM_SIZE")))
    527                         info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE")));
    528                 else
    529                 info->fbiMemSize = 2;
    530 
    531                 if(GETENV(("SST_TMUMEM_SIZE")))
    532                         info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE")));
    533                 else
    534                 info->tmuMemSize[0] = 2;
    535                 info->tmuMemSize[1] = info->tmuMemSize[0];
    536                 info->tmuMemSize[2] = info->tmuMemSize[0];
     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];
    537538    } else {
    538                 int i;
    539 
    540                 for(i=0; i<5; i++) {
    541                         if(i)
    542                                 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
    543                 /* GetFbiInfo() must be called before GetTmuInfo() */
    544                 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
    545                                 continue;
    546                 /* get the revision ID of each TMU and verify that they are all the
    547                            same */
    548                 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)
    549                                 continue;
    550                         break;
    551                 }
    552                 if(i == 5)
    553                         return(FXFALSE);
     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);
    554555    }
    555556    INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n",
     
    568569    if(sst1InitUseVoodooFile == FXTRUE) {
    569570        if(iniDac == (sst1InitDacStruct *) NULL)
    570                         INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
    571                 else
    572                 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
    573                           iniDac->dacManufacturer, iniDac->dacDevice));
    574         } else {
    575             INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
    576             if(info->fbiDacType == SST_FBI_DACTYPE_ATT)
    577                 INIT_PRINTF(("AT&T ATT20C409\n"));
    578             else if(info->fbiDacType == SST_FBI_DACTYPE_ICS)
    579                 INIT_PRINTF(("ICS ICS5342\n"));
    580             else if(info->fbiDacType == SST_FBI_DACTYPE_TI)
    581                 INIT_PRINTF(("TI TVP3409\n"));
    582             else
    583                 INIT_PRINTF(("Unknown\n"));
    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    }
    585586    INIT_PRINTF(("sst1DeviceInfo: SliDetect:%d\n", info->sstSliDetect));
    586587
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:34 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:05 $
    2324**
    2425** Parsing code for grabbing information from "voodoo.ini" initialization file
     
    170171    /* Override voodoo.ini name */
    171172    strcpy(filename, getenv("VOODOO_FILE"));
    172     if (!(file = fopen(filename, "r"))) 
     173    if (!(file = fopen(filename, "r")))
    173174      goto __errExit;
    174175  } else {
     
    183184    while(1) {
    184185      if (!i) {
    185         if ((tmpPtr = strtok(path, ":")) == NULL)
    186           break;
     186    if ((tmpPtr = strtok(path, ":")) == NULL)
     187      break;
    187188      } else {
    188         if ((tmpPtr = strtok(NULL, ":")) == NULL)
    189           break;
     189    if ((tmpPtr = strtok(NULL, ":")) == NULL)
     190      break;
    190191      }
    191192      strcpy(filename, tmpPtr);
    192193      if (filename[strlen(filename)-1] == '\\')
    193         sprintf(filename, "%voodoo", filename);
     194    sprintf(filename, "%voodoo", filename);
    194195      else
    195         sprintf(filename, "%s/voodoo", filename);
     196    sprintf(filename, "%s/voodoo", filename);
    196197      i++;
    197198      if ((file = fopen(filename, "r")))
    198         break;
     199    break;
    199200    }
    200201  }
     
    513514                break;
    514515            }
    515             if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 
     516            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct))))
    516517                return(0);
    517518
     
    898899   * string table has been freed by the c runtime but has not been set
    899900   * 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.
    901902   */
    902903  {
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:34 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:05 $
    2324**
    2425** Print functions for SST-1 Initialization routines
     
    4647    if(firstPass == FXTRUE) {
    4748        firstPass = FXFALSE;
    48         if (sst1InitMsgFile == NULL)
    49         {
    50           /* I couldn't initialize to stdout because stdout is not constant */
    51           sst1InitMsgFile = stdout;
    52         }
     49    if (sst1InitMsgFile == NULL)
     50    {
     51      /* I couldn't initialize to stdout because stdout is not constant */
     52      sst1InitMsgFile = stdout;
     53    }
    5354        if(GETENV(("SST_INITDEBUG")))
    5455            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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:34 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:05 $
    2324**
    2425** Initialization code for initializing scanline interleaving
     
    8485        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    8586        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));
    8788        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) |
    8889          (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE));
     
    153154            /* 16-bit Video Output */
    154155            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)) |
    156157                SST_EN_SCANLINE_INTERLEAVE |
    157158                /* SST_VIDEO_VID_CLK_SLAVE | */
     
    166167            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
    167168                    ~(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)) |
    169170                SST_EN_SCANLINE_INTERLEAVE |
    170171                /* SST_VIDEO_VID_CLK_SLAVE | */
     
    274275        /* 16-bit Video Output */
    275276        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)) |
    277278            SST_EN_SCANLINE_INTERLEAVE |
    278279            SST_VIDEO_VID_CLK_2X |
     
    286287        ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) &
    287288                ~(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)) |
    289290            SST_EN_SCANLINE_INTERLEAVE |
    290291            SST_VIDEO_VID_CLK_2X |
     
    321322    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    322323    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)));
    324325    MasterPhysAddr = sst1CurrentBoard->physAddr;
    325326    sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */
     
    332333    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    333334    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));
    335336    /* Map both boards to same Master physical address */
    336337    PCICFG_WR(PCI_BASE_ADDRESS_0, MasterPhysAddr);
     
    432433            PCICFG_WR(SST1_PCI_INIT_ENABLE,
    433434                (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));
    435436            PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
    436437            ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) &
     
    438439            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    439440            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)));
    441442            PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
    442443            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/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:35 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:31:06 $
    2223**
    2324*/
     
    2829** NOTE: This code must compiled with optimizations DISABLED!!
    2930**
    30 ** The following environment variables can optionally be used to alter 
     31** The following environment variables can optionally be used to alter
    3132** functionality (A value of X is a "don't care"):
    3233**
     
    203204                &sst1InitDeviceNumber, j, 0);
    204205#else
    205             sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard, 
     206            sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard,
    206207                &sst1InitDeviceNumber, j, 0);
    207208#endif /* DIRECTX */
     
    331332    sst1InitReturnStatus(sstbase);
    332333    sst1InitReturnStatus(sstbase);
    333    
     334
    334335    /* Adjust Fbi-to-Trex clock delay value */
    335336    /* Adjust Trex-to-Fbi FIFO */
     
    486487            (tf2_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
    487488    }
    488     INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 
     489    INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n",
    489490        sst1CurrentBoard->tmuInit1[2]));
    490491
     
    709710    }
    710711#ifdef __DOS32__
    711     /* 
     712    /*
    712713     * HACK alert. -MS
    713714     *
    714715     * There's a pciClose(), but nobody calls it. This is needed by the
    715716     * DOS DPMI services to close fxmemmap.vxd.
    716      * 
     717     *
    717718     * We need to move this to the "appropriate" place, wherever that may be.
    718719     */
     
    762763            return(FXFALSE);
    763764        sst1CurrentBoard->initGrxClkDone = 0;
    764        
     765
    765766        if((++n > 1) || !SliEnable)
    766767            break;
     
    877878}
    878879
    879 static FxU32 
     880static FxU32
    880881  mtrr;
    881882
     
    886887**
    887888*/
    888 FX_EXPORT void FX_CSTYLE 
     889FX_EXPORT void FX_CSTYLE
    889890sst1InitCachingOn(void)
    890891{
    891   FxU32 
     892  FxU32
    892893    physAddr;
    893894  FxBool
     
    909910  else
    910911    return;                   /* It's already there.  We're done. */
    911  
     912
    912913  if (res)
    913914    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:35 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:06 $
    2324**
    2425** Utility routines for SST-1 Initialization code
     
    225226    if(enable) {
    226227        /* 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) |
    228229            sst1CurrentBoard->vgaPassthruEnable);
    229230        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN);
    230231    } else {
    231232        /* 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) |
    233234            sst1CurrentBoard->vgaPassthruDisable);
    234235        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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:35 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:07 $
    2324**
    2425** Initialization code for initializing SST-1 video unit
     
    348349    /* Reset Video Refresh Unit */
    349350    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
    350    
     351
    351352    /* Enable video clock */
    352353    if(SLI_DRIVEOK()) {
     
    400401    /* Setup SST memory mapper for desired resolution */
    401402    if(sst1CurrentBoard->fbiMemSize == 4)
    402         sst1InitSetResolution(sstbase, sstVideoRez, 1); 
     403        sst1InitSetResolution(sstbase, sstVideoRez, 1);
    403404    else
    404         sst1InitSetResolution(sstbase, sstVideoRez, 0); 
     405        sst1InitSetResolution(sstbase, sstVideoRez, 0);
    405406
    406407    if((GETENV(("SST_TRIPLE_BUFFER"))) ||
     
    506507    if(sst1CurrentBoard->fbiMemSize == 1 && sstVideoRez->xDimension > 512)
    507508        n = 0;
    508    
     509
    509510    if(n) {
    510511        sst1CurrentBoard->fbiMemoryFifoEn = 1;
     
    530531    INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n",
    531532                 sst1CurrentBoard->memFifoStatusLwm,
    532                  sst1CurrentBoard->memFifoStatusLwm)); 
     533                 sst1CurrentBoard->memFifoStatusLwm));
    533534
    534535    vInClkDel = 0;
     
    781782**      Video Timing Structure
    782783*/
    783 FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 
     784FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution,
    784785                                                                          GrScreenRefresh_t screenRefresh)
    785786{
     
    995996**
    996997*/
    997 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 
     998FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase,
    998999    sst1VideoTimingStruct *sstVideoRez, FxU32 Banked)
    9991000{
     
    10891090** sst1InitSetTripleBuffering():
    10901091**  Specify Video Triple Buffering
    1091 **  NOTE: sst1InitSetTripleBuffering() must be called prior to calling 
     1092**  NOTE: sst1InitSetTripleBuffering() must be called prior to calling
    10921093**   sst1InitVideo() to properly setup Video Triple Buffering
    10931094**
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:27 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:00 $
    2324**
    2425*/
     
    5051                        int                     *fbStride,
    5152                        sst1VideoTimingStruct   *vidTimings) {
    52     return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin, 
     53    return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin,
    5354                           nColBuffers, nAuxBuffers,
    5455                           &context->info.regs,
     
    7273        init96Swap( code, &context->info.regs, context->writeMethod );
    7374    return INIT_SWAP_FLIP;
    74 } 
     75}
    7576
    7677static FxU32 status( void ) {
    7778  return *(context->info.regs.hwDep.VG96RegDesc.serialStatus);
    78 } 
     79}
    7980
    8081static FxBool busy(void) {
     
    8485
    8586  return rv;
    86 } 
     87}
    8788
    8889static void idle( void ) {
     
    111112    FxBool rv = FXFALSE;
    112113    GDBG_INFO((80, "vg96drvr: control: code = %d\n", code));
    113     if (context) 
     114    if (context)
    114115        rv = init96Control( code, &context->info.regs);
    115116    return rv;
     
    160161    context->initGammaTable   = gammatable;
    161162    context->findVidTimingStruct = findvidtiming;
    162 } 
     163}
    163164#else
    164165/* I've got to stub this one to get the Voodoo Graphics glide to link */
     
    184185    context->gammaRGB         = NULL;
    185186    context->initGammaTable   = NULL;
    186     context->findVidTimingStruct = NULL; 
     187    context->findVidTimingStruct = NULL;
    187188
    188189}
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:27 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:01 $
    2324**
    2425*/
     
    4546    static int _w[] = {320,320,400,512,640,640,640,640,800,960,856,512};
    4647    static int _h[] = {200,240,256,384,200,350,400,480,600,720,480,256};
    47    
     48
    4849    rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
    4950                        sRes,
    50                         vRefresh, 
     51                        vRefresh,
    5152                        vidTimings );
    5253
     
    5859        rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.slaveBaseAddr,
    5960                            sRes,
    60                             vRefresh, 
     61                            vRefresh,
    6162                            vidTimings );
    6263        if ( !rv ) goto BAIL;
     
    8889
    8990    if ( info ) {
    90         rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr, 
     91        rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
    9192                                    &sstInfo );
    9293        info->hwDep.vgFIFOData.memFifoStatusLwm = sstInfo.memFifoStatusLwm;
     
    103104static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) {
    104105    return INIT_SWAP_FLIP;
    105 } 
     106}
    106107
    107108static FxU32 FX_CALL status( void ) {
    108109  return sst1InitReturnStatus((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr);
    109 } 
     110}
    110111
    111112static FxBool FX_CALL busy(void) {
    112113  FxU32 stat = status();
    113114  FxBool ret = (stat & SST_BUSY) ? FXTRUE : FXFALSE;
    114  
     115
    115116  return ret;
    116 } 
     117}
    117118
    118119static 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 $ */
    12/*
    23 * DLL entry point
     
    5152   case DLL_THREAD_ATTACH:
    5253   case DLL_THREAD_DETACH:
    53         return DllMain(hinstDLL, fdwReason, fImpLoad);
     54    return DllMain(hinstDLL, fdwReason, fImpLoad);
    5455
    5556   case DLL_PROCESS_DETACH:
    56         DllMain(hinstDLL, fdwReason, fImpLoad);
    57         ctordtorTerm();
    58         return TRUE;
     57    DllMain(hinstDLL, fdwReason, fImpLoad);
     58    ctordtorTerm();
     59    return TRUE;
    5960   }
    6061   return FALSE;
     
    8687         CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed  98-03-18 05:28:48*/
    8788
    88         dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
    89          if(dllHandle == 0) 
    90                 return 0UL;
     89    dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
     90         if(dllHandle == 0)
     91        return 0UL;
    9192
    9293         break;
    9394      case 1 :
    9495         if(dllHandle) {
    95                 UnregisterLxDll(dllHandle);
     96        UnregisterLxDll(dllHandle);
    9697         }
    9798         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 $ */
    12/*
    23 * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 * 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
    89 * 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.
    1011 *
    1112 * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
     
    2526/*************************************** 3df files ****************************/
    2627/* Read word, msb first */
    27 static FxBool 
     28static FxBool
    2829_txRead16 (FILE *stream, FxU16* data)
    2930{
     
    3637
    3738/* Read long word, msb first */
    38 static FxBool 
     39static FxBool
    3940_txRead32 (FILE *stream, FxU32* data)
    4041{
     
    5354
    5455/* Read NCC table */
    55 static FxBool 
     56static FxBool
    5657_txRead3DFNCCTable (FILE* stream, FxI32* ncc_table)
    5758{
     
    8788}
    8889
    89 static FxBool 
     90static FxBool
    9091_txRead3DFPalTable (FILE* stream, FxI32* pal)
    9192{
     
    114115    if (fscanf (stream, "f v%6s", version) != 1) return FXFALSE;
    115116
    116     /* 
     117    /*
    117118     * skip comments
    118119     */
  • 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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:36 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:08 $
    2324*/
    2425
     
    3738  if( txVerbose )
    3839    {
    39       printf( "clamping from %dx%d to %dx%d\n", 
     40      printf( "clamping from %dx%d to %dx%d\n",
    4041              ix, iy, ox, oy );
    4142    }
     
    7677  if ((srcMip->data[0] == NULL) || (dstMip->data[0] == NULL))
    7778    txPanic("txImageClamp: Null buffer\n");
    78  
     79
    7980  sw = srcMip->width;
    8081  sh = srcMip->height;
     
    8283  dh = dstMip->height;
    8384
    84   for( i = 0; i < srcMip->depth; i++ ) 
     85  for( i = 0; i < srcMip->depth; i++ )
    8586    {
    8687      if( !dstMip->data[i] )
     
    103104    }
    104105}
    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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:37 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:08 $
    2324*/
    2425
     
    3031#include "texusint.h"
    3132
    32 /* 
     33/*
    3334 * Pn_8 = convert n bits (n <= 6) to 8 bits by replicating the msb's of input
    3435 * into the lsb's of the output.
     
    9495
    9596/* 16 bit pixels */
    96 static FxU32 
     97static FxU32
    9798_txPixArgb8332to8888(FxU16 c8332)
    9899{
    99100    FxU32       a, r, g, b;
    100     a =      (c8332 >>  8);     
     101    a =      (c8332 >>  8);
    101102    r = P3_8[(c8332 >>  5) & 0x7];
    102103    g = P3_8[(c8332 >>  2) & 0x7];
     
    233234    in  += n;
    234235    while (n--) {
    235         in--; 
     236        in--;
    236237        *--out = (pal[(*in) & 0xff] & 0x00ffffff) | ((*in & 0xFF00) << 16);
    237238    }
     
    302303    in  += n;
    303304
    304     while (n--) *--out = *--in; 
     305    while (n--) *--out = *--in;
    305306}
    306307
     
    314315    for( i = 0; i < n; i++ )
    315316      {
    316         out[i] = 
    317           ( ( ( FxU32 )0xff ) << 24 ) | 
     317        out[i] =
     318          ( ( ( FxU32 )0xff ) << 24 ) |
    318319          ( ( ( FxU32 )in[i*3] )<< 16 ) |
    319320          ( ( ( FxU32 )in[i*3+1] )<< 8 ) |
     
    322323}
    323324
    324 void   
     325void
    325326txMipDequantize(TxMip *txMip, TxMip *pxMip)
    326327{
     
    344345            printf(" %dx%d", w, h); fflush(stdout);
    345346          }
    346            
     347
    347348        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,
    351352                                                                        (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,
    359360                                                                        pxMip->pal); break;
    360361
    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,
    364365                                                                        (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,
    374375                                                                        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:
    381382                                                                break;
    382383        }
  • 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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:37 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:09 $
    2324*/
    2425
     
    3940FxU8    bestR[256], bestG[256], bestB[256];
    4041
    41 static int 
     42static int
    4243_txAscendingR(const void *a, const void *b)
    4344{
     
    4647
    4748
    48 static int 
     49static int
    4950_txAscendingG(const void *a, const void *b)
    5051{
     
    5354
    5455
    55 static int 
     56static int
    5657_txAscendingB(const void *a, const void *b)
    5758{
     
    7879
    7980#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",
    8283            i, sortR[i], sortG[i], sortB[i]);
    8384#endif
    8485
    85  
     86
    8687    for (i=0; i<256; i++) {
    8788
     
    129130    persist = 0;
    130131    for (i=bestR[r]; i>=0; i--) {
    131         d = DISTANCE(r, g, b, 
     132        d = DISTANCE(r, g, b,
    132133            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
    133134        if (d < mindist) { mindist = d; minpos = (pal[i] >> 24) & 0xff; }
     
    138139    persist = 0;
    139140    for (i=bestR[r]+1; i < nsorted; i++) {
    140         d = DISTANCE(r, g, b, 
     141        d = DISTANCE(r, g, b,
    141142            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
    142143        if (d < mindist) { mindist = d; minpos = (pal[i] >> 24) & 0xff; }
     
    149150    persist = 0;
    150151    for (i=bestG[g]; i>=0; i--) {
    151         d = DISTANCE(r, g, b, 
     152        d = DISTANCE(r, g, b,
    152153            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
    153154        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
     
    158159    persist = 0;
    159160    for (i=bestG[g]+1; i < nsorted; i++) {
    160         d = DISTANCE(r, g, b, 
     161        d = DISTANCE(r, g, b,
    161162            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
    162163        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
     
    168169    persist = 0;
    169170    for (i=bestB[b]; i>=0; i--) {
    170         d = DISTANCE(r, g, b, 
     171        d = DISTANCE(r, g, b,
    171172            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
    172173        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
     
    177178    persist = 0;
    178179    for (i=bestB[b]+1; i < nsorted; i++) {
    179         d = DISTANCE(r, g, b, 
     180        d = DISTANCE(r, g, b,
    180181            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
    181182        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
     
    221222            ib += qb + ErrB[x];
    222223
    223             qr = ir;    // quantized pixel values. 
     224            qr = ir;    // quantized pixel values.
    224225            qg = ig;    // qR is error from pixel to left, errR is
    225226            qb = ib;    // error from pixel to the top & top left.
     
    245246            qb = ib - qb;
    246247
    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,
    248249            // 1/4 (0.25) to the SOUTH-EAST.
    249250            ErrR[x]  = ((x == 0) ? 0 : ErrR[x]) + ((int) (qr * 0.375f));
     
    279280        printf("EDiffusion:..."); fflush(stdout);
    280281      }
    281        
     282
    282283#if     FAST_DIFFUSION
    283284    _txMakeRange(palette, ncolors);
     
    289290
    290291    for (i=0; i<txMip->depth; i++) {
    291         _txToDiffuseIndex(pxMip->data[i], pixsize, palette, ncolors, 
     292        _txToDiffuseIndex(pxMip->data[i], pixsize, palette, ncolors,
    292293            txMip->data[i], w, h);
    293294            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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:37 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:10 $
    2324*/
    2425
     
    3536/*
    3637 * 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
    3839 * the format that you want to download.
    3940 */
     
    325326          ncc_table.yRGB[i] = ( FxU8 )texture->pal[i];
    326327        }
    327      
     328
    328329      for( i = 0; i < 4; i++ )
    329330        {
  • 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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:37 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:10 $
    2324*/
    2425
  • 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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:37 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:31:11 $
    2223*/
    2324
     
    2930#include "texusint.h"
    3031
    31 static int 
    32 dithmat[4][4] = {       0,  8,  2, 10, 
    33                            12,  4, 14,  6, 
    34                             3, 11,  1,  9, 
     32static int
     33dithmat[4][4] = {       0,  8,  2, 10,
     34                           12,  4, 14,  6,
     35                            3, 11,  1,  9,
    3536                           15,  7, 13,  5 };
    3637
     
    4546_txPixQuantize_YIQ422 (unsigned long argb, int x, int y, int w)
    4647{
    47     int         r, g, b; 
     48    int         r, g, b;
    4849    int         iy, ii, iq;
    4950
     
    125126
    126127static 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,
    128129    int dither)
    129130{
     
    153154
    154155   RGB values can be converted to YIQ using the equation:
    155  
     156
    156157   Y = 0.30F * R + 0.59F * G + 0.11F * B;
    157158   I = 0.60F * R - 0.28F * G - 0.32F * B;
    158159   Q = 0.21F * R - 0.52F * G + 0.31F * B;
    159160
    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,
    161162   Y ranges from (0 .. 255)
    162163   I ranges from (-0.60 * 255 .. 0.60 * 255) i.e, (-153 to 153)
     
    166167
    167168
    168 static void     
     169static void
    169170_txMipNccStatTable(TxMip *txMip)
    170171{
    171172    int i, w, h;
    172173
    173     for (i=0; i<256; i++) 
     174    for (i=0; i<256; i++)
    174175        ncc.yhist[i] = ncc.ihist[i] = ncc.qhist[i] = 0;
    175176    ncc.npixels = 0;
     
    250251
    251252
    252 void   
     253void
    253254txMipNcc(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression)
    254255{
     
    256257
    257258    switch (compression & TX_COMPRESSION_MASK) {
    258     case        TX_COMPRESSION_HEURISTIC:                               
     259    case        TX_COMPRESSION_HEURISTIC:
    259260                _txMipNccStatTable(txMip);
    260261                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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:38 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:11 $
    2324*/
    2425#include <stdio.h>
     
    3334 * ARGB8888 format and produces an optimal YAB table, and an 8 bit image
    3435 * 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
    3637 * /tdfx/engr/devel/sst1/docs/yab.doc. The summary follows.
    3738 *
    38  * Neural net algorithms first determine a "representative sample" of the 
     39 * Neural net algorithms first determine a "representative sample" of the
    3940 * input image. This representative sample is repeatedly run through the net
    4041 * during the network learning stage, and the neural net "learns" which colors
    4142 * are important and which ones are not. It's quite possible to feed every
    4243 * 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.
    4445 *
    4546 * So, we prefer to make a representative sample of colors for the input image.
     
    4849 * colors (just like for the 8-bit palettized case) works quite well, and
    4950 * 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
    5152 * textures very easy.
    5253 *
    5354 * 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.
    5960 *
    6061 * So now it's possible to translate the original image into an 8 bit image
     
    6566 * In the process of converting the original image to the YAB format, we could
    6667 * optionally dither the image. Ordered dithering doesn't quite work, so we
    67  * use error-diffusion dithering. 
     68 * use error-diffusion dithering.
    6869 *
    6970 * I've found that there are three speed bottlenecks to overcome. The first
    7071 * 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
    7374 * much as possible. The third bottleneck is the translation of the original
    7475 * image into the 8 bit YAB indexed image; this still needs work, especially
     
    7980
    8081/******************************************************************************
    81  * 
     82 *
    8283 * The hardcore neural net stuff begins here.
    8384 *
     
    117118_nn_modifyNeurons(long ir, long ig, long ib)
    118119{
    119     int         i; 
     120    int         i;
    120121    int         d0, d1;                         // closest & next closest distance to input
    121122    int         p0, p1;                         // index into the 256 color table.
     
    138139
    139140        d = DISTANCE(n->r, n->g, n->b, ir, ig, ib);
    140         if (d < d0) { 
     141        if (d < d0) {
    141142                d1 = d0; d0 = d;
    142143                p1 = p0; p0 = i;
     
    145146                d1 = d;
    146147                p1 = i;
    147         } 
     148        }
    148149    }
    149150
     
    183184    pb = N[p0].pb;
    184185    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);
    186187    pa->g += (dg >> 2) ; CLAMP_BOTH(pa->g);
    187188    pa->b += (db >> 2) ; CLAMP_BOTH(pa->b);
     
    258259
    259260static  int order[256];
    260 static int 
     261static int
    261262_nn_randomOrder(const void *a, const void *b)
    262263{
     
    275276
    276277    _nn_initTables();
    277     /* 
     278    /*
    278279     * Select a number which is relatively prime to nsamples.
    279280     */
     
    295296                FxU32   *pRGB;
    296297
    297                 // We present the samples randomly to the network. 
     298                // We present the samples randomly to the network.
    298299                // _nn_modify_neurons() makes the neurons learn
    299300                // errR, errG, errB, errMax are computed in _nn_modifyNeurons(), as
     
    308309
    309310        if (errMax < bstMax) {
    310                 /* 
     311                /*
    311312                 * A lower total error than before, take a Snapshot
    312313                 *
     
    344345                bstB   = errB;
    345346#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,
    349350                   totG/nsamples, totR/nsamples, totB/nsamples
    350351                );
     
    356357        }
    357358
    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();
    361362                break;
    362363        }
    363364    }
    364365
    365     /* 
     366    /*
    366367     * At this point YAB has the YAB table, samples has input palette,
    367368     * Replace MSB of samples with index to be used with YAB table.
     
    393394
    394395
    395     /* 
    396      * Get a 256 color palette, to be used as samples 
     396    /*
     397     * Get a 256 color palette, to be used as samples
    397398     * Incidentally, convert src 32 bit image to dst 8 bit indexed image,
    398399     * with indices referring to the 256 color palette.
     
    403404        printf("NCC Neural nets..."); fflush(stdout);
    404405      }
    405     pxMip->format = (format == GR_TEXFMT_YIQ_422) ? GR_TEXFMT_P_8 : 
     406    pxMip->format = (format == GR_TEXFMT_YIQ_422) ? GR_TEXFMT_P_8 :
    406407        GR_TEXFMT_AP_88;
    407408    ncolors = txMipPal256(pxMip, txMip, pxMip->format, 0, 0);
     
    413414    if( txVerbose )
    414415      {
    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,
    417418               totG/ncolors, totR/ncolors, totB/ncolors
    418419               );
     
    423424        /*
    424425         * 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
    426427         * useful for error diffusion dithering.
    427428         */
    428429        txYABtoPal256((long *)pxMip->pal, (long *)yabTable);
    429430        txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
    430     } 
     431    }
    431432    else {
    432433
  • 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 $ */
    12/*
    23 * 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
    45 * preserved on all copies.
    5  * 
     6 *
    67 * There is no warranty or other guarantee of fitness for this software,
    78 * it is provided solely "as is".  Bug reports or fixes may be sent
     
    910 *
    1011 * 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
    1213 * source is available for no extra charge.
    1314 *
     
    7273 * Readability constants.
    7374 */
    74 #define REDI            0       
     75#define REDI            0
    7576#define GREENI          1
    76 #define BLUEI           2       
     77#define BLUEI           2
    7778#define TRUE            1
    7879#define FALSE           0
     
    111112 * Perform variance-based color quantization on a 24-bit image.
    112113 */
    113 int     
     114int
    114115txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression)
    115116{
     
    117118    int         i;                              /* Counter */
    118119    int         OutColors;              /* # of entries computed */
    119     int         Colormax;               /* quantized full-intensity */ 
     120    int         Colormax;               /* quantized full-intensity */
    120121    float       Cfactor;                /* Conversion factor */
    121122#if 0
     
    131132    Cfactor = (float)FULLINTENSITY / Colormax;
    132133
    133     Boxes = _Boxes;     
     134    Boxes = _Boxes;
    134135#if 0
    135136    Histogram = (ulong *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(long));
     
    157158
    158159    OutColors = CutBoxes(Boxes, MAXCOLORS);
    159    
     160
    160161    /*
    161162     * We now know the set of representative colors.  We now
     
    180181        pxMip->pal[i] = (r<<16) | (g << 8) | b;
    181182    }
    182     ComputeRGBMap(Boxes, OutColors, rgbmap); 
     183    ComputeRGBMap(Boxes, OutColors, rgbmap);
    183184
    184185    /*
     
    218219                                *dst++ = rgbmap[index];
    219220                        } else {
    220                                 *(FxU16 *)dst = (rgbmap[index]) | 
     221                                *(FxU16 *)dst = (rgbmap[index]) |
    221222                                                ((argb >> 16) & 0xFF00);
    222223                                dst+= 2;
     
    253254     * We compute both the histogram and the proj. frequencies of
    254255     * the first box at the same time to save a pass through the
    255      * entire image. 
     256     * entire image.
    256257     */
    257    
     258
    258259    for (i = 0; i < npixels; i++) {
    259260        rr = (uchar) (((*pixels >> 16) & 0xff) >> (8-NBITS));
     
    266267        Histogram[(((rr<<NBITS)|gg)<<NBITS)|bb]++;
    267268    }
    268        
     269
    269270}
    270271
     
    273274 */
    274275static int
    275 CutBoxes(Box *boxes, int colors) 
     276CutBoxes(Box *boxes, int colors)
    276277{
    277278    int curbox;
     
    363364     * Find 'optimal' cutpoint along each of the red, green and blue
    364365     * 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
    366367     * (possible) later use.
    367368     */
     
    461462    bzero(box1->freq[0], ColormaxI * sizeof(ulong));
    462463    bzero(box1->freq[1], ColormaxI * sizeof(ulong));
    463     bzero(box1->freq[2], ColormaxI * sizeof(ulong)); 
     464    bzero(box1->freq[2], ColormaxI * sizeof(ulong));
    464465
    465466    for (r = box1->low[0]; r < box1->high[0]; r++) {
     
    507508{
    508509    int r, g, b;
    509    
     510
    510511    for (r = box->low[REDI]; r < box->high[REDI]; r++) {
    511512        for (g = box->low[GREENI]; g < box->high[GREENI]; g++) {
    512513                for (b = box->low[BLUEI]; b < box->high[BLUEI]; b++) {
    513514                        int     index;
    514                        
     515
    515516                        index = (((r<<NBITS)|g)<<NBITS)|b;
    516517                        rgbmap[index]=(char)boxnum;
     
    528529  int min_index;
    529530  long r, g, b;
    530  
     531
    531532  min_dist = 256 * 256 + 256 * 256 + 256 * 256;
    532533  min_index = -1;
     
    573574          unsigned long index;
    574575          unsigned long r_index, g_index, b_index;
    575          
     576
    576577          r_index = ( ( ( unsigned long )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) );
    577578          g_index = ( ( ( unsigned long )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) );
    578579          b_index = ( ( ( unsigned long )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) );
    579           index = 
     580          index =
    580581            ( r_index << ( INVERSE_PAL_G_BITS + INVERSE_PAL_B_BITS ) ) |
    581582            ( g_index << INVERSE_PAL_B_BITS ) |
     
    618619  static          FxU32 last_pal[256];
    619620  static          FxBool been_here = FXFALSE;
    620  
     621
    621622  w = outputMip->width;
    622623  h = outputMip->height;
     
    632633    }
    633634
    634   for( i = 0; i < trueColorMip->depth; i++ ) 
     635  for( i = 0; i < trueColorMip->depth; i++ )
    635636    {
    636637      _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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:38 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:12 $
    2324**
    2425*/
     
    3233
    3334
    34 FxBool 
     35FxBool
    3536_txReadPPMHeader( FILE *stream, FxU32 cookie, TxMip *info)
    36 { 
     37{
    3738    char buffer[256];
    3839    FxU32 state = 1;
    3940    FxBool done = FXFALSE;
    40    
     41
    4142    if ( stream == NULL ) {
    42         txPanic("PPM file: Bad file handle.");
    43         return FXFALSE;
     43    txPanic("PPM file: Bad file handle.");
     44    return FXFALSE;
    4445    }
    45    
     46
    4647    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;
    5749
    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;
    6258
    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;
    7263
    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        }
    7979    }
    80    
     80    }
     81
    8182    if ( state < 4 ) {
    82         txPanic("PPM file: Read error before end of header.");
    83         return FXFALSE;
     83        txPanic("PPM file: Read error before end of header.");
     84    return FXFALSE;
    8485    }
    8586    info->depth = 1;
     
    8990}
    9091
    91 FxBool 
    92 _txReadPPMData( FILE *stream, TxMip *info) 
    93 { 
     92FxBool
     93_txReadPPMData( FILE *stream, TxMip *info)
     94{
    9495    FxU32 numPixels;
    9596    FxU32 *data32 = info->data[0];
    96    
     97
    9798    numPixels = info->width * info->height;
    9899
    99100    if ( stream == NULL ) {
    100         txPanic("PPM file: Bad file handle.");
    101         return FXFALSE;
     101    txPanic("PPM file: Bad file handle.");
     102    return FXFALSE;
    102103    }
    103    
     104
    104105    // Read in image data
    105106    while (numPixels--) {
    106         int r, g, b;
     107    int r, g, b;
    107108
    108         r = getc( stream );
    109         g = getc( stream );
    110         b = getc( stream );
    111         if ( b == EOF ) {
    112             txPanic("PPM file: Unexpected End of File.");
    113             return FXFALSE;
    114         }
    115         *data32++ = (0xFF << 24) | (r << 16) | (g << 8) | b;
     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;
    116117    }
    117118    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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:38 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:12 $
    2324*/
    2425
     
    3031#include "texusint.h"
    3132
    32 static int 
    33 dithmat[4][4] = {       0,  8,  2, 10, 
    34                            12,  4, 14,  6, 
    35                             3, 11,  1,  9, 
     33static int
     34dithmat[4][4] = {       0,  8,  2, 10,
     35                           12,  4, 14,  6,
     36                            3, 11,  1,  9,
    3637                           15,  7, 13,  5 };
    3738
    3839// for error diffusion.
    39 static int      errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH];     
     40static int      errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH];
    4041
    4142static int
     
    5455    int n, t;
    5556
    56     n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 
     57    n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d;
    5758    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;
    5960    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;
    6162    t |= (n>>4)<<0;
    6263    return t & 0xFF;
     
    8283    ib += errB[x] + qb;
    8384
    84     qr = ir;            // quantized pixel values. 
     85    qr = ir;            // quantized pixel values.
    8586    qg = ig;            // qR is error from pixel to left, errR is
    8687    qb = ib;            // error from pixel to the top & top left.
     
    157158
    158159
    159     n = (int) (n * 0xF0/255.0f + 0.5f) + d;     
     160    n = (int) (n * 0xF0/255.0f + 0.5f) + d;
    160161    t = (n>>4);
    161162    t |= (int)  ((argb>>24) & 0xF0);
     
    215216    int n, t;
    216217
    217     n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 
     218    n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d;
    218219    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;
    220221    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;
    222223    t |= (n>>4)<<0;
    223224    t |= ((argb >> 16) & 0xFF00);
     
    252253    int n, t;
    253254
    254     n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;       
     255    n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;
    255256    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;
    257258    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;
    259260    t |= (n>>4)<<0;
    260261    return t & 0xFFFF;
     
    279280    ib += errB[x] + qb;
    280281
    281     qr = ir;            // quantized pixel values. 
     282    qr = ir;            // quantized pixel values.
    282283    qg = ig;            // qR is error from pixel to left, errR is
    283284    qb = ib;            // error from pixel to the top & top left.
     
    324325                    ((argb >> 9) & 0x7C00) |
    325326                        ((argb >> 6) & 0x03E0) |
    326                         ((argb >> 3) & 0x001F) |       
     327                        ((argb >> 3) & 0x001F) |
    327328                        ((argb >> 24) ? 0x8000 : 0)     );
    328329}
     
    334335    int n, t;
    335336
    336     n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;       
     337    n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;
    337338    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;
    339340    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;
    341342    t |= (n>>4)<<0;
    342343    t |= ((argb >> 24) ? 0x8000 : 0);
     
    361362    ib += errB[x] + qb;
    362363
    363     qr = ir;            // quantized pixel values. 
     364    qr = ir;            // quantized pixel values.
    364365    qg = ig;            // qR is error from pixel to left, errR is
    365366    qb = ib;            // error from pixel to the top & top left.
     
    407408                    ((argb >> 12) & 0x0F00) |
    408409                        ((argb >>  8) & 0x00F0) |
    409                         ((argb >>  4) & 0x000F) |       
     410                        ((argb >>  4) & 0x000F) |
    410411                        ((argb >> 16) & 0xF000) );
    411412}
     
    417418    int n, t;
    418419
    419     n = (int) (((argb >> 16) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 
     420    n = (int) (((argb >> 16) & 0xFF) * 0xF0/255.0f + 0.5f) + d;
    420421    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;
    422423    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;
    424425    t |= (n>>4)<<0;
    425426    t |= (argb >> 16) & 0xF000;
     
    444445    ib += errB[x] + qb;
    445446
    446     qr = ir;            // quantized pixel values. 
     447    qr = ir;            // quantized pixel values.
    447448    qg = ig;            // qR is error from pixel to left, errR is
    448449    qb = ib;            // error from pixel to the top & top left.
     
    511512
    512513        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;
    516517                                                                break;
    517518        case GR_TEXFMT_I_8:                     quantizer = _txPixQuantize_I8;
     
    521522        case GR_TEXFMT_ARGB_8332:       quantizer = _txPixQuantize_ARGB8332_DErr;
    522523                                                                break;
    523         case GR_TEXFMT_RGB_565:         quantizer = _txPixQuantize_RGB565_DErr; 
     524        case GR_TEXFMT_RGB_565:         quantizer = _txPixQuantize_RGB565_DErr;
    524525                                                                break;
    525526        case GR_TEXFMT_ARGB_1555:       quantizer =     _txPixQuantize_ARGB1555_DErr;
     
    535536
    536537        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");
    558559                                                                break;
    559560        }
     
    561562
    562563        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");
    584585                                                                break;
    585586        }
     
    614615 * quality levels in each of the compression cases.
    615616 */
    616 void   
     617void
    617618txMipQuantize(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression)
    618619{
     
    636637                return;
    637638
    638     case GR_TEXFMT_ARGB_8888: 
     639    case GR_TEXFMT_ARGB_8888:
    639640                // Copy source to destination, and be done.
    640641                if( txVerbose )
     
    651652
    652653    // 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:
    656657    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:
    660661    case GR_TEXFMT_ARGB_4444:
    661662    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 $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** 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
    89** 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**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:38 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:31:13 $
    2223*/
    2324
     
    3839#define TX_UNK  0x200   // TGA is unknown from cookie signature.
    3940
    40 int 
     41int
    4142_txReadHeader( FILE *stream, TxMip *info )
    4243{
     
    8687}
    8788
    88 static FxBool 
     89static FxBool
    8990_txReadData( FILE *stream, int fformat, TxMip *info )
    9091{
     
    109110
    110111  file = fopen(filename, "rb");
    111   if( file == NULL ) 
     112  if( file == NULL )
    112113    {
    113114      fprintf( stderr,"Error: can't open input file %s\n", filename );
    114115      exit(2);
    115116    }
    116  
     117
    117118  retval = txMipReadFromFP( txMip, filename, file, prefFormat );
    118119  fclose(file);
     
    128129
    129130        if ((prefFormat != GR_TEXFMT_ARGB_8888) &&
    130             (prefFormat != GR_TEXFMT_ANY)) 
     131            (prefFormat != GR_TEXFMT_ANY))
    131132          {
    132133            txPanic("txMipRead: bad preferred format.");
     
    143144            fprintf(stderr,"Loading image file ");
    144145
    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,
    146147                     txMip->width,txMip->height, GR_TEXFMT_SIZE(txMip->format), txMip->depth);
    147148          }
    148149
    149150        /*
    150          * Allocate memory requested in data[0]; 
     151         * Allocate memory requested in data[0];
    151152         */
    152153
     
    159160                        continue;
    160161                }
    161                 txMip->data[i] = (FxU8*)txMip->data[i-1] + 
     162                txMip->data[i] = (FxU8*)txMip->data[i-1] +
    162163                        w * h * GR_TEXFMT_SIZE(txMip->format);
    163164                if (w > 1) w >>= 1;
     
    166167
    167168        if( txVerbose ) {
    168                   fprintf( stderr, "mip-> format: %d width: %d height: %d depth: %d size: %d\n",
    169                 txMip->format, txMip->width, txMip->height, txMip->depth,
    170                 txMip->size );
    171                  fflush( stderr );
     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 );
    172173        }
    173174
     
    195196        if( txVerbose )
    196197          {
    197             fprintf(stderr, "Dequantizing Input from %s to argb8888.\n", 
     198            fprintf(stderr, "Dequantizing Input from %s to argb8888.\n",
    198199                   Format_Name[txMip->format]);
    199200          }
  • 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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:39 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:13 $
    2324*/
    2425
     
    3839 * total of ox * ix fragments, same as before.
    3940 * 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
    4142 * 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
    4344 */
    4445
     
    6566        int    oa, or, og, ob;
    6667
    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
    6970        // output pixel.
    7071
    7172        ef = ix - accf;         // the excessive # of fragments.
    7273
    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",
    7475    //  accf, nf, ef, ix, ox);
    7576
     
    9495
    9596        *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",
    9798           //  o, oa, or, og, ob);
    9899        o++;
     
    124125
    125126static void
    126 _txImgResample(FxU32 *out, int ox, int oy, 
     127_txImgResample(FxU32 *out, int ox, int oy,
    127128               const FxU32 *in, int ix, int iy)
    128129{
     
    147148        int          ef;
    148149
    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
    151152        // output pixel.
    152153
     
    243244          printf("Resampling to %dx%d: ", destMip->width, destMip->height);
    244245
    245        
     246
    246247        sw = srcMip->width;
    247248        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 $ */
    12
    23/*
     
    45** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    56** 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
    910** 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**
    1213** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1314** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1516** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1617** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    17 ** THE UNITED STATES. 
    18 ** 
     18** THE UNITED STATES.
     19**
    1920** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:39 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:14 $
    2324**
    2425*/
     
    3637const FxU16 ITYPE_BGR      = 0x04;
    3738const FxU16 ITYPE_RGT      = 0x08;
    38    
     39
    3940typedef struct _rgtHeader{
    4041    FxU16 magic;
     
    6768    while (length--) {
    6869        s = *array;
    69         *array++ = (s << 24) | ((s >> 8)&0xFF00) | 
     70        *array++ = (s << 24) | ((s >> 8)&0xFF00) |
    7071                        ((s&0xFF00) << 8) | (s>>24);
    7172    }
     
    8384
    8485
    85 FxBool 
     86FxBool
    8687_txReadRGTHeader( FILE *stream, FxU32 cookie, TxMip *info)
    8788{
     
    9394        return FXFALSE;
    9495    }
    95    
     96
    9697    if ( fread( &(rgtHeader->typeLo), 1, sizeof(RgtHeader)-2, stream ) != 10 ) {
    9798        txPanic("RGT file: Unexpected end of file.");
     
    104105
    105106
    106     info->format = GR_TEXFMT_ARGB_8888; 
     107    info->format = GR_TEXFMT_ARGB_8888;
    107108    info->width = rgtHeader->sizeXHi << 8 | rgtHeader->sizeXLo;
    108109    info->height = rgtHeader->sizeYHi << 8 | rgtHeader->sizeYLo;
     
    111112    if( txVerbose )
    112113      {
    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,
    114115               info->width, info->height, rgtHeader->sizeZLo, rgtHeader->typeHi, rgtHeader->typeLo, rgtHeader->magic == IMAGIC);
    115116      }
     
    119120// RGT is RGBA in memory (low byte to high byte), or ABGR in a register
    120121
    121 FxBool 
     122FxBool
    122123_txReadRGTData( FILE *stream, TxMip *info)
    123124{
    124125    RgtHeader   *rgtHeader = (RgtHeader *) info->pal;
    125126    FxU16 type = (rgtHeader->typeHi);
    126     FxU16 swap = (rgtHeader->magic == IMAGIC); 
     127    FxU16 swap = (rgtHeader->magic == IMAGIC);
    127128    int   x, y;
    128    
     129
    129130    if ( stream == NULL ) {
    130131        txPanic("RGT file: Bad file handle.");
     
    139140        return FXFALSE;
    140141    }
    141    
     142
    142143    // load rgt, rgt's are bottom up
    143144    for ( y = 0; y < info->height; y++ ) {
Note: See TracChangeset for help on using the changeset viewer.