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

Added $Id:$ keyword.

Location:
trunk/src/opengl/glide/cvg
Files:
61 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/glide/cvg/glide/cpudetect.c

    r2888 r6653  
     1/* $Id: cpudetect.c,v 1.2 2001-09-05 14:30:19 bird Exp $ */
    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 */
  • trunk/src/opengl/glide/cvg/glide/ddgump.c

    r2888 r6653  
     1/* $Id: ddgump.c,v 1.2 2001-09-05 14:30:20 bird Exp $ */
    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/cvg/glide/ddgump.c,v 1.1 2000-02-25 00:37:34 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/ddgump.c,v 1.2 2001-09-05 14:30:20 bird Exp $
    2122** $Log: ddgump.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:34  sandervl
     23** Revision 1.2  2001-09-05 14:30:20  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:34  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 16    2/20/98 11:00a Peter
    2731** removed glide3 from glid2 tree
    28  * 
     32 *
    2933 * 15    12/17/97 4:45p Peter
    3034 * groundwork for CrybabyGlide
    31  * 
     35 *
    3236 * 14    12/15/97 5:51p Atai
    3337 * disable obsolete glide2 api for glide3
    34  * 
     38 *
    3539 * 13    12/08/97 12:06p Atai
    3640 * change prototype for grDrawPoint, grDrawLine, grDrawTriangel
    37  * 
     41 *
    3842 * 12    11/18/97 4:36p Peter
    3943 * chipfield stuff cleanup and w/ direct writes
    40  * 
     44 *
    4145 * 11    11/17/97 4:55p Peter
    4246 * watcom warnings/chipfield stuff
    43  * 
     47 *
    4448 * 10    11/03/97 3:43p Peter
    4549 * h3/cvg cataclysm
    46  * 
     50 *
    4751 * 9     10/27/97 1:16p Peter
    4852 * fixed silliness
    49  * 
     53 *
    5054 * 8     10/27/97 11:10a Peter
    5155 * starting cleanup
    52  * 
     56 *
    5357 * 7     9/15/97 7:31p Peter
    5458 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    5559 * place, lfb's are on, Hmmmm.. probably more
    56  * 
     60 *
    5761 * 6     9/04/97 3:32p Peter
    5862 * starting grouping serial reg writes
    59  * 
     63 *
    6064 * 5     6/06/97 10:47a Peter
    6165 * texture downloading, fixed 640x480 dimension, changed cvg dep to be the
    6266 * same as sst1
    63  * 
     67 *
    6468 * 4     5/27/97 1:16p Peter
    65  * Basic cvg, w/o cmd fifo stuff. 
    66  * 
     69 * Basic cvg, w/o cmd fifo stuff.
     70 *
    6771 * 3     5/21/97 6:04a Peter
    68  * 
     72 *
    6973 * 2     3/04/97 9:08p Dow
    70  * 
     74 *
    7175 * 1     12/23/96 1:39p Dow
    7276 * Changes for multiplatform
     
    9296/*
    9397** _gumpTexCombineFunction
    94 **                                                         
     98**
    9599** Sets the texture combine function.  For a dual TMU system this function
    96100** will configure the TEXTUREMODE registers as appropriate.  For a
     
    135139    }
    136140    break;
    137    
     141
    138142  case GR_MPTEXTURECOMBINE_DETAIL0:
    139143    /* tmu0: (other - local) * lod + local */
     
    150154      texmode |= (SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD |
    151155                  SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND |
    152                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER);     
     156                  SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER);
    153157    }
    154158    break;
     
    211215  case GR_MPTEXTURECOMBINE_SUBTRACT:
    212216    /*
    213       tmu0: other - local 
     217      tmu0: other - local
    214218      tmu1: local
    215219      doesn't work, alpha blender can't subtract
     
    228232  {
    229233    SstRegs* tmuRegs = SST_TMU(hw, 0);
    230    
     234
    231235    GR_SET(eChipTMU0, tmuRegs, textureMode, texmode);
    232236  }
     
    325329          /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA
    326330             does not work, you need to do this instead of below.
    327              
     331
    328332             if (gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA)
    329333             {
     
    331335             }
    332336             */
    333      
     337
    334338          fbzcolorpath &= ~(SST_CC_ADD_CLOCAL | SST_CC_ADD_ALOCAL | SST_CC_SUB_CLOCAL);
    335339          REG_GROUP_SET(hw, fbzColorPath, fbzcolorpath);
     
    357361          if (depthP) {
    358362            fbzmode = fbzmode_orig = gc->state.fbi_config.fbzMode;
    359            
     363
    360364            fbzmode &= ~(SST_ZAWRMASK | SST_ZFUNC);
    361365            fbzmode |= GR_CMP_EQUAL;
     
    380384          /* restore alpha blending state */
    381385          REG_GROUP_SET(hw, alphaMode, alphamode_orig);
    382          
     386
    383387          /* restore depth buffer state */
    384388          if (depthP) REG_GROUP_SET(hw, fbzMode, fbzmode_orig);
     
    386390        REG_GROUP_END();
    387391      }
    388        
     392
    389393      goto all_done;
    390394    } else if (_gumpState.tc_fnc == GR_MPTEXTURECOMBINE_MULTIPLY) {
     
    434438          /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA
    435439             does not work, you need to do this instead of below.
    436              
     440
    437441             if (gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA)
    438442             {
     
    454458        }
    455459        REG_GROUP_END();
    456        
     460
    457461        /* render first pass */
    458462        grDrawTriangle(a, b, c);
    459        
     463
    460464        /* second pass */
    461465        /* xxx may sometimes need to copy texture coordinates */
    462        
     466
    463467        /* tmu setup */
    464468        guTexSource(_gumpState.mmid[1]);
     
    481485                             SST_CC_INVERT_OUTPUT |
    482486                             SST_CC_REVERSE_BLEND );
    483          
     487
    484488          /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA
    485489             does not work, you need to do this instead of below.
    486              
     490
    487491             if ( gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA )
    488492             {
     
    498502          /* disable fog */
    499503          if (fogP) REG_GROUP_SET(hw, fogMode, 0);
    500          
     504
    501505          /* enable alpha blend to multiply to destination buffers */
    502506          /* xxx alpha component blender can only handle factors of
     
    510514
    511515          REG_GROUP_SET(hw, alphaMode, alphamode);
    512          
     516
    513517          /* if depth buffering, set to z= mode and disable writes */
    514518          if (depthP) {
     
    516520            fbzmode &= ~(SST_ZAWRMASK | SST_ZFUNC);
    517521            fbzmode |= GR_CMP_EQUAL;
    518            
     522
    519523            REG_GROUP_SET(hw, fbzMode, fbzmode);
    520524          }
     
    524528        /* render second pass */
    525529        grDrawTriangle(a, b, c);
    526        
     530
    527531        /* if bias, third pass */
    528532        if (fogP) {
     
    535539            fogmode |= SST_FOGMULT;
    536540            REG_GROUP_SET(hw, fogMode, fogmode);
    537            
     541
    538542            alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT);
    539543            alphamode |= (SST_ENALPHABLEND |
     
    545549          }
    546550          REG_GROUP_END();
    547          
     551
    548552          /* render third pass */
    549553          grDrawTriangle(a, b, c);
     
    560564          /* restore alpha blending state */
    561565          REG_GROUP_SET(hw, alphaMode, alphamode_orig);
    562          
     566
    563567          /* restore depth buffer state */
    564568          if (depthP) REG_GROUP_SET(hw, fbzMode, fbzmode_orig);
  • trunk/src/opengl/glide/cvg/glide/diglide.c

    r2888 r6653  
     1/* $Id: diglide.c,v 1.2 2001-09-05 14:30:20 bird Exp $ */
    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/cvg/glide/diglide.c,v 1.1 2000-02-25 00:37:34 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/diglide.c,v 1.2 2001-09-05 14:30:20 bird Exp $
    2122** $Log: diglide.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:34  sandervl
     23** Revision 1.2  2001-09-05 14:30:20  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:34  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 40    6/23/98 5:38p Peter
    2731** lfb hinting
    28 ** 
     32**
    2933** 39    3/17/98 3:00p Peter
    3034** removed unused stats
    31 ** 
     35**
    3236** 38    3/02/98 7:22p Peter
    3337** moved internal function to where it is used
    34 ** 
     38**
    3539** 37    2/20/98 11:00a Peter
    3640** removed glide3 from glid2 tree
    37 ** 
     41**
    3842** 36    2/20/98 9:05a Peter
    3943** removed remnants of comdex grot
    40 ** 
     44**
    4145** 35    1/30/98 4:31p Peter
    4246** general clenaup
    43 ** 
     47**
    4448** 34    1/20/98 10:48a Atai
    4549** validate state in grGlideGetState
    46  * 
     50 *
    4751 * 33    1/07/98 10:22a Peter
    4852 * lod dithering env var
    49  * 
     53 *
    5054 * 32    1/06/98 3:53p Atai
    5155 * remove grHint, modify grLfbWriteRegion and grGet
    52  * 
     56 *
    5357 * 31    12/17/97 4:05p Atai
    5458 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet()
    5559 * functions
    56  * 
     60 *
    5761 * 30    12/09/97 12:20p Peter
    5862 * mac glide port
    59  * 
     63 *
    6064 * 29    12/01/97 5:46p Peter
    6165 * fixed variable names in swizzle
    62  * 
     66 *
    6367 * 28    12/01/97 5:17p Peter
    64  * 
     68 *
    6569 * 27    11/18/97 4:36p Peter
    6670 * chipfield stuff cleanup and w/ direct writes
    67  * 
     71 *
    6872 * 26    11/14/97 5:02p Peter
    6973 * more comdex stuff
    70  * 
     74 *
    7175 * 25    11/14/97 12:09a Peter
    7276 * comdex thing and some other stuff
    73  * 
     77 *
    7478 * 24    11/12/97 2:27p Peter
    75  * 
     79 *
    7680 * 23    11/12/97 11:39a Dow
    7781 * H3 Stuff
    78  * 
     82 *
    7983 * 22    11/12/97 9:21a Dow
    8084 * Changed CVG_FIFO to USE_PACKET_FIFO
    81  * 
     85 *
    8286 * 21    11/04/97 4:00p Dow
    8387 * Banshee Mods
    84  * 
     88 *
    8589 * 20    11/03/97 3:43p Peter
    8690 * h3/cvg cataclysm
    87  * 
     91 *
    8892 * 19    10/16/97 3:40p Peter
    8993 * packed rgb
    90  * 
     94 *
    9195 * 18    9/20/97 10:53a Peter
    9296 * keep track of palette stats
    93  * 
     97 *
    9498 * 17    9/15/97 7:31p Peter
    9599 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    96100 * place, lfb's are on, Hmmmm.. probably more
    97  * 
     101 *
    98102 * 16    9/10/97 10:13p Peter
    99103 * fifo logic from GaryT, non-normalized fp first cut
    100  * 
     104 *
    101105 * 15    7/25/97 11:40a Peter
    102106 * removed dHalf, change field name to match real use for cvg
    103  * 
     107 *
    104108 * 14    7/08/97 2:48p Peter
    105  * 
     109 *
    106110 * 13    6/30/97 3:20p Peter
    107111 * error callback
    108  * 
     112 *
    109113 * 12    6/23/97 4:43p Peter
    110114 * cleaned up #defines etc for a nicer tree
    111  * 
     115 *
    112116**
    113117*/
     
    160164    gdbg_info(80,"\t\tWraps: %ld\n", _GlideRoot.stats.fifoWraps);
    161165    if (_GlideRoot.stats.fifoWraps > 0) {
    162       gdbg_info(80,"\t\tAvg Drain Depth: %g\n", 
     166      gdbg_info(80,"\t\tAvg Drain Depth: %g\n",
    163167                (double)_GlideRoot.stats.fifoWrapDepth / _GlideRoot.stats.fifoWraps);
    164168    }
    165169    gdbg_info(80,"\t\tStalls: %ld\n", _GlideRoot.stats.fifoStalls);
    166170    if (_GlideRoot.stats.fifoStalls > 0) {
    167       gdbg_info(80,"\t\tAvg Stall Depth: %g\n", 
     171      gdbg_info(80,"\t\tAvg Stall Depth: %g\n",
    168172                (double)_GlideRoot.stats.fifoStallDepth / _GlideRoot.stats.fifoStalls);
    169173    }
     
    205209**
    206210*/
    207 void 
     211void
    208212_grSwizzleColor(GrColor_t *color)
    209213{
    210214  GR_DCL_GC;
    211215  FxU32 red, green, blue, alpha;
    212  
     216
    213217  switch(gc->state.color_format) {
    214218  case GR_COLORFORMAT_ARGB:
     
    286290
    287291  case GR_HINT_FIFOCHECKHINT:
    288     /* swFifoLWM is kept internally in bytes, hints are in fifo entries */ 
     292    /* swFifoLWM is kept internally in bytes, hints are in fifo entries */
    289293    gc->state.checkFifo = hints;
    290294    break;
     
    296300  case GR_HINT_ALLOW_MIPMAP_DITHER:
    297301    /* Regardless of the game hint, force the user selection */
    298     gc->state.allowLODdither = ((_GlideRoot.environment.texLodDither != 0) || 
     302    gc->state.allowLODdither = ((_GlideRoot.environment.texLodDither != 0) ||
    299303                                hints);
    300304    break;
     
    302306  case GR_HINT_LFB_WRITE:
    303307  {
    304     const FxU32 lfbRange = (((hints * gc->state.screen_height) + 0x1000UL) & 
     308    const FxU32 lfbRange = (((hints * gc->state.screen_height) + 0x1000UL) &
    305309                            ~(0x1000UL - 1));
    306    
     310
    307311    pciLinearRangeSetPermission((const FxU32)((const FxU8*)gc->base_ptr + 0x200000UL),
    308312                                0x200000UL,
     
    331335                                FXTRUE);
    332336    break;
    333  
     337
    334338  default:
    335339    GR_CHECK_F(myName, 1, "invalid hints type");
     
    345349{
    346350  GDBG_INIT();
    347  
     351
    348352  GDBG_INFO(80,"grGlideInit()\n");
    349353  _GlideInitEnvironment();                      /* the main init code */
  • trunk/src/opengl/glide/cvg/glide/digutex.c

    r2888 r6653  
     1/* $Id: digutex.c,v 1.2 2001-09-05 14:30:20 bird Exp $ */
    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/cvg/glide/digutex.c,v 1.1 2000-02-25 00:37:34 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/digutex.c,v 1.2 2001-09-05 14:30:20 bird Exp $
    2122** $Log: digutex.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:34  sandervl
     23** Revision 1.2  2001-09-05 14:30:20  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:34  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 11    2/20/98 5:31p Peter
    2731** crybaby glide
    28 ** 
     32**
    2933** 10    2/20/98 11:00a Peter
    3034** removed glide3 from glid2 tree
    31  * 
     35 *
    3236 * 9     1/08/98 7:09p Peter
    3337 * real hw stuff modulo makefile change
    34  * 
     38 *
    3539 * 8     1/06/98 6:47p Atai
    3640 * undo grSplash and remove gu routines
    37  * 
     41 *
    3842 * 7     12/15/97 5:51p Atai
    3943 * disable obsolete glide2 api for glide3
    40  * 
     44 *
    4145 * 6     5/27/97 1:16p Peter
    42  * Basic cvg, w/o cmd fifo stuff. 
    43  * 
     46 * Basic cvg, w/o cmd fifo stuff.
     47 *
    4448 * 5     5/21/97 6:04a Peter
    45  * 
     49 *
    4650 * 4     5/05/97 4:24p Pgj
    4751 * Neuter guTexDownloadMipMap error message
    48  * 
     52 *
    4953 * 3     3/18/97 9:07p Dow
    5054 * Got rid of #$#%#$ // comments
    51  * 
     55 *
    5256 * 2     3/09/97 10:31a Dow
    5357 * Added GR_DIENTRY for di glide functions
    54  * 
     58 *
    5559 * 1     12/23/96 1:39p Dow
    5660 * Changes for multiplatform
     
    115119   */
    116120  GR_CHECK_F(myName, small_lod < large_lod, "smallest_lod is larger than large_lod");
    117  
     121
    118122  info.smallLod = small_lod;
    119123  info.largeLod = large_lod;
     
    128132    (gc->tmu_state[tmu].freemem_base + memrequired > 0x200000))
    129133    gc->tmu_state[tmu].freemem_base = 0x200000;
    130  
     134
    131135  /*
    132136   ** If we have enough memory and a free mip map handle then go for it
    133137   */
    134138  memavail = guTexMemQueryAvail( tmu );
    135  
     139
    136140  if ( memavail < memrequired )
    137141    return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
    138  
     142
    139143  if (gc->mm_table.free_mmid >= MAX_MIPMAPS_PER_SST )
    140144    return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
    141  
     145
    142146  /*
    143147   ** Allocate the mip map id
     
    148152   ** calculate baseAddress (where LOD 0 would go)
    149153   */
    150   baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base, 
    151                                        large_lod, 
    152                                        aspect_ratio, 
    153                                        format, 
     154  baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base,
     155                                       large_lod,
     156                                       aspect_ratio,
     157                                       format,
    154158                                       odd_even_mask );
    155159
    156160  GDBG_INFO(gc->myLevel,"  baseAddress = 0x%x (in bytes)\n",baseAddress);
    157  
     161
    158162  /*
    159163   ** reduce available memory to reflect allocation
     
    174178                (magfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0)
    175179                );
    176  
     180
    177181  clampMode = (
    178182               (s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) |
    179183               (t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
    180                ); 
    181  
     184               );
     185
    182186  /*
    183187   ** Create the tTextureMode register value for this mip map
     
    188192  texturemode |= filterMode;
    189193  texturemode |= clampMode;
    190  
     194
    191195  if ( mipmap_mode == GR_MIPMAP_NEAREST_DITHER )
    192196    texturemode |= SST_TLODDITHER;
    193  
     197
    194198  if ( trilinear ) {
    195199      texturemode |= SST_TRILINEAR;
     
    201205        tLod |= SST_LOD_TSPLIT;
    202206  }
    203  
     207
    204208  /*
    205209   ** Fill in the mm_table data for this mip map
     
    227231  gc->mm_table.data[mmid].width          = width;
    228232  gc->mm_table.data[mmid].height         = height;
    229  
     233
    230234  GR_RETURN(mmid);
    231235} /* guTexAllocateMemory */
     
    238242  int texturemode      = 0;
    239243  int tLod             = 0;
    240   FxU32 
     244  FxU32
    241245    filterMode,                 /* filter mode bits of texturemode */
    242246    clampMode;                  /* clamp mode bits of texturemode */
     
    251255               (mminfo->t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
    252256               );
    253    
     257
    254258  /*
    255259   ** build up tTextureMode
     
    285289
    286290/*---------------------------------------------------------------------------
    287 **  guTexChangeAttributes 
     291**  guTexChangeAttributes
    288292*/
    289293GR_DIENTRY(guTexChangeAttributes, FxBool, ( GrMipMapId_t mmid,
     
    349353/*---------------------------------------------------------------------------
    350354** grTexCombineFunction - obsolete
    351 **                             
     355**
    352356*/
    353357GR_DIENTRY(grTexCombineFunction, void,
    354            (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 
     358           (GrChipID_t tmu, GrTextureCombineFnc_t tc))
    355359{
    356360  guTexCombineFunction( tmu, tc );
     
    359363/*---------------------------------------------------------------------------
    360364** guTexCombineFunction
    361 **                             
     365**
    362366** Sets the texture combine function.  For a dual TMU system this function
    363367** will configure the TEXTUREMODE registers as appropriate.  For a
     
    438442** to be in row major order from largest mip map to smallest mip map.
    439443*/
    440 GR_DIENTRY(guTexDownloadMipMap, void, 
     444GR_DIENTRY(guTexDownloadMipMap, void,
    441445           (GrMipMapId_t mmid, const void *src, const GuNccTable
    442446            *ncc_table ) )
     
    487491  const  GrMipMapInfo *mminfo;
    488492  GR_DCL_GC;
    489  
     493
    490494  GDBG_INFO(99,"guTexDownloadMipMapLevel(%d,%d,0x%x)\n",mmid,lod,src_base);
    491495  GR_ASSERT(src_base != NULL);
     
    565569{
    566570  int i;
    567  
     571
    568572  GR_BEGIN_NOFIFOCHECK("guTexMemReset",99);
    569573  GDBG_INFO_MORE(gc->myLevel,"()\n");
     
    571575  memset( gc->mm_table.data, 0, sizeof( gc->mm_table.data ) );
    572576  gc->mm_table.free_mmid = 0;
    573  
     577
    574578  for ( i = 0; i < gc->num_tmu; i++ ) {
    575579    gc->state.current_mm[i] = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
    576580    gc->tmu_state[i].freemem_base = 0;
    577     gc->tmu_state[i].ncc_mmids[0] = 
    578       gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;   
    579     gc->tmu_state[i].ncc_table[0] = 
     581    gc->tmu_state[i].ncc_mmids[0] =
     582      gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
     583    gc->tmu_state[i].ncc_table[0] =
    580584      gc->tmu_state[i].ncc_table[1] = 0;
    581585  }
  • trunk/src/opengl/glide/cvg/glide/disst.c

    r2888 r6653  
     1/* $Id: disst.c,v 1.2 2001-09-05 14:30:21 bird Exp $ */
    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/cvg/glide/disst.c,v 1.1 2000-02-25 00:37:35 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/disst.c,v 1.2 2001-09-05 14:30:21 bird Exp $
    2122** $Log: disst.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:35  sandervl
     23** Revision 1.2  2001-09-05 14:30:21  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:35  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 22    4/21/98 10:05a Peter
    2731** grSstSelect cleanup (Thanks John/Rufus)
    28 ** 
     32**
    2933** 21    3/17/98 6:50p Peter
    3034** sli paired vs active
    31 ** 
     35**
    3236** 20    2/24/98 10:15a Peter
    3337** oem dll muckage
    34 ** 
     38**
    3539** 19    2/20/98 11:00a Peter
    3640** removed glide3 from glid2 tree
    37  * 
     41 *
    3842 * 18    12/17/97 4:05p Atai
    3943 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet()
    4044 * functions
    41  * 
     45 *
    4246 * 17    12/09/97 12:20p Peter
    4347 * mac glide port
    44  * 
     48 *
    4549 * 16    11/19/97 2:49p Peter
    4650 * env vars in registry for win32
    47  * 
     51 *
    4852 * 15    11/18/97 4:36p Peter
    4953 * chipfield stuff cleanup and w/ direct writes
    50  * 
     54 *
    5155 * 14    10/31/97 9:15a Peter
    5256 * only lie about v2 boards
    53  * 
     57 *
    5458 * 13    10/31/97 8:53a Peter
    5559 * last lying change, really
    56  * 
     60 *
    5761 * 12    9/05/97 5:29p Peter
    5862 * changes for direct hw
    59  * 
     63 *
    6064 * 11    6/20/97 9:56a Peter
    6165 * better lines/pts, hopefully
    62  * 
     66 *
    6367 * 10    6/02/97 4:09p Peter
    6468 * Compile w/ gcc for Dural
    65  * 
     69 *
    6670 * 9     5/27/97 1:16p Peter
    67  * Basic cvg, w/o cmd fifo stuff. 
    68  * 
     71 * Basic cvg, w/o cmd fifo stuff.
     72 *
    6973 * 8     5/21/97 6:04a Peter
    70  * 
     74 *
    7175 * 7     5/02/97 2:07p Pgj
    7276 * grSstScreenWidth/Height now FxU32
    73  * 
     77 *
    7478 * 6     3/17/97 6:25a Jdt
    7579 * Added initDeviceSelect to grSstSelect()
    76  * 
     80 *
    7781 * 5     3/09/97 10:31a Dow
    7882 * Added GR_DIENTRY for di glide functions
    79  * 
     83 *
    8084 * 4     3/04/97 9:08p Dow
    81  * 
     85 *
    8286 * 3     1/18/97 11:39p Dow
    8387 * Changed location of _curGCFuncs
    84  * 
     88 *
    8589 * 2     1/16/97 3:39p Dow
    8690 * Added ref to _curGCFuncs during grSstSelect()
    87  * 
     91 *
    8892 * 1     12/23/96 1:39p Dow
    8993 * Changes for multiplatform
     
    213217#endif
    214218
    215   _GlideRoot.GCs[whichSst].vidTimings = vidTimings;   
     219  _GlideRoot.GCs[whichSst].vidTimings = vidTimings;
    216220} /* grSstVidMode */
  • trunk/src/opengl/glide/cvg/glide/distate.c

    r2888 r6653  
     1/* $Id: distate.c,v 1.2 2001-09-05 14:30:21 bird Exp $ */
    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/cvg/glide/distate.c,v 1.1 2000-02-25 00:37:35 sandervl Exp $
     21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/distate.c,v 1.2 2001-09-05 14:30:21 bird Exp $
    2122 ** $Log: distate.c,v $
    22  ** Revision 1.1  2000-02-25 00:37:35  sandervl
     23 ** Revision 1.2  2001-09-05 14:30:21  bird
     24 ** Added $Id:$ keyword.
     25 **
     26 ** Revision 1.1  2000/02/25 00:37:35  sandervl
    2327 ** Created Voodoo 2 dir
    2428 **
    25  * 
     29 *
    2630 * 17    1/13/98 12:42p Atai
    2731 * fixed grtexinfo, grVertexLayout, and draw triangle
    28  * 
     32 *
    2933 * 16    1/10/98 4:01p Atai
    3034 * inititialize vertex layout, viewport, added defines
    31  * 
     35 *
    3236 * 15    1/05/98 6:06p Atai
    3337 * glide extension stuff
    34  * 
     38 *
    3539 * 14    12/17/97 4:05p Atai
    3640 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet()
    3741 * functions
    38  * 
     42 *
    3943 * 13    12/16/97 11:38a Atai
    4044 * added grChromaRange()
    41  * 
     45 *
    4246 * 12    12/15/97 5:52p Atai
    4347 * disable obsolete glide2 api for glide3
    44  * 
     48 *
    4549 * 10    12/12/97 1:30p Atai
    4650 * remove fp z  buffer
    47  * 
     51 *
    4852 * 8     12/08/97 10:44a Atai
    4953 * added entry point for grCoordinateSpace(), grDepthRange(), and
    5054 * grViewport()
    51  * 
     55 *
    5256 * 7     11/13/97 4:38p Atai
    5357 * invalidate lfbMode and c0c1
    54  * 
     58 *
    5559 * 6     11/10/97 5:20p Atai
    5660 * added factor for grAlphaCombine and remove extra  _grChromakeyMode
    57  * 
     61 *
    5862 * 5     11/07/97 11:22a Atai
    5963 * remove GR_*_SMOOTH. use GR_SMOOTH
    60  * 
     64 *
    6165 * 4     10/15/97 7:33a Dow
    6266 * Made _grValidateState use central routine for writing data
    63  * 
     67 *
    6468 * 3     10/14/97 4:18p Atai
    6569 * added grEnable and grDisable
    66  * 
     70 *
    6771 * 2     10/10/97 2:57p Dow
    6872 * Minor adjustments
    69  * 
     73 *
    7074 * 1     10/09/97 5:19p Dow
    7175 * State Monster file
     
    123127  Inform Glide that the Alpha Blend Function has been modified.
    124128  Arguments:
    125  
     129
    126130  Return:
    127131  -------------------------------------------------------------------*/
     
    147151  Implementor(s): dow
    148152  Description:
    149  
    150   Arguments:
    151  
     153
     154  Arguments:
     155
    152156  Return:
    153157  -------------------------------------------------------------------*/
     
    170174  Implementor(s): dow
    171175  Description:
    172  
    173   Arguments:
    174  
     176
     177  Arguments:
     178
    175179  Return:
    176180  -------------------------------------------------------------------*/
     
    192196  Implementor(s): dow
    193197  Description:
    194  
    195   Arguments:
    196  
     198
     199  Arguments:
     200
    197201  Return:
    198202  -------------------------------------------------------------------*/
    199203GR_DIENTRY(grAlphaCombine, void ,
    200          (GrCombineFunction_t function, GrCombineFactor_t factor, 
     204         (GrCombineFunction_t function, GrCombineFactor_t factor,
    201205          GrCombineLocal_t local, GrCombineOther_t other, FxBool invert) )
    202206{
     
    220224  Implementor(s): dow
    221225  Description:
    222  
    223   Arguments:
    224  
     226
     227  Arguments:
     228
    225229  Return:
    226230  -------------------------------------------------------------------*/
     
    242246  Implementor(s): dow
    243247  Description:
    244  
    245   Arguments:
    246  
     248
     249  Arguments:
     250
    247251  Return:
    248252  -------------------------------------------------------------------*/
     
    272276  Implementor(s): dow
    273277  Description:
    274  
    275   Arguments:
    276  
     278
     279  Arguments:
     280
    277281  Return:
    278282  -------------------------------------------------------------------*/
     
    295299  Implementor(s): atai
    296300  Description:
    297  
    298   Arguments:
    299  
     301
     302  Arguments:
     303
    300304  Return:
    301305  -------------------------------------------------------------------*/
     
    317321  Implementor(s): atai
    318322  Description:
    319  
    320   Arguments:
    321  
     323
     324  Arguments:
     325
    322326  Return:
    323327  -------------------------------------------------------------------*/
     
    346350  Implementor(s): dow
    347351  Description:
    348  
    349   Arguments:
    350  
     352
     353  Arguments:
     354
    351355  Return:
    352356  -------------------------------------------------------------------*/
     
    368372  Implementor(s): dow
    369373  Description:
    370  
    371   Arguments:
    372  
     374
     375  Arguments:
     376
    373377  Return:
    374378  -------------------------------------------------------------------*/
     
    392396  Implementor(s): dow
    393397  Description:
    394  
    395   Arguments:
    396  
     398
     399  Arguments:
     400
    397401  Return:
    398402  -------------------------------------------------------------------*/
     
    415419  Implementor(s): dow
    416420  Description:
    417  
    418   Arguments:
    419  
     421
     422  Arguments:
     423
    420424  Return:
    421425  -------------------------------------------------------------------*/
     
    439443  Implementor(s): dow
    440444  Description:
    441  
    442   Arguments:
    443  
     445
     446  Arguments:
     447
    444448  Return:
    445449  -------------------------------------------------------------------*/
     
    462466  Implementor(s): dow
    463467  Description:
    464  
    465   Arguments:
    466  
     468
     469  Arguments:
     470
    467471  Return:
    468472  -------------------------------------------------------------------*/
     
    485489  Implementor(s): dow
    486490  Description:
    487  
    488   Arguments:
    489  
     491
     492  Arguments:
     493
    490494  Return:
    491495  -------------------------------------------------------------------*/
     
    510514  Implementor(s): dow
    511515  Description:
    512  
    513   Arguments:
    514  
     516
     517  Arguments:
     518
    515519  Return:
    516520  -------------------------------------------------------------------*/
     
    532536  Implementor(s): dow
    533537  Description:
    534  
    535   Arguments:
    536  
     538
     539  Arguments:
     540
    537541  Return:
    538542  -------------------------------------------------------------------*/
    539543GR_DIENTRY(grClipWindow, void , (FxU32 minx, FxU32 miny, FxU32 maxx,
    540                                FxU32 maxy) ) 
     544                               FxU32 maxy) )
    541545{
    542546#define FN_NAME "grClipWindow"
     
    559563  Implementor(s): dow
    560564  Description:
    561  
    562   Arguments:
    563  
     565
     566  Arguments:
     567
    564568  Return:
    565569  -------------------------------------------------------------------*/
     
    583587  Implementor(s): dow
    584588  Description:
    585  
    586   Arguments:
    587  
     589
     590  Arguments:
     591
    588592  Return:
    589593  -------------------------------------------------------------------*/
     
    607611  Implementor(s): dow
    608612  Description:
    609  
    610   Arguments:
    611  
     613
     614  Arguments:
     615
    612616  Return:
    613617  -------------------------------------------------------------------*/
     
    629633  Implementor(s): dow
    630634  Description:
    631  
    632   Arguments:
    633  
     635
     636  Arguments:
     637
    634638  Return:
    635639  -------------------------------------------------------------------*/
     
    652656  Implementor(s): dow
    653657  Description:
    654  
    655   Arguments:
    656  
     658
     659  Arguments:
     660
    657661  Return:
    658662  -------------------------------------------------------------------*/
    659663GR_DIENTRY(grLfbWriteColorSwizzle, void , (FxBool swizzleBytes, FxBool
    660                                          swapWords) ) 
     664                                         swapWords) )
    661665{
    662666#define FN_NAME "grLfbWriteColorSwizzle"
     
    677681  Implementor(s): dow
    678682  Description:
    679  
    680   Arguments:
    681  
     683
     684  Arguments:
     685
    682686  Return:
    683687  -------------------------------------------------------------------*/
     
    733737                    LOADARG(grAlphaCombine, invert));
    734738    _grAlphaControlsITRGBLighting(LOADARG(grAlphaControlsITRGBLighting,
    735                                           enable)); 
    736     _grColorCombine(LOADARG(grColorCombine, function), 
     739                                          enable));
     740    _grColorCombine(LOADARG(grColorCombine, function),
    737741                    LOADARG(grColorCombine, factor),
    738742                    LOADARG(grColorCombine, local),
     
    809813  Implementor(s): atai
    810814  Description:
    811  
    812   Arguments:
    813  
     815
     816  Arguments:
     817
    814818  Return:
    815819  -------------------------------------------------------------------*/
     
    843847  Implementor(s): atai
    844848  Description:
    845  
    846   Arguments:
    847  
     849
     850  Arguments:
     851
    848852  Return:
    849853  -------------------------------------------------------------------*/
     
    876880  Implementor(s): atai
    877881  Description:
    878  
    879   Arguments:
    880  
     882
     883  Arguments:
     884
    881885  Return:
    882886  -------------------------------------------------------------------*/
     
    903907  Implementor(s): atai
    904908  Description:
    905  
    906   Arguments:
    907  
     909
     910  Arguments:
     911
    908912  Return:
    909913  -------------------------------------------------------------------*/
     
    926930  Implementor(s): atai
    927931  Description:
    928  
    929   Arguments:
    930  
     932
     933  Arguments:
     934
    931935  Return:
    932936  -------------------------------------------------------------------*/
  • trunk/src/opengl/glide/cvg/glide/distrip.c

    r2888 r6653  
     1/* $Id: distrip.c,v 1.2 2001-09-05 14:30:21 bird Exp $ */
    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/cvg/glide/distrip.c,v 1.1 2000-02-25 00:37:35 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/distrip.c,v 1.2 2001-09-05 14:30:21 bird Exp $
    2122** $Log: distrip.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:35  sandervl
     23** Revision 1.2  2001-09-05 14:30:21  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:35  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 14    1/08/98 4:58p Atai
    2731 * tex table broadcast, grVertexLayout enable/disable, stq, and some
    2832 * defines
    29  * 
     33 *
    3034 * 13    12/12/97 10:59a Atai
    3135 * clip space and viewport
    32  * 
     36 *
    3337 * 12    12/08/97 10:42a Atai
    3438 * added grDrawVertexArrayLinear()
    35  * 
     39 *
    3640 * 11    11/21/97 6:05p Atai
    3741 * use one datalist (tsuDataList) in glide3
    38  * 
     42 *
    3943 * 10    11/18/97 6:11p Peter
    4044 * fixed glide3 muckage
    41  * 
     45 *
    4246 * 9     11/18/97 3:24p Atai
    4347 * change grParameterData to grVertexLayout
    4448 * define GR_PARAM_*
    45  * 
     49 *
    4650 * 8     11/07/97 11:22a Atai
    4751 * remove GR_*_SMOOTH. use GR_SMOOTH
    48  * 
     52 *
    4953 * 7     11/06/97 6:10p Atai
    5054 * update GrState size
    5155 * rename grDrawArray to grDrawVertexArray
    5256 * update _grDrawPoint and _grDrawVertexList
    53  * 
     57 *
    5458 * 6     10/21/97 8:36p Atai
    5559 * added gr_lines routines
    5660 * use dword offset
    57  * 
     61 *
    5862 * 5     10/17/97 2:11p Atai
    5963 * added grContinueArray. We only support non aa mode for now.
    60  * 
     64 *
    6165 * 4     10/14/97 4:34p Atai
    6266 * filled out the calls to different drawarray routines
    63  * 
     67 *
    6468 * 3     9/29/97 1:26p Dow
    6569 * Fixed packed color strips/fans
    66  * 
     70 *
    6771 * 2     9/26/97 10:24a Dow
    6872 * Fixed state muckage in Glide3 parameter data
    69  * 
     73 *
    7074 * 1     9/23/97 2:04p Dow
    7175 * DI code for strips
     
    8690  Date: 17-Sep-97
    8791  Implementor(s): dow
    88   Library: Init Code for 
     92  Library: Init Code for
    8993  Description:
    9094    This routine defines the format for vertex arrays.
     
    98102
    99103        So, this table summarizes the legal combinations:
    100         Param           Type            Size    Description 
     104        Param           Type            Size    Description
    101105        =======================================================================================================
    102106        GR_PARAM_XY     FxFloat         8       X and Y coordinates.  Offset must be zero.
     
    106110        GR_PARAM_PARGB  FxU32           4       Packed ARGB.  High-order byte is A, followed by R, G, and B.
    107111        GR_PARAM_STn    FxFloat         8       S and T coordinates for TMU , where n is in the range [0, TBD]
    108         GR_PARAM_Wn     FxFloat         4       
     112        GR_PARAM_Wn     FxFloat         4
    109113
    110114  Return:
     
    123127  case GR_PARAM_XY:
    124128    GR_CHECK_F(myName,
    125                (offset != 0), 
     129               (offset != 0),
    126130               "Offset must be zero.");
    127131
     
    202206    GR_CHECK_F(myName,
    203207               !((components == GR_VERTEX_XYZ) ||
    204                 (components == GR_VERTEX_XYZW)), 
     208                (components == GR_VERTEX_XYZW)),
    205209               "Bad Component for Vertex Parameter");
    206210    gc->state.vData.vertexInfo.components = components;
    207211
    208     GR_CHECK_F(myName, !(type == GR_FLOAT), "Bad Type for Vertex Parameter"); 
     212    GR_CHECK_F(myName, !(type == GR_FLOAT), "Bad Type for Vertex Parameter");
    209213    gc->state.vData.vertexInfo.type = type;
    210214
     
    213217    GDBG_INFO(gc->myLevel, "%s:  Vertex Offset = %d\n", FN_NAME,
    214218              gc->state.vData.vertexInfo.offset);
    215    
     219
    216220    break;
    217221
     
    222226    gc->state.vData.colorInfo.components = components;
    223227
    224     GR_CHECK_F(myName, !((type == GR_FLOAT) || (type == GR_U8)), 
     228    GR_CHECK_F(myName, !((type == GR_FLOAT) || (type == GR_U8)),
    225229               "Bad Type for Color Parameter");
    226230    gc->state.vData.colorInfo.type = type;
     
    229233    GDBG_INFO(gc->myLevel, "%s:  Color Offset = %d\n", FN_NAME,
    230234              gc->state.vData.colorInfo.offset);
    231    
    232     break;
    233    
     235
     236    break;
     237
    234238  case GR_TEXTURE0:
    235239    GR_CHECK_F(myName,
     
    245249    GDBG_INFO(gc->myLevel, "%s:  Tex0 Offset = %d\n", FN_NAME,
    246250              gc->state.vData.tex0Info.offset);
    247    
     251
    248252    break;
    249253
     
    262266              gc->state.vData.tex1Info.offset);
    263267    break;
    264    
     268
    265269  default:
    266270    GR_CHECK_F(myName, 0, "Invalid Parameter");
     
    281285  Implementor(s): dow
    282286  Description:
    283  
     287
    284288  Arguments:
    285289        mode:   GR_POINTS, GR_LINE_STRIP, GR_POLYGON, GR_TRIANLGE_STRIP,
    286290                GR_TRIANGLE_FAN, GR_TRIANGLES
    287  
     291
    288292  Return:
    289293        Nothing ever
     
    331335      _grDrawVertexList(kSetupFan, GR_VTX_PTR_ARRAY, Count, pointers);
    332336    break;
    333    
     337
    334338  case GR_TRIANGLE_STRIP:
    335339    if (gc->state.grEnableArgs.primitive_smooth_mode)
     
    345349      _grDrawVertexList(kSetupFan, GR_VTX_PTR_ARRAY, Count, pointers);
    346350    break;
    347      
     351
    348352  case GR_TRIANGLES:
    349353    if (gc->state.grEnableArgs.primitive_smooth_mode)
     
    352356      else
    353357        _grAAVpDrawTriangles(GR_VTX_PTR_ARRAY, GR_TRIANGLES, Count, pointers);
    354     else 
     358    else
    355359      _grDrawTriangles(GR_VTX_PTR_ARRAY, Count, pointers);
    356360    break;
     
    366370  Implementor(s): atai
    367371  Description:
    368  
     372
    369373  Arguments:
    370374        mode:   GR_POINTS, GR_LINE_STRIP, GR_POLYGON, GR_TRIANLGE_STRIP,
    371375                GR_TRIANGLE_FAN, GR_TRIANGLES
    372  
     376
    373377  Return:
    374378        Nothing ever
     
    417421      _grDrawVertexList(kSetupFan, GR_VTX_PTR, Count, pointers);
    418422    break;
    419    
     423
    420424  case GR_TRIANGLE_STRIP:
    421425    if (gc->state.grEnableArgs.primitive_smooth_mode)
     
    431435      _grDrawVertexList(kSetupFan, GR_VTX_PTR, Count, pointers);
    432436    break;
    433      
     437
    434438  case GR_TRIANGLES:
    435439    if (gc->state.grEnableArgs.primitive_smooth_mode)
     
    438442      else
    439443        _grAAVpDrawTriangles(GR_VTX_PTR, GR_TRIANGLES, Count, pointers);
    440     else 
     444    else
    441445      _grDrawTriangles(GR_VTX_PTR, Count, pointers);
    442446    break;
     
    446450} /* grDrawVertexArrayLinear */
    447451
    448 #endif /* GLIDE3 */ 
     452#endif /* GLIDE3 */
  • trunk/src/opengl/glide/cvg/glide/ditex.c

    r2888 r6653  
     1/* $Id: ditex.c,v 1.2 2001-09-05 14:30:22 bird Exp $ */
    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/cvg/glide/ditex.c,v 1.1 2000-02-25 00:37:35 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/ditex.c,v 1.2 2001-09-05 14:30:22 bird Exp $
    2122** $Log: ditex.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:35  sandervl
     23** Revision 1.2  2001-09-05 14:30:22  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:35  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 20    6/06/98 12:06p Peter
    2731** gmt's trilinear hell bug
    28 ** 
     32**
    2933** 19    2/20/98 5:31p Peter
    3034** crybaby glide
    31 ** 
     35**
    3236** 18    2/20/98 11:00a Peter
    3337** removed glide3 from glid2 tree
    34 ** 
     38**
    3539** 17    1/30/98 4:31p Peter
    3640** general clenaup
    37  * 
     41 *
    3842 * 16    1/13/98 12:42p Atai
    3943 * fixed grtexinfo, grVertexLayout, and draw triangle
    40  * 
     44 *
    4145 * 15    1/09/98 6:48p Atai
    4246 * grTexInfo, GR_LOD_* and GR_ASPECT_*
    43  * 
     47 *
    4448 * 13    12/09/97 12:20p Peter
    4549 * mac glide port
    46  * 
     50 *
    4751 * 12    12/02/97 9:49a Dow
    4852 * Got rid of Texelfx rev 0 warning
    49  * 
     53 *
    5054 * 11    11/20/97 6:58p Dow
    5155 * Marked _grTexTextureMemRequired for movement
    52  * 
     56 *
    5357 * 10    8/18/97 3:52p Peter
    5458 * pre-hw arrival fixes/cleanup
    55  * 
     59 *
    5660 * 9     6/02/97 4:09p Peter
    5761 * Compile w/ gcc for Dural
    58  * 
     62 *
    5963 * 8     5/27/97 1:16p Peter
    60  * Basic cvg, w/o cmd fifo stuff. 
    61  * 
     64 * Basic cvg, w/o cmd fifo stuff.
     65 *
    6266 * 7     5/21/97 6:04a Peter
    63  * 
     67 *
    6468 * 6     3/15/97 8:09p Jdt
    6569 * Remove grTexDownloadTable from this file because I added SST-1 only
    6670 * code to it
    67  * 
     71 *
    6872 * 5     3/09/97 10:31a Dow
    6973 * Added GR_DIENTRY for di glide functions
    70  * 
     74 *
    7175 * 4     2/12/97 2:09p Hanson
    72  * Hopefully removed the rest of my muckage. 
    73  * 
     76 * Hopefully removed the rest of my muckage.
     77 *
    7478 * 3     2/12/97 12:34p Dow
    7579 * Fixed Hanson muckage
    76  * 
     80 *
    7781 * 2     1/18/97 11:41p Dow
    7882 * Fixed Gary's "Last C Bug" analog
    7983 * Fixed usage of _grMipMapOffset_Tsplit
    80  * 
     84 *
    8185 * 1     12/23/96 1:39p Dow
    8286 * Changes for multiplatform
     
    103107
    104108/* size in texels  */
    105 const FxU32 _grMipMapHostSize[4][16] = 
     109const FxU32 _grMipMapHostSize[4][16] =
    106110{
    107111  {                             /* 1:1 aspect ratio */
     
    153157const int _grMipMapHostWH[GR_ASPECT_1x8 + 1][GR_LOD_1 + 1][2] =
    154158{
    155    { 
    156      { 256 , 32 }, 
    157      { 128 , 16 }, 
    158      { 64  , 8 }, 
    159      { 32  , 4 }, 
    160      { 16  , 2 }, 
    161      { 8   , 1 }, 
    162      { 4   , 1 }, 
    163      { 2   , 1 }, 
     159   {
     160     { 256 , 32 },
     161     { 128 , 16 },
     162     { 64  , 8 },
     163     { 32  , 4 },
     164     { 16  , 2 },
     165     { 8   , 1 },
     166     { 4   , 1 },
     167     { 2   , 1 },
    164168     { 1   , 1 }
    165169   },
    166    { 
    167      { 256 , 64 }, 
    168      { 128 , 32 }, 
    169      { 64  , 16 }, 
    170      { 32  , 8 }, 
    171      { 16  , 4 }, 
     170   {
     171     { 256 , 64 },
     172     { 128 , 32 },
     173     { 64  , 16 },
     174     { 32  , 8 },
     175     { 16  , 4 },
    172176     { 8   , 2 },
    173      { 4   , 1 }, 
    174      { 2   , 1 }, 
     177     { 4   , 1 },
     178     { 2   , 1 },
    175179     { 1   , 1 }
    176180   } ,
    177    { 
    178      { 256 , 128 }, 
    179      { 128 , 64 }, 
    180      { 64  , 32 }, 
     181   {
     182     { 256 , 128 },
     183     { 128 , 64 },
     184     { 64  , 32 },
    181185     { 32  , 16 },
    182186     { 16  , 8 },
    183      { 8   , 4 }, 
    184      { 4   , 2 }, 
    185      { 2   , 1 }, 
     187     { 8   , 4 },
     188     { 4   , 2 },
     189     { 2   , 1 },
    186190     { 1   , 1 }
    187191   },
    188    { 
    189      { 256 , 256 }, 
    190      { 128 , 128 }, 
     192   {
     193     { 256 , 256 },
     194     { 128 , 128 },
    191195     { 64  , 64 },
    192196     { 32  , 32 },
    193197     { 16  , 16 },
    194      { 8   , 8 }, 
    195      { 4   , 4 }, 
    196      { 2   , 2 }, 
     198     { 8   , 8 },
     199     { 4   , 4 },
     200     { 2   , 2 },
    197201     { 1   , 1 }
    198202   },
    199    { 
     203   {
    200204     { 128, 256 },
    201205     { 64,  128 },
    202206     { 32,  64  },
    203207     { 16,  32  },
    204      { 8,   16  }, 
    205      { 4,   8   }, 
    206      { 2,   4   }, 
    207      { 1,   2   }, 
     208     { 8,   16  },
     209     { 4,   8   },
     210     { 2,   4   },
     211     { 1,   2   },
    208212     { 1,   1 }
    209213   },
     
    214218     { 8,   32  },
    215219     { 4,   16  },
    216      { 2,   8   }, 
    217      { 1,   4   }, 
    218      { 1,   2   }, 
     220     { 2,   8   },
     221     { 1,   4   },
     222     { 1,   2   },
    219223     { 1,   1 }
    220224   },
    221    { 
     225   {
    222226     { 32,  256 },
    223227     { 16,  128 },
     
    225229     { 4,   32  },
    226230     { 2,   16  },
    227      { 1,   8   }, 
    228      { 1,   4   }, 
     231     { 1,   8   },
     232     { 1,   4   },
    229233     { 1,   2   },
    230234     { 1,   1 }
     
    244248};
    245249
    246 const FxU32 _gr_evenOdd_xlate_table[] = 
     250const FxU32 _gr_evenOdd_xlate_table[] =
    247251{
    248252  0xFFFFFFFF,                      /* invalid */
     
    333337*/
    334338FxU32
    335 _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 
     339_grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod,
    336340                           GrAspectRatio_t aspect, GrTextureFormat_t format,
    337341                           FxU32 evenOdd )
     
    341345  GR_CHECK_W("_grTexTextureMemRequired", small_lod < large_lod,
    342346                 "small_lod bigger than large_lod" );
    343   GR_CHECK_F( "_grTexTextureMemRequired", evenOdd >  GR_MIPMAPLEVELMASK_BOTH || evenOdd == 0, 
     347  GR_CHECK_F( "_grTexTextureMemRequired", evenOdd >  GR_MIPMAPLEVELMASK_BOTH || evenOdd == 0,
    344348              "invalid evenOdd mask" );
    345349
     
    404408    sum_of_lod_sizes = _grMipMapOffset_Tsplit[aspect][large_lod];
    405409  }
    406    
     410
    407411  if ( format >= GR_TEXFMT_16BIT ) sum_of_lod_sizes <<= 1;
    408412
     
    414418*/
    415419GR_DIENTRY(grTexCalcMemRequired, FxU32,
    416            ( GrLOD_t small_lod, GrLOD_t large_lod, 
     420           ( GrLOD_t small_lod, GrLOD_t large_lod,
    417421            GrAspectRatio_t aspect, GrTextureFormat_t format ))
    418422{
    419   const FxU32 memrequired  = _grTexTextureMemRequired(small_lod, large_lod, 
     423  const FxU32 memrequired  = _grTexTextureMemRequired(small_lod, large_lod,
    420424                                                      aspect, format,
    421425                                                      GR_MIPMAPLEVELMASK_BOTH );
     
    439443  FxU32 dmax    = ( FxU32 ) ( detail_max * _GlideRoot.pool.f255 );
    440444  FxU32 dscale  = detail_scale;
    441  
     445
    442446  GR_BEGIN_NOFIFOCHECK("grTexDetailControl",88);
    443447  GDBG_INFO_MORE(gc->myLevel,"(%d,%d,%g)\n",tmu,detail_scale,detail_max);
     
    450454  tDetail |= ( ( dmax << SST_DETAIL_MAX_SHIFT ) & SST_DETAIL_MAX );
    451455  tDetail |= ( ( dscale << SST_DETAIL_SCALE_SHIFT ) & SST_DETAIL_SCALE );
    452  
     456
    453457  /* MULTIPLAT */
    454458  _grTexDetailControl( tmu, tDetail );
     
    498502  Library: glide
    499503  Description:
    500     Returns the tmu memory required to store the specified mipmap   
    501     ( Gary and I don't like the name of this function, but are 
    502       a little backed into a corner because of the existence 
     504    Returns the tmu memory required to store the specified mipmap
     505    ( Gary and I don't like the name of this function, but are
     506      a little backed into a corner because of the existence
    503507      of grTexMemRequired() which does not imply any distinction
    504508      between texture memory and system ram )
     
    506510    evenOdd  - which set of mipmap levels are to be stored
    507511                One of:
    508                   GR_MIPMAPLEVELMASK_EVEN 
     512                  GR_MIPMAPLEVELMASK_EVEN
    509513                  GR_MIPMAPLEVELMASK_ODD
    510514                  GR_MIPMAPLEVELMASK_BOTH
     
    512516                of texture
    513517  Return:
    514     offset to be added to current texture base address to calculate next 
     518    offset to be added to current texture base address to calculate next
    515519    valid texture memory download location
    516520  -------------------------------------------------------------------*/
     
    526530                                         info->format,
    527531                                         evenOdd );
    528                        
     532
    529533  GDBG_INFO(88,"grTexTextureMemRequired(%d,0x%x) => 0x%x(%d)\n",
    530534                evenOdd,info,memrequired,memrequired);
     
    555559    none
    556560  -------------------------------------------------------------------*/
    557 GR_DIENTRY(grTexDownloadMipMap, void, 
     561GR_DIENTRY(grTexDownloadMipMap, void,
    558562           ( GrChipID_t tmu, FxU32 startAddress, FxU32
    559563            evenOdd, GrTexInfo  *info ))
     
    568572  GDBG_INFO(89,"grTexDownloadMipMap(%d,0x%x,%d,0x%x\n",tmu,startAddress,evenOdd,info);
    569573  GR_CHECK_TMU( "grTexDownloadMipMap", tmu );
    570   GR_CHECK_COMPATABILITY("grTexDownloadMipMap", 
     574  GR_CHECK_COMPATABILITY("grTexDownloadMipMap",
    571575                         startAddress + size > gc->tmu_state[tmu].total_mem,
    572576                         "insufficient texture ram at startAddress" );
    573577  GR_CHECK_F( "grTexDownloadMipMap", evenOdd > 0x3, "evenOdd mask invalid" );
    574578  GR_CHECK_F( "grTexDownloadMipMap", !info, "info invalid" );
    575  
     579
    576580  if ((startAddress < 0x200000) && (startAddress + size > 0x200000)) {
    577581    GR_CHECK_COMPATABILITY("grTexDownloadMipMap",
     
    582586
    583587  src_base = (char *)info->data;
    584  
     588
    585589  /*---------------------------------------------------------------
    586590    Download one mipmap level at a time
    587591    ---------------------------------------------------------------*/
    588592  for(lod = info->largeLod; lod <= info->smallLod; lod++ ) {
    589     grTexDownloadMipMapLevel( tmu, 
    590                               startAddress, 
     593    grTexDownloadMipMapLevel( tmu,
     594                              startAddress,
    591595                              lod,
    592596                              info->largeLod,
     
    595599                              evenOdd,
    596600                              src_base );
    597                
    598     src_base += (_grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod] << 
     601
     602    src_base += (_grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod] <<
    599603                 (info->format >= GR_TEXFMT_16BIT));
    600604  }
     
    621625  -------------------------------------------------------------------*/
    622626GR_DIENTRY(grTexDownloadTablePartial, void,
    623            ( GrChipID_t tmu, GrTexTable_t type, 
     627           ( GrChipID_t tmu, GrTexTable_t type,
    624628            void *data, int start, int end ))
    625629{
     
    636640    _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end );
    637641    /* Removed redundant call
    638      * _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end ); 
     642     * _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end );
    639643     */
    640644  }
     
    646650** grTexDownloadMipMapLevel
    647651*/
    648 GR_DIENTRY(grTexDownloadMipMapLevel, void, 
     652GR_DIENTRY(grTexDownloadMipMapLevel, void,
    649653           ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod,
    650654            GrLOD_t largeLod, GrAspectRatio_t aspectRatio,
    651             GrTextureFormat_t format, FxU32 evenOdd, void *data )) 
     655            GrTextureFormat_t format, FxU32 evenOdd, void *data ))
    652656{
    653657  GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevel",89);
     
    657661  /*
    658662  ** note for glide3 lod translation:
    659   ** we are calling gr* routine so the lod data should remain the same 
     663  ** we are calling gr* routine so the lod data should remain the same
    660664  */
    661665  grTexDownloadMipMapLevelPartial( tmu, startAddress,
    662                                    thisLod, largeLod, 
     666                                   thisLod, largeLod,
    663667                                   aspectRatio, format,
    664668                                   evenOdd, data,
  • trunk/src/opengl/glide/cvg/glide/fifo.c

    r2888 r6653  
     1/* $Id: fifo.c,v 1.2 2001-09-05 14:30:22 bird Exp $ */
    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/cvg/glide/fifo.c,v 1.1 2000-02-25 00:37:36 sandervl Exp $
     21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/fifo.c,v 1.2 2001-09-05 14:30:22 bird Exp $
    2122 ** $Log: fifo.c,v $
    22  ** Revision 1.1  2000-02-25 00:37:36  sandervl
     23 ** Revision 1.2  2001-09-05 14:30:22  bird
     24 ** Added $Id:$ keyword.
     25 **
     26 ** Revision 1.1  2000/02/25 00:37:36  sandervl
    2327 ** Created Voodoo 2 dir
    2428 **
    25 ** 
     29**
    2630** 22    3/14/98 1:07p Peter
    2731** mac port happiness
    28 ** 
     32**
    2933** 21    2/20/98 9:05a Peter
    3034** removed remnants of comdex grot
    31 ** 
     35**
    3236** 20    2/11/98 5:22p Peter
    3337** added fifo get stuff for hanson
    34 ** 
     38**
    3539** 19    2/01/98 7:44p Peter
    3640** parameter dumping level
    37  * 
     41 *
    3842 * 18    12/17/97 4:45p Peter
    3943 * groundwork for CrybabyGlide
    40  * 
     44 *
    4145 * 17    12/09/97 12:20p Peter
    4246 * mac glide port
    43  * 
     47 *
    4448 * 16    12/09/97 10:28a Peter
    4549 * cleaned up some frofanity
    46  * 
     50 *
    4751 * 15    12/05/97 4:26p Peter
    4852 * watcom warnings
    49  * 
     53 *
    5054 * 14    12/03/97 11:34a Peter
    5155 * dos debugging
    52  * 
     56 *
    5357 * 13    11/21/97 3:53p Peter
    5458 * reset messages are controlled by gdbg_level
    55  * 
     59 *
    5660 * 12    11/19/97 6:04p Peter
    5761 * actually exit if not reset
    58  * 
     62 *
    5963 * 11    11/18/97 4:36p Peter
    6064 * chipfield stuff cleanup and w/ direct writes
    61  * 
     65 *
    6266 * 10    11/17/97 4:55p Peter
    6367 * watcom warnings/chipfield stuff
    64  * 
     68 *
    6569 * 9     11/15/97 9:20p Peter
    6670 * I am the sorriest f*cker on the face of the planet
    67  * 
     71 *
    6872 **
    6973 */
     
    344348  "reserved0FD",                /* 0xfd */
    345349  "reserved0FE",                /* 0xfe */
    346   "reserved0FF",                /* 0xff */ 
     350  "reserved0FF",                /* 0xff */
    347351};
    348352
     
    356360
    357361  GDBG_INFO(gc->myLevel + 199, "Storing to FIFO:\n");
    358   GDBG_INFO(gc->myLevel + 199, "  FIFO Ptr:    0x%x : 0x%X\n", fifoPtr, gc->cmdTransportInfo.fifoRoom); 
    359   if (index <= 0xff) { 
     362  GDBG_INFO(gc->myLevel + 199, "  FIFO Ptr:    0x%x : 0x%X\n", fifoPtr, gc->cmdTransportInfo.fifoRoom);
     363  if (index <= 0xff) {
    360364    GDBG_INFO(gc->myLevel + 199, "  Reg Name:    %s\n", cvgRegNames[index]);
    361365    GDBG_INFO(gc->myLevel + 199, "  Reg Num:     0x%X\n", index);
     
    363367    const char* strP;
    364368    const FxU32 offset = (addr - (FxU32)gc->reg_ptr);
    365      
     369
    366370    if (offset >= HW_TEXTURE_OFFSET) {
    367371      strP = "Texture";
     
    380384
    381385  GDBG_INFO(120, "        SET(0x%X, %ld(0x%X)) 0 %s (0x%X)\n",
    382             0x10000000UL + (FxU32)(index << 2), val, val, 
     386            0x10000000UL + (FxU32)(index << 2), val, val,
    383387            cvgRegNames[index & 0xFF], fifoPtr);
    384388} /* _grFifoWriteDebug */
     
    398402  GDBG_INFO(gc->myLevel + 200, "  Value:       %4.2f\n", val);
    399403
    400   GDBG_INFO(120, "        SET(0x%X, %4.2f (0x%X)) 0 %s\n", 
    401             0x10000000UL + (FxU32)(index << 2), val, *(const FxU32*)&val, 
     404  GDBG_INFO(120, "        SET(0x%X, %4.2f (0x%X)) 0 %s\n",
     405            0x10000000UL + (FxU32)(index << 2), val, *(const FxU32*)&val,
    402406            cvgRegNames[index & 0xFF]);
    403407} /* _grFifoFWriteDebug */
     
    410414  /* Dump Packet Header */
    411415  GDBG_INFO(gc->myLevel + 200, "CMD Fifo Triangle Packet (0x%X)\n", hdrVal);
    412   GDBG_INFO(gc->myLevel + 200, "  # Vertex: 0x%X\n", 
     416  GDBG_INFO(gc->myLevel + 200, "  # Vertex: 0x%X\n",
    413417            (hdrVal & SSTCP_PKT3_NUMVERTEX) >> SSTCP_PKT3_NUMVERTEX_SHIFT);
    414418  GDBG_INFO(gc->myLevel + 200, "  RGB: %s\n",
     
    426430  GDBG_INFO(gc->myLevel + 200, "  PingPongSign: %s\n",
    427431            (((hdrVal & (0x01 << 25)) == 0) ? "Normal" : "Disable"));
    428  
     432
    429433  if (GDBG_GET_DEBUGLEVEL(gc->myLevel + 200)) {
    430434    const FxU32 temp = (hdrVal & SSTCP_PKT3_PMASK);
     
    435439    for(i = 10; i <= 17; i++) {
    436440      static const char* paramSel[] = { "RGB", "Alpha", "Z", "Wb", "W0", "ST[0]", "W1", "ST[1]" };
    437      
     441
    438442      if ((temp & (0x01UL << i)) != 0) GDBG_PRINTF("%s ", paramSel[i - 10]);
    439443    }
     
    470474  if (!inProcP) {
    471475    static char errMsgBuf[1024];
    472    
     476
    473477    inProcP = FXTRUE;
    474478    {
     
    508512_grGet32(volatile FxU32* const sstAddr)
    509513{
    510   return GR_GET(*sstAddr); 
     514  return GR_GET(*sstAddr);
    511515}
    512516
     
    528532
    529533  /* Update the roomToXXX values w/ the # of writes since the last
    530    * fifo stall/wrap. 
     534   * fifo stall/wrap.
    531535   */
    532536  {
    533537    const FxI32 writes = (MIN(gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd) -
    534538                          gc->cmdTransportInfo.fifoRoom);
    535    
     539
    536540    gc->cmdTransportInfo.roomToReadPtr   -= writes;
    537541    gc->cmdTransportInfo.roomToEnd       -= writes;
     
    544548                   ((fName == NULL) ? "Unknown" : fName), fLine,
    545549                   (FxU32)gc->cmdTransportInfo.fifoPtr, blockSize,
    546                    gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd, 
     550                   gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
    547551                   gc->cmdTransportInfo.fifoRoom, writes,
    548552                   HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead);
     
    553557
    554558      GDBG_INFO_MORE(gc->myLevel, "\tsli: 0x%X : (0x%X : 0x%X : 0x%X)\n",
    555                      HW_FIFO_PTR(FXFALSE), 
    556                      GR_GET(slaveHw->cmdFifoDepth), 
    557                      GR_GET(slaveHw->cmdFifoHoles), 
     559                     HW_FIFO_PTR(FXFALSE),
     560                     GR_GET(slaveHw->cmdFifoDepth),
     561                     GR_GET(slaveHw->cmdFifoHoles),
    558562                     GR_GET(slaveHw->status));
    559563    }
     
    561565#endif /* GDBG_INFO_ON */
    562566
    563     ASSERT_FAULT_IMMED((gc->cmdTransportInfo.roomToReadPtr >= 0) && 
     567    ASSERT_FAULT_IMMED((gc->cmdTransportInfo.roomToReadPtr >= 0) &&
    564568                       (gc->cmdTransportInfo.roomToEnd >= 0));
    565569  }
     
    597601        /* Is the slave closer than the master? */
    598602        if (distSlave < distMaster) {
    599 #if GDBG_INFO_ON 
     603#if GDBG_INFO_ON
    600604          {
    601             SstRegs* slaveHw = (SstRegs*)gc->slave_ptr; 
     605            SstRegs* slaveHw = (SstRegs*)gc->slave_ptr;
    602606            GDBG_INFO(gc->myLevel, "  Wait sli: 0x%X : (0x%X : 0x%X : 0x%X)\n"
    603607                      "\tMaster: 0x%X : 0x%X\n"
    604608                      "\tSlave : 0x%X : 0x%X\n",
    605                       HW_FIFO_PTR(FXFALSE), 
    606                       GR_GET(slaveHw->cmdFifoDepth), 
    607                       GR_GET(slaveHw->cmdFifoHoles), 
     609                      HW_FIFO_PTR(FXFALSE),
     610                      GR_GET(slaveHw->cmdFifoDepth),
     611                      GR_GET(slaveHw->cmdFifoHoles),
    608612                      GR_GET(slaveHw->status),
    609613                      curReadPtr, curReadDist,
     
    636640    gc->cmdTransportInfo.roomToReadPtr = roomToReadPtr;
    637641
    638     GDBG_INFO(gc->myLevel, "  Wait: (0x%X : 0x%X) : 0x%X\n", 
     642    GDBG_INFO(gc->myLevel, "  Wait: (0x%X : 0x%X) : 0x%X\n",
    639643              gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
    640644              gc->cmdTransportInfo.fifoRead);
    641645  }
    642  
     646
    643647  /* Do we need to wrap to front? */
    644648  if (gc->cmdTransportInfo.roomToEnd <= blockSize) {
    645     GDBG_INFO(gc->myLevel + 10, "  Pre-Wrap: (0x%X : 0x%X) : 0x%X\n", 
     649    GDBG_INFO(gc->myLevel + 10, "  Pre-Wrap: (0x%X : 0x%X) : 0x%X\n",
    646650              gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
    647651              gc->cmdTransportInfo.fifoRead);
    648652
    649     /* Set the jsr packet. 
     653    /* Set the jsr packet.
    650654     * NB: This command must be fenced.
    651655     */
     
    656660    }
    657661    FIFO_ASSERT();
    658    
     662
    659663    wrapAddr = (FxU32)gc->cmdTransportInfo.fifoPtr;
    660664
     
    668672#endif
    669673
    670     /* Reset fifo ptr to start */ 
     674    /* Reset fifo ptr to start */
    671675    gc->cmdTransportInfo.fifoPtr = gc->cmdTransportInfo.fifoStart;
    672676
     
    675679      FxU32* fifoPtr = gc->cmdTransportInfo.fifoShadowPtr;
    676680
    677       while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2)) 
     681      while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2))
    678682        *fifoPtr++ = 0x00UL;
    679683      gc->cmdTransportInfo.fifoShadowPtr = gc->cmdTransportInfo.fifoShadowBase;
     
    681685#endif /* GLIDE_USE_SHADOW_FIFO */
    682686
    683     GDBG_INFO(gc->myLevel + 10, "  Post-Wrap: (0x%X : 0x%X) : 0x%X\n", 
     687    GDBG_INFO(gc->myLevel + 10, "  Post-Wrap: (0x%X : 0x%X) : 0x%X\n",
    684688              gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
    685689              gc->cmdTransportInfo.fifoRead);
     
    687691    goto again;
    688692  }
    689  
     693
    690694  /* compute room left */
    691695  gc->cmdTransportInfo.fifoRoom = MIN(gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd);
    692696
    693 #if GDBG_INFO_ON 
     697#if GDBG_INFO_ON
    694698#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
    695699  GDBG_INFO(gc->myLevel, FN_NAME"_Done:\n"
     
    698702            "\tfifo hw: (0x%X : 0x%X) : (0x%X : 0x%X : 0x%X)\n",
    699703            (FxU32)gc->cmdTransportInfo.fifoPtr, blockSize,
    700             gc->cmdTransportInfo.roomToReadPtr, 
     704            gc->cmdTransportInfo.roomToReadPtr,
    701705            gc->cmdTransportInfo.roomToEnd, gc->cmdTransportInfo.fifoRoom,
    702             HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead, 
     706            HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead,
    703707            GR_GET(hw->cmdFifoDepth), GR_GET(hw->cmdFifoHoles), GR_GET(hw->status));
    704708#endif
     
    707711  if (gc->scanline_interleaved) {
    708712    SstRegs* slaveHw = (SstRegs*)gc->slave_ptr;
    709    
     713
    710714    GDBG_INFO_MORE(gc->myLevel, "\tsli: 0x%X : (0x%X : 0x%X : 0x%X)\n",
    711                    HW_FIFO_PTR(FXFALSE), 
    712                    GR_GET(slaveHw->cmdFifoDepth), 
    713                    GR_GET(slaveHw->cmdFifoHoles), 
     715                   HW_FIFO_PTR(FXFALSE),
     716                   GR_GET(slaveHw->cmdFifoDepth),
     717                   GR_GET(slaveHw->cmdFifoHoles),
    714718                   GR_GET(slaveHw->status));
    715719  }
    716720#endif /* !GLIDE_INIT_HAL */
    717721#endif /* GDBG_INFO_ON */
    718  
     722
    719723  FIFO_ASSERT();
    720724  GR_TRACE_EXIT(FN_NAME);
  • trunk/src/opengl/glide/cvg/glide/fxbldno.c

    r2888 r6653  
     1/* $Id: fxbldno.c,v 1.2 2001-09-05 14:30:22 bird Exp $ */
    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/cvg/glide/fxbldno.c,v 1.1 2000-02-25 00:37:36 sandervl Exp $
     21 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/fxbldno.c,v 1.2 2001-09-05 14:30:22 bird Exp $
    2122 * $Log: fxbldno.c,v $
    22  * Revision 1.1  2000-02-25 00:37:36  sandervl
     23 * Revision 1.2  2001-09-05 14:30:22  bird
     24 * Added $Id:$ keyword.
     25 *
     26 * Revision 1.1  2000/02/25 00:37:36  sandervl
    2327 * Created Voodoo 2 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/cvg/glide/fxgasm.c

    r2888 r6653  
     1/* $Id: fxgasm.c,v 1.2 2001-09-05 14:30:23 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:37:36 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:30:23 $
    2223*/
    2324
     
    6263#define NEWLINE printf("\n");
    6364#define COMMENT printf("#----------------------------------------------------------------------\n")
    64  
     65
    6566#define HEADER(str)     NEWLINE; COMMENT; \
    6667                        printf("# Assembler offsets for %s struct\n",str);\
     
    113114               offsetof(struct GrGC_s, cmdTransportInfo.triSetupProc));
    114115#endif /* GLIDE_DISPATCH_SETUP */
    115        
     116
    116117        printf("/* The # of 2-byte entries in the hw fog table */\n");
    117118        printf("#define kInternalFogTableEntryCount 0x%XUL\n",
  • trunk/src/opengl/glide/cvg/glide/g3df.c

    r2888 r6653  
     1/* $Id: g3df.c,v 1.2 2001-09-05 14:30:23 bird Exp $ */
    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/cvg/glide/g3df.c,v 1.1 2000-02-25 00:37:37 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/g3df.c,v 1.2 2001-09-05 14:30:23 bird Exp $
    2122** $Log: g3df.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:37  sandervl
     23** Revision 1.2  2001-09-05 14:30:23  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:37  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 17    2/20/98 11:00a Peter
    2731** removed glide3 from glid2 tree
    28  * 
     32 *
    2933 * 16    1/13/98 7:48p Atai
    3034 * fixed gu3dfGetInfo, grBufferClear, and GrState size
    31  * 
     35 *
    3236 * 15    1/13/98 12:42p Atai
    3337 * fixed grtexinfo, grVertexLayout, and draw triangle
    34  * 
     38 *
    3539 * 14    1/09/98 6:48p Atai
    3640 * grTexInfo, GR_LOD_* and GR_ASPECT_*
    37  * 
     41 *
    3842 * 12    12/17/97 4:45p Peter
    3943 * groundwork for CrybabyGlide
    40  * 
     44 *
    4145 * 11    12/09/97 12:20p Peter
    4246 * mac glide port
    43  * 
     47 *
    4448 * 10    6/06/97 5:56p Peter
    4549 * fixed gcc/dural compilation things
    46  * 
     50 *
    4751 * 9     6/02/97 4:09p Peter
    4852 * Compile w/ gcc for Dural
    49  * 
     53 *
    5054 * 8     5/27/97 1:16p Peter
    51  * Basic cvg, w/o cmd fifo stuff. 
    52  * 
     55 * Basic cvg, w/o cmd fifo stuff.
     56 *
    5357 * 7     5/21/97 6:05a Peter
    54  * 
     58 *
    5559 * 6     3/09/97 10:31a Dow
    5660 * Added GR_DIENTRY for di glide functions
     
    9397
    9498
    95 static FxBool 
     99static FxBool
    96100_grGet3dfHeader(FILE* stream, char* const buffer, const FxU32 bufSize)
    97101{
    98102  int numLines = 0;
    99103  FxU32 bufPos = 0;
    100  
     104
    101105  while(numLines < 4) {
    102106    /* Handle stream errors */
    103107    if (fgets(buffer + bufPos, bufSize - bufPos, stream) == NULL) break;
    104108    bufPos += strlen(buffer + bufPos);
    105    
     109
    106110    /* fgets includes the '\n' in the buffer. If this is not there
    107111     * then the buffer is too small so fail.
     
    143147    GR_ASPECT_8x1
    144148  };
    145   CfTableEntry cftable[] = 
     149  CfTableEntry cftable[] =
    146150  {
    147151    { "I8",       GR_TEXFMT_INTENSITY_8,        FXTRUE },
     
    398402      packedvalue |= ((FxU32) info->table.nccTable.yRGB[index*4+2]) << 16;
    399403      packedvalue |= ((FxU32) info->table.nccTable.yRGB[index*4+3]) << 24;
    400                                            
     404
    401405      info->table.nccTable.packed_data[index] = packedvalue;
    402406    }
     
    450454  case GR_TEXFMT_RGB_332:
    451455  case GR_TEXFMT_P_8:
    452     Read8Bit(info->data, image_file, 
    453              info->header.small_lod, 
    454              info->header.large_lod, 
     456    Read8Bit(info->data, image_file,
     457             info->header.small_lod,
     458             info->header.large_lod,
    455459             info->header.aspect_ratio);
    456460    break;
     
    463467  case GR_TEXFMT_ALPHA_INTENSITY_88:
    464468  case GR_TEXFMT_AP_88:
    465     Read16Bit(info->data, image_file, 
     469    Read16Bit(info->data, image_file,
    466470              info->header.small_lod,
    467471              info->header.large_lod,
     
    486490** Read in an 8-bit texture map, unpacked.
    487491*/
    488 static void 
    489 Read8Bit(FxU8 *data, FILE *image_file, 
    490          int small_lod, int large_lod, 
     492static void
     493Read8Bit(FxU8 *data, FILE *image_file,
     494         int small_lod, int large_lod,
    491495         GrAspectRatio_t aspect_ratio)
    492496{
     
    508512** Read in a 16-bit texture map, unpacked.
    509513*/
    510 static void Read16Bit(FxU16 *data, FILE *image_file, 
    511                       int small_lod, int large_lod, 
     514static void Read16Bit(FxU16 *data, FILE *image_file,
     515                      int small_lod, int large_lod,
    512516                      GrAspectRatio_t aspect_ratio)
    513517{
     
    534538  FxU16 b1 = (FxU16)getc(fp);
    535539  FxU16 b2 = (FxU16)getc(fp);
    536  
     540
    537541#define kShiftB1        8
    538542#define kShiftB2        0
  • trunk/src/opengl/glide/cvg/glide/gaa.c

    r2888 r6653  
     1/* $Id: gaa.c,v 1.2 2001-09-05 14:30:23 bird Exp $ */
    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/cvg/glide/gaa.c,v 1.1 2000-02-25 00:37:37 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gaa.c,v 1.2 2001-09-05 14:30:23 bird Exp $
    2122** $Log: gaa.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:37  sandervl
     23** Revision 1.2  2001-09-05 14:30:23  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:37  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 64    5/18/98 12:15p Peter
    2731** crybaby check for alpha enable
    28 ** 
     32**
    2933** 63    4/22/98 6:18p Jdt
    3034** Optimized AA Lines.
    31 ** 
     35**
    3236** 62    2/20/98 11:00a Peter
    3337** removed glide3 from glid2 tree
    34  * 
     38 *
    3539 * 61    1/15/98 2:46p Atai
    3640 * fixed grDrawPoint and grDrawLine in aa mode
    37  * 
     41 *
    3842 * 60    12/17/97 4:45p Peter
    3943 * groundwork for CrybabyGlide
    40  * 
     44 *
    4145 * 59    12/12/97 12:43p Atai
    4246 * move i and dateElem into the set up loop
    43  * 
     47 *
    4448 * 57    12/08/97 10:40a Atai
    4549 * modify draw vertex primitive routines to do grDrawVertexArrayLinear()
    46  * 
     50 *
    4751 * 56    12/05/97 4:26p Peter
    4852 * watcom warnings
    49  * 
     53 *
    5054 * 55    11/24/97 4:40p Peter
    5155 * aa prims vs packing
    52  * 
     56 *
    5357 * 54    11/21/97 6:05p Atai
    5458 * use one datalist (tsuDataList) in glide3
    55  * 
     59 *
    5660 * 53    11/21/97 3:20p Peter
    5761 * direct writes tsu registers
    58  * 
     62 *
    5963 * 52    11/18/97 6:11p Peter
    6064 * fixed glide3 muckage
    61  * 
     65 *
    6266 * 51    11/18/97 4:36p Peter
    6367 * chipfield stuff cleanup and w/ direct writes
    64  * 
     68 *
    6569 * 50    11/18/97 3:26p Atai
    66  * update vData 
     70 * update vData
    6771 * optimize state monster
    68  * 
     72 *
    6973 * 49    11/17/97 4:55p Peter
    7074 * watcom warnings/chipfield stuff
    71  * 
     75 *
    7276 * 48    11/06/97 6:10p Atai
    7377 * update GrState size
    7478 * rename grDrawArray to grDrawVertexArray
    7579 * update _grDrawPoint and _grDrawVertexList
    76  * 
     80 *
    7781 * 47    11/04/97 6:35p Atai
    7882 * 1. sync with data structure changes
    7983 * 2. break up aa triangle routine
    80  * 
     84 *
    8185 * 46    11/04/97 5:04p Peter
    8286 * cataclysm part deux
    83  * 
     87 *
    8488 * 45    11/04/97 4:57p Atai
    8589 * use byte offset
    86  * 
     90 *
    8791 * 44    11/03/97 3:43p Peter
    8892 * h3/cvg cataclysm
    89  * 
     93 *
    9094 * 43    11/03/97 3:19p Atai
    9195 * optimization
    92  * 
     96 *
    9397 * 42    10/29/97 2:45p Peter
    9498 * C version of Taco's packing code
    95  * 
     99 *
    96100 * 41    10/29/97 2:24p Atai
    97101 * re-work aa draw routines to increase sbench number
    98  * 
     102 *
    99103 * 40    10/21/97 8:38p Atai
    100104 * added lines routine for grDrawArray
    101  * 
     105 *
    102106 * 39    10/21/97 3:22p Peter
    103107 * hand pack rgb
    104  * 
     108 *
    105109 * 38    10/19/97 12:51p Peter
    106110 * no tsu happiness
    107  * 
     111 *
    108112 * 37    10/17/97 3:15p Peter
    109113 * removed unused addr field from datalist
    110  * 
     114 *
    111115 * 36    10/17/97 10:15a Peter
    112116 * packed rgb state cleanup
    113  * 
     117 *
    114118 * 35    10/16/97 5:33p Peter
    115119 * argb != rgba
    116  * 
     120 *
    117121 * 34    10/16/97 3:40p Peter
    118122 * packed rgb
    119  * 
     123 *
    120124 * 33    10/16/97 1:50p Atai
    121125 * fix drawarray bugs
    122  * 
     126 *
    123127 * 32    10/14/97 7:33p Atai
    124128 * fix compiler error
    125  * 
     129 *
    126130 * 31    10/14/97 5:40p Atai
    127131 * added grculltest
    128  * 
     132 *
    129133 * 30    10/14/97 4:36p Atai
    130134 * added aa points, strip line and trianlges for drawarray
    131  * 
     135 *
    132136 * 29    10/09/97 8:02p Dow
    133137 * State Monster 1st Cut
    134  * 
     138 *
    135139 * 28    10/08/97 5:19p Peter
    136140 * optinally clamp only texture params
    137  * 
     141 *
    138142 * 27    10/08/97 11:32a Peter
    139143 * pre-computed packet headers for packet 3
    140  * 
     144 *
    141145 * 26    9/20/97 4:42p Peter
    142146 * tri_setf fixup/big fifo
    143  * 
     147 *
    144148 * 25    9/16/97 2:49p Peter
    145149 * fixed watcom unhappiness w/ static initializers
    146  * 
     150 *
    147151 * 24    9/15/97 7:31p Peter
    148152 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    149153 * place, lfb's are on, Hmmmm.. probably more
    150  * 
     154 *
    151155 * 23    9/10/97 10:13p Peter
    152156 * fifo logic from GaryT, non-normalized fp first cut
    153  * 
     157 *
    154158 * 22    8/30/97 5:58p Tarolli
    155159 * cleanups
    156  * 
     160 *
    157161 * 21    7/29/97 4:31p Atai
    158162 * replace old edge sense routine
    159  * 
     163 *
    160164 * 19    7/28/97 2:42p Peter
    161165 * aa points?
    162  * 
     166 *
    163167 * 18    7/26/97 3:04p Peter
    164168 * cleanup
    165  * 
     169 *
    166170 * 17    7/25/97 11:40a Peter
    167171 * removed dHalf, change field name to match real use for cvg
    168  * 
     172 *
    169173 * 16    6/30/97 3:21p Peter
    170174 * more aa through cmd fifo
    171  * 
     175 *
    172176 * 15    6/20/97 1:17p Peter
    173177 * changes for new CVG_TRI macros
     
    200204**   w = h = 2pixels
    201205*/
    202 GR_ENTRY(grAADrawPoint, void, (const GrVertex *e)) 
     206GR_ENTRY(grAADrawPoint, void, (const GrVertex *e))
    203207{
    204208#define FN_NAME "grAADrawPoint"
    205209  GR_DCL_GC;
    206210  GrCullMode_t cullSave;
    207  
     211
    208212#if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP
    209213  const FxU32 vertexParamOffset = _GlideRoot.curVertexSize;
     
    223227  /* We draw this as a 4 triangle fan centered around E. */
    224228  GR_SET_EXPECTED_SIZE(vertexParamOffset * 6, 1);
    225   TRI_STRIP_BEGIN(kSetupFan, 
    226                   0x06UL, vertexParamOffset, 
     229  TRI_STRIP_BEGIN(kSetupFan,
     230                  0x06UL, vertexParamOffset,
    227231                  SSTCP_PKT3_BDDDDD);
    228232
     
    242246      if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    243247        FxU32 packedColor = 0x00;
    244        
     248
    245249        if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    246250          packedColor = (RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_B_OFFSET << 2)), B) |
    247251                         RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_G_OFFSET << 2)), G) |
    248252                         RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_R_OFFSET << 2)), R));
    249          
     253
    250254          dataList++;
    251255        }
    252        
     256
    253257        packedColor |= RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_A_OFFSET << 2)), A);
    254258        TRI_SET(packedColor);
     
    267271      dataList++;
    268272#endif /* GLIDE_FP_CLAMP_TEX */
    269      
     273
    270274      while(*dataList != 0) {
    271275        TRI_SETF_CLAMP(FARRAY(fp, *dataList));
     
    283287      static const float xAdjust[] = {  1.0f, -1.0f, -1.0f, 1.0f,  1.0f };
    284288      static const float yAdjust[] = { -1.0f, -1.0f,  1.0f, 1.0f, -1.0f };
    285          
     289
    286290      ASSERT(ArraySize(xAdjust) == ArraySize(yAdjust));
    287          
     291
    288292      for(v = 0; v < ArraySize(xAdjust); v++) {
    289293        TRI_SETF(ptX + xAdjust[v]);
    290294        TRI_SETF(ptY + yAdjust[v]);
    291            
     295
    292296        {
    293297          const int* dataList = gc->tsuDataList;
     
    296300          if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    297301            FxU32 packedColor = 0x00;
    298            
     302
    299303            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    300304              packedColor = (RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_B_OFFSET << 2)), B) |
    301305                             RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_G_OFFSET << 2)), G) |
    302306                             RGBA_COMP_CLAMP(FARRAY(fp, (GR_VERTEX_R_OFFSET << 2)), R));
    303              
     307
    304308              dataList++;
    305309            }
    306            
     310
    307311            TRI_SET(packedColor);
    308312          } else {
     
    319323            dataList++;
    320324          }
    321          
     325
    322326          /* Send constant Alpha == 0.0f */
    323327          TRI_SETF(0.0f);
     
    335339          dataList++;
    336340#endif /* GLIDE_FP_CLAMP_TEX */
    337          
     341
    338342          /* Anything else in the dataList */
    339           while(*dataList != 0) {                 
     343          while(*dataList != 0) {
    340344            TRI_SETF_CLAMP(FARRAY(fp, *dataList));
    341345            dataList++;
     
    345349    }
    346350  }
    347  
     351
    348352  TRI_END;
    349353  GR_CHECK_SIZE();
    350354#else
    351355  {
    352     GrVertex a, b;     
     356    GrVertex a, b;
    353357
    354358    /*
    355359    ** make corners of a square
    356360    */
    357     a = 
     361    a =
    358362    b = *e;
    359      
     363
    360364    a.tmuvtx[0].oow =
    361365    b.tmuvtx[0].oow = _GlideRoot.pool.f1;
    362      
     366
    363367    a.x -= _GlideRoot.pool.f1;
    364368    a.y -= _GlideRoot.pool.f1;
     
    367371    b.y -= _GlideRoot.pool.f1;
    368372
    369     a.a = 
     373    a.a =
    370374      b.a =  _GlideRoot.pool.f0;
    371      
     375
    372376    grDrawTriangle(&a, &b, e);    /* A B E */
    373      
     377
    374378    b.x -= 2.0F;                  /* compute point D */
    375379    b.y += 2.0F;
    376380    grDrawTriangle(&a, e, &b);    /* A E D */
    377      
     381
    378382    a.x += 2.0F;                  /* compute point C */
    379383    a.y += 2.0F;
    380384    grDrawTriangle(&b, e, &a);    /* D E C */
    381      
     385
    382386    b.x += 2.0F;
    383387    b.y -= 2.0F;
     
    385389  }
    386390#endif /* GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP */
    387  
     391
    388392  /* Restore culling mode */
    389393  gc->state.cull_mode = cullSave;
     
    397401#define FN_NAME "grAADrawStrip"
    398402  const FxU32 vertexParamOffset = _GlideRoot.curVertexSize;
    399    
     403
    400404  GR_BEGIN_NOFIFOCHECK(FN_NAME, gc->myLevel);
    401405  GDBG_INFO_MORE(gc->myLevel, "(): 0x%X\n", vectorNum);
     
    405409  GR_SET_EXPECTED_SIZE(vertexParamOffset * vectorNum, 1);
    406410  TRI_PACKET_BEGIN(cullMode, gc->cmdTransportInfo.paramMask,
    407                    vectorNum, vertexParamOffset, 
     411                   vectorNum, vertexParamOffset,
    408412                   SSTCP_PKT3_BDDDDD);
    409413  {
     
    412416    for(v = 0; v < vectorNum; v++) {
    413417      const float* const vector = vectorList[v];
    414          
     418
    415419      TRI_SETF(vector[GR_VERTEX_X_OFFSET]);
    416420      TRI_SETF(vector[GR_VERTEX_Y_OFFSET]);
     
    422426        if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    423427          FxU32 packedColor = 0x00;
    424          
     428
    425429          if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    426430            packedColor = (RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_B_OFFSET << 2)), B) |
    427431                           RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_G_OFFSET << 2)), G) |
    428432                           RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_R_OFFSET << 2)), R));
    429            
     433
    430434            dataList++;
    431435          }
    432          
     436
    433437          packedColor |= RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_A_OFFSET << 2)), A);
    434438          TRI_SET(packedColor);
     
    438442        dataList++;
    439443#endif /* GLIDE_PACKED_RGB */
    440        
     444
    441445#if GLIDE_FP_CLAMP_TEX
    442446        while(*dataList != 0) {
     
    447451        dataList++;
    448452#endif /* GLIDE_FP_CLAMP_TEX */
    449        
     453
    450454        while(*dataList != 0) {
    451455          TRI_SETF_CLAMP(FARRAY(vector, *dataList));
     
    476480    ooa, dxAB, dxBC, dyAB, dyBC;
    477481  float negateArea = -1.f;
    478  
     482
    479483  GR_BEGIN_NOFIFOCHECK("grAADrawEdgeTriangle",gc->myLevel);
    480484  GDBG_INFO_MORE(gc->myLevel,"()\n");
     
    486490  **  clockwise), we need to change the area of the triangle.  Note
    487491  **  that we know the first two elements are X & Y by looking at the
    488   **  grVertex structure. 
     492  **  grVertex structure.
    489493  */
    490494  if (va[1] < vb[1]) {
     
    544548  dyBC *= ooa;
    545549
    546   GR_SET_EXPECTED_SIZE(((10 + (_GlideRoot.paramCount - 1)) << 2), 
     550  GR_SET_EXPECTED_SIZE(((10 + (_GlideRoot.paramCount - 1)) << 2),
    547551                       10 + (_GlideRoot.paramCount - 1));
    548552
     
    570574
    571575  {
    572     const struct dataList_s* dlp = gc->regDataList; 
     576    const struct dataList_s* dlp = gc->regDataList;
    573577    int i = dlp->i;
    574    
     578
    575579    /* We already put the alpha out, and this is guaranteed to
    576580     * be included in the dataList via convention.
     
    581585      i = dlp->i;
    582586    }
    583    
     587
    584588    dlp++;
    585589    i = dlp->i;
    586    
     590
    587591    while (i != 0) {
    588592      GR_SETF_INDEX(BROADCAST_ID, hw, ((FxU32*)dlp->addr - (FxU32*)hw), FARRAY(fa, i));
     
    590594      i = dlp->i;
    591595    }
    592    
     596
    593597    /* Draw the triangle by writing the area to the triangleCMD register */
    594598    GR_SETF(BROADCAST_ID, hw, FtriangleCMD, area);
     
    604608#define FUCAST( X ) (*(unsigned long*)&(X))
    605609#define FN_NAME "grAADrawLine"
    606 GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) 
     610GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2))
    607611{
    608612    GR_DCL_GC;
    609613    GrVertex *_v1, *_v2;
    610     const FxU32 vertexParamOffset = _GlideRoot.curVertexSize; 
     614    const FxU32 vertexParamOffset = _GlideRoot.curVertexSize;
    611615    const int* datalist;
    612616    float xoff, yoff;
     
    620624
    621625    GR_SET_EXPECTED_SIZE( vertexParamOffset * 6, 1 );
    622     TRI_PACKET_BEGIN( 0, 
     626    TRI_PACKET_BEGIN( 0,
    623627                      gc->cmdTransportInfo.paramMask,
    624                       6, 
    625                       vertexParamOffset, 
     628                      6,
     629                      vertexParamOffset,
    626630                      SSTCP_PKT3_BDDDDD );
    627    
     631
    628632    /* y sort*/
    629633    if (v2->y < v1->y) {
     
    637641#define v2 _v2
    638642    /* compute deltas and absolute deltas */
    639    
     643
    640644    dx  = v2->x - v1->x;
    641645    dy  = v2->y - v1->y;
    642    
     646
    643647    adx = (float)(FUCAST( dx ) & 0x7fffffff);
    644648    ady = (float)(FUCAST( dy ) & 0x7fffffff);
    645    
     649
    646650    if ( adx >= ady ) {
    647651        xoff = 0.0f;
     
    651655        yoff = 0.0f;
    652656    }
    653    
     657
    654658    /*  A---B  Alpha = 0.0
    655         | \ | 
     659        | \ |
    656660        V1-V2  Alpha = 1.0 ( user )
    657         | \ | 
     661        | \ |
    658662        E---F  Alpha = 0.0
    659663*/
    660    
     664
    661665    /* B Vertex */
    662666    TRI_SETF( v2->x + xoff );
     
    690694
    691695    v1->a = alpha;
    692      
     696
    693697      /* V2 Vertex */
    694698    datalist = gc->tsuDataList;
     
    696700    TRI_SETF( v2->x );
    697701    TRI_SETF( v2->y );
    698      
     702
    699703    while( *datalist != 0 ) {
    700704        TRI_SETF(FARRAY(v2, *datalist));
    701705        datalist++;
    702706    }
    703      
     707
    704708    /* V1 Vertex */
    705709    datalist = gc->tsuDataList;
     
    707711    TRI_SETF( v1->x );
    708712    TRI_SETF( v1->y );
    709      
     713
    710714    while( *datalist != 0 ) {
    711715        TRI_SETF(FARRAY(v1, *datalist));
    712716        datalist++;
    713717    }
    714      
     718
    715719    /* F Vertex */
    716720    datalist = gc->tsuDataList;
     
    746750    }
    747751    v1->a = alpha;
    748      
     752
    749753#undef v1
    750754#undef v2
     
    754758#undef FN_NAME
    755759#else /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP */
    756 GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2)) 
     760GR_ENTRY(grAADrawLine, void, (const GrVertex *v1, const GrVertex *v2))
    757761{
    758762  float           dx, dy;           /* delta X and Y */
     
    767771  GrCullMode_t cullSave = gc->state.cull_mode;
    768772  gc->state.cull_mode = GR_CULL_DISABLE;
    769  
     773
    770774  GDBG_INFO(95, "grAADrawLine (%f %f) -> (%f %f)\n",
    771775            v1->x, v1->y, v2->x, v2->y);
     
    777781    const GrVertex* tv = v1; v1 = v2; v2 = tv;
    778782  }
    779  
     783
    780784  /* compute deltas and absolute deltas */
    781785  dx = adx = v2->x - v1->x;
     
    785789  if (ady < 0)
    786790    ady = -ady;
    787  
     791
    788792  a = *v1;
    789793  e = *v1;
     
    870874     * the inner triangle.
    871875     */
    872     GR_DCL_GC;     
     876    GR_DCL_GC;
    873877    const FxU32 cullMode = gc->state.cull_mode;
    874878    const FxU32 sMode = ((cullMode != GR_CULL_DISABLE)
     
    900904
    901905#define DXSQUARED(i,j) ((i->x - j->x) * (i->x - j->x))
    902 #define DYSQUARED(i,j) ((i->y - j->y) * (i->y - j->y)) 
    903  
     906#define DYSQUARED(i,j) ((i->y - j->y) * (i->y - j->y))
     907
    904908/*
    905909**
     
    954958         void,
    955959         (const GrVertex *a, const GrVertex *b, const GrVertex *c,
    956           FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias)) 
     960          FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias))
    957961{
    958962#define FN_NAME "grAADrawTriangle"
     
    970974                         ((gc->cmdTransportInfo.paramMask & (SST_SETUP_A << SSTCP_PKT3_PMASK_SHIFT)) == 0),
    971975                         "Antialiasing require enabling alpha");
    972  
     976
    973977  GR_FLUSH_STATE();
    974978
    975979  fbzModeOld = gc->state.fbi_config.fbzMode;
    976  
     980
    977981  /* backfaced or zero area */
    978982  if (TRISETUP(a, b, c) <= 0) return;
    979    
     983
    980984  /* Disable depth buffer writes for edge triangles */
    981985  fbzMode = fbzModeOld;
     
    990994    grAADrawTriEdge(a, b, sense);
    991995  }
    992  
     996
    993997  if (bc_antialias) {
    994998    sense = aaCalcEdgeSense(b, c, a);
    995999    grAADrawTriEdge(b, c, sense);
    9961000  }
    997  
     1001
    9981002  if (ca_antialias) {
    9991003    sense = aaCalcEdgeSense(c, a, b);
     
    10131017*/
    10141018
    1015 GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 
     1019GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[]))
    10161020{
    10171021#define FN_NAME "grAADrawPolygon"
     
    10511055      sense = aaCalcEdgeSense(c, a, b);
    10521056      grAADrawTriEdge(c, a, sense);
    1053     } 
     1057    }
    10541058
    10551059    sense = aaCalcEdgeSense(b, c, a);
     
    10661070*/
    10671071
    1068 GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 
     1072GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[]))
    10691073{
    10701074#define FN_NAME "grAADrawPolygonVertexList"
     
    11081112      sense = aaCalcEdgeSense(c, a, b);
    11091113      grAADrawTriEdge(c, a, sense);
    1110     } 
     1114    }
    11111115
    11121116    sense = aaCalcEdgeSense(b, c, a);
  • trunk/src/opengl/glide/cvg/glide/gbanner.c

    r2888 r6653  
     1/* $Id: gbanner.c,v 1.2 2001-09-05 14:30:24 bird Exp $ */
    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/cvg/glide/gbanner.c,v 1.1 2000-02-25 00:37:37 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gbanner.c,v 1.2 2001-09-05 14:30:24 bird Exp $
    2122** $Log: gbanner.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:37  sandervl
     23** Revision 1.2  2001-09-05 14:30:24  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:37  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 17    1/05/98 6:06p Atai
    2731 * glide extension stuff
    28  * 
     32 *
    2933 * 16    12/15/97 5:52p Atai
    3034 * disable obsolete glide2 api for glide3
    31  * 
     35 *
    3236 * 15    11/18/97 4:36p Peter
    3337 * make thing more translucent
    34  * 
     38 *
    3539 * 14    9/15/97 7:31p Peter
    3640 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    3741 * place, lfb's are on, Hmmmm.. probably more
    38  * 
     42 *
    3943 * 13    7/26/97 3:04p Peter
    4044 * gratuitous plug is translucent
    41  * 
     45 *
    4246 * 12    7/08/97 2:48p Peter
    4347 * shameless plug just uses lfb routines
    44  * 
     48 *
    4549 * 11    5/27/97 1:16p Peter
    46  * Basic cvg, w/o cmd fifo stuff. 
    47  * 
     50 * Basic cvg, w/o cmd fifo stuff.
     51 *
    4852 * 10    5/21/97 6:05a Peter
    49  * 
     53 *
    5054 * 9     5/02/97 2:08p Pgj
    5155 * screen_width/height now FxU32
    52  * 
     56 *
    5357 * 8     3/16/97 2:24a Jdt
    5458 * Fixed bug.  Didn't initialize info.
    55  * 
     59 *
    5660 * 7     3/12/97 11:51p Jdt
    5761 * Watcom warning.
    58  * 
     62 *
    5963 * 6     3/12/97 4:20p Jdt
    6064 * Fixed for VG96 and optimized SST-1
    61  * 
     65 *
    6266 * 5     2/26/97 11:55a Jdt
    6367 * Updated banner for new lfb api
    64  * 
     68 *
    6569 * 4     12/23/96 1:37p Dow
    6670 * chagnes for multiplatform glide
     
    106110  grClipWindow(0, 0,
    107111               gc->state.screen_width - 1,
    108                gc->state.screen_height - 1); 
     112               gc->state.screen_height - 1);
    109113  grDepthMask(FXFALSE);
    110114  grDepthBufferFunction(GR_CMP_ALWAYS);
    111115  grDepthBufferMode(GR_DEPTHBUFFER_DISABLE);
    112  
     116
    113117#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
    114118  _grChromaRangeExt(0x0000, 0x0000, GR_CHROMARANGE_RGB_ALL);
     
    126130   */
    127131  _grLfbWriteRegion(FXTRUE, GR_BUFFER_BACKBUFFER,
    128                     gc->state.screen_width - (banner_width + 1), 
     132                    gc->state.screen_width - (banner_width + 1),
    129133                    gc->state.screen_height - (banner_height + 1),
    130134                    GR_LFBWRITEMODE_565,
    131135                    banner_width, banner_height,
    132136                    -(banner_width << 1),
    133                     banner_data + (banner_width * (banner_height - 1))); 
     137                    banner_data + (banner_width * (banner_height - 1)));
    134138#else
    135139  {
  • trunk/src/opengl/glide/cvg/glide/gdraw.c

    r2888 r6653  
     1/* $Id: gdraw.c,v 1.2 2001-09-05 14:30:24 bird Exp $ */
    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/cvg/glide/gdraw.c,v 1.1 2000-02-25 00:37:38 sandervl Exp $
     21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gdraw.c,v 1.2 2001-09-05 14:30:24 bird Exp $
    2122 ** $Log: gdraw.c,v $
    22  ** Revision 1.1  2000-02-25 00:37:38  sandervl
     23 ** Revision 1.2  2001-09-05 14:30:24  bird
     24 ** Added $Id:$ keyword.
     25 **
     26 ** Revision 1.1  2000/02/25 00:37:38  sandervl
    2327 ** Created Voodoo 2 dir
    2428 **
    25 ** 
     29**
    2630** 98    6/02/98 8:03p Peter
    2731** Mmmmm.... points
    28 ** 
     32**
    2933** 97    6/01/98 6:44p Peter
    3034** snapped/unsnapped points
    31 ** 
     35**
    3236** 96    5/20/98 3:51p Peter
    3337** no fifo glide
    34 ** 
     38**
    3539** 95    5/18/98 12:14p Peter
    3640** better point code
    37 ** 
     41**
    3842** 94    2/20/98 11:00a Peter
    3943** removed glide3 from glid2 tree
    40 ** 
     44**
    4145** 93    2/11/98 5:23p Peter
    4246** workaround for tombraider rgb > 255.0
    43  * 
     47 *
    4448 * 92    1/15/98 2:46p Atai
    4549 * fixed grDrawPoint and grDrawLine in aa mode
    46  * 
     50 *
    4751 * 90    12/17/97 4:45p Peter
    4852 * groundwork for CrybabyGlide
    49  * 
     53 *
    5054 * 89    12/15/97 5:52p Atai
    5155 * disable obsolete glide2 api for glide3
    52  * 
     56 *
    5357 * 85    12/08/97 12:06p Atai
    5458 * change prototype for grDrawPoint, grDrawLine, grDrawTriangel
    55  * 
     59 *
    5660 * 83    11/21/97 6:05p Atai
    5761 * use one datalist (tsuDataList) in glide3
    58  * 
     62 *
    5963 * 82    11/21/97 3:20p Peter
    6064 * direct writes tsu registers
    61  * 
     65 *
    6266 * 81    11/19/97 4:33p Atai
    6367 * make vSize debug variable
    64  * 
     68 *
    6569 * 80    11/18/97 4:36p Peter
    6670 * chipfield stuff cleanup and w/ direct writes
    67  * 
     71 *
    6872 * 79    11/17/97 4:55p Peter
    6973 * watcom warnings/chipfield stuff
    70  * 
     74 *
    7175 * 78    11/16/97 2:20p Peter
    7276 * cleanup
    73  * 
     77 *
    7478 * 77    11/15/97 7:43p Peter
    7579 * more comdex silliness
    76  * 
     80 *
    7781 **
    7882 */
     
    115119   * can change the rounding mode so that it is difficult to get the
    116120   * correct truncation/ceiling operation w/ a simple adjustment to
    117    * the bias. 
     121   * the bias.
    118122   *
    119123   * NB: The constant kNumMantissaBits defines how many bits of
     
    170174
    171175  /* Packet w/ actual point coordinate and parameter data */
    172   TRI_PACKET_BEGIN(kSetupStrip | kSetupCullDisable, gc->cmdTransportInfo.paramMask, 
     176  TRI_PACKET_BEGIN(kSetupStrip | kSetupCullDisable, gc->cmdTransportInfo.paramMask,
    173177                   1, _GlideRoot.curVertexSize, SSTCP_PKT3_DDDDDD);
    174178  {
    175179    TRI_SET(x);
    176180    TRI_SET(y);
    177            
     181
    178182    /* Vertex parameters */
    179183    {
     
    183187      if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    184188        FxU32 packedColor = 0x00;
    185            
     189
    186190        if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    187           packedColor = (RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_B_OFFSET << 2)), B) | 
     191          packedColor = (RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_B_OFFSET << 2)), B) |
    188192                         RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_G_OFFSET << 2)), G) |
    189193                         RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_R_OFFSET << 2)), R));
    190              
     194
    191195          dataList++;
    192196        }
    193            
     197
    194198        if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    195199          packedColor |= RGBA_COMP_CLAMP(FARRAY(p, (GR_VERTEX_A_OFFSET << 2)), A);
    196200          dataList++;
    197201        }
    198            
     202
    199203        TRI_SET(packedColor);
    200204      }
     
    209213      dataList++;
    210214#endif /* GLIDE_FP_CLAMP_TEX */
    211                
     215
    212216      while(*dataList != 0) {
    213217        TRI_SETF_CLAMP(FARRAY(p, *dataList));
     
    218222  TRI_END;
    219223  GR_CHECK_SIZE();
    220      
     224
    221225  _GlideRoot.stats.pointsDrawn++;
    222226#else /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP) */
    223   /* GMT: gross overestimate of fifo requirements */   
     227  /* GMT: gross overestimate of fifo requirements */
    224228  GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize, _GlideRoot.curTriSize >> 2);
    225229  {
    226230    const struct dataList_s* dlp = gc->regDataList;
    227231    int i;
    228          
     232
    229233#ifdef GLIDE_USE_ALT_REGMAP
    230234    hw = SST_WRAP(hw,128);                /* use alternate register mapping */
    231235#endif
    232          
     236
    233237    GR_SET(BROADCAST_ID, hw, FvA.x, x);
    234238    GR_SET(BROADCAST_ID, hw, FvA.y, y);
    235      
     239
    236240    x += (0x01UL << (22UL - kNumMantissaBits));
    237241    GR_SET(BROADCAST_ID, hw, FvB.x, x);
     
    244248    i = _GlideRoot.stats.pointsDrawn++;
    245249    _GlideRoot.stats.pointsDrawn = ++i;
    246      
     250
    247251    dlp = gc->regDataList;
    248     i = dlp->i;     
    249          
     252    i = dlp->i;
     253
    250254    /* we don't care what the slopes are because the pixel center that is drawn */
    251255    /* is exactly at vertex A - isn't that wonderful */
     
    260264  GR_CHECK_SIZE();
    261265#endif /* !(GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP) */
    262    
     266
    263267  GR_END();
    264268#undef FN_NAME
     
    298302
    299303  GR_BEGIN_NOFIFOCHECK("grDrawLine", 91);
    300   GDBG_INFO_MORE(gc->myLevel, "A: (%f %f) B: (%f %f)\n", 
     304  GDBG_INFO_MORE(gc->myLevel, "A: (%f %f) B: (%f %f)\n",
    301305                 a->x, a->y, b->x, b->y);
    302306
     
    320324    j ^= 0x80000000;            /* adx = -adx; */
    321325  }
    322  
     326
    323327  /* check for zero-length lines */
    324328  if ((j >= i) && (j == 0)) goto all_done;
     
    330334    const float* const fa = (float*)a;
    331335    const float* const fb = (float*)b;
    332    
     336
    333337    /* Draw the triangle pair as a strip of 4 vertices.
    334338     * We can skip all of the gradient calculation stuff.
     
    356360          if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    357361            FxU32 packedColor = 0x00;
    358            
     362
    359363            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    360               packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) | 
     364              packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) |
    361365                             RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_G_OFFSET << 2)), G) |
    362366                             RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_R_OFFSET << 2)), R));
    363              
    364               dataList++;
    365             }
    366            
     367
     368              dataList++;
     369            }
     370
    367371            if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    368372              packedColor |= RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_A_OFFSET << 2)), A);
    369373              dataList++;
    370374            }
    371            
     375
    372376            TRI_SET(packedColor);
    373377          }
     
    375379
    376380#if GLIDE_FP_CLAMP_TEX
    377             while(*dataList != 0) {       
     381            while(*dataList != 0) {
    378382              TRI_SETF(FARRAY(fb, *dataList));
    379383              dataList++;
    380384            }
    381            
     385
    382386            dataList++;
    383387#endif /* GLIDE_FP_CLAMP_TEX */
    384          
     388
    385389            while(*dataList != 0) {
    386390              TRI_SETF_CLAMP(FARRAY(fb, *dataList));
     
    398402          if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    399403            FxU32 packedColor = 0x00;
    400            
     404
    401405            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    402               packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) | 
     406              packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) |
    403407                             RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_G_OFFSET << 2)), G) |
    404408                             RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_R_OFFSET << 2)), R));
    405              
    406               dataList++;
    407             }
    408            
     409
     410              dataList++;
     411            }
     412
    409413            if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    410414              packedColor |= RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_A_OFFSET << 2)), A);
    411415              dataList++;
    412416            }
    413            
     417
    414418            TRI_SET(packedColor);
    415419          }
     
    417421
    418422#if GLIDE_FP_CLAMP_TEX
    419             while(*dataList != 0) {       
     423            while(*dataList != 0) {
    420424              TRI_SETF(FARRAY(fa, *dataList));
    421425              dataList++;
     
    424428            dataList++;
    425429#endif /* GLIDE_FP_CLAMP_TEX */
    426          
     430
    427431            while (*dataList != 0) {
    428432              TRI_SETF_CLAMP(FARRAY(fa, *dataList));
     
    431435          }
    432436
    433           fBias *= -1.0f;       
     437          fBias *= -1.0f;
    434438        }
    435439      } else { /* y major */
     
    444448          if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    445449            FxU32 packedColor = 0x00;
    446            
     450
    447451            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    448               packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) | 
     452              packedColor = (RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_B_OFFSET << 2)), B) |
    449453                             RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_G_OFFSET << 2)), G) |
    450454                             RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_R_OFFSET << 2)), R));
    451              
    452               dataList++;
    453             }
    454            
     455
     456              dataList++;
     457            }
     458
    455459            if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    456460              packedColor |= RGBA_COMP_CLAMP(FARRAY(fb, (GR_VERTEX_A_OFFSET << 2)), A);
    457461              dataList++;
    458462            }
    459            
     463
    460464            TRI_SET(packedColor);
    461465          }
     
    463467
    464468#if GLIDE_FP_CLAMP_TEX
    465             while(*dataList != 0) {       
     469            while(*dataList != 0) {
    466470              TRI_SETF(FARRAY(fb, *dataList));
    467471              dataList++;
     
    470474            dataList++;
    471475#endif /* GLIDE_FP_CLAMP_TEX */
    472          
     476
    473477            while (*dataList != 0) {
    474478              TRI_SETF_CLAMP(FARRAY(fb, *dataList));
     
    476480            }
    477481          }
    478        
     482
    479483          TRI_SETF(fa[GR_VERTEX_X_OFFSET] + fBias);
    480484          TRI_SETF(fa[GR_VERTEX_Y_OFFSET]);
     
    486490          if ((gc->cmdTransportInfo.paramMask & SSTCP_PKT3_PACKEDCOLOR) != 0) {
    487491            FxU32 packedColor = 0x00;
    488            
     492
    489493            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    490               packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) | 
     494              packedColor = (RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_B_OFFSET << 2)), B) |
    491495                             RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_G_OFFSET << 2)), G) |
    492496                             RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_R_OFFSET << 2)), R));
    493              
    494               dataList++;
    495             }
    496            
     497
     498              dataList++;
     499            }
     500
    497501            if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    498502              packedColor |= RGBA_COMP_CLAMP(FARRAY(fa, (GR_VERTEX_A_OFFSET << 2)), A);
    499503              dataList++;
    500504            }
    501            
     505
    502506            TRI_SET(packedColor);
    503507          }
     
    505509
    506510#if GLIDE_FP_CLAMP_TEX
    507             while(*dataList != 0) {       
     511            while(*dataList != 0) {
    508512              TRI_SETF(FARRAY(fa, *dataList));
    509513              dataList++;
     
    512516            dataList++;
    513517#endif /* GLIDE_FP_CLAMP_TEX */
    514          
     518
    515519            while (*dataList != 0) {
    516520              TRI_SETF_CLAMP(FARRAY(fa, *dataList));
     
    518522            }
    519523          }
    520        
     524
    521525          fBias *= -1.0f;
    522526        }
     
    531535#endif
    532536
    533   GR_SET_EXPECTED_SIZE(12 + _GlideRoot.curTriSize, (_GlideRoot.curTriSize + 12) >> 2); 
     537  GR_SET_EXPECTED_SIZE(12 + _GlideRoot.curTriSize, (_GlideRoot.curTriSize + 12) >> 2);
    534538  {
    535539    float    m, dp;
     
    548552      GR_SETF(BROADCAST_ID, hw, FvB.x, dp);
    549553      GR_SETF(BROADCAST_ID, hw, FvC.x, dp);
    550      
     554
    551555      GR_SETF(BROADCAST_ID, hw, FvA.y, a->y - _GlideRoot.pool.fHalf);
    552556
     
    559563      while (i) {
    560564        dp = FARRAY(a,i);
    561         GR_SETF_INDEX(BROADCAST_ID, hw, 
     565        GR_SETF_INDEX(BROADCAST_ID, hw,
    562566                      ((FxU32*)dlp->addr - (FxU32*)hw), dp);
    563567
    564568        dp = FARRAY(b,i) - dp;
    565         GR_SETF_INDEX(BROADCAST_ID, hw, 
     569        GR_SETF_INDEX(BROADCAST_ID, hw,
    566570                      ((FxU32*)&dlp->addr[DPDX_OFFSET >> 2] - (FxU32*)hw), dp * m);
    567571
    568572        dlp++;
    569573        i = dlp->i;
    570         GR_SETF_INDEX(BROADCAST_ID, hw, 
     574        GR_SETF_INDEX(BROADCAST_ID, hw,
    571575                      ((FxU32*)&dlp->addr[DPDY_OFFSET >> 2] - (FxU32*)hw), _GlideRoot.pool.f0);
    572576      }
     
    588592      GR_SETF(BROADCAST_ID, hw, FvB.y,dp);
    589593      GR_SETF(BROADCAST_ID, hw, FvC.y,dp);
    590      
     594
    591595      GR_SETF(BROADCAST_ID, hw, FvA.x,a->x - _GlideRoot.pool.fHalf);
    592596
     
    596600      i = dlp->i;
    597601      GR_SETF(BROADCAST_ID, hw, FvC.x,dp + _GlideRoot.pool.fHalf);
    598        
     602
    599603      while (i) {
    600604        dp = FARRAY(a,i);
     
    607611        dlp++;
    608612        i = dlp->i;
    609         GR_SETF_INDEX(BROADCAST_ID, hw, 
     613        GR_SETF_INDEX(BROADCAST_ID, hw,
    610614                      ((FxU32*)&dlp->addr[DPDY_OFFSET >> 2] - (FxU32*)hw), dp * m);
    611615      }
    612616      GR_SET(BROADCAST_ID, hw, triangleCMD, 0xFFFFFFFF);
    613      
     617
    614618      GR_SETF(BROADCAST_ID, hw, FvB.x, a->x + _GlideRoot.pool.fHalf);
    615619      GR_SETF(BROADCAST_ID, hw, FvB.y, a->y);
     
    657661#endif /* GLIDE_DEBUG */
    658662
    659   /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 
     663  /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */
    660664#if GLIDE_DEBUG && !GLIDE_USE_C_TRISETUP
    661665  /* HackAlert: Nuke the fifo ptr checking stuff here if we're just
     
    688692  asm( "popl %%ebp" : /* no outputs*/ : /* no inputs */ : "ebp");
    689693#endif
    690   asm( "jmp %0" 
    691        : /* no outputs */ 
     694  asm( "jmp %0"
     695       : /* no outputs */
    692696       : "m" (_GlideRoot.curGC->cmdTransportInfo.triSetupProc)
    693697       );
     
    747751  GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x)\n",nVerts,vList);
    748752  GR_CHECK_F(myName, !vList, "NULL pointer passed");
    749    
     753
    750754  GR_FLUSH_STATE();
    751755
     
    756760    int n,i = nVerts-2;
    757761    const GrVertex *firstv = &vList[0];
    758      
     762
    759763    for (i = 1; i < nVerts - 1; i++) {
    760764      n = TRISETUP(firstv, &vList[i], &vList[i+1]);
     
    767771      _trisetup_nogradients(firstv, &vList[i], &vList[i+1]);
    768772    }
    769      
     773
    770774all_done:
    771775    ;
     
    780784
    781785/* Packet 3 requires at least one vertex, if there isn't enough room
    782  * in the fifo then force a wrap now and write up to the max. 
     786 * in the fifo then force a wrap now and write up to the max.
    783787 */
    784788#define FIFO_VERT(__vertSize, __polyVerts) \
     
    809813   */
    810814  if (nVerts <= 0) goto __exitNoVerts;
    811    
     815
    812816#if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP
    813817  {
     
    832836      for(vertexOffset = 0; vertexOffset < packSize; vertexOffset += vertexParamOffset) {
    833837        const float* vertex = (const float*)(vList + *vertexIndexP++);
    834        
     838
    835839        TRI_SETF(vertex[GR_VERTEX_X_OFFSET]);
    836840        TRI_SETF(vertex[GR_VERTEX_Y_OFFSET]);
     
    843847            FxBool doColorP = FXFALSE;
    844848            FxU32 packedColor = 0x00;
    845          
     849
    846850            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    847               packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | 
     851              packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) |
    848852                             RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_G_OFFSET << 2)), G) |
    849853                             RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_R_OFFSET << 2)), R));
     
    851855              dataList++;
    852856            }
    853            
     857
    854858            if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    855859              packedColor |= RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_A_OFFSET << 2)), A);
     
    857861              dataList++;
    858862            }
    859            
     863
    860864            if (doColorP) TRI_SET(packedColor);
    861865          }
     
    863867
    864868#if GLIDE_FP_CLAMP_TEX
    865           while(*dataList != 0) {       
     869          while(*dataList != 0) {
    866870            TRI_SETF(FARRAY(vertex, *dataList));
    867871            dataList++;
     
    870874          dataList++;
    871875#endif /* GLIDE_FP_CLAMP_TEX */
    872          
     876
    873877          while (*dataList != 0) {
    874878            TRI_SETF_CLAMP(FARRAY(vertex, *dataList));
     
    893897
    894898      packType = SSTCP_PKT3_DDDDDD;
    895          
     899
    896900      GDBG_INFO(120, "\tSending continueing polygon data (0x%X : 0x%X)\n", nVerts, packVerts);
    897        
     901
    898902      goto __doPolyVertexSend;
    899903    }
     
    932936   */
    933937  if (nVerts <= 0) goto __exitNoVerts;
    934    
     938
    935939#if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP
    936940  {
     
    948952      const FxU32 packSize = packVerts * vertexParamOffset;
    949953      FxU32 vertexOffset;
    950      
     954
    951955      GR_SET_EXPECTED_SIZE(packSize, 1);
    952956      TRI_STRIP_BEGIN(kSetupFan, packVerts, vertexParamOffset, packType);
     
    954958      for(vertexOffset = 0; vertexOffset < packSize; vertexOffset += vertexParamOffset) {
    955959        const float* vertex = (const float*)vertexListP++;
    956        
     960
    957961        TRI_SETF(vertex[GR_VERTEX_X_OFFSET]);
    958962        TRI_SETF(vertex[GR_VERTEX_Y_OFFSET]);
     
    977981            FxBool doColorP = FXFALSE;
    978982            FxU32 packedColor = 0x00;
    979          
     983
    980984            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    981               packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) | 
     985              packedColor = (RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_B_OFFSET << 2)), B) |
    982986                             RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_G_OFFSET << 2)), G) |
    983987                             RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_R_OFFSET << 2)), R));
     
    985989              dataList++;
    986990            }
    987            
     991
    988992            if (*dataList == (GR_VERTEX_A_OFFSET << 2)) {
    989993              packedColor |= RGBA_COMP_CLAMP(FARRAY(vertex, (GR_VERTEX_A_OFFSET << 2)), A);
     
    991995              dataList++;
    992996            }
    993            
     997
    994998            if (doColorP) TRI_SET(packedColor);
    995999          }
     
    10041008          dataList++;
    10051009#endif /* GLIDE_FP_CLAMP_TEX */
    1006          
     1010
    10071011          while (*dataList != 0) {
    10081012            TRI_SETF_CLAMP(FARRAY(vertex, *dataList));
     
    10261030      /* Packet type to continue strip */
    10271031      packType = SSTCP_PKT3_DDDDDD;
    1028          
     1032
    10291033      GDBG_INFO(120, "\tSending continueing polygon data (0x%X : 0x%X)\n", packVerts, nVerts);
    1030        
     1034
    10311035      goto __doPolyVertexSend;
    10321036    }
     
    10351039  {
    10361040    int i;
    1037    
     1041
    10381042    for (i = 1; i < nVerts - 1; i++) {
    10391043      grDrawTriangle(&vList[0], &vList[i], &vList[i+1]);
     
    10741078      GR_SET(BROADCAST_ID, hw, dbdx, 0);
    10751079      GR_SET(BROADCAST_ID, hw, dbdy, 0);
    1076     } 
     1080    }
    10771081    GR_CHECK_SIZE();
    10781082  }
  • trunk/src/opengl/glide/cvg/glide/gerror.c

    r2888 r6653  
     1/* $Id: gerror.c,v 1.2 2001-09-05 14:30:25 bird Exp $ */
    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/cvg/glide/gerror.c,v 1.1 2000-02-25 00:37:39 sandervl Exp $
     22** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gerror.c,v 1.2 2001-09-05 14:30:25 bird Exp $
    2223** $Log: gerror.c,v $
    23 ** Revision 1.1  2000-02-25 00:37:39  sandervl
     24** Revision 1.2  2001-09-05 14:30:25  bird
     25** Added $Id:$ keyword.
     26**
     27** Revision 1.1  2000/02/25 00:37:39  sandervl
    2428** Created Voodoo 2 dir
    2529**
    26 ** 
     30**
    2731** 28    3/14/98 1:07p Peter
    2832** mac port happiness
    29 ** 
     33**
    3034** 27    2/11/98 5:23p Peter
    3135** no more infinite recursion
    32  * 
     36 *
    3337 * 26    12/18/97 2:13p Peter
    3438 * cleaned up the error code
    35  * 
     39 *
    3640 * 25    12/09/97 12:20p Peter
    3741 * mac glide port
    38  * 
     42 *
    3943 * 24    12/05/97 4:38p Peter
    4044 * sli vs assertions
    41  * 
     45 *
    4246 * 23    12/03/97 11:34a Peter
    4347 * dos debugging
    44  * 
     48 *
    4549 * 22    11/17/97 4:55p Peter
    4650 * watcom warnings/chipfield stuff
    47  * 
     51 *
    4852 * 21    11/15/97 8:55p Peter
    4953 * Removed OutputDebugString
    50  * 
     54 *
    5155 * 20    11/15/97 7:43p Peter
    5256 * more comdex silliness
    53  * 
     57 *
    5458 * 19    11/12/97 2:27p Peter
    55  * 
     59 *
    5660 * 18    11/12/97 11:16a Peter
    5761 * cleaned up assertions
    58  * 
     62 *
    5963 * 17    11/04/97 5:04p Peter
    6064 * cataclysm part deux
    61  * 
     65 *
    6266 * 16    11/03/97 4:02p Peter
    6367 * cataclysm fix
    64  * 
     68 *
    6569 * 15    11/03/97 3:43p Peter
    6670 * h3/cvg cataclysm
    67  * 
     71 *
    6872 * 14    10/23/97 5:28p Peter
    6973 * sli fifo thing
    70  * 
     74 *
    7175 * 13    9/24/97 1:29p Peter
    7276 * more assertion spewage
    73  * 
     77 *
    7478 * 12    9/05/97 5:29p Peter
    7579 * changes for direct hw
    76  * 
     80 *
    7781 * 11    5/30/97 5:44p Peter
    7882 * Version that does basic triangles/registers w/ command fifo. Does not
    7983 * currently download textures correctly.
    80  * 
     84 *
    8185 * 10    5/28/97 9:05a Peter
    8286 * Merge w/ latest glide changes
    83  * 
     87 *
    8488 * 9     5/27/97 1:16p Peter
    85  * Basic cvg, w/o cmd fifo stuff. 
    86  * 
     89 * Basic cvg, w/o cmd fifo stuff.
     90 *
    8791 * 8     5/21/97 6:05a Peter
    88  * 
     92 *
    8993 * 7     5/20/97 9:47a Pgj
    9094 * Use OutputDebugString for non-fatal errors under windows
    91  * 
     95 *
    9296 * 6     5/19/97 7:35p Pgj
    9397 * Print cogent error message if h/w not found
    94  * 
     98 *
    9599 * 5     3/09/97 10:31a Dow
    96100 * Added GR_DIENTRY for di glide functions
    97  * 
     101 *
    98102 * 4     12/23/96 1:37p Dow
    99103 * chagnes for multiplatform glide
     
    171175
    172176#if (GLIDE_PLATFORM & GLIDE_OS_MACOS)
    173                 {
    174                         Str255 errBuf;
    175                        
    176                         errBuf[0] = sprintf((char*)(errBuf + 1), "%s", s);
    177                         DebugStr(errBuf);
    178                 }
     177        {
     178            Str255 errBuf;
     179
     180            errBuf[0] = sprintf((char*)(errBuf + 1), "%s", s);
     181            DebugStr(errBuf);
     182        }
    179183#endif /* (GLIDE_PLATFORM * GLIDE_OS_MACOS) */
    180184  }
     
    223227#if (GLIDE_PLATFORM & GLIDE_HW_CVG) && USE_PACKET_FIFO
    224228  /* Spew about the state of the fifo since that's what most of the
    225    * assertions are about anyway. 
     229   * assertions are about anyway.
    226230   */
    227   {   
     231  {
    228232    gdbg_printf("Command Fifo:\n");
    229233    gdbg_printf("\tfifoPtr:    0x%X\n"
     
    234238                gc->cmdTransportInfo.fifoPtr,
    235239                gc->cmdTransportInfo.fifoStart, gc->cmdTransportInfo.fifoEnd,
    236                 gc->cmdTransportInfo.fifoSize, 
    237                 gc->cmdTransportInfo.fifoRoom, 
     240                gc->cmdTransportInfo.fifoSize,
     241                gc->cmdTransportInfo.fifoRoom,
    238242                gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
    239                 HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead, 
     243                HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead,
    240244                GR_GET(hw->cmdFifoDepth), GR_GET(hw->cmdFifoHoles), GR_GET(hw->cmdFifoBase),
    241245                GR_GET(hw->status));
     
    244248    if (gc->scanline_interleaved) {
    245249      SstRegs* slaveHw = (SstRegs*)gc->slave_ptr;
    246      
     250
    247251      GDBG_INFO_MORE(gc->myLevel, "\tsli: 0x%X : (0x%X : 0x%X : 0x%X)\n",
    248                      HW_FIFO_PTR(FXFALSE), 
    249                      GR_GET(slaveHw->cmdFifoDepth), 
    250                      GR_GET(slaveHw->cmdFifoHoles), 
     252                     HW_FIFO_PTR(FXFALSE),
     253                     GR_GET(slaveHw->cmdFifoDepth),
     254                     GR_GET(slaveHw->cmdFifoHoles),
    251255                     GR_GET(slaveHw->status));
    252256    }
     
    264268
    265269      GDBG_PRINTF("Up to fifo wrap: \n");
    266       while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2)) 
     270      while(fifoPtr < gc->cmdTransportInfo.fifoShadowBase + (kDebugFifoSize >> 2))
    267271        GDBG_PRINTF("0x%X\n", *fifoPtr++);
    268272#endif
  • trunk/src/opengl/glide/cvg/glide/gglide.c

    r2888 r6653  
     1/* $Id: gglide.c,v 1.2 2001-09-05 14:30:25 bird Exp $ */
    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/cvg/glide/gglide.c,v 1.1 2000-02-25 00:37:39 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gglide.c,v 1.2 2001-09-05 14:30:25 bird Exp $
    2122** $Log: gglide.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:39  sandervl
     23** Revision 1.2  2001-09-05 14:30:25  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:39  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 168   7/02/98 6:59p Peter
    2731** Fixed merge problem from previous checkin
    28 ** 
     32**
    2933** 167   6/30/98 6:08p Jeske
    3034** fixed bug where we tried to setup MTRRs on old (<p6) systems which
    31 ** didn't have them. 
    32 ** 
     35** didn't have them.
     36**
    3337** 165   6/11/98 3:59p Peter
    3438** sli buffer swap needs to be max of app setting vs forcing sync
    35 ** 
     39**
    3640** 164   6/03/98 6:31p Peter
    3741** clearing single scanlines
    38 ** 
     42**
    3943** 163   5/28/98 2:52p Peter
    4044** fixed wrong checking w/ h3
    41 ** 
     45**
    4246** 162   5/27/98 9:41a Peter
    4347** grBufferClear is constrained by clipping
    44 ** 
     48**
    4549** 161   5/18/98 12:16p Peter
    4650** culling enabling
    47 ** 
     51**
    4852** 160   4/16/98 3:54p Peter
    4953** 1x1 lod fix, sorry John
    50 ** 
     54**
    5155** 159   4/08/98 3:52p Peter
    5256** fixed resetting of unused tmu to small lod
    53 ** 
     57**
    5458** 158   4/01/98 1:51p Peter
    5559** fixed resetting unused tmu muckage/sli origin thing vs grRenderBuffer
    56 ** 
     60**
    5761** 157   3/31/98 6:09p Peter
    5862** sli origin everywhere (I think) and grLfbReadRegion/grRenderBuffer vs
    5963** triple buffering
    60 ** 
     64**
    6165** 156   3/30/98 4:56p Peter
    6266** fog table monotonicity
    63 ** 
     67**
    6468** 155   3/29/98 1:07p Peter
    6569** removed shutdown cruft and yet another sli origin thing
    66 ** 
     70**
    6771** 154   3/23/98 4:21p Jdt
    6872** Fixed texture state validation bug in grColorCombine
    69 ** 
     73**
    7074** 153   3/20/98 11:02a Peter
    7175** inactive tmu reset
    72 ** 
     76**
    7377** 152   3/04/98 9:10p Peter
    7478** properly restore fbzMode for the sli swapping thing
    75 ** 
     79**
    7680** 151   3/03/98 9:37p Peter
    7781** more sli origin fun
    78 ** 
     82**
    7983** 150   3/02/98 7:22p Peter
    8084** more crybaby stuff
    81 ** 
     85**
    8286** 149   2/21/98 8:33a Peter
    8387** mixed case ini vars
    84 ** 
     88**
    8589** 148   2/20/98 5:31p Peter
    8690** crybaby glide
    87 ** 
     91**
    8892** 147   2/20/98 2:16p Peter
    8993** shutting down hw should clear hwInit and open
    90 ** 
     94**
    9195** 146   2/20/98 11:00a Peter
    9296** removed glide3 from glid2 tree
    93 ** 
     97**
    9498** 145   2/20/98 9:05a Peter
    9599** removed remnants of comdex grot
    96 ** 
     100**
    97101** 144   2/17/98 12:40p Peter
    98102** fog table fix
    99 ** 
     103**
    100104** 143   2/12/98 3:40p Peter
    101105** single buffering for opengl
    102 ** 
     106**
    103107** 142   2/11/98 5:23p Peter
    104108** fixed grRenderBuffer vs blit clear
    105 ** 
     109**
    106110** 141   1/30/98 4:19p Peter
    107111** sli/y-origin blit clear
    108 ** 
     112**
    109113** 140   1/23/98 3:02p Peter
    110114** uswc nightmare
    111 ** 
     115**
    112116** 139   1/19/98 1:43p Atai
    113117** fixed non-debug mode assignement
    114 ** 
     118**
    115119** 138   1/19/98 11:00a Atai
    116120** remove assignment before validate the state
    117  * 
     121 *
    118122 * 137   1/15/98 1:12p Peter
    119123 * only one culler please
    120  * 
     124 *
    121125 * 136   1/13/98 7:48p Atai
    122126 * fixed gu3dfGetInfo, grBufferClear, and GrState size
    123  * 
     127 *
    124128 * 135   1/13/98 12:42p Atai
    125129 * fixed grtexinfo, grVertexLayout, and draw triangle
    126  * 
     130 *
    127131 * 134   1/09/98 7:29p Atai
    128132 * fixed grBufferSwap for glide3
    129  * 
     133 *
    130134 * 133   1/08/98 9:25p Peter
    131135 * infinite recurrsion in debugging assert
    132  * 
     136 *
    133137 * 132   1/08/98 9:23p Peter
    134138 * fixed macro muckage
    135  * 
     139 *
    136140 * 131   1/08/98 7:09p Peter
    137141 * real hw stuff modulo makefile change
    138  * 
     142 *
    139143**
    140144*/
     
    156160#if GLIDE_HW_TRI_SETUP
    157161static void
    158 _grUpdateTriPacketHdr(FxU32 paramMask, 
     162_grUpdateTriPacketHdr(FxU32 paramMask,
    159163                      const GrCullMode_t mode);
    160164#endif /* GLIDE_HW_TRI_SETUP */
     
    167171*/
    168172
    169 GR_STATE_ENTRY(grAlphaBlendFunction, void, 
    170                (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, 
     173GR_STATE_ENTRY(grAlphaBlendFunction, void,
     174               (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df,
    171175                GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df))
    172176{
     
    196200  else
    197201    alphamode |=  SST_ENALPHABLEND;
    198  
     202
    199203  alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT);
    200  
     204
    201205  alphamode |= ((((FxU32) rgb_sf) << SST_RGBSRCFACT_SHIFT) |
    202206                (((FxU32) rgb_df) << SST_RGBDSTFACT_SHIFT) |
     
    216220*/
    217221
    218 GR_STATE_ENTRY(grAlphaCombine, void, 
    219                (GrCombineFunction_t function, GrCombineFactor_t factor, 
     222GR_STATE_ENTRY(grAlphaCombine, void,
     223               (GrCombineFunction_t function, GrCombineFactor_t factor,
    220224                GrCombineLocal_t local, GrCombineOther_t other, FxBool invert))
    221225{
     
    255259                    SST_CCA_ADD_ALOCAL |
    256260                    SST_CCA_INVERT_OUTPUT);
    257  
     261
    258262  /* setup reverse blending first, then strip off the the high bit */
    259263  if ((factor & 0x8) == 0)
     
    266270  gc->state.ac_requires_it_alpha = ((local == GR_COMBINE_LOCAL_ITERATED) |
    267271                                    (other == GR_COMBINE_OTHER_ITERATED));
    268  
     272
    269273  /* setup scale factor bits */
    270274  fbzColorPath |= factor << SST_CCA_MSELECT_SHIFT;
     
    272276  /* setup local color bits */
    273277  fbzColorPath |= local << SST_ALOCALSELECT_SHIFT;
    274  
     278
    275279  /* setup other color bits */
    276280  fbzColorPath |= other << SST_ASELECT_SHIFT;
    277  
    278  
     281
     282
    279283  /* setup invert output bits */
    280284  if (invert)
    281285    fbzColorPath |= SST_CCA_INVERT_OUTPUT;
    282  
     286
    283287  /* setup core color combine unit bits */
    284288  switch (function) {
     
    286290    fbzColorPath |= SST_CCA_ZERO_OTHER;
    287291    break;
    288    
     292
    289293  case GR_COMBINE_FUNCTION_LOCAL:
    290294  case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
    291295    fbzColorPath |= SST_CCA_ZERO_OTHER | SST_CCA_ADD_ALOCAL;
    292296    break;
    293    
     297
    294298  case GR_COMBINE_FUNCTION_SCALE_OTHER:
    295299    break;
    296    
     300
    297301  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
    298302  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
    299303    fbzColorPath |= SST_CCA_ADD_ALOCAL;
    300304    break;
    301    
     305
    302306  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
    303307    fbzColorPath |= SST_CCA_SUB_CLOCAL;
    304308    break;
    305    
     309
    306310  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
    307311  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
    308312    fbzColorPath |= SST_CCA_SUB_CLOCAL | SST_CCA_ADD_ALOCAL;
    309313    break;
    310    
     314
    311315  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
    312316  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
     
    339343/*---------------------------------------------------------------------------
    340344** grAlphaControlsITRGBLighting
    341 ** 
     345**
    342346** Determines whether the LSB of alpha controls what lighting is used--
    343347** Specifically whether grConstantColorValu or the interated RGB values are used
    344348** during TEXTURE_TIMES_itrgb & TEXTURE_TIMES_ITRGB_DELTA0 color combine modes.
    345349**
    346 */ 
     350*/
    347351
    348352GR_STATE_ENTRY(grAlphaControlsITRGBLighting, void, (FxBool enable))
     
    463467     * then we can use the sgram fill rect to clear the page aligned
    464468     * region, and then use the fastFillCmd to clear the remainder.
    465      * 
     469     *
    466470     * NB: The test really does check against (clipLeft == 0) &&
    467471     * (clipright == screenWidth) since screenWidth should have 0
     
    501505
    502506      /* If they're both in the same tile then just clear using a
    503        * fastFillCmd 
     507       * fastFillCmd
    504508       */
    505509      if (tileHi <= tileLow) goto __skipBlitClear;
    506510
    507511      /* Column size is always a full page size divided by the #
    508        * of points in a tile row (2 tiles). 
     512       * of points in a tile row (2 tiles).
    509513       *
    510514       * NB: This set is 'lifted' out of the groupings below because
     
    513517      {
    514518        GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
    515         GR_SET(BROADCAST_ID, hw, bltSize, 
     519        GR_SET(BROADCAST_ID, hw, bltSize,
    516520               (((((tileHi - tileLow) * gc->hwDep.cvgDep.xTilePages) - 1) << 16) | (0x1000 >> 3) - 1));
    517521        GR_CHECK_SIZE();
     
    525529        {
    526530          /* Starting point of the blit. We always do a full page in x. */
    527           REG_GROUP_SET(hw, bltDstXY, 
     531          REG_GROUP_SET(hw, bltDstXY,
    528532                        (((tileBuffer + (tileLow * gc->hwDep.cvgDep.xTilePages)) << 16) | 0x00UL));
    529533
     
    545549      if (doAuxP) {
    546550        const FxU32 tileBuffer = (gc->hwDep.cvgDep.numBufferPages * gc->state.num_buffers);
    547            
     551
    548552        REG_GROUP_BEGIN(BROADCAST_ID, bltDstXY, 3, 0x29);
    549553        {
     
    560564      /* Did we round off crap to page align the top part of
    561565       * clipping? If so then reset the hw clipping and use
    562        * the normal fastFillCmd on this region. 
     566       * the normal fastFillCmd on this region.
    563567       */
    564568      didClipP = ((tileLow << yTileShift) > clipLow);
     
    572576        REG_GROUP_END();
    573577
    574         REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 
     578        REG_GROUP_BEGIN(BROADCAST_ID, fbzMode,
    575579                        2 + bottomOriginP, (bottomOriginP | 0x28UL));
    576580        {
     
    583587          REG_GROUP_SET(hw, clipBottomTop, ((clipLow << SST_CLIPBOTTOM_SHIFT) |
    584588                                            MIN(((tileLow << yTileShift) << SST_CLIPTOP_SHIFT), clipHi)));
    585          
     589
    586590          /* Execute the FASTFILL command */
    587591          REG_GROUP_SET(hw, fastfillCMD, 1);
    588592        }
    589593        REG_GROUP_END();
    590       }       
    591          
     594      }
     595
    592596      /* If we're done then we have to restore the color registers.
    593597       * Otherwise, leave them set for the next fastFillCmd, and
     
    621625         * time sending them again, and always set the clip flag.
    622626         */
    623         doColorP = 
     627        doColorP =
    624628        doAuxP   = FXFALSE;
    625629        didClipP = FXTRUE;
     
    627631    }
    628632#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR */
    629    
     633
    630634    if (!doneP) {
    631635      REG_GROUP_BEGIN(BROADCAST_ID, zaColor, 2, 0x41);
     
    635639      }
    636640      REG_GROUP_END();
    637      
     641
    638642      REG_GROUP_BEGIN(BROADCAST_ID, fastfillCMD, 3, 0x209);
    639643      {
    640644        /* Execute the FASTFILL command */
    641645        REG_GROUP_SET(hw, fastfillCMD, 1);
    642        
     646
    643647        /* Restore C1 and ZACOLOR */
    644648        REG_GROUP_SET(hw, zaColor, oldzacolor);
     
    651655    /* Restore clipping */
    652656    if (didClipP) {
    653       REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 
     657      REG_GROUP_BEGIN(BROADCAST_ID, fbzMode,
    654658                      bottomOriginP + 1, (bottomOriginP | 0x8UL));
    655659      {
     
    694698  }
    695699  REG_GROUP_END();
    696  
     700
    697701  /* Do the clear */
    698702  REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 2, 0x21UL);
    699703  {
    700     REG_GROUP_SET(hw, fbzMode, 
    701                   ((gc->state.fbi_config.fbzMode & ~SST_YORIGIN) | 
     704    REG_GROUP_SET(hw, fbzMode,
     705                  ((gc->state.fbi_config.fbzMode & ~SST_YORIGIN) |
    702706                   (~gc->state.fbi_config.fbzMode & SST_YORIGIN) |
    703707                   SST_RGBWRMASK));
     
    708712  REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 2, 0x21UL);
    709713  {
    710     REG_GROUP_SET(hw, fbzMode, 
     714    REG_GROUP_SET(hw, fbzMode,
    711715                  (gc->state.fbi_config.fbzMode | SST_RGBWRMASK));
    712716    REG_GROUP_SET(hw, fastfillCMD, 0x01UL);
    713717  }
    714718  REG_GROUP_END();
    715  
     719
    716720  /* Restore the initial glide state.
    717721   * NB: Cannot be done in one packet. Wah!
     
    756760  /* optionally display the 3Dfx powerfield logo overlay */
    757761  if (_GlideRoot.environment.shamelessPlug) _grShamelessPlug();
    758  
     762
    759763  /* check for environmental override.
    760    * 
     764   *
    761765   * NB: If we are sli, the application passes in 0, and the user has
    762766   * elected to not sync to retrace then we honor the user's
    763767   * choice. Otherwise we force syncing because most apps don't know
    764768   * any better. If, however, the user has not chosen, but the app
    765    * wants something other than 0 then we need to honor their choice. 
     769   * wants something other than 0 then we need to honor their choice.
    766770   */
    767771  swapInterval = ((_GlideRoot.environment.swapInterval >= 0)
    768772                  ? _GlideRoot.environment.swapInterval
    769773                  : (gc->scanline_interleaved ? MAX(swapInterval, 1) : swapInterval));
    770  
     774
    771775  GR_CHECK_F(myName,
    772776             (swapInterval > 255) || (swapInterval < 0),
     
    779783  while (grBufferNumPending() > 6)
    780784    ;
    781  
     785
    782786  /* if the interval is non-zero turn on VSYNC waiting */
    783787  vSync = (swapInterval > 0);
    784  
     788
    785789  if (swapInterval > 0) swapInterval--;
    786  
     790
    787791    /* NOTE: we need a PCI read before and after the swap command */
    788792    /* but since we already called grBufferNumPending() we've done a read */
     
    809813    GR_CHECK_SIZE();
    810814  }
    811  
     815
    812816#ifdef GLIDE_DEBUG
    813817  {
     
    815819      static char saveDBG[GDBG_MAX_LEVELS];
    816820      int i;
    817      
     821
    818822      /* turn off tracing after frame 0 and the snapshot frame */
    819       if ((_GlideRoot.stats.bufferSwaps == 0) || 
     823      if ((_GlideRoot.stats.bufferSwaps == 0) ||
    820824          (_GlideRoot.stats.bufferSwaps == _GlideRoot.environment.snapshot + 3)) {
    821825        GDBG_PRINTF(FN_NAME": FX_SNAPSHOT (%ld)\n", _GlideRoot.stats.bufferSwaps);
     
    854858    }
    855859
    856   GDBG_INFO(gc->myLevel, 
     860  GDBG_INFO(gc->myLevel,
    857861              "\trenderBuf: 0x%X\n",
    858862              gc->hwDep.cvgDep.renderBuf);
     
    863867  grSstStatus();        /* special bug workaround       */
    864868#else
    865 #    error "Need to implement swap." 
     869#    error "Need to implement swap."
    866870#endif /* GLIDE_PLATFORM & GLIDE_HW_SST1 */
    867  
     871
    868872  _GlideRoot.stats.bufferSwaps++;
    869  
     873
    870874  GR_END();
    871 #undef FN_NAME 
     875#undef FN_NAME
    872876} /* grBufferSwap */
    873877
     
    882886  {
    883887    FxU32 status = grSstStatus();
    884    
     888
    885889#if ((GLIDE_PLATFORM & GLIDE_HW_CVG) || (GLIDE_PLATFORM & GLIDE_HW_H3))
    886890    pend = ((status & SST_SWAPBUFPENDING) >> SST_SWAPBUFPENDING_SHIFT);
     
    985989            FN_NAME, minx, maxx, miny, maxy);
    986990
    987   GR_CHECK_COMPATABILITY(FN_NAME, 
     991  GR_CHECK_COMPATABILITY(FN_NAME,
    988992                         ((maxx > gc->state.screen_width) || (maxy > gc->state.screen_height)),
    989993                         "Max clip coordinate > screen size");
     
    10011005            FN_NAME, minx, maxx, miny, maxy);
    10021006
    1003   *clipLeftRight = (minx << SST_CLIPLEFT_SHIFT) | (maxx << SST_CLIPRIGHT_SHIFT); 
     1007  *clipLeftRight = (minx << SST_CLIPLEFT_SHIFT) | (maxx << SST_CLIPRIGHT_SHIFT);
    10041008  *clipBottomTop = (miny << SST_CLIPBOTTOM_SHIFT) | (maxy << SST_CLIPTOP_SHIFT);
    10051009
     
    10071011            FN_NAME, clipLeftRight, clipBottomTop);
    10081012
    1009 #undef FN_NAME 
     1013#undef FN_NAME
    10101014} /* _grClipNormalizeAndGenerateRegValues */
    10111015
     
    10131017** grClipWindow
    10141018*/
    1015 GR_STATE_ENTRY(grClipWindow, void, (FxU32 minx, FxU32 miny, 
    1016                                     FxU32 maxx, FxU32 maxy)) 
     1019GR_STATE_ENTRY(grClipWindow, void, (FxU32 minx, FxU32 miny,
     1020                                    FxU32 maxx, FxU32 maxy))
    10171021{
    10181022#define FN_NAME "grClipWindow"
     
    10501054*/
    10511055
    1052 GR_STATE_ENTRY(grColorCombine, void, 
     1056GR_STATE_ENTRY(grColorCombine, void,
    10531057               (GrCombineFunction_t function, GrCombineFactor_t factor,
    10541058                GrCombineLocal_t local, GrCombineOther_t other, FxBool invert))
     
    11761180    GR_SET_EXPECTED_SIZE(sizeof(FxU32) + (texTransP ? sizeof(FxU32) : 0),
    11771181                         1 + texTransP);
    1178    
     1182
    11791183    /* transition into/out of texturing ... add nopCMD */
    11801184    if (texTransP) GR_SET(BROADCAST_ID, hw, nopCMD, 0);
     
    13821386  /* turn off all the bits and then turn them back on selectively */
    13831387  fbzMode = gc->state.fbi_config.fbzMode;
    1384   fbzMode &= ~(SST_ENDEPTHBUFFER | 
    1385                SST_WBUFFER | 
    1386                SST_ENZBIAS | 
     1388  fbzMode &= ~(SST_ENDEPTHBUFFER |
     1389               SST_WBUFFER |
     1390               SST_ENZBIAS |
    13871391               SST_ZCOMPARE_TO_ZACOLOR);
    13881392
     
    13901394  case GR_DEPTHBUFFER_DISABLE:
    13911395    break;
    1392    
     1396
    13931397  case GR_DEPTHBUFFER_ZBUFFER:
    13941398    fbzMode |= SST_ENDEPTHBUFFER | SST_ENZBIAS;
     
    14991503
    15001504  fbzMode = gc->state.fbi_config.fbzMode;
    1501   if (_GlideRoot.environment.disableDitherSub == FXTRUE) 
     1505  if (_GlideRoot.environment.disableDitherSub == FXTRUE)
    15021506    fbzMode &= ~(SST_ENDITHER | SST_DITHER2x2);
    15031507  else
     
    15071511  case GR_DITHER_DISABLE:
    15081512    break;
    1509        
     1513
    15101514  case GR_DITHER_2x2:
    15111515    fbzMode |= (SST_ENDITHER | SST_DITHER2x2);
     
    15371541
    15381542  fogmode = gc->state.fbi_config.fogMode;
    1539   fogmode &= ~(SST_ENFOGGING | 
    1540                SST_FOGADD | 
    1541                SST_FOGMULT | 
    1542                SST_FOG_ALPHA | 
    1543                SST_FOG_Z | 
     1543  fogmode &= ~(SST_ENFOGGING |
     1544               SST_FOGADD |
     1545               SST_FOGMULT |
     1546               SST_FOG_ALPHA |
     1547               SST_FOG_Z |
    15441548               SST_FOG_CONSTANT);
    15451549
     
    15641568
    15651569  /* GMT says that this should be enabled for CVG.  It is always safe
    1566    * to enable these even when fogging is not enabled. 
     1570   * to enable these even when fogging is not enabled.
    15671571   */
    15681572  fogmode |= (SST_FOG_DITHER | SST_FOG_ZONES);
     
    16181622  {
    16191623    int j;
    1620    
     1624
    16211625    for (j = 0; j < iend; j++) {
    16221626      FxU32 e0, e1, d0, d1;
    1623      
     1627
    16241628      e0 = locTable[0];                     /* lower entry */
    16251629      e1 = locTable[1];                     /* upper entry */
    16261630
    1627       GR_CHECK_COMPATABILITY(FN_NAME, 
    1628                              (e1 < e0), 
     1631      GR_CHECK_COMPATABILITY(FN_NAME,
     1632                             (e1 < e0),
    16291633                             "Invalid fog table entry. (Must be monotonically increasing)");
    1630       GR_CHECK_COMPATABILITY(FN_NAME, 
     1634      GR_CHECK_COMPATABILITY(FN_NAME,
    16311635                             ((j > 0) ? (e0 < locTable[-1]) : 0),
    16321636                             "Invalid fog table entry. (Must be monotonically increasing)");
    1633      
     1637
    16341638      /* del0 in .2 format */
    1635       d0 = ((e1 - e0) << 2); 
     1639      d0 = ((e1 - e0) << 2);
    16361640
    16371641      /* del1 in .2 format - don't access beyond end of table */
    16381642      d1 = ((j == (iend - 1)) ? e1 : locTable[2]);
    16391643      d1 = (d1 - e1) << 2;
    1640      
    1641       REG_GROUP_SET(hw, fogTable[j], 
     1644
     1645      REG_GROUP_SET(hw, fogTable[j],
    16421646                    ((e1 << 24) | (d1 << 16) | (e0 << 8) | d0));
    16431647      GDBG_INFO(gc->myLevel + 200, "fogTable[%ld]: 0x%X\n",
     
    16581662  Library: Glide
    16591663  Description:
    1660   Shutdown the Glide Library.  Iterate through all hardware and 
     1664  Shutdown the Glide Library.  Iterate through all hardware and
    16611665  call grSstWinClose().  Call InitShutdown() which unmaps all
    16621666  hardware from linear memory.
     
    16951699    /* dpc - 5 sep 1997 - FixMe!
    16961700     * Move this to the new initCode world some time.
    1697      * 
     1701     *
    16981702     * initClose();
    16991703     *
     
    17011705     * if the application never called grSstWinOpen because they are
    17021706     * doing some sort of hw/dll detection before trying to run w/
    1703      * glide. 
     1707     * glide.
    17041708     */
    17051709    for(i = 0; i < _GlideRoot.hwConfig.num_sst; i++) {
    17061710      if (_GlideRoot.GCs[i].hwInitP) {
    17071711        if (_GlideRoot.CPUType >= 6) {
    1708                 sst1InitCaching(_GlideRoot.GCs[i].base_ptr, FXFALSE);
    1709         }
     1712        sst1InitCaching(_GlideRoot.GCs[i].base_ptr, FXFALSE);
     1713    }
    17101714        sst1InitShutdown(_GlideRoot.GCs[i].base_ptr);
    17111715
     
    17301734        then it's still used by grGlideSetState()
    17311735  Arguments:
    1732  
     1736
    17331737  Return:
    17341738  -------------------------------------------------------------------*/
     
    17501754    REG_GROUP_SET(hw, alphaMode, gc->state.fbi_config.alphaMode);
    17511755    REG_GROUP_SET(hw, fbzMode, gc->state.fbi_config.fbzMode);
    1752    
     1756
    17531757    REG_GROUP_SET(hw, lfbMode, gc->state.fbi_config.lfbMode);
    17541758    REG_GROUP_SET(hw, clipLeftRight, gc->state.fbi_config.clipLeftRight);
    17551759    REG_GROUP_SET(hw, clipBottomTop, gc->state.fbi_config.clipBottomTop);
    1756    
     1760
    17571761    REG_GROUP_SET(hw, fogColor, gc->state.fbi_config.fogColor);
    17581762    REG_GROUP_SET(hw, zaColor, gc->state.fbi_config.zaColor);
     
    17601764  }
    17611765  REG_GROUP_NO_CHECK_END();
    1762  
     1766
    17631767  REG_GROUP_NO_CHECK_BEGIN(BROADCAST_ID, stipple, 3, 0x07);
    17641768  {
     
    17851789
    17861790  GR_ASSERT(state != NULL);
    1787  
     1791
    17881792  /* if texture mapping changed then we need to issue a NOP command*/
    17891793  {
    1790     const FxBool texChangeP = (((gc->state.fbi_config.fbzColorPath ^ state->fbi_config.fbzColorPath) & 
     1794    const FxBool texChangeP = (((gc->state.fbi_config.fbzColorPath ^ state->fbi_config.fbzColorPath) &
    17911795                                SST_ENTEXTUREMAP) != 0);
    17921796    if (texChangeP) {
     
    17991803#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
    18001804  /* If we're on sli and the new state includes changing the origin
    1801    * that we clear the slop lines at the bottom of the screen. 
     1805   * that we clear the slop lines at the bottom of the screen.
    18021806   */
    18031807  if (gc->scanline_interleaved) gc->hwDep.cvgDep.sliOriginBufCount = gc->grColBuf;
     
    18091813  /* Update the hardware state from the saved state. */
    18101814  _grFlushCommonStateRegs();
    1811  
     1815
    18121816  GR_SET_EXPECTED_SIZE((7 * sizeof(FxU32)) * gc->num_tmu, gc->num_tmu);
    18131817  {
    18141818    int tmu;
    1815    
     1819
    18161820    for (tmu = 0; tmu < gc->num_tmu; tmu++) {
    18171821      SstRegs* tmuregs = SST_TMU(hw, tmu);
    18181822      const FifoChipField chipField = (FifoChipField)(0x02UL << tmu);
    1819      
     1823
    18201824      REG_GROUP_NO_CHECK_BEGIN(chipField, textureMode, 7, 0x7F);
    18211825      {
     
    18241828        REG_GROUP_SET(tmuregs, tDetail, gc->state.tmu_config[tmu].tDetail);
    18251829        REG_GROUP_SET(tmuregs, texBaseAddr, gc->state.tmu_config[tmu].texBaseAddr);
    1826        
     1830
    18271831        REG_GROUP_SET(tmuregs, texBaseAddr1, gc->state.tmu_config[tmu].texBaseAddr_1);
    18281832        REG_GROUP_SET(tmuregs, texBaseAddr2, gc->state.tmu_config[tmu].texBaseAddr_2);
     
    18361840  /* NOTE: since glide state includes things like hints and all cached
    18371841   * variables like paramIndex we needn't recompute these, BUT: we do
    1838    * need to rebuild stuff that depends on them!!! 
     1842   * need to rebuild stuff that depends on them!!!
    18391843   */
    18401844  _grUpdateParamIndex();
     
    18611865  {
    18621866    FxU32 fbzMode;
    1863    
     1867
    18641868    fbzMode = gc->state.fbi_config.fbzMode;
    18651869    fbzMode &= ~(SST_DRAWBUFFER);
    18661870    fbzMode |= ((buffer == GR_BUFFER_FRONTBUFFER)
    1867                 ? SST_DRAWBUFFER_FRONT 
     1871                ? SST_DRAWBUFFER_FRONT
    18681872                : SST_DRAWBUFFER_BACK);
    18691873
     
    18751879  }
    18761880
    1877 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR 
     1881#if (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR
    18781882    /* Setting the render buffer means we need to adjust
    18791883     * our current pointer to the render buffer's physical
     
    18821886    {
    18831887      const FxU32 oldRenderBuf = gc->hwDep.cvgDep.renderBuf;
    1884      
     1888
    18851889      gc->hwDep.cvgDep.renderBuf = ((buffer == GR_BUFFER_FRONTBUFFER)
    18861890                                    ? gc->hwDep.cvgDep.frontBuf
     
    18901894    }
    18911895#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR */
    1892    
     1896
    18931897  GR_END();
    18941898#undef FN_NAME
     
    19321936      /* 0 */
    19331937      STATE_REQUIRES_OOW_FBI,
    1934      
     1938
    19351939      /* 1 */
    1936       STATE_REQUIRES_OOW_FBI | 
     1940      STATE_REQUIRES_OOW_FBI |
    19371941      STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0,
    19381942
    19391943      /* 2 */
    1940       STATE_REQUIRES_OOW_FBI | 
     1944      STATE_REQUIRES_OOW_FBI |
    19411945      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1,
    19421946
    19431947      /* 3 */
    1944       STATE_REQUIRES_OOW_FBI | 
    1945       STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 | 
     1948      STATE_REQUIRES_OOW_FBI |
     1949      STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 |
    19461950      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1,
    19471951
    19481952      /* 4 */
    1949       STATE_REQUIRES_OOW_FBI | 
     1953      STATE_REQUIRES_OOW_FBI |
    19501954      STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2,
    19511955
    19521956      /* 5 */
    1953       STATE_REQUIRES_OOW_FBI | 
     1957      STATE_REQUIRES_OOW_FBI |
    19541958      STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 |
    19551959      STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2,
    19561960
    19571961      /* 6 */
    1958       STATE_REQUIRES_OOW_FBI | 
     1962      STATE_REQUIRES_OOW_FBI |
    19591963      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1 |
    19601964      STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2,
    19611965
    19621966      /* 7 */
    1963       STATE_REQUIRES_OOW_FBI | 
     1967      STATE_REQUIRES_OOW_FBI |
    19641968      STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 |
    19651969      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1 |
     
    19691973    GR_ASSERT(gc->state.tmuMask < sizeof(paramI_array)/sizeof(paramI_array[0]));
    19701974    paramIndex |= paramI_array[gc->state.tmuMask];
    1971   } 
     1975  }
    19721976
    19731977  /* See if we need iterated RGB */
     
    19771981
    19781982  /* See if we need to iterate alpha based on the value of
    1979      ac_requires_it_alpha */ 
     1983     ac_requires_it_alpha */
    19801984  if (gc->state.ac_requires_it_alpha) {
    19811985    paramIndex |= STATE_REQUIRES_IT_ALPHA;
     
    20222026      paramIndex &= ~STATE_REQUIRES_W_TMU0;
    20232027  }
    2024  
     2028
    20252029  /* Turn off ST for TMU1 if TMU0 is active and TMU1 is not different */
    20262030  if (((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQUIRES_ST_TMU1)) ==
     
    20282032      !(hints & GR_STWHINT_ST_DIFF_TMU1))
    20292033    paramIndex &= ~STATE_REQUIRES_ST_TMU1;
    2030  
    2031   /* Turn off W for TMU1 if we have a previous W, and don't have a hint */ 
     2034
     2035  /* Turn off W for TMU1 if we have a previous W, and don't have a hint */
    20322036  if ((paramIndex & STATE_REQUIRES_W_TMU1) && !(hints & GR_STWHINT_W_DIFF_TMU1))
    20332037    paramIndex &= ~STATE_REQUIRES_W_TMU1;
    20342038
    20352039#if (GLIDE_NUM_TMU > 2)
    2036   /* Turn off ST for TMU1 if it's not different & any other is set up.  */ 
     2040  /* Turn off ST for TMU1 if it's not different & any other is set up.  */
    20372041  if ((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQURES_ST_TMU1)) &&
    20382042      (paramIndex & STATE_REQUIRES_ST_TMU2) &&
    20392043      !(hints & GR_STWHINT_ST_DIFF_TMU2))
    20402044    paramIndex &= ~STATE_REQUIRES_ST_TMU2;
    2041  
    2042   /* Turn off W for TMU2 if we have a previous W, and don't have a hint */ 
     2045
     2046  /* Turn off W for TMU2 if we have a previous W, and don't have a hint */
    20432047  if ((paramIndex & STATE_REQUIRES_W_TMU2) && !(hints & GR_STWHINT_W_DIFF_TMU2))
    20442048    paramIndex &= ~STATE_REQUIRES_W_TMU2;
    20452049#endif
    2046  
     2050
    20472051  gc->state.paramIndex = paramIndex;
    20482052
     
    21052109#if GLIDE_HW_TRI_SETUP
    21062110static void
    2107 _grUpdateTriPacketHdr(FxU32 paramMask, 
     2111_grUpdateTriPacketHdr(FxU32 paramMask,
    21082112                      const GrCullMode_t cullMode)
    21092113{
    21102114  GR_DCL_GC;
    2111   FxU32 sMode = ((cullMode != GR_CULL_DISABLE) 
    2112                  ? kSetupCullEnable 
     2115  FxU32 sMode = ((cullMode != GR_CULL_DISABLE)
     2116                 ? kSetupCullEnable
    21132117                 : kSetupPingPongDisable);
    2114   if (sMode != kSetupPingPongDisable) sMode |= ((cullMode == GR_CULL_POSITIVE) 
    2115                                                 ? kSetupCullPositive 
     2118  if (sMode != kSetupPingPongDisable) sMode |= ((cullMode == GR_CULL_POSITIVE)
     2119                                                ? kSetupCullPositive
    21162120                                                : kSetupCullNegative);
    21172121
     
    21192123#define COLOR_COMP_ARGB ((SST_SETUP_RGB | SST_SETUP_A) << SSTCP_PKT3_PMASK_SHIFT)
    21202124#define COLOR_COMP_RGB  (SST_SETUP_RGB << SSTCP_PKT3_PMASK_SHIFT)
    2121 #define COLOR_COMP_MASK COLOR_COMP_ARGB 
     2125#define COLOR_COMP_MASK COLOR_COMP_ARGB
    21222126
    21232127  /* Setup custom triangle/strip procs.
     
    21622166                                       paramMask |
    21632167                                       SSTCP_PKT3);
    2164  
     2168
    21652169  /* Independent triangle hdr for grDrawTriangle */
    21662170  gc->cmdTransportInfo.triPacketHdr = (gc->cmdTransportInfo.cullStripHdr |
     
    22002204  FxBool packedRGB = FXFALSE;
    22012205#endif /* GLIDE_PACKED_RGB */
    2202    
     2206
    22032207#ifdef GLIDE_DEBUG
    22042208  static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow",
    22052209                          "s0","t0","w0","s1","t1","w1","s2","t2","w2"};
    22062210#endif /* GLIDE_DEBUG */
    2207  
     2211
    22082212  GDBG_INFO(85,"(s) paramHints=0x%x paramIndex=0x%x\n", FN_NAME,
    22092213            gc->state.paramHints,gc->state.paramIndex);
    2210  
     2214
    22112215  curTriSize = params = 0;
    22122216  i = gc->state.paramIndex;
     
    22292233    /* When using packed color we only add *ONE* item to the data list
    22302234     * and this signals the entire color set since it is not possible
    2231      * to specify a single color component in any packet. 
     2235     * to specify a single color component in any packet.
    22322236     */
    22332237#if !GLIDE_PACKED_RGB
     
    22742278    {
    22752279      /* Only increment the parameter packet size if we have not already
    2276        * added the rgb fields. 
     2280       * added the rgb fields.
    22772281       */
    22782282      if ((i & STATE_REQUIRES_IT_DRGB) == 0) params += 1;
     
    22832287#endif /* !GLIDE_PACKED_RGB */
    22842288  }
    2285  
     2289
    22862290  if (i & STATE_REQUIRES_OOZ) {
    22872291#if GLIDE_HW_TRI_SETUP
     
    23292333  gc->tsuDataList[curTriSize++] = 0;
    23302334#endif /* GLIDE_FP_CLAMP_TEX */
    2331  
     2335
    23322336  /* NOTE: this is the first */
    23332337  if (i & STATE_REQUIRES_W_TMU0) {
     
    23452349    params += 1;
    23462350  }
    2347  
     2351
    23482352  /* TMU0 --------------------------------- */
    23492353  /* always output to ALL chips, saves from having to change CHIP field */
     
    23652369    params += 2;
    23662370  }
    2367    
     2371
    23682372  /* TMU1 --------------------------------- */
    23692373  if (i & STATE_REQUIRES_W_TMU1) {
     
    24002404    params += 2;
    24012405  }
    2402  
     2406
    24032407#if (GLIDE_NUM_TMU > 2)
    24042408#error "GLIDE_NUM_TMU > 2: Write this code."
     
    24522456  gc->tsuDataList[++curTriSize]   = 0;
    24532457#endif /* GLIDE_FP_CLAMP_TEX */
    2454  
     2458
    24552459#ifdef GDBG_INFO_ON
    24562460#if GLIDE_HW_TRI_SETUP
     
    24802484GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc))
    24812485{
    2482  
     2486
    24832487  gc->gcFuncs._grColorCombineDelta0Mode = (void *)
    2484     GR_DDNAME(_grColorCombineDelta0Mode); 
     2488    GR_DDNAME(_grColorCombineDelta0Mode);
    24852489  gc->gcFuncs._grRebuildDataList = (void *) GR_DDNAME(_grRebuildDataList);
    24862490  gc->gcFuncs._grTexDetailControl = (void *) GR_DDNAME(_grTexDetailControl);
    24872491  gc->gcFuncs._grTexDownloadNccTable = (void *)
    2488     GR_DDNAME(_grTexDownloadNccTable); 
     2492    GR_DDNAME(_grTexDownloadNccTable);
    24892493  gc->gcFuncs._grTexDownloadPalette = (void *)
    2490     GR_DDNAME(_grTexDownloadPalette); 
     2494    GR_DDNAME(_grTexDownloadPalette);
    24912495  gc->gcFuncs._gumpTexCombineFunction = (void *)
    2492     GR_DDNAME(_gumpTexCombineFunction); 
     2496    GR_DDNAME(_gumpTexCombineFunction);
    24932497  gc->gcFuncs._grUpdateParamIndex = (void *)
    2494     GR_DDNAME(_grUpdateParamIndex); 
    2495   gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup); 
     2498    GR_DDNAME(_grUpdateParamIndex);
     2499  gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup);
    24962500  gc->gcFuncs._trisetup_nogradients = (void *)
    2497     GR_DDNAME(_trisetup_nogradients); 
    2498   gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine); 
    2499   gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint); 
    2500   gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon); 
     2501    GR_DDNAME(_trisetup_nogradients);
     2502  gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine);
     2503  gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint);
     2504  gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon);
    25012505  gc->gcFuncs.grAADrawPolygonVertexList = (void *)
    2502     GR_DDNAME(grAADrawPolygonVertexList); 
    2503   gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle); 
     2506    GR_DDNAME(grAADrawPolygonVertexList);
     2507  gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle);
    25042508  gc->gcFuncs.grAlphaBlendFunction = (void *)
    2505     GR_DDNAME(grAlphaBlendFunction); 
    2506   gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine); 
     2509    GR_DDNAME(grAlphaBlendFunction);
     2510  gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine);
    25072511  gc->gcFuncs.grAlphaControlsITRGBLighting = (void *)
    2508     GR_DDNAME(grAlphaControlsITRGBLighting); 
     2512    GR_DDNAME(grAlphaControlsITRGBLighting);
    25092513  gc->gcFuncs.grAlphaTestFunction = (void *)
    2510     GR_DDNAME(grAlphaTestFunction); 
     2514    GR_DDNAME(grAlphaTestFunction);
    25112515  gc->gcFuncs.grAlphaTestReferenceValue = (void *)
    2512     GR_DDNAME(grAlphaTestReferenceValue); 
    2513   gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear); 
     2516    GR_DDNAME(grAlphaTestReferenceValue);
     2517  gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear);
    25142518  gc->gcFuncs.grBufferNumPending = (void *)
    2515     GR_DDNAME(grBufferNumPending); 
    2516   gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap); 
    2517   gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode); 
    2518   gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue); 
    2519   gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow); 
    2520   gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine); 
    2521   gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask); 
     2519    GR_DDNAME(grBufferNumPending);
     2520  gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap);
     2521  gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode);
     2522  gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue);
     2523  gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow);
     2524  gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine);
     2525  gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask);
    25222526  gc->gcFuncs.grConstantColorValue = (void *)
    2523     GR_DDNAME(grConstantColorValue); 
     2527    GR_DDNAME(grConstantColorValue);
    25242528  gc->gcFuncs.grConstantColorValue4 = (void *)
    2525     GR_DDNAME(grConstantColorValue4); 
    2526   gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode); 
    2527   gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel); 
     2529    GR_DDNAME(grConstantColorValue4);
     2530  gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode);
     2531  gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel);
    25282532  gc->gcFuncs.grDepthBufferFunction = (void *)
    2529     GR_DDNAME(grDepthBufferFunction); 
     2533    GR_DDNAME(grDepthBufferFunction);
    25302534  gc->gcFuncs.grDepthBufferMode = (void *) GR_DDNAME(grDepthBufferMode);
    2531  
    2532   gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask); 
     2535
     2536  gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask);
    25332537  gc->gcFuncs.grDisableAllEffects = (void *)
    2534     GR_DDNAME(grDisableAllEffects); 
    2535   gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode); 
    2536   gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine); 
     2538    GR_DDNAME(grDisableAllEffects);
     2539  gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode);
     2540  gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine);
    25372541  gc->gcFuncs.grDrawPlanarPolygon = (void *)
    2538     GR_DDNAME(grDrawPlanarPolygon); 
     2542    GR_DDNAME(grDrawPlanarPolygon);
    25392543  gc->gcFuncs.grDrawPlanarPolygonVertexList = (void *)
    2540     GR_DDNAME(grDrawPlanarPolygonVertexList); 
    2541   gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint); 
    2542   gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon); 
     2544    GR_DDNAME(grDrawPlanarPolygonVertexList);
     2545  gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint);
     2546  gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon);
    25432547  gc->gcFuncs.grDrawPolygonVertexList = (void *)
    2544     GR_DDNAME(grDrawPolygonVertexList); 
    2545   gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle); 
    2546   gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue); 
    2547   gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode); 
    2548   gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable); 
     2548    GR_DDNAME(grDrawPolygonVertexList);
     2549  gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle);
     2550  gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue);
     2551  gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode);
     2552  gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable);
    25492553  gc->gcFuncs.grGammaCorrectionValue = (void *)
    2550     GR_DDNAME(grGammaCorrectionValue); 
    2551   gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState); 
    2552   gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown); 
     2554    GR_DDNAME(grGammaCorrectionValue);
     2555  gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState);
     2556  gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown);
    25532557  gc->gcFuncs.grLfbConstantAlpha = (void *)
    2554     GR_DDNAME(grLfbConstantAlpha); 
     2558    GR_DDNAME(grLfbConstantAlpha);
    25552559  gc->gcFuncs.grLfbConstantDepth = (void *)
    2556     GR_DDNAME(grLfbConstantDepth); 
     2560    GR_DDNAME(grLfbConstantDepth);
    25572561  gc->gcFuncs.grLfbLock = (void *)GR_DDNAME(grLfbLock);
    25582562  gc->gcFuncs.grLfbUnlock = (void*)GR_DDNAME(grLfbUnlock);
    25592563  gc->gcFuncs.grLfbWriteColorFormat = (void *)
    2560     GR_DDNAME(grLfbWriteColorFormat); 
     2564    GR_DDNAME(grLfbWriteColorFormat);
    25612565  gc->gcFuncs.grLfbWriteColorSwizzle = (void *)
    2562     GR_DDNAME(grLfbWriteColorSwizzle); 
    2563   gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer); 
     2566    GR_DDNAME(grLfbWriteColorSwizzle);
     2567  gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer);
    25642568  gc->gcFuncs.grSstConfigPipeline = (void *)
    2565     GR_DDNAME(grSstConfigPipeline); 
    2566   gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle); 
    2567   gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy); 
    2568   gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen); 
    2569   gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin); 
     2569    GR_DDNAME(grSstConfigPipeline);
     2570  gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle);
     2571  gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy);
     2572  gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen);
     2573  gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin);
    25702574  gc->gcFuncs.grSstPassthruMode = (void *) GR_DDNAME(grSstPassthruMode);
    2571  
    2572   gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats); 
     2575
     2576  gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats);
    25732577  gc->gcFuncs.grSstResetPerfStats = (void *) GR_DDNAME(grSstResetPerfStats);
    2574   gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus); 
    2575   gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn); 
    2576   gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine); 
    2577   gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode); 
    2578   gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine); 
     2578  gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus);
     2579  gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn);
     2580  gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine);
     2581  gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode);
     2582  gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine);
    25792583  gc->gcFuncs.grTexDownloadMipMapLevelPartial = (void *)
    2580     GR_DDNAME(grTexDownloadMipMapLevelPartial); 
    2581   gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode); 
     2584    GR_DDNAME(grTexDownloadMipMapLevelPartial);
     2585  gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode);
    25822586  gc->gcFuncs.grTexLodBiasValue = (void *) GR_DDNAME(grTexLodBiasValue);
    25832587  gc->gcFuncs.grTexMipMapMode = (void *) GR_DDNAME(grTexMipMapMode);
    2584   gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 
     2588  gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase);
    25852589  gc->gcFuncs.grTexMultibaseAddress = (void *)
    2586     GR_DDNAME(grTexMultibaseAddress); 
    2587   gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable); 
    2588   gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource); 
    2589   gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle); 
     2590    GR_DDNAME(grTexMultibaseAddress);
     2591  gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable);
     2592  gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource);
     2593  gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle);
    25902594  gc->gcFuncs.guTexSource = (void *) GR_DDNAME(guTexSource);
    2591   gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle); 
    2592   gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom); 
     2595  gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle);
     2596  gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom);
    25932597} /* _grInitializeGCFuncs */
    25942598#endif
  • trunk/src/opengl/glide/cvg/glide/glfb.c

    r2888 r6653  
     1/* $Id: glfb.c,v 1.2 2001-09-05 14:30:26 bird Exp $ */
    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/cvg/glide/glfb.c,v 1.1 2000-02-25 00:37:39 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/glfb.c,v 1.2 2001-09-05 14:30:26 bird Exp $
    2122** $Log: glfb.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:39  sandervl
     23** Revision 1.2  2001-09-05 14:30:26  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:39  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 75    6/23/98 5:38p Peter
    2731** lfb hinting
    28 ** 
     32**
    2933** 74    4/29/98 2:49p Peter
    3034** fixed debug build
    31 ** 
     35**
    3236** 73    4/16/98 3:54p Peter
    3337** removed cruft
    34 ** 
     38**
    3539** 72    4/01/98 1:51p Peter
    3640** sli origin thing vs grRenderBuffer
    37 ** 
     41**
    3842** 71    3/31/98 6:09p Peter
    3943** sli origin everywhere (I think) and grLfbReadRegion/grRenderBuffer vs
    4044** triple buffering
    41 ** 
     45**
    4246** 70    3/29/98 1:07p Peter
    4347** yet another sli origin thing
    44 ** 
     48**
    4549** 69    3/23/98 5:57p Peter
    4650** warning cleanup
    47 ** 
     51**
    4852** 68    3/18/98 3:04p Peter
    4953** cleaner origin swapping hacks
    50 ** 
     54**
    5155** 67    3/13/98 1:56p Peter
    5256** more sli origin swapping
    53 ** 
     57**
    5458** 66    3/13/98 1:27p Peter
    5559** grLfbReadRegion vs triple buffering
    56 ** 
     60**
    5761** 65    3/09/98 2:24p Peter
    5862** change for new pci passthrough interface
    59 ** 
     63**
    6064** 63    3/02/98 7:23p Peter
    6165** clear slop on sli systems when changing y origin
    62 ** 
     66**
    6367** 62    2/20/98 11:00a Peter
    6468** removed glide3 from glid2 tree
    65 ** 
     69**
    6670** 61    2/11/98 5:26p Peter
    6771** new write edge stuff
    68 ** 
     72**
    6973** 60    2/01/98 7:52p Peter
    7074** grLfbWriteRegion byte count problems
    71 ** 
     75**
    7276** 59    1/30/98 4:31p Peter
    7377** general clenaup
    74  * 
     78 *
    7579 * 58    1/16/98 4:18p Atai
    7680 * fixed lfb and grLoadGammaTable
    77  * 
     81 *
    7882 * 57    1/06/98 3:53p Atai
    7983 * remove grHint, modify grLfbWriteRegion and grGet
    80  * 
     84 *
    8185 * 56    12/17/97 4:45p Peter
    8286 * groundwork for CrybabyGlide
    83  * 
     87 *
    8488 * 55    12/15/97 6:04p Atai
    8589 * disable obsolete glide2 api for glide3
    86  * 
     90 *
    8791 * 54    12/15/97 5:54p Peter
    8892 * swizzle reads too
    89  * 
     93 *
    9094 * 53    12/11/97 4:15p Peter
    9195 * mac lfb write region
    92  * 
     96 *
    9397 * 52    12/01/97 5:18p Peter
    94  * 
     98 *
    9599 * 51    11/25/97 12:09p Peter
    96100 * nested calls to grLfbLock vs init code locking on v2
    97  * 
     101 *
    98102 * 50    11/18/97 4:36p Peter
    99103 * chipfield stuff cleanup and w/ direct writes
    100  * 
     104 *
    101105 * 49    11/17/97 4:55p Peter
    102106 * watcom warnings/chipfield stuff
    103  * 
     107 *
    104108 * 48    11/06/97 3:38p Dow
    105109 * More banshee stuff
    106  * 
     110 *
    107111 * 47    11/04/97 5:04p Peter
    108112 * cataclysm part deux
    109  * 
     113 *
    110114 * 46    11/03/97 3:43p Peter
    111115 * h3/cvg cataclysm
    112  * 
     116 *
    113117 * 45    10/27/97 11:10a Peter
    114118 * starting cleanup
    115  * 
     119 *
    116120 * 44    10/09/97 8:02p Dow
    117121 * State Monster 1st Cut
    118  * 
     122 *
    119123 * 43    10/08/97 5:18p Peter
    120124 * fixed grLfbLock wrt writemode_any
    121  * 
     125 *
    122126 * 42    10/08/97 11:33a Peter
    123127 * hmmmm....
    124  * 
     128 *
    125129 * 41    9/30/97 1:03p Peter
    126130 * more debugging code
    127  * 
     131 *
    128132 * 40    9/25/97 1:35p Peter
    129  * 
     133 *
    130134 * 39    9/24/97 4:09p Peter
    131135 * lfb/idle fixes
    132  * 
     136 *
    133137 * 38    9/24/97 1:31p Peter
    134138 * assert if grXX call inside lock/unlock
    135  * 
     139 *
    136140 * 37    9/20/97 10:54a Peter
    137141 * naked lfb writes
    138  * 
     142 *
    139143 * 36    9/15/97 7:31p Peter
    140144 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    141145 * place, lfb's are on, Hmmmm.. probably more
    142  * 
     146 *
    143147 * 35    9/10/97 10:13p Peter
    144148 * fifo logic from GaryT, non-normalized fp first cut
    145  * 
     149 *
    146150**
    147151*/
     
    204208  -------------------------------------------------------------------*/
    205209
    206 GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer, 
    207                             GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, 
    208                             FxBool pixelPipeline, GrLfbInfo_t *info)) 
     210GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
     211                            GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
     212                            FxBool pixelPipeline, GrLfbInfo_t *info))
    209213{
    210214#define FN_NAME "grLfbLock"
     
    215219  FxBool swizzleByteP = FXFALSE;
    216220#endif /* (GLIDE_PLATFORM & GLIDE_OS_MACOS) && SET_BSWAP */
    217  
     221
    218222  GR_BEGIN_NOFIFOCHECK("grLfbLock", 87);
    219   GDBG_INFO_MORE(gc->myLevel,"(%d, %d, %d, %d, %d)\n", 
     223  GDBG_INFO_MORE(gc->myLevel,"(%d, %d, %d, %d, %d)\n",
    220224                 type, buffer, writeMode, origin, pixelPipeline);
    221225
     
    235239    } else {
    236240      lfbMode = gc->state.fbi_config.lfbMode;
    237       lfbMode &= ~(SST_LFB_READBUFSELECT | 
     241      lfbMode &= ~(SST_LFB_READBUFSELECT |
    238242                   SST_LFB_YORIGIN);
    239                    
     243
    240244      switch(buffer) {
    241245      case GR_BUFFER_FRONTBUFFER:
     
    252256
    253257      default:
    254         GR_CHECK_F(myName, 
    255                    1, 
     258        GR_CHECK_F(myName,
     259                   1,
    256260                   "illegal buffer parameter passed");
    257261        rv = FXFALSE;
     
    275279
    276280  case GR_LFB_WRITE_ONLY:
    277   {           
     281  {
    278282    if (gc->lockPtrs[type] != (FxU32)-1) {
    279283      GDBG_INFO(83, "Write failure due to existing lock");
     
    282286      /* Set up the constant depth register because it may have
    283287       * been trashed by a call to grDepthBiasLevel
    284        * (depthbiaslevel and constant depth use the same register) 
     288       * (depthbiaslevel and constant depth use the same register)
    285289       */
    286290      zaColor = gc->state.fbi_config.zaColor;
     
    291295      fbzMode = gc->state.fbi_config.fbzMode;
    292296      fbzMode &= ~(SST_ENZBIAS);
    293          
     297
    294298      lfbMode = gc->state.fbi_config.lfbMode;
    295299      lfbMode &= ~(SST_LFB_WRITEBUFSELECT |
     
    297301                   SST_LFB_FORMAT         |
    298302                   SST_LFB_ENPIXPIPE);
    299          
     303
    300304      switch(writeMode) {
    301305      case GR_LFBWRITEMODE_RESERVED1:
     
    315319                     : GR_LFBWRITEMODE_565);
    316320      }
    317          
     321
    318322      switch(buffer) {
    319323      case GR_BUFFER_FRONTBUFFER:
     
    353357      }
    354358      gc->state.fbi_config.lfbMode = lfbMode;
    355                        
     359
    356360      info->origin    = origin;
    357361      info->writeMode = writeMode;
     
    368372      if (!gc->cmdTransportInfo.fifoLfbP) lfbMode |= SST_LFB_WRITE_SWAP16;
    369373#endif /* (GLIDE_PLATFORM & GLIDE_OS_MACOS) */
    370                    
     374
    371375      switch(lfbMode & SST_LFB_FORMAT) {
    372376      case SST_LFB_565:
     
    407411#if (GLIDE_PLATFORM & GLIDE_HW_CVG) && !GLIDE_INIT_HAL
    408412    /* If the cmd fifo has been turned off before then make sure its
    409      * on again before trying to dork w/ the modes etc. 
     413     * on again before trying to dork w/ the modes etc.
    410414     */
    411415    if (lfbLockCount > 0) {
     
    437441    case GR_LFB_WRITE_ONLY:
    438442      REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 3, 0x103);
    439       {         
     443      {
    440444        REG_GROUP_SET(hw, fbzMode, fbzMode);
    441445        REG_GROUP_SET(hw, lfbMode, lfbMode);
     
    478482#if (GLIDE_PLATFORM & GLIDE_HW_CVG) && !GLIDE_INIT_HAL
    479483      sst1InitLfbLock((FxU32*)hw);
    480      
     484
    481485#if GLIDE_DEBUG || GLIDE_CHECK_COMPATABILITY
    482486      grHints(GR_HINT_LFB_PROTECT, info->strideInBytes);
    483487#endif /* GLIDE_DEBUG || GLIDE_CHECK_COMPATABILITY */
    484488#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && !GLIDE_INIT_HAL */
    485      
     489
    486490      /* Increment lock count */
    487491      gc->cmdTransportInfo.lfbLockCount = lfbLockCount + 1;
     
    492496#undef FN_NAME
    493497} /* grLfbLock */
    494    
     498
    495499/*-------------------------------------------------------------------
    496500  Function: grLfbUnlock
     
    502506  Arguments:
    503507  type - type of lock (read only/write only)
    504   buffer - which buffer to unlock 
     508  buffer - which buffer to unlock
    505509  Return:
    506510  FXTRUE  - success
     
    512516#define FN_NAME "grLfbUnlock"
    513517  FxBool rval = FXFALSE;
    514  
     518
    515519  GR_BEGIN_NOFIFOCHECK("grLfbUnLock", 87);
    516520  GDBG_INFO_MORE(gc->myLevel,"(%d, %d)\n", type, buffer);
    517521
    518522  type = type & ~(GR_LFB_NOIDLE);
    519  
    520   GR_CHECK_COMPATABILITY(FN_NAME, 
     523
     524  GR_CHECK_COMPATABILITY(FN_NAME,
    521525                         type != GR_LFB_WRITE_ONLY &&
    522526                         type != GR_LFB_READ_ONLY,
    523527                         "Bad type");
    524  
    525   GR_CHECK_COMPATABILITY(FN_NAME, 
     528
     529  GR_CHECK_COMPATABILITY(FN_NAME,
    526530                         buffer != GR_BUFFER_FRONTBUFFER &&
    527531                         buffer != GR_BUFFER_BACKBUFFER  &&
     
    529533                         "Bad buffer");
    530534
    531 #if ((GLIDE_PLATFORM & GLIDE_HW_SST1) || (GLIDE_PLATFORM & GLIDE_HW_CVG)) 
     535#if ((GLIDE_PLATFORM & GLIDE_HW_SST1) || (GLIDE_PLATFORM & GLIDE_HW_CVG))
    532536  if (gc->lockPtrs[type] == (FxU32)buffer) {
    533537    rval = FXTRUE;
     
    541545      /* If there are no more outstanding lfb locks, then turn the
    542546       * fifo back on before we do anything else otherwise just
    543        * return w/ the new lock count. 
     547       * return w/ the new lock count.
    544548       */
    545549      gc->cmdTransportInfo.lfbLockCount--;
     
    556560      }
    557561    }
    558    
     562
    559563    GR_SET_EXPECTED_SIZE(8 + MaskSelect(gc->scanline_interleaved, sizeof(FxU32)),
    560564                         2 + gc->scanline_interleaved);
     
    562566      /* Restore depth bias level */
    563567      GR_SET(BROADCAST_ID, hw, zaColor, gc->state.fbi_config.zaColor);
    564      
     568
    565569      /* turn back on depth biasing */
    566570      GR_SET(BROADCAST_ID, hw, fbzMode, gc->state.fbi_config.fbzMode);
    567      
     571
    568572      if (gc->scanline_interleaved) GR_SET(BROADCAST_ID, hw, nopCMD, 0x0);
    569573    }
     
    609613      GR_SET(BROADCAST_ID, hw, lfbMode, lfbMode);
    610614      gc->state.fbi_config.lfbMode = lfbMode;
    611      
     615
    612616      if (sliP) GR_SET(BROADCAST_ID, hw, nopCMD, 0x0);
    613617    }
     
    654658      GR_SET(BROADCAST_ID, hw, lfbMode, lfbMode);
    655659      gc->state.fbi_config.lfbMode = lfbMode;
    656      
     660
    657661      if (sliP) GR_SET(BROADCAST_ID, hw, nopCMD, 0x0);
    658662    }
     
    666670FxBool
    667671_grLfbWriteRegion(FxBool pixPipelineP,
    668                   GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, 
    669                   GrLfbSrcFmt_t src_format, 
    670                   FxU32 src_width, FxU32 src_height, 
     672                  GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y,
     673                  GrLfbSrcFmt_t src_format,
     674                  FxU32 src_width, FxU32 src_height,
    671675                  FxI32 src_stride, void *src_data)
    672676{
     
    675679  GrLfbInfo_t      info;
    676680  GrLfbWriteMode_t writeMode;
    677  
     681
    678682  GR_BEGIN_NOFIFOCHECK("_grLfbWriteRegion", 82);
    679683  GDBG_INFO_MORE(gc->myLevel,
    680                  "(0x%x, %s, %d, %d, %d, %d, %d, %d, 0x%x)\n", 
     684                 "(0x%x, %s, %d, %d, %d, %d, %d, %d, 0x%x)\n",
    681685                 dst_buffer,
    682686                 (pixPipelineP ? "Enable" : "Disable"),
    683                  dst_x, dst_y, 
     687                 dst_x, dst_y,
    684688                 src_format, src_width, src_height,
    685689                 src_stride, src_data);
    686  
    687   if (src_format == GR_LFB_SRC_FMT_RLE16) 
     690
     691  if (src_format == GR_LFB_SRC_FMT_RLE16)
    688692    writeMode = GR_LFBWRITEMODE_565;
    689   else 
     693  else
    690694    writeMode = src_format;
    691  
     695
    692696  gc->cmdTransportInfo.fifoLfbP = FXTRUE;
    693697  info.size = sizeof(info);
    694  
    695   if (grLfbLock(GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE, 
    696                 dst_buffer, 
     698
     699  if (grLfbLock(GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE,
     700                dst_buffer,
    697701                writeMode,
    698702                GR_ORIGIN_UPPER_LEFT,
     
    716720    dstData = (FxU32*)(((FxU8*)info.lfbPtr) + (dst_y * info.strideInBytes));
    717721#endif
    718      
     722
    719723    srcData = (FxU32*)src_data;
    720724    scanline = src_height;
    721    
     725
    722726    switch(src_format) {
    723727      /* 16-bit aligned */
     
    736740          GR_ASSERT(((FxU32)dstData & 0x03UL) == 0);
    737741          end = (FxU32*)((char*)srcData + length - 2);
    738                
     742
    739743          if (srcData < end) {
    740744            LINEAR_WRITE_BEGIN(length >> 2, kLinearWriteLFB, dstData, 0x00, 0x00);
     
    746750            LINEAR_WRITE_END();
    747751          }
    748                  
     752
    749753          if ((length & 0x3) != 0x00) {
    750754            LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, *(FxU16*)srcData, sizeof(FxU16));
     
    752756            srcData = (FxU32*)(((FxU16*)srcData) + 1);
    753757          }
    754                  
     758
    755759          dstData = (FxU32*)(((char*)dstData) + dstJump);
    756760          srcData = (FxU32*)(((char*)srcData) + srcJump);
     
    761765          end = (FxU32*)((char*)srcData + length);
    762766
    763           LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, 
     767          LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData,
    764768                            *(FxU16*)srcData, sizeof(FxU16));
    765769          dstData = (FxU32*)(((FxU16*)dstData) + 1);
    766770          srcData = (FxU32*)(((FxU16*)srcData) + 1);
    767                  
     771
    768772          if (srcData < end) {
    769773            const FxU32 numWords = (((FxU32)end - (FxU32)srcData) >> 2);
     
    778782            LINEAR_WRITE_END();
    779783          }
    780                  
     784
    781785          if ((length & 0x03) == 0) {
    782             LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData, 
     786            LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData,
    783787                              *(FxU16*)srcData, sizeof(FxU16));
    784788            dstData = (FxU32*)(((FxU16*)dstData) + 1);
    785789            srcData = (FxU32*)(((FxU16*)srcData) + 1);
    786790          }
    787                  
     791
    788792          dstData = (FxU32*)(((char*)dstData) + dstJump);
    789793          srcData = (FxU32*)(((char*)srcData) + srcJump);
     
    804808      while(scanline--) {
    805809        end = (FxU32*)((char*)srcData + length);
    806            
     810
    807811        LINEAR_WRITE_BEGIN(src_width,
    808812                           kLinearWriteLFB,
     
    815819        }
    816820        LINEAR_WRITE_END();
    817            
     821
    818822        dstData = (FxU32*)(((char*)dstData)+dstJump);
    819823        srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    845849  dst_x,dst_y - destination image start coordinates
    846850  src_format  - data format of source image
    847   src_width, src_height 
     851  src_width, src_height
    848852              - dimensions of source image
    849853  src_stride  - stride of source image in bytes, not meaningful
    850854                for RLE images
    851   src_data    - pointer to source data memory           
     855  src_data    - pointer to source data memory
    852856  Return:
    853857  FXTRUE  succeed
    854858  FXFALSE fail
    855859  -------------------------------------------------------------------*/
    856 GR_ENTRY(grLfbWriteRegion, FxBool, (GrBuffer_t dst_buffer, 
    857                                     FxU32 dst_x, FxU32 dst_y, 
    858                                     GrLfbSrcFmt_t src_format, 
    859                                     FxU32 src_width, FxU32 src_height, 
     860GR_ENTRY(grLfbWriteRegion, FxBool, (GrBuffer_t dst_buffer,
     861                                    FxU32 dst_x, FxU32 dst_y,
     862                                    GrLfbSrcFmt_t src_format,
     863                                    FxU32 src_width, FxU32 src_height,
    860864                                    FxI32 src_stride, void *src_data))
    861865{
    862866  FxBool           rv = FXTRUE;
    863  
     867
    864868  GR_BEGIN_NOFIFOCHECK("grLfbWriteRegion",82);
    865869  GDBG_INFO_MORE(gc->myLevel,
    866                  "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n", 
    867                  dst_buffer, dst_x, dst_y, 
     870                 "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n",
     871                 dst_buffer, dst_x, dst_y,
    868872                 src_format, src_width, src_height,
    869873                 src_stride, src_data);
    870  
     874
    871875  rv = _grLfbWriteRegion(FXFALSE, dst_buffer, dst_x, dst_y,
    872876                         src_format, src_width, src_height,
     
    884888  Grab a rectangle from the frame buffer into user supplied memory
    885889  Arguments:
    886   src_buffer - buffer to read from 
     890  src_buffer - buffer to read from
    887891  src_x      - x coordinate of upper left corner rectangle to read
    888892  src_y      - y coordinate of upper left corner of rectangle to read
     
    895899  FXFALSE - failure
    896900  -------------------------------------------------------------------*/
    897 GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer, 
    898                                    FxU32 src_x, FxU32 src_y, 
    899                                    FxU32 src_width, FxU32 src_height, 
     901GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
     902                                   FxU32 src_x, FxU32 src_y,
     903                                   FxU32 src_width, FxU32 src_height,
    900904                                   FxU32 dst_stride, void *dst_data))
    901905{
     
    903907  FxBool rv = FXTRUE;
    904908  GrLfbInfo_t info;
    905  
     909
    906910  GR_BEGIN_NOFIFOCHECK("grLfbReadRegion", 82);
    907911  GDBG_INFO_MORE(gc->myLevel,
     
    910914                 src_width, src_height, dst_stride, dst_data);
    911915
    912 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 
     916#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
    913917#define kTileSize (32 * sizeof(FxU16))
    914918#define kTileMask (kTileSize - 1)
     
    920924                           ((src_buffer == GR_BUFFER_FRONTBUFFER) && (gc->hwDep.cvgDep.frontBuf == 2))));
    921925
    922     if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr, 
    923                                                           gc->grColBuf, 
     926    if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr,
     927                                                          gc->grColBuf,
    924928                                                          0);
    925929#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */
    926  
     930
    927931    info.size = sizeof(info);
    928932    if (grLfbLock(GR_LFB_READ_ONLY,
     
    938942      FxU32 length;               /* bytes to copy in scanline */
    939943      FxU32 scanline;             /* scanline number */
    940      
     944
    941945      dstData = (FxU32*)dst_data;
    942946      srcData = (const FxU32*)((FxU8*)info.lfbPtr +
     
    948952      srcJump  = info.strideInBytes - length;
    949953
    950 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 
     954#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
    951955      /* Voodoo2 has a problem reading from the frame buffer if we are
    952956       * triple buffering and the triple buffer is the currently
     
    994998            /* Copying the logical 1 tile. This may require us to go
    995999             * 'backwards' in physical memory if there was no logical
    996              * 0 tile in the current read. 
     1000             * 0 tile in the current read.
    9971001             */
    9981002            tilePtr      = (const FxU32*)(((FxU32)srcData - tileSlopAdjust) & tileSlopMask);
    999             tileEnd      = (const FxU32*)MIN((((FxU32)tilePtr + kTileSize) & ~kTileMask), 
     1003            tileEnd      = (const FxU32*)MIN((((FxU32)tilePtr + kTileSize) & ~kTileMask),
    10001004                                             (FxU32)end - kTileSize - sizeof(FxU16));
    10011005            tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x03UL);
     
    10081012                tilePtr = (const FxU32*)((FxU8*)tilePtr + sizeof(FxU16));
    10091013              }
    1010              
     1014
    10111015              /* Copy the remainder of the logical 1 tile */
    10121016              while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++);
    1013               if (tileEnd != tileEndAlign) 
     1017              if (tileEnd != tileEndAlign)
    10141018                *(FxU16*)dstData = GR_GET16(*tilePtr);
    10151019            }
    1016              
     1020
    10171021            srcData = (const FxU32*)(((FxU32)srcData + (kTileSize << 1)) & ~kPageMask);
    10181022          }
     
    10261030              tileEnd     = (const FxU32*)((FxU32)tilePtr + kTileSize);
    10271031              while(tilePtr < tileEnd) *dstData++ = GR_GET(*tilePtr++);
    1028              
     1032
    10291033              tilePtr = srcData;
    10301034              tileEnd = (const FxU32*)((FxU32)tilePtr + kTileSize);
     
    10381042          if (srcData < end) {
    10391043            const FxU32* startTileAddr = (const FxU32*)((FxU32)srcData + kTileSize);
    1040            
     1044
    10411045            tilePtr      = startTileAddr;
    1042             tileEnd      = (const FxU32*)((FxU32)startTileAddr + 
     1046            tileEnd      = (const FxU32*)((FxU32)startTileAddr +
    10431047                                          MIN(kTileSize, ((FxU32)end - (FxU32)srcData)));
    10441048            tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x3);
    10451049
    10461050            while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++);
    1047             if (tileEnd != tileEndAlign) 
     1051            if (tileEnd != tileEndAlign)
    10481052              *(FxU16*)dstData = GR_GET16(*tilePtr);
    10491053
    10501054            if (startTileAddr < end) {
    10511055              tilePtr      = srcData;
    1052               tileEnd      = (const FxU32*)((FxU8*)tilePtr + kTileSize - 
     1056              tileEnd      = (const FxU32*)((FxU8*)tilePtr + kTileSize -
    10531057                                            ((FxU32)tileEndAlign - (FxU32)end));
    10541058              tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x3);
    10551059
    10561060              while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++);
    1057               if (tileEnd != tileEndAlign) 
     1061              if (tileEnd != tileEndAlign)
    10581062                *(FxU16*)dstData = GR_GET16(*tilePtr);
    10591063            }
     
    10651069        }
    10661070      } else
    1067 #endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */     
     1071#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */
    10681072      /* If the source data is aligned for 4 byte pci reads */
    10691073      if (((FxU32)srcData & 0x02UL) == 0) {
    10701074        while(scanline--) {
    10711075          const FxU32* end = (const FxU32*)((char*)srcData + length - 2);
    1072          
     1076
    10731077          while(srcData < end) {
    10741078            *dstData++ = GR_GET(*srcData++);
    10751079          }
    1076          
     1080
    10771081          if (((int)length) & 0x2) {
    10781082            (*(FxU16*)dstData) = GR_GET16(*srcData);
     
    10801084            srcData = (FxU32*)(((FxU16*)srcData) + 1);
    10811085          }
    1082          
     1086
    10831087          dstData = (FxU32*)(((char*)dstData)+dstJump);
    10841088          srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    11011105            srcData = (FxU32*)(((FxU16*)srcData) + 1);
    11021106          }
    1103                
     1107
    11041108          dstData = (FxU32*)(((char*)dstData)+dstJump);
    11051109          srcData = (FxU32*)(((char*)srcData)+srcJump);
     
    11121116    }
    11131117
    1114 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 
    1115     if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr, 
    1116                                                           gc->grColBuf, 
     1118#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
     1119    if (swapP && (gc->grAuxBuf > 0)) sst1InitAllocBuffers(gc->base_ptr,
     1120                                                          gc->grColBuf,
    11171121                                                          gc->grAuxBuf);
    11181122  }
  • trunk/src/opengl/glide/cvg/glide/gmovie.c

    r2888 r6653  
     1/* $Id: gmovie.c,v 1.2 2001-09-05 14:30:26 bird Exp $ */
    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/cvg/glide/gmovie.c,v 1.1 2000-02-25 00:37:40 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gmovie.c,v 1.2 2001-09-05 14:30:26 bird Exp $
    2122** $Log: gmovie.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:40  sandervl
     23** Revision 1.2  2001-09-05 14:30:26  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:40  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 6     8/30/97 5:59p Tarolli
    2731 * cleanups
    28  * 
     32 *
    2933 * 5     5/27/97 1:16p Peter
    30  * Basic cvg, w/o cmd fifo stuff. 
    31  * 
     34 * Basic cvg, w/o cmd fifo stuff.
     35 *
    3236 * 4     5/21/97 6:05a Peter
    33  * 
     37 *
    3438 * 3     3/09/97 10:31a Dow
    3539 * Added GR_DIENTRY for di glide functions
  • trunk/src/opengl/glide/cvg/glide/gpci.c

    r2888 r6653  
     1/* $Id: gpci.c,v 1.2 2001-09-05 14:30:27 bird Exp $ */
    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/cvg/glide/gpci.c,v 1.1 2000-02-25 00:37:40 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gpci.c,v 1.2 2001-09-05 14:30:27 bird Exp $
    2122** $Log: gpci.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:40  sandervl
     23** Revision 1.2  2001-09-05 14:30:27  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:40  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 110   6/30/98 6:08p Jeske
    2731** fixed bug where we tried to setup MTRRs on old (<p6) systems which
    28 ** didn't have them. 
    29 ** 
     32** didn't have them.
     33**
    3034** 109   5/21/98 5:52p Peter
    3135** mismatched pairs
    32 ** 
     36**
    3337** 108   5/20/98 3:51p Peter
    3438** no fifo glide
    35 ** 
     39**
    3640** 107   5/18/98 12:15p Peter
    3741** better point code
    38 ** 
     42**
    3943** 106   4/21/98 5:53p Peter
    4044** slidetect vs hw pointers
    41 ** 
     45**
    4246** 105   4/08/98 3:52p Peter
    4347** point coordinate truncation
    44 ** 
     48**
    4549** 104   4/06/98 9:55a Peter
    4650** sli slave detection for oem dll
    47 ** 
     51**
    4852** 103   3/17/98 6:50p Peter
    4953** sli paired vs active
    50 ** 
     54**
    5155** 102   3/17/98 3:00p Peter
    5256** removed unused stats
    53 ** 
     57**
    5458** 101   3/13/98 5:08p Peter
    5559** doh, got it backwards
    56 ** 
     60**
    5761** 100   3/13/98 3:39p Peter
    5862** voodoo1.5 silliness
    59 ** 
     63**
    6064** 99    2/20/98 9:05a Peter
    6165** removed remnants of comdex grot
    62 ** 
     66**
    6367** 98    2/11/98 5:25p Peter
    6468** detection dialog fixes
    65 ** 
     69**
    6670** 97    1/30/98 4:51p Peter
    6771** fixed sli-detect for multiple pairs
    68 ** 
     72**
    6973** 96    1/30/98 4:27p Peter
    7074** no uswc for sli slave
    71 ** 
     75**
    7276** 95    1/24/98 12:29p Peter
    7377** more caching fun
    74 ** 
     78**
    7579** 94    1/20/98 11:03a Peter
    7680** env var to force triple buffering
    77  * 
     81 *
    7882 * 93    1/16/98 5:41p Peter
    7983 * fixed sense of lod_dither
    80  * 
     84 *
    8185 * 92    1/14/98 10:22a Peter
    8286 * no more hacks
    83  * 
     87 *
    8488 * 91    1/08/98 7:09p Peter
    8589 * real hw stuff modulo makefile change
    86  * 
     90 *
    8791 * 90    1/07/98 11:18a Atai
    8892 * remove GrMipMapInfo and GrGC.mm_table in glide3
    89  * 
     93 *
    9094 * 89    1/07/98 10:22a Peter
    9195 * lod dithering env var
    92  * 
     96 *
    9397 * 88    12/17/97 10:08a Peter
    9498 * fast system comdex twiddling
    95  * 
     99 *
    96100 * 87    12/09/97 4:20p Peter
    97101 * 0x100 fbiRev ofset for v2
    98  * 
     102 *
    99103 * 86    12/09/97 12:20p Peter
    100104 * mac glide port
    101  * 
     105 *
    102106 * 85    12/05/97 4:26p Peter
    103107 * watcom warnings
    104  * 
     108 *
    105109 * 84    12/03/97 2:36p Peter
    106110 * upped comdex reset defaults
    107  * 
     111 *
    108112 * 83    12/02/97 9:48a Dow
    109113 * Removed some spurious code I inadvertantly added.
    110  * 
     114 *
    111115 * 82    11/21/97 6:24p Dow
    112116 * Banshee Lying about being Rush stuf
    113  * 
     117 *
    114118 * 81    11/21/97 11:19a Dow
    115119 * Made Banshee report Voodoo2
    116  * 
     120 *
    117121 * 80    11/20/97 6:39p Peter
    118122 * fixed direct_exec w/ csim
    119  * 
     123 *
    120124 * 79    11/19/97 2:49p Peter
    121125 * env vars in registry for win32
    122  * 
     126 *
    123127 * 78    11/17/97 4:55p Peter
    124128 * watcom warnings/chipfield stuff
    125  * 
     129 *
    126130 * 77    11/15/97 7:43p Peter
    127131 * more comdex silliness
    128  * 
     132 *
    129133 * 76    11/14/97 11:10p Peter
    130134 * open vs hw init confusion
    131  * 
     135 *
    132136 * 75    11/14/97 5:02p Peter
    133137 * more comdex stuff
    134  * 
     138 *
    135139 * 74    11/14/97 12:09a Peter
    136140 * comdex thing and some other stuff
    137  * 
     141 *
    138142 * 73    11/12/97 9:54p Peter
    139143 * fixed all the muckage from new config
    140  * 
     144 *
    141145 * 72    11/12/97 9:37p Dow
    142146 * Textures on Banshee half work
    143  * 
     147 *
    144148 * 71    11/12/97 9:22a Dow
    145149 * h3 mods
    146  * 
     150 *
    147151 * 70    11/08/97 3:34p Peter
    148152 * fixed stupid gdbg_info crasher
    149  * 
     153 *
    150154 * 69    11/04/97 4:00p Dow
    151155 * Banshee Mods
    152  * 
     156 *
    153157 * 68    11/03/97 3:43p Peter
    154158 * h3/cvg cataclysm
    155  * 
     159 *
    156160 * 67    11/01/97 12:11p Pgj
    157161 * glide.dll ---> glide2x.dll
    158  * 
     162 *
    159163 * 66    10/31/97 8:53a Peter
    160164 * last lying change, really
    161  * 
     165 *
    162166 * 65    10/30/97 3:42p Peter
    163167 * protected the last bit of nonsense
    164  * 
     168 *
    165169 * 64    10/30/97 3:37p Peter
    166170 * spoof sst1
    167  * 
     171 *
    168172 * 63    10/29/97 2:45p Peter
    169173 * C version of Taco's packing code
    170  * 
     174 *
    171175 * 62    10/23/97 5:28p Peter
    172176 * sli fifo thing
    173  * 
     177 *
    174178 * 61    9/15/97 7:31p Peter
    175179 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    176180 * place, lfb's are on, Hmmmm.. probably more
    177  * 
     181 *
    178182 * 60    9/10/97 10:13p Peter
    179183 * fifo logic from GaryT, non-normalized fp first cut
    180  * 
     184 *
    181185 * 59    9/05/97 5:29p Peter
    182186 * changes for direct hw
    183  * 
     187 *
    184188 * 58    9/01/97 3:18p Peter
    185189 * correct integer rounding for pts
    186  * 
     190 *
    187191 * 57    8/30/97 5:59p Tarolli
    188192 * init and hal fixups
    189  * 
     193 *
    190194 * 56    8/30/97 1:19p Peter
    191195 * first cut at using blit to clear, more to come to do inner rects
    192  * 
     196 *
    193197 * 55    8/18/97 3:52p Peter
    194198 * pre-hw arrival fixes/cleanup
    195  * 
     199 *
    196200 * 54    7/30/97 2:42p Peter
    197201 * shared and sanitized
    198  * 
     202 *
    199203 * 53    7/28/97 2:41p Peter
    200204 * turned sli code back on for cvg, but waiting for hal
    201  * 
     205 *
    202206 * 52    7/25/97 11:40a Peter
    203207 * removed dHalf, change field name to match real use for cvg
    204  * 
     208 *
    205209 * 51    7/08/97 2:47p Peter
    206210 * fixed merge stupidity from last checkin
    207  * 
     211 *
    208212 * 50    7/02/97 12:28p Peter
    209213 * removed spurious NOP, tex dl
    210  * 
     214 *
    211215 * 49    6/24/97 4:02p Peter
    212216 * proper cmd fifo placement
    213  * 
     217 *
    214218 * 48    6/23/97 4:46p Peter
    215219 * fixed my ,uckage
     
    234238#include <windows.h>
    235239
    236 BOOL WINAPI 
    237 DllMain(HANDLE hInst, ULONG  ul_reason_for_call, LPVOID lpReserved) 
     240BOOL WINAPI
     241DllMain(HANDLE hInst, ULONG  ul_reason_for_call, LPVOID lpReserved)
    238242{
    239243  switch( ul_reason_for_call ) {
     
    255259    break;
    256260  }
    257  
     261
    258262  return TRUE;
    259263
     
    270274  Discover devices on the PCI bus.
    271275  Discover configuration of detected devices.
    272   Initialize all Glide GC's 
     276  Initialize all Glide GC's
    273277
    274278  Recognized devices depend upon compile time flags
    275279
    276   This code should NOT initialize the hardware 
    277   any more than is necessary for discovery of 
     280  This code should NOT initialize the hardware
     281  any more than is necessary for discovery of
    278282  configuration
    279283
    280284  Arguments: none
    281   Return: 
     285  Return:
    282286  FXTRUE  - at least one device was detected
    283287  FXFALSE - no devices were detected.
    284288  -------------------------------------------------------------------*/
    285 FxBool 
     289FxBool
    286290_grSstDetectResources(void)
    287291{
     
    301305#endif /* !GLIDE_INIT_HAL */
    302306
    303     /* The first time through the init code we need to map 
     307    /* The first time through the init code we need to map
    304308     * all of the boards. Future calls can just grab this
    305309     * info out of the halInfo that we have here.
     
    317321                              ? 4
    318322                              : atol(GETENV("FX_GLIDE_HW_REV")));
    319      
     323
    320324      for(ctx = device = 0; device < count; device++) {
    321325        const FxDeviceInfo* curDev = NULL;
     
    336340#endif /* !GLIDE_INIT_HAL */
    337341
    338         if ((devRegs != NULL) && 
     342        if ((devRegs != NULL) &&
    339343            (curDev != NULL) &&
    340344            (curDev->fbiRevision >= hwRevNum)) {
     
    342346          FxU32 i;
    343347
    344 #if (GLIDE_PLATFORM & GLIDE_HW_CVG)       
     348#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
    345349          /* Internally we always keep the real type. */
    346350          hwConfig->SSTs[ctx].type = GR_SSTTYPE_Voodoo2;
     
    358362           * happy, in win95.  However, if this is the slave of an sli
    359363           * pair then we don't want to waste mtrr's that we're never
    360            * really going to write to. 
     364           * really going to write to.
    361365           */
    362366          if (!inSliPairP && (_GlideRoot.CPUType >= 6)) {
    363                 sst1InitCaching((FxU32*)devRegs, FXTRUE);
    364           }
     367        sst1InitCaching((FxU32*)devRegs, FXTRUE);
     368      }
    365369
    366370          if (!sst1InitRegisters((FxU32*)devRegs) ||
     
    378382          _GlideRoot.GCs[ctx].grSstRez     = GR_RESOLUTION_NONE;
    379383          _GlideRoot.GCs[ctx].grSstRefresh = curDev->fbiVideoRefresh;
    380        
     384
    381385          /* Chip configuration */
    382386          _GlideRoot.GCs[ctx].num_tmu   = curDev->numberTmus;
     
    386390          if (!inSliPairP) {
    387391            _GlideRoot.gcMap[curSstNum] = _GlideRoot.gcNum;
    388            
     392
    389393            /* Voodoo^2 glide2x returns that it is an sst1, but the
    390394             * revision is bumped so that developers can really tell.
    391395             * Additionally, we now have the fun on Voodoo^1.5 which is
    392              * just a Voodoo^2 in a 2200 configuration. 
     396             * just a Voodoo^2 in a 2200 configuration.
    393397             */
    394             hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.fbiRev = (curDev->fbiRevision + 
     398            hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.fbiRev = (curDev->fbiRevision +
    395399                                                                       ((curDev->numberTmus == 1)
    396                                                                         ? 0x080 
     400                                                                        ? 0x080
    397401                                                                        : 0x100));
    398            
     402
    399403            hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.fbRam     = curDev->fbiMemSize;
    400404            hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.nTexelfx  = curDev->numberTmus;
     
    403407            for(i = 0; i < curDev->numberTmus; i++) {
    404408              const FxU32 curTmuMemSize = curDev->tmuMemSize[i];
    405              
     409
    406410              hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.tmuConfig[i].tmuRev = curDev->tmuRevision;
    407411              hwConfig->SSTs[curSstNum].sstBoard.Voodoo2Config.tmuConfig[i].tmuRam = curTmuMemSize;
     
    414418          for(i = 0; i < curDev->numberTmus; i++) {
    415419            const FxU32 curTmuMemSize = curDev->tmuMemSize[i];
    416            
     420
    417421            memset(&_GlideRoot.GCs[ctx].tmu_state[i], 0, sizeof(_GlideRoot.GCs[ctx].tmu_state[i]));
    418422            _GlideRoot.GCs[ctx].tmu_state[i].total_mem = (curTmuMemSize << 20);
    419            
    420             _GlideRoot.GCs[ctx].tmu_state[i].ncc_mmids[0] = 
     423
     424            _GlideRoot.GCs[ctx].tmu_state[i].ncc_mmids[0] =
    421425              _GlideRoot.GCs[ctx].tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
    422426          }
     
    425429           * until after the boards are paired w/ sst1InitSli which we
    426430           * have not yet done. Currently we assume that the next
    427            * discovered board will be the slave. 
     431           * discovered board will be the slave.
    428432           */
    429433          _GlideRoot.GCs[ctx].scanline_interleaved = curDev->sliDetected;
     
    468472          _GlideRoot.gcNum++;
    469473          _GlideRoot.GCs[ctx].hwInitP = FXTRUE;
    470        
     474
    471475          rv = FXTRUE;
    472476          ctx++;
     
    500504#else
    501505#  error "Write code for this chip"
    502 #endif 
    503  
     506#endif
     507
    504508  return rv;
    505509} /* _grSstDetectResources */
     
    513517    int tmuNum;
    514518
    515     GDBG_INFO(80,"SST board %d: 3Dfx Voodoo%s\n", 
     519    GDBG_INFO(80,"SST board %d: 3Dfx Voodoo%s\n",
    516520              i, ((hwc->SSTs[i].type == GR_SSTTYPE_VOODOO) ? " Graphics" : "^2"));
    517521    if (hwc->SSTs[i].sstBoard.VoodooConfig.sliDetect) {
     
    597601                                                ? 0x00UL
    598602                                                : SST_TLODDITHER);
    599    
     603
    600604    _GlideRoot.environment.nColorBuffer      = GLIDE_GETENV("FX_GLIDE_ALLOC_COLOR", -1L);
    601     _GlideRoot.environment.nAuxBuffer        = GLIDE_GETENV("FX_GLIDE_ALLOC_AUX", -1L);   
     605    _GlideRoot.environment.nAuxBuffer        = GLIDE_GETENV("FX_GLIDE_ALLOC_AUX", -1L);
    602606    _GlideRoot.environment.swFifoLWM         = GLIDE_GETENV("FX_GLIDE_LWM", -1L);
    603607
     
    606610      _GlideRoot.environment.swapInterval = 0;
    607611    }
    608    
     612
    609613    _GlideRoot.environment.snapshot          = GLIDE_GETENV("FX_SNAPSHOT", 0);
    610    
     614
    611615    GDBG_INFO(80,"    triBoundsCheck: %d\n",_GlideRoot.environment.triBoundsCheck);
    612616    GDBG_INFO(80,"      swapInterval: %d\n",_GlideRoot.environment.swapInterval);
     
    637641      char s[128];
    638642      const char* errStr = s;
    639      
     643
    640644      if (pciGetErrorCode() == PCI_ERR_NOERR) {
    641645#ifndef __linux__
     
    649653        errStr = pciGetErrorString();
    650654      }
    651      
     655
    652656      GrErrorCallback(errStr, FXTRUE);
    653657    }
    654    
     658
    655659    /* GMT: this isn't really necessary since GlideRoot is static */
    656660    for (i = 0; i < _GlideRoot.hwConfig.num_sst; i++) {
     
    658662      displayBoardInfo(i, &_GlideRoot.hwConfig);
    659663    }
    660    
     664
    661665    _grMipMapInit();
    662666    _GlideRoot.initialized = hwDetectP;               /* save this for the end */
  • trunk/src/opengl/glide/cvg/glide/gsplash.c

    r2888 r6653  
     1/* $Id: gsplash.c,v 1.2 2001-09-05 14:30:27 bird Exp $ */
    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/cvg/glide/gsplash.c,v 1.1 2000-02-25 00:37:41 sandervl Exp $
     21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gsplash.c,v 1.2 2001-09-05 14:30:27 bird Exp $
    2122 ** $Log: gsplash.c,v $
    22  ** Revision 1.1  2000-02-25 00:37:41  sandervl
     23 ** Revision 1.2  2001-09-05 14:30:27  bird
     24 ** Added $Id:$ keyword.
     25 **
     26 ** Revision 1.1  2000/02/25 00:37:41  sandervl
    2327 ** Created Voodoo 2 dir
    2428 **
    25 ** 
     29**
    2630** 26    2/20/98 11:00a Peter
    2731** removed glide3 from glid2 tree
    28 ** 
     32**
    2933** 25    2/17/98 3:21p Peter
    3034** no splash w/o deepth buffer
    31 ** 
     35**
    3236** 24    1/28/98 1:12p Peter
    3337** Stupid swap state form gratuitous splash screen
    34  * 
     38 *
    3539 * 23    1/09/98 6:48p Atai
    3640 * grTexInfo, GR_LOD_* and GR_ASPECT_*
    37  * 
     41 *
    3842 * 21    1/06/98 6:47p Atai
    3943 * undo grSplash and remove gu routines
    40  * 
     44 *
    4145 * 20    12/18/97 2:13p Peter
    4246 * fogTable cataclysm
    43  * 
     47 *
    4448 * 19    12/15/97 5:52p Atai
    4549 * disable obsolete glide2 api for glide3
    46  * 
     50 *
    4751 * 18    12/09/97 10:20a Peter
    4852 * removed extraneous cruft
    49  * 
     53 *
    5054 * 17    11/14/97 5:03p Peter
    5155 * picking up the torch... removed #!@#$% c++ comments
    52  * 
     56 *
    5357 * 16    10/23/97 5:30p Peter
    5458 * packed rgb happiness
    55  * 
     59 *
    5660 * 15    7/31/97 11:14a Peter
    5761 * merge w/ sst1 glide tree, hopefully
    58  * 
     62 *
    5963 * 13    7/07/97 3:05p Dow
    6064 * Moved fouled clears
    61  * 
     65 *
    6266 * 12    3/18/97 9:07p Dow
    6367 * Got rid of #$#%#$ // comments
    64  * 
     68 *
    6569 * 11    3/16/97 12:42a Jdt
    6670 * Removed watcom warning
    67  * 
     71 *
    6872 * 10    3/13/97 10:53p Jdt
    6973 * Rewrote with simple optimizations.  Changed prototype for
    7074 * multi-resolution, and running as a better shameless plug.
    71  * 
     75 *
    7276 * 9     3/13/97 2:52a Jdt
    7377 * Added arguments to splash.
    74  * 
     78 *
    7579 * 8     3/09/97 10:31a Dow
    7680 * Added GR_DIENTRY for di glide functions
    77  * 
     81 *
    7882 * 7     3/01/97 6:24p Jdt
    7983 * Made splash force yorigin.
    80  * 
     84 *
    8185 * 6     1/02/97 1:06p Dow
    8286 * Fixed state bug
    83  * 
     87 *
    8488 * 3     11/17/96 11:16p Garymct
    8589 * Updated grSplash code to set all of the necessary state itself rather
     
    149153  -----------------------------*/
    150154/* xScale, xOffset, yScale, yOffset */
    151 static float viewPort[4] = { 
    152   480.0f, 320.0f, 
    153   480.0f, 240.0f 
     155static float viewPort[4] = {
     156  480.0f, 320.0f,
     157  480.0f, 240.0f
    154158};
    155159
     
    180184  Privates
    181185  -----------------------------*/
    182 static void 
    183 sourceTexture(Texture *texture) 
     186static void
     187sourceTexture(Texture *texture)
    184188{
    185189  static Texture *lastTexture;
     
    199203}
    200204
    201 static GrTexTable_t 
    202 texTableType(GrTextureFormat_t format) 
     205static GrTexTable_t
     206texTableType(GrTextureFormat_t format)
    203207{
    204208  GrTexTable_t rv = (GrTexTable_t)NO_TABLE;
     
    219223}
    220224
    221 static void 
    222 downloadTexture(Texture *texture, Gu3dfInfo *info) 
     225static void
     226downloadTexture(Texture *texture, Gu3dfInfo *info)
    223227{
    224228  texture->info.data        = info->data;
     
    248252}
    249253
    250 static void 
    251 createTextures(void) 
     254static void
     255createTextures(void)
    252256{
    253257  Gu3dfInfo *info;
     
    270274}
    271275
    272 static void 
    273 vecMatMult(float *dstVec, float *srcVec, float *matrix) 
     276static void
     277vecMatMult(float *dstVec, float *srcVec, float *matrix)
    274278{
    275279  dstVec[0] = (srcVec[0] * matrix[0] +
     
    277281               srcVec[2] * matrix[8] +
    278282               matrix[12]);
    279    
     283
    280284  dstVec[1] = (srcVec[0] * matrix[1] +
    281285               srcVec[1] * matrix[5] +
    282286               srcVec[2] * matrix[9] +
    283287               matrix[13]);
    284    
     288
    285289  dstVec[2] = (srcVec[0] * matrix[2] +
    286290               srcVec[1] * matrix[6] +
     
    289293}
    290294
    291 static void 
    292 normMatMult(float *dstVec, float *srcVec, float *matrix) 
     295static void
     296normMatMult(float *dstVec, float *srcVec, float *matrix)
    293297{
    294298  dstVec[0] = (srcVec[0] * matrix[0] +
    295299               srcVec[1] * matrix[4] +
    296300               srcVec[2] * matrix[8]);
    297    
     301
    298302  dstVec[1] = (srcVec[0] * matrix[1] +
    299303               srcVec[1] * matrix[5] +
    300304               srcVec[2] * matrix[9]);
    301    
     305
    302306  dstVec[2] = (srcVec[0] * matrix[2] +
    303307               srcVec[1] * matrix[6] +
     
    305309}
    306310
    307 static void 
    308 xfAndProj(int frame, int obj) 
     311static void
     312xfAndProj(int frame, int obj)
    309313{
    310314  int    vertex;
     
    335339}
    336340
    337 static void 
    338 setupMaterial(int material_index) 
     341static void
     342setupMaterial(int material_index)
    339343{
    340344  switch(material_index) {
     
    363367                     GR_COMBINE_OTHER_TEXTURE,
    364368                     FXFALSE);
    365     } 
     369    }
    366370    break;
    367371  case 1:                       /* fx */
     
    398402}
    399403
    400 static void 
    401 calculateIntensity(int material_index, 
    402                    Vector intensity_factor, 
    403                    int frame) 
     404static void
     405calculateIntensity(int material_index,
     406                   Vector intensity_factor,
     407                   int frame)
    404408{
    405409  switch(material_index) {
     
    437441}
    438442
    439 static void 
    440 drawFaces(int frame, int objnum) 
     443static void
     444drawFaces(int frame, int objnum)
    441445{
    442446  int facenum;
     
    447451  int i;
    448452  FxBool aa_a, aa_b, aa_c;
    449    
     453
    450454  for(facenum = 0; facenum < num_faces[objnum]; facenum++)  {
    451455    material_index = face[objnum][facenum].mat_index;
     
    456460      prev_mat_index = material_index;
    457461    }
    458        
     462
    459463    if((material_index != 0) && (pass == 2))
    460464      continue;
    461          
     465
    462466    aa_a = aa_b = aa_c = FXFALSE;
    463467    if(face[objnum][facenum].aa_edge_flags & 4)
     
    467471    if(face[objnum][facenum].aa_edge_flags & 1)
    468472      aa_c = FXTRUE;
    469        
     473
    470474    for(i = 0; i < 3; i++) {
    471475      float *transformed_vert, *transformed_norm;
     
    473477      int vertnum;
    474478      float factor;
    475            
     479
    476480      vertnum = face[objnum][facenum].v[i];
    477481      transformed_vert = transformed_verts[vertnum];
    478482      transformed_norm = transformed_norms[vertnum];
    479483      v = &vert[objnum][vertnum];
    480            
     484
    481485      gvert[i].x = transformed_vert[0];
    482486      gvert[i].y = transformed_vert[1];
     
    485489      gvert[i].tmuvtx[0].sow = v->s * gvert[i].oow;
    486490      gvert[i].tmuvtx[0].tow = v->t * gvert[i].oow;
    487            
    488       factor = ((light[0] * transformed_norm[0] + 
    489                  light[1] * transformed_norm[1] + 
     491
     492      factor = ((light[0] * transformed_norm[0] +
     493                 light[1] * transformed_norm[1] +
    490494                 light[2] * transformed_norm[2])+ 1.0f) * 127.5f;
    491495
     
    495499      gvert[i].a = 255.0f;
    496500    }
    497        
     501
    498502    if(pass == 2) {
    499503      for(i = 0; i < 3; i++) {
    500504        float *transformed_norm;
    501                
    502         transformed_norm = 
     505
     506        transformed_norm =
    503507          transformed_norms[face[objnum][facenum].v[i]];
    504                
    505         gvert[i].tmuvtx[0].sow = gvert[i].oow * 
     508
     509        gvert[i].tmuvtx[0].sow = gvert[i].oow *
    506510          (128.0f + transformed_norm[0] * 128.0f);
    507         gvert[i].tmuvtx[0].tow = gvert[i].oow * 
     511        gvert[i].tmuvtx[0].tow = gvert[i].oow *
    508512          (128.0f + transformed_norm[1] * 128.0f);
    509                
     513
    510514        gvert[i].r = intensity_factor[0] * 255.0f;
    511515        gvert[i].g = intensity_factor[1] * 255.0f;
    512516        gvert[i].b = intensity_factor[2] * 255.0f;
    513       }                 
    514            
     517      }
     518
    515519      grDrawTriangle(&gvert[0], &gvert[1], &gvert[2]);
    516            
     520
    517521      continue;
    518522    }
    519        
    520     grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, 
     523
     524    grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA,
    521525                         GR_BLEND_ONE, GR_BLEND_ZERO);
    522526    /* Do this if 3D. */
    523527    if(material_index == 0) {
    524528      /*
    525        * Draw the textured 3D without specular. 
     529       * Draw the textured 3D without specular.
    526530       */
    527531      sourceTexture(&textImage);
     
    533537                     FXFALSE);
    534538#endif
    535       grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2], 
     539      grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2],
    536540                       aa_a, aa_b, aa_c);
    537541    } else if(material_index != 1) {
     
    543547                       aa_a, aa_b, aa_c);
    544548    }
    545        
     549
    546550    if(do_phong && (material_index != 0)) {
    547       /* 
     551      /*
    548552       * figure out texture coords in [0..255.0f] based on the normal
    549553       * the specular highlight.
     
    551555      for(i = 0; i < 3; i++) {
    552556        float *transformed_norm;
    553                
    554         transformed_norm = 
     557
     558        transformed_norm =
    555559          transformed_norms[face[objnum][facenum].v[i]];
    556                
    557         gvert[i].tmuvtx[0].sow = gvert[i].oow * 
     560
     561        gvert[i].tmuvtx[0].sow = gvert[i].oow *
    558562          (128.0f + transformed_norm[0] * 128.0f);
    559         gvert[i].tmuvtx[0].tow = gvert[i].oow * 
     563        gvert[i].tmuvtx[0].tow = gvert[i].oow *
    560564          (128.0f + transformed_norm[1] * 128.0f);
    561                
     565
    562566        gvert[i].r = intensity_factor[0] * 255.0f;
    563567        gvert[i].g = intensity_factor[1] * 255.0f;
    564568        gvert[i].b = intensity_factor[2] * 255.0f;
    565       }                 
    566            
    567       grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2], 
     569      }
     570
     571      grAADrawTriangle(&gvert[0], &gvert[1], &gvert[2],
    568572                       aa_a, aa_b, aa_c);
    569573    }
     
    571575}
    572576
    573 static void 
    574 intersectLineWithZPlane(Vector result, Vector p1, 
    575                         Vector p2, float z) 
     577static void
     578intersectLineWithZPlane(Vector result, Vector p1,
     579                        Vector p2, float z)
    576580{
    577581  float t;
    578  
     582
    579583  t = (z - p1[2]) / (p2[2] - p1[2]);
    580584  result[0] = p1[0] + (p2[0] - p1[0]) * t;
     
    583587}
    584588
    585 static float 
    586 vectorMag(float *v) 
     589static float
     590vectorMag(float *v)
    587591{
    588592  return (float)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
    589593}
    590594
    591 static void 
    592 drawShadow(int frame, int shadow_object_index, 
    593            int receiver_object_index, Vector light_position) 
     595static void
     596drawShadow(int frame, int shadow_object_index,
     597           int receiver_object_index, Vector light_position)
    594598{
    595599  float *shadow_object_matrix;
     
    598602  Vector projected_view_verts[4];
    599603  int i;
    600  
     604
    601605  Vector local_verts[4] = {
    602606    { -280.0f, 0.0f, -160.0f },
    603607    { -280.0f, 0.0f,  150.0f },
    604608    {  280.0f, 0.0f,  150.0f },
    605     {  280.0f, 0.0f, -160.0f } 
     609    {  280.0f, 0.0f, -160.0f }
    606610  };
    607  
     611
    608612  float texcoords[4][2] = {
    609613    {  10.5f, 127.5f },
     
    612616    { 255.0f, 127.5f }
    613617  };
    614  
     618
    615619  GrVertex gvert[4];
    616620  GrVertex projected_gvert[4];
    617621  GrVertex light_gvert;
    618  
     622
    619623  /*
    620    * The point relative to the back part of the shield that 
     624   * The point relative to the back part of the shield that
    621625   * the shadow is going to be projected onto.
    622626   */
    623627  Vector shadow_light;
    624  
     628
    625629  shadow_light[0] = light_position[0];
    626630  shadow_light[1] = light_position[1];
    627631  shadow_light[2] = light_position[2];
    628  
     632
    629633  shadow_object_matrix   = &mat[frame][shadow_object_index][0];
    630634  receiver_object_matrix = &mat[frame][receiver_object_index][0];
    631  
     635
    632636  /*
    633    * Offset the light by the Z position of 
     637   * Offset the light by the Z position of
    634638   * the backplane that we are projected
    635639   * onto.
    636640   */
    637641  shadow_light[2] += receiver_object_matrix[14];
    638  
     642
    639643  for(i = 0; i < 4; i++) {
    640644    vecMatMult(view_verts[i], local_verts[i], shadow_object_matrix);
    641        
     645
    642646    /*
    643      * project . . . 
     647     * project . . .
    644648     */
    645649    gvert[i].oow = 1.0f / view_verts[i][2];
    646     gvert[i].x = 
    647       view_verts[i][0] * gvert[i].oow * viewPort[0] + 
     650    gvert[i].x =
     651      view_verts[i][0] * gvert[i].oow * viewPort[0] +
    648652        viewPort[1] + SNAP_BIAS;
    649     gvert[i].y = 
    650       view_verts[i][1] * gvert[i].oow * viewPort[2] + 
     653    gvert[i].y =
     654      view_verts[i][1] * gvert[i].oow * viewPort[2] +
    651655        viewPort[3] + SNAP_BIAS;
    652        
     656
    653657    /*
    654658     * Set up texture coordinates.
     
    657661    gvert[i].tmuvtx[0].tow = texcoords[i][1] * gvert[i].oow;
    658662  }
    659  
    660  
     663
     664
    661665  /*
    662666   * Intersect each line formed by the light source and a
    663    * particular corner of the shadow object with the 
     667   * particular corner of the shadow object with the
    664668   * plane which the texture is to be projected onto.
    665669   */
     
    673677     * hw, probably because some other state is not being correctly
    674678     * setup. This doesn't seem to affect the 'correctness' of the
    675      * splash screen so I'm not investigating it any more. 
     679     * splash screen so I'm not investigating it any more.
    676680     */
    677     projected_gvert[i].r = 
    678     projected_gvert[i].g = 
    679     projected_gvert[i].b = 
     681    projected_gvert[i].r =
     682    projected_gvert[i].g =
     683    projected_gvert[i].b =
    680684    projected_gvert[i].a = 0.0f;
    681685#endif /* GLIDE_PACKED_RGB */
    682        
    683     intersectLineWithZPlane(projected_view_verts[i], 
    684                             shadow_light, 
    685                             view_verts[i], 
     686
     687    intersectLineWithZPlane(projected_view_verts[i],
     688                            shadow_light,
     689                            view_verts[i],
    686690                            receiver_object_matrix[14] - 26.0f);
    687691    projected_gvert[i].oow = 1.0f / projected_view_verts[i][2];
     
    690694    projected_gvert[i].y = (projected_view_verts[i][1] * projected_gvert[i].oow * viewPort[2] +
    691695                            viewPort[3] + SNAP_BIAS);
    692        
     696
    693697    tmpvect[0] = projected_view_verts[i][0] - shadow_light[0];
    694698    tmpvect[1] = projected_view_verts[i][1] - shadow_light[1];
    695699    tmpvect[2] = projected_view_verts[i][2] - shadow_light[2];
    696700    q = vectorMag(tmpvect);
    697        
     701
    698702    /*
    699703     * Set up texture coordinates.
     
    703707    projected_gvert[i].tmuvtx[0].tow = texcoords[i][1] * projected_gvert[i].oow;
    704708  }
    705  
     709
    706710  light_gvert.oow = 1.0f / shadow_light[2];
    707711  light_gvert.x = shadow_light[0] * light_gvert.oow * viewPort[0] + viewPort[1] + SNAP_BIAS;
    708712  light_gvert.y = shadow_light[1] * light_gvert.oow * viewPort[2] + viewPort[3] + SNAP_BIAS;
    709  
     713
    710714  /*
    711715   * Draw a segment between the light and the point which hits
     
    718722                 FXFALSE);
    719723  sourceTexture(&shadowImage);
    720  
     724
    721725  grAlphaBlendFunction(GR_BLEND_DST_COLOR, GR_BLEND_ZERO,
    722726                        GR_BLEND_ONE, GR_BLEND_ZERO);
    723727
    724   grDrawTriangle(&projected_gvert[0], 
    725                  &projected_gvert[1], 
     728  grDrawTriangle(&projected_gvert[0],
     729                 &projected_gvert[1],
    726730                 &projected_gvert[2]);
    727   grDrawTriangle(&projected_gvert[0], 
    728                  &projected_gvert[2], 
     731  grDrawTriangle(&projected_gvert[0],
     732                 &projected_gvert[2],
    729733                 &projected_gvert[3]);
    730   grDrawTriangle(&projected_gvert[0], 
    731                  &projected_gvert[2], 
     734  grDrawTriangle(&projected_gvert[0],
     735                 &projected_gvert[2],
    732736                 &projected_gvert[1]);
    733   grDrawTriangle(&projected_gvert[0], 
    734                  &projected_gvert[3], 
     737  grDrawTriangle(&projected_gvert[0],
     738                 &projected_gvert[3],
    735739                 &projected_gvert[2]);
    736  
     740
    737741  grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO,
    738742                       GR_BLEND_ONE, GR_BLEND_ZERO);
    739  
     743
    740744}
    741745
     
    775779
    776780  /* Check Screen Dimensions and Check Avail of Depth Buffer */
    777   if ((x > gc->state.screen_width) || 
     781  if ((x > gc->state.screen_width) ||
    778782      ((x+w) > gc->state.screen_width) ||
    779783      (y > gc->state.screen_height) ||
    780       ((y+h) > gc->state.screen_height)) 
     784      ((y+h) > gc->state.screen_height))
    781785    return;
    782786
     
    797801    y = ((gc->state.screen_height - 1.0f) - (h-1.0f)) - y;
    798802  }
    799        
     803
    800804  viewPort[0] = w *  (480.0f / 640.0f);
    801805  viewPort[1] = x + (w / 2.0f);
     
    827831                       GR_BLEND_ONE, GR_BLEND_ZERO);
    828832  if (useTextures)
    829     grTexCombine(GR_TMU0, 
     833    grTexCombine(GR_TMU0,
    830834                 GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
    831835                 GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE,
     
    846850  /* grClipWindow((int)x, (int)y, (int)(x+w), (int)(y+h)); */
    847851  grFogColorValue(0x0);
    848  
     852
    849853  fadeInFrames  = (int)(((float)total_num_frames) * FADEIN_END_PERCENT);
    850   fadeOutFrames = (int)(((float)total_num_frames) * 
     854  fadeOutFrames = (int)(((float)total_num_frames) *
    851855                        (1.0f - FADEOUT_BEGIN_PERCENT));
    852856
     
    854858    for(frame = 1; frame < total_num_frames; frame++) {
    855859      int i;
    856            
     860
    857861      /* Set Fog Value For This Frame */
    858862      if(frame < fadeInFrames)  {
    859         unsigned char fval = (((unsigned char)0xFF) - 
     863        unsigned char fval = (((unsigned char)0xFF) -
    860864                              ((unsigned char)(255.0f * (float)(frame + 1) / (float)fadeInFrames)));
    861865        for(i = 0; i < kInternalFogTableEntryCount; i++) fogTable[i] = fval;
     
    864868        fog = 1;
    865869      } else if(frame > total_num_frames-fadeOutFrames) {
    866         unsigned char fval = (((unsigned char)0xFF) - 
    867                               (unsigned char)(255.0f* ((float)(total_num_frames - frame))/ 
     870        unsigned char fval = (((unsigned char)0xFF) -
     871                              (unsigned char)(255.0f* ((float)(total_num_frames - frame))/
    868872                                              ((float)fadeOutFrames)));
    869         for(i = 0; i < kInternalFogTableEntryCount; i++) 
     873        for(i = 0; i < kInternalFogTableEntryCount; i++)
    870874          fogTable[i] = fval;
    871875        grFogMode(GR_FOG_WITH_TABLE);
     
    876880        fog = 0;
    877881      }
    878        
     882
    879883      grBufferClear(0x00000000, 0, GR_WDEPTHVALUE_FARTHEST);
    880        
     884
    881885      pass = 1;
    882886
     
    890894      xfAndProj(frame, 2);
    891895      drawFaces(frame, 2);
    892      
     896
    893897      /* yellow and white part of shield. */
    894898      xfAndProj(frame, 0);
     
    926930  } else {                      /* Render One Frame */
    927931    frame = ((_frame>>1) % SPIN_FRAMES)+SPIN_START;
    928        
     932
    929933    grColorMask(FXFALSE, FXFALSE);
    930934    grBufferClear(0x00000000, 0, GR_WDEPTHVALUE_FARTHEST);
    931935    grColorMask(FXTRUE, FXFALSE);
    932        
     936
    933937    pass = 0xbeef;
    934        
     938
    935939    /* 3Dfx logo */
    936940    xfAndProj(frame, 1);
     
    944948  if (frame == 0) {
    945949    int i;
    946    
     950
    947951    for(i = 0; i < gc->grColBuf; i++) {
    948952      grBufferClear(0x00000000, 0, GR_WDEPTHVALUE_FARTHEST);
     
    950954    }
    951955  }
    952    
     956
    953957  /*
    954958   * Clean up after yourself!
  • trunk/src/opengl/glide/cvg/glide/gsst.c

    r2888 r6653  
     1/* $Id: gsst.c,v 1.2 2001-09-05 14:30:27 bird Exp $ */
    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/cvg/glide/gsst.c,v 1.1 2000-02-25 00:37:41 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gsst.c,v 1.2 2001-09-05 14:30:27 bird Exp $
    2122** $Log: gsst.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:41  sandervl
     23** Revision 1.2  2001-09-05 14:30:27  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:41  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 168   6/30/98 6:08p Jeske
    2731** fixed bug where we tried to setup MTRRs on old (<p6) systems which
    28 ** didn't have them. 
    29 ** 
     32** didn't have them.
     33**
    3034** 167   6/25/98 10:40a Peter
    3135** more cb checks
    32 ** 
     36**
    3337** 166   6/23/98 5:38p Peter
    3438** lfb hinting
    35 ** 
     39**
    3640** 165   6/04/98 12:13p Peter
    3741** splash dll rename
    38 ** 
     42**
    3943** 164   5/20/98 4:37p Peter
    4044** doh
    41 ** 
     45**
    4246** 163   5/20/98 3:51p Peter
    4347** no fifo glide
    44 ** 
     48**
    4549** 162   5/18/98 12:16p Peter
    4650** culling enabling
    47 ** 
     51**
    4852** 161   4/29/98 3:05p Peter
    4953** triple buffering vs grLfbReadRegion
    50 ** 
     54**
    5155** 160   4/21/98 5:53p Peter
    5256** slidetect vs hw pointers
    53 ** 
     57**
    5458** 159   4/09/98 5:24p Peter
    5559** properly re-cache the hw base addresses after a re-init just in case
    5660** the base addresses changed
    57 ** 
     61**
    5862** 158   4/08/98 3:53p Peter
    5963** allow different base addresses
    60 ** 
     64**
    6165** 157   4/06/98 9:55a Peter
    6266** sli slave detection for oem dll
    63 ** 
     67**
    6468** 156   4/01/98 1:52p Peter
    6569** sli origin thing vs grRenderBuffer/synced state when doing dynamic
    6670** loading of the glide dll on sli
    67 ** 
     71**
    6872** 155   3/31/98 6:09p Peter
    6973** sli origin everywhere (I think) and grLfbReadRegion/grRenderBuffer vs
    7074** triple buffering
    71 ** 
     75**
    7276** 154   3/30/98 2:45p Peter
    7377** update default gamma
    74 ** 
     78**
    7579** 153   3/29/98 1:07p Peter
    7680** yet another sli origin thing
    77 ** 
     81**
    7882** 152   3/23/98 5:57p Peter
    7983** warning cleanup
    80 ** 
     84**
    8185** 151   3/20/98 12:45p Atai
    8286** added strapping register in oem boardid field
    83 ** 
     87**
    8488** 150   3/20/98 11:01a Peter
    8589** sli swap interval thing
    86 ** 
     90**
    8791** 149   3/18/98 7:25p Peter
    8892** doh! checked in experiment again
    89 ** 
     93**
    9094** 148   3/18/98 3:04p Peter
    9195** cleaner origin swapping hacks
    92 ** 
     96**
    9397** 147   3/17/98 6:50p Peter
    9498** sli paired vs active
    95 ** 
     99**
    96100** 146   3/17/98 1:57p Atai
    97101** added boardid and requireoemdll registry
    98 ** 
     102**
    99103** 145   3/14/98 1:07p Peter
    100104** mac port happiness
    101 ** 
     105**
    102106** 144   3/13/98 2:57p Atai
    103107** update grSstWinOpen to detect tv connection
    104 ** 
     108**
    105109** 143   3/13/98 1:27p Peter
    106110** removed legacy variables
    107 ** 
     111**
    108112** 142   3/10/98 9:20a Peter
    109113** fixed checkin
    110 ** 
     114**
    111115** 141   3/09/98 2:24p Peter
    112116** change for new pci passthrough interface
    113 ** 
     117**
    114118** 140   3/03/98 9:37p Peter
    115119** more sli origin fun
    116 ** 
     120**
    117121** 139   3/02/98 7:23p Peter
    118122** clear slop on sli systems when changing y origin
    119 ** 
     123**
    120124** 138   2/24/98 10:15a Peter
    121125** oem dll muckage
    122 ** 
     126**
    123127** 137   2/23/98 7:32p Atai
    124128** modify for oem dll
    125 ** 
     129**
    126130** 136   2/20/98 2:16p Peter
    127131** correct error message when failing video init
    128 ** 
     132**
    129133** 135   2/20/98 11:00a Peter
    130134** removed glide3 from glid2 tree
    131 ** 
     135**
    132136** 134   2/20/98 9:05a Peter
    133137** removed remnants of comdex grot
    134 ** 
     138**
    135139** 133   2/19/98 5:10p Peter
    136140** moved passthrough stuff into glide
    137 ** 
     141**
    138142** 132   2/19/98 3:16p Peter
    139143** changes for initVideobuffers
    140 ** 
     144**
    141145** 131   2/17/98 12:39p Peter
    142146** sli monitor detect thing
    143 ** 
     147**
    144148** 130   2/12/98 9:42p Peter
    145149** fixed typo
    146 ** 
     150**
    147151** 129   2/12/98 8:20p Pgj
    148 ** 
     152**
    149153** 128   2/12/98 6:47p Atai
    150154** fix typo
    151 ** 
     155**
    152156** 127   2/12/98 4:01p Atai
    153157** change refresh rate if oemdll updated for tv out
    154 ** 
     158**
    155159** 126   2/12/98 3:40p Peter
    156160** single buffering for opengl
    157 ** 
     161**
    158162** 125   2/11/98 5:25p Peter
    159163** properly turn off caching
    160 ** 
     164**
    161165** 124   2/10/98 4:45p Pgj
    162166** don't require fxoem2x..dll
    163 ** 
     167**
    164168** 123   2/04/98 9:21p Pgj
    165169** don't require fxoem2x.dll for static builds
    166 ** 
     170**
    167171** 122   2/04/98 7:56p Pgj
    168172** DOS sanity
    169 ** 
     173**
    170174** 121   2/04/98 6:57p Atai
    171175** added fxoem2x.dll for cvg
    172 ** 
     176**
    173177** 120   2/02/98 4:41p Peter
    174 ** 
     178**
    175179** 119   1/30/98 4:23p Peter
    176180** renamed curSwapBuf->curRenderBuf for clarity
    177 ** 
     181**
    178182** 118   1/24/98 12:29p Peter
    179183** more caching fun
    180 ** 
     184**
    181185** 117   1/20/98 11:03a Peter
    182186** env var to force triple buffering
    183  * 
     187 *
    184188 * 116   1/16/98 4:18p Atai
    185189 * fixed lfb and grLoadGammaTable
    186  * 
     190 *
    187191 * 115   1/16/98 10:47a Peter
    188192 * fixed idle muckage
    189  * 
     193 *
    190194 * 114   1/16/98 10:16a Atai
    191195 * fixed grSstIldle
    192  * 
     196 *
    193197 * 113   1/10/98 4:01p Atai
    194198 * inititialize vertex layout, viewport, added defines
    195  * 
     199 *
    196200 * 110   1/06/98 6:47p Atai
    197201 * undo grSplash and remove gu routines
    198  * 
     202 *
    199203 * 109   1/06/98 3:53p Atai
    200204 * remove grHint, modify grLfbWriteRegion and grGet
    201  * 
     205 *
    202206 * 107   12/18/97 2:12p Peter
    203207 * grSstControl on v2
    204  * 
     208 *
    205209 * 106   12/17/97 4:48p Peter
    206210 * groundwork for CrybabyGlide
    207  * 
     211 *
    208212 * 105   12/17/97 4:06p Atai
    209213 * added grChromaRange(), grGammaCorrecionRGB(), grRest(), and grGet()
    210214 * functions
    211  * 
     215 *
    212216 * 104   12/16/97 1:33p Atai
    213217 * added grGammaCorrectionRGB()
    214  * 
     218 *
    215219 * 103   12/16/97 10:03a Atai
    216220 * fixed gutexmemreset for glide2
    217  * 
     221 *
    218222 * 101   12/09/97 12:20p Peter
    219223 * mac glide port
    220  * 
     224 *
    221225 * 100   12/05/97 4:26p Peter
    222226 * watcom warnings
    223  * 
     227 *
    224228 * 99    12/03/97 11:35a Peter
    225229 * is busy thing
    226  * 
     230 *
    227231 * 98    11/25/97 12:09p Peter
    228232 * nested calls to grLfbLock vs init code locking on v2
    229  * 
     233 *
    230234 * 97    11/21/97 1:02p Peter
    231235 * v^2 supported resolutions
    232  * 
     236 *
    233237 * 96    11/21/97 11:19a Dow
    234238 * Added RESOLUTION_NONE hack for Banshee
    235  * 
     239 *
    236240 * 95    11/19/97 2:49p Peter
    237241 * env vars in registry for win32
    238  * 
     242 *
    239243 * 94    11/19/97 2:22p Dow
    240244 * gsst.c
    241  * 
     245 *
    242246 * 93    11/18/97 4:50p Peter
    243247 * chipfield stuff cleanup and w/ direct writes
    244  * 
     248 *
    245249 * 92    11/18/97 4:00p Atai
    246250 * fixed the GR_BEGIN and GR_END error in previous check-in
    247  * 
     251 *
    248252 * 91    11/18/97 3:27p Atai
    249  * update vData 
     253 * update vData
    250254 * optimize state monster
    251  * 
     255 *
    252256 * 90    11/17/97 4:55p Peter
    253257 * watcom warnings/chipfield stuff
    254  * 
     258 *
    255259 * 89    11/16/97 2:20p Peter
    256260 * cleanup
    257  * 
     261 *
    258262 * 88    11/15/97 7:43p Peter
    259263 * more comdex silliness
    260  * 
     264 *
    261265 * 87    11/14/97 11:10p Peter
    262266 * open vs hw init confusion
    263  * 
     267 *
    264268 * 86    11/14/97 5:02p Peter
    265269 * more comdex stuff
    266  * 
     270 *
    267271 * 85    11/14/97 4:47p Dow
    268272 * New splash screen
    269  * 
     273 *
    270274 * 84    11/14/97 12:09a Peter
    271275 * comdex thing and some other stuff
    272  * 
     276 *
    273277 * 83    11/12/97 9:37p Dow
    274278 * Banshee crap
    275  * 
     279 *
    276280 * 82    11/12/97 2:27p Peter
    277  * 
     281 *
    278282 * 81    11/12/97 1:09p Dow
    279283 * H3 Stuf
    280  * 
     284 *
    281285 * 80    11/12/97 9:22a Dow
    282286 * H3 Mods
    283  * 
     287 *
    284288 * 79    11/06/97 3:46p Peter
    285289 * sli shutdown problem
    286  * 
     290 *
    287291 * 78    11/06/97 3:38p Dow
    288292 * More banshee stuff
    289  * 
     293 *
    290294 * 77    11/04/97 5:04p Peter
    291295 * cataclysm part deux
    292  * 
     296 *
    293297 * 76    11/04/97 3:58p Dow
    294298 * Banshee stuff
    295  * 
     299 *
    296300 * 75    11/03/97 3:43p Peter
    297301 * h3/cvg cataclysm
    298  * 
     302 *
    299303 * 74    10/29/97 4:59p Peter
    300  * 
     304 *
    301305 * 73    10/29/97 2:45p Peter
    302306 * C version of Taco's packing code
    303  * 
     307 *
    304308 * 72    10/23/97 5:28p Peter
    305309 * sli fifo thing
    306  * 
     310 *
    307311 * 71    10/17/97 3:15p Peter
    308312 * grSstVidMode thingee
    309  * 
     313 *
    310314 * 70    10/14/97 2:44p Peter
    311315 * moved close flag set
    312  * 
     316 *
    313317 * 69    10/09/97 8:02p Dow
    314318 * State Monster 1st Cut
    315  * 
     319 *
    316320**
    317321*/
     
    323327#include <glidesys.h>
    324328
    325 #if (GLIDE_PLATFORM & GLIDE_HW_SST96) 
     329#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
    326330#include <init.h>
    327331#endif
     
    347351  Initialize the selected SST
    348352
    349   Initialization has 4 Steps 
    350 
    351   Video Init - 
     353  Initialization has 4 Steps
     354
     355  Video Init -
    352356     In the full screen case this includes setting the requested
    353      resolution/refresh state and allocating any necessary OS 
    354      resource for the GC. 
     357     resolution/refresh state and allocating any necessary OS
     358     resource for the GC.
    355359
    356360     In the windowed case, this involves acquiring all necessary
    357361     surfaces for rendering, back buffer and memory fifo
    358362
    359      Also perform any work necessary to enable access to 3D 
     363     Also perform any work necessary to enable access to 3D
    360364     registers
    361365
     
    363367     Assuming video registers are in a reset state, initialize
    364368     the appropriate command transport mechanism.  All writes
    365      to hardware prior to this action are direct writes, 
     369     to hardware prior to this action are direct writes,
    366370     afterwards, most commands will go throught the command
    367371     transport
    368372
    369   GC Init - 
     373  GC Init -
    370374     Initialize the current GC based on the user requested
    371375     open parameters and command transport data reported
    372376     during initialization.
    373377
    374   3D State Init - 
    375      Push an initial state onto all of the 3D state registers.   
    376      
     378  3D State Init -
     379     Push an initial state onto all of the 3D state registers.
     380
    377381  Arguments:
    378   hwnd - pointer to a window handle or null.  If NULL, then 
     382  hwnd - pointer to a window handle or null.  If NULL, then
    379383         the application window handle will be inferred though
    380384         the GetActiveWindow() api.
     
    398402  FXTRUE - glide successfully acquired the necessary resources and a
    399403           is ready for rendering
    400   FXFALSE - glide was unsuccessful in getting the necessary resources, 
     404  FXFALSE - glide was unsuccessful in getting the necessary resources,
    401405            or the requested configuration is unavailble on the host
    402406            hardware - any calls to glide rendering routines will result
     
    405409GR_ENTRY(grSstWinOpen, FxBool, (
    406410  FxU32                   hWnd,
    407   GrScreenResolution_t    resolution, 
    408   GrScreenRefresh_t       refresh, 
    409   GrColorFormat_t         format, 
    410   GrOriginLocation_t      origin, 
     411  GrScreenResolution_t    resolution,
     412  GrScreenRefresh_t       refresh,
     413  GrColorFormat_t         format,
     414  GrOriginLocation_t      origin,
    411415  int                     nColBuffers,
    412416  int                     nAuxBuffers))
     
    421425  FxBool tv_swap_board = FXFALSE;
    422426#endif
    423  
     427
    424428  GR_BEGIN_NOFIFOCHECK("grSstWinOpen",80);
    425429  GDBG_INFO_MORE(gc->myLevel,
     
    429433                 nColBuffers, nAuxBuffers);
    430434  GR_CHECK_F(FN_NAME, !gc, "no SST selected as current (gc==NULL)");
    431  
    432 #if (GLIDE_PLATFORM & GLIDE_HW_CVG) 
     435
     436#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
    433437  /* Voodoo^2 has a bug in sli mode where the video cannot really
    434438   * support resolutions less than 512x384 on pc monitors. Rather than
    435439   * saying sli is not fully compatible w/ single board systems the
    436440   * 'solution' is to just not allow these resolutions.
    437    * 
     441   *
    438442   * NB: The current assumption here is taht if the user passes
    439443   * their own video timing structure then they know what the hell
     
    451455
    452456#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    453   GR_CHECK_COMPATABILITY(FN_NAME, 
     457  GR_CHECK_COMPATABILITY(FN_NAME,
    454458                         ((hWnd == 0x00UL) && (GetActiveWindow() == NULL)),
    455459                         "A valid active window or hWnd parameter is required.");
    456460#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
    457461#endif /* (GLIDE_PLATFORM & GLODE_HW_CVG) */
    458  
     462
    459463#if !GLIDE_INIT_HAL
    460464__tryReOpen:
     
    469473  if (!gc->hwInitP) {
    470474    FxU32* sstRegs = NULL;
    471    
     475
    472476    rv = pciOpen();
    473477    if (!rv) {
     
    475479      goto BAILOUT;
    476480    }
    477    
    478     sstRegs = sst1InitMapBoard(_GlideRoot.current_sst); 
     481
     482    sstRegs = sst1InitMapBoard(_GlideRoot.current_sst);
    479483    rv = (sstRegs != NULL);
    480484    if (!rv) {
     
    483487      goto BAILOUT;
    484488    }
    485    
     489
    486490    /* Re-enabled write combining */
    487491    if (_GlideRoot.CPUType >= 6) {
     
    494498      goto BAILOUT;
    495499    }
    496    
     500
    497501    /* Reset up pointers to the various address spaces within the hw
    498502     * since the hw base address can be different from the original
    499      * map board. 
     503     * map board.
    500504     */
    501505    gc->base_ptr  = (FxU32*)HW_BASE_PTR(sstRegs);
     
    503507    gc->lfb_ptr   = (FxU32*)HW_LFB_PTR(sstRegs);
    504508    gc->tex_ptr   = (FxU32*)HW_TEX_PTR(sstRegs);
    505    
     509
    506510    /* Make sure that the sli-slave gets re-initted too.
    507511     *
     
    517521        goto BAILOUT;
    518522      }
    519      
     523
    520524      rv = sst1InitRegisters(sstRegs);
    521525      if (!rv) {
     
    523527        goto BAILOUT;
    524528      }
    525      
     529
    526530      /* Reset up pointers to the various address spaces within the hw
    527531       * since the hw base address can be different from the original
    528        * map board. 
     532       * map board.
    529533       */
    530534      (gc + 1)->base_ptr  = (FxU32*)HW_BASE_PTR(sstRegs);
     
    535539      gc->slave_ptr = sstRegs;
    536540    }
    537    
     541
    538542    gc->hwInitP = FXTRUE;
    539543  } else if (gc->open) {
     
    551555  }
    552556#endif /* !GLIDE_INIT_HAL */
    553  
     557
    554558#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    555559  /*
    556560  ** load fxoem2x.dll and map board
    557561  */
    558   { 
     562  {
    559563    gc->oemInit = NULL;
    560564    rv = sst1InitGetDeviceInfo(gc->reg_ptr, &devInfo);
     
    574578      gc->oemi.fxoemPciWriteConfig = (PciConfigProc)pciSetConfigData;
    575579      gc->oemi.fxoemPciReadConfig = (PciConfigProc)pciGetConfigData;
    576      
     580
    577581      boardIDStr = GETENV("FX_GLIDE_BOARDID");
    578582      boardID = (boardIDStr == NULL) ? 0 : atol(boardIDStr);
     
    612616        }
    613617      }
    614      
     618
    615619      /*
    616       ** oem map board 
     620      ** oem map board
    617621      */
    618622      if (gc->oemInit) {
     
    634638  /*------------------------------------------------------
    635639    Video Init
    636     ------------------------------------------------------*/ 
     640    ------------------------------------------------------*/
    637641#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    638642  /*
    639643  ** initialize video timing data for oemdll
    640644  ** if tv out component exist, the oem dll need to modify the vidtiming
    641   ** data in oemi. Glide will take the changes and pass it to 
     645  ** data in oemi. Glide will take the changes and pass it to
    642646  ** sst1InitVideoBuffers()
    643647  */
     
    676680            tvVidtiming.clkFreq16bpp = gc->oemi.vid.clkFreq16bpp;
    677681            tvVidtiming.clkFreq24bpp = gc->oemi.vid.clkFreq24bpp;
    678             refresh = tvVidtiming.refreshRate  = gc->oemi.vid.refresh; 
     682            refresh = tvVidtiming.refreshRate  = gc->oemi.vid.refresh;
    679683        grSstVidMode(_GlideRoot.current_sst, &tvVidtiming);
    680684      }
     
    688692  {
    689693    GDBG_INFO(gc->myLevel, "  HAL Video Init\n");
    690    
     694
    691695    rv = fxHalInitVideo((SstRegs*)gc->reg_ptr,
    692                         ((resolution == GR_RESOLUTION_NONE) 
     696                        ((resolution == GR_RESOLUTION_NONE)
    693697                         ? GR_RESOLUTION_640x480
    694                          : resolution), 
    695                         refresh, 
     698                         : resolution),
     699                        refresh,
    696700                        NULL);
    697701    if (!rv) goto BAILOUT;
     
    714718   *
    715719   * NB: We cannot fail the allocation on the env settings since the
    716    * user could have messed up and set something ridiculous. 
     720   * user could have messed up and set something ridiculous.
    717721   */
    718722  {
     
    729733                      (curAuxBuffers == nAuxBuffers));
    730734
    731       rv = sst1InitVideoBuffers(gc->reg_ptr, 
    732                                 resolution, refresh, 
     735      rv = sst1InitVideoBuffers(gc->reg_ptr,
     736                                resolution, refresh,
    733737                                ((curColorBuffers == 1) ? 2 : curColorBuffers),
    734738                                curAuxBuffers,
     
    740744      }
    741745    } while(!rv && !triedParamsP);
    742    
     746
    743747    /* Reset the parameters for the possible sli-slave video init and
    744      * internal bookkeeping. 
     748     * internal bookkeeping.
    745749     */
    746750    nColBuffers = curColorBuffers;
     
    755759      goto __errSliExit;
    756760    }
    757    
     761
    758762    rv = sst1InitVideoBuffers(gc->slave_ptr,
    759763                              resolution, refresh,
    760                               nColBuffers, nAuxBuffers, 
     764                              nColBuffers, nAuxBuffers,
    761765                              gc->vidTimings,
    762766                              FXTRUE);
     
    778782    if (oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4"))
    779783      oemInitSetVideo(&gc->oemi);
    780    
     784
    781785    if (oemGet = GetProcAddress(gc->oemInit, "_fxoemGet@12")) {
    782786      oemGet(FX_OEM_TVOUT, 4, &tv_connected);
     
    785789        oemGet(FX_OEM_SLIMASTER, 8, slimaster);
    786790        oemGet(FX_OEM_SLISLAVE, 8, slislave);
    787         if (((FxU32 *)slimaster[1] == gc->slave_ptr) && 
     791        if (((FxU32 *)slimaster[1] == gc->slave_ptr) &&
    788792            ((FxU32 *)slislave[1] == gc->base_ptr))
    789793          tv_swap_board = FXTRUE;
     
    820824    rv = sst1InitGetDeviceInfo(gc->reg_ptr, &devInfo);
    821825    if (!rv) {
    822       GDBG_INFO(gc->myLevel, 
     826      GDBG_INFO(gc->myLevel,
    823827                "  sst1InitGetDeviceInfo failed to determine master monitor connectivness.\n");
    824828      goto __errSliExit;
     
    828832        rv = sst1InitGetDeviceInfo(gc->slave_ptr, &devInfo);
    829833        if (!rv) {
    830           GDBG_INFO(gc->myLevel, 
     834          GDBG_INFO(gc->myLevel,
    831835                    "  sst1InitGetDeviceInfo failed to determine slave monitor connectivness.\n");
    832836          goto __errSliExit;
    833837        }
    834      
     838
    835839        rv = FXTRUE;
    836840        if (devInfo.monitorDetected) {
    837           GDBG_INFO(gc->myLevel, "  Swapping sli slave and master");         
     841          GDBG_INFO(gc->myLevel, "  Swapping sli slave and master");
    838842        } else {
    839843          /* no monitors attached.
     
    841845           */
    842846#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    843           /* 
     847          /*
    844848          ** We need to check the if tv is connected.
    845849          ** If not, then there is no output.
    846850          */
    847           if (tv_swap_board) 
    848             GDBG_INFO(gc->myLevel, "  TV is connected. Swapping sli slave and master");         
    849           else 
     851          if (tv_swap_board)
     852            GDBG_INFO(gc->myLevel, "  TV is connected. Swapping sli slave and master");
     853          else
    850854#endif
    851855          {
     
    859863          rv = FXTRUE;
    860864          goto __errSliExit;
    861         } else 
     865        } else
    862866#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    863867          if (!tv_swap_board)
     
    876880             *
    877881             * NB: The order of the caching changes is relevant here since
    878              * we don't want to waste mtrr's, even briefly. 
     882             * we don't want to waste mtrr's, even briefly.
    879883             */
    880884            if (_GlideRoot.CPUType >= 6) {
     
    891895             * NB: However, we don't do this currently because it requires
    892896             * odd semantics to the calling conventions of the oem dll.
    893              */           
     897             */
    894898#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && 0
    895899            if (gc->oemInit) {
    896               FARPROC oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@4"); 
     900              FARPROC oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@4");
    897901              if (oemRestoreVideo != NULL) oemRestoreVideo(&gc->oemi);
    898902            }
    899903#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
    900            
     904
    901905            gc->hwInitP = FXFALSE;
    902906          }
     
    908912           */
    909913          pciOpen();
    910          
     914
    911915          /* Re-init the new master */
    912916          {
     
    923927              goto __errSliExit;
    924928            }
    925            
     929
    926930            /* Reset up pointers to the various address spaces within the hw
    927931             * since the hw base address can be different from the original
    928              * map board. 
     932             * map board.
    929933             */
    930934            (gc + 1)->base_ptr  = (FxU32*)HW_BASE_PTR(sstRegs);
     
    932936            (gc + 1)->lfb_ptr   = (FxU32*)HW_LFB_PTR(sstRegs);
    933937            (gc + 1)->tex_ptr   = (FxU32*)HW_TEX_PTR(sstRegs);
    934            
     938
    935939            /* We're done setting up the new master's hw */
    936940            (gc + 1)->hwInitP = FXTRUE;
     
    948952        }
    949953      }
    950    
    951       /* Switch the senses of the master and slave in the gc's. 
    952        * 
     954
     955      /* Switch the senses of the master and slave in the gc's.
     956       *
    953957       * NB: This only has to swap the hw addresses since the rest of
    954958       * the information has to be the same in order for the boards to
    955        * be sli-able. 
     959       * be sli-able.
    956960       */
    957961#define SwapPtrVal(__a, __b) do { FxU32* temp = (__a); (__a) = (__b); (__b) = temp; } while(0);
     
    973977         *
    974978         * NB: The order of the caching changes is relevant here since
    975          * we don't want to waste mtrr's, even briefly. 
     979         * we don't want to waste mtrr's, even briefly.
    976980         */
    977981        if (_GlideRoot.CPUType >= 6) {
     
    980984        }
    981985      }
    982    
     986
    983987      /* Save that we swapped teh master sense so that we can
    984988       * restore these settings when we shut down.
     
    988992#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
    989993      /* NB: We need to make sure that the oem structure reflects the
    990        * 'new' sense of the master/slave relationship. 
     994       * 'new' sense of the master/slave relationship.
    991995       */
    992996      gc->oemi.linearAddress = gc->base_ptr;
    993       gc->oemi.slaveAddress = gc->slave_ptr;     
     997      gc->oemi.slaveAddress = gc->slave_ptr;
    994998
    995999      /* re-initialize oem vedio for the board */
     
    10071011   * was detected we will get here straightline. If no monitors are
    10081012   * detected (sli or no) we will get here via an error goto to
    1009    * the label __errSliExit. 
     1013   * the label __errSliExit.
    10101014   */
    10111015__errSliExit:
    1012   if (rv && gc->scanline_interleaved) { 
     1016  if (rv && gc->scanline_interleaved) {
    10131017    rv = sst1InitSli(gc->reg_ptr, gc->slave_ptr);
    10141018    if (!rv) {
     
    10201024     * override the swapInterval for grBufferSwap so that it always
    10211025     * goes w/ vsync. Otherwise it can look bad as the boards swap out
    1022      * of sync w/ each other. 
     1026     * of sync w/ each other.
    10231027     */
    10241028    if (_GlideRoot.environment.swapInterval < 0) _GlideRoot.environment.swapInterval = 1;
     
    10271031  /* Explicitly set the pass through address that the vxd will be
    10281032   * using to toggle the passthrough. In sli mode this is the master,
    1029    * and otherwise it is the card driving the monitor's vidoe. 
     1033   * and otherwise it is the card driving the monitor's vidoe.
    10301034   * Currently, we set this to be a 16mb address space.
    10311035   */
     
    10441048      xres = 320; yres = 200;
    10451049      break;
    1046    
     1050
    10471051    case GR_RESOLUTION_320x240:
    10481052      xres = 320; yres = 240;
    10491053      break;
    1050    
     1054
    10511055    case GR_RESOLUTION_400x256:
    10521056      xres = 400; yres = 256;
     
    10901094      break;
    10911095
    1092     case GR_RESOLUTION_1024x768: 
     1096    case GR_RESOLUTION_1024x768:
    10931097      xres = 1024; yres = 768;
    10941098      break;
     
    11171121  fbStride = 1024;
    11181122
    1119   GDBG_INFO(gc->myLevel, 
     1123  GDBG_INFO(gc->myLevel,
    11201124            "  Video init succeeded. xRes:%.04d yRes:%.04d nCol:%d nAux:%d\n",
    11211125            xres, yres, gc->grColBuf, gc->grAuxBuf);
     
    11271131#if !((GLIDE_PLATFORM & GLIDE_HW_CVG))
    11281132    InitFIFOData fifoInfo;
    1129      
     1133
    11301134    GDBG_INFO(gc->myLevel, "  Command Transport Init\n");
    11311135    rv = initEnableTransport(&fifoInfo);
    1132     if (!rv) goto BAILOUT;     
     1136    if (!rv) goto BAILOUT;
    11331137#endif
    1134      
     1138
    11351139#if ((GLIDE_PLATFORM & GLIDE_HW_H3) || (GLIDE_PLATFORM & GLIDE_HW_CVG))
    11361140    /* Place cmd fifo into fbi memory.  There are actually two
     
    11591163      xTileNum = devInfo.fbiVideoTilesInX;
    11601164#endif
    1161        
     1165
    11621166#if (GLIDE_PLATFORM & GLIDE_HW_CVG) && GLIDE_BLIT_CLEAR
    11631167      {
     
    11671171        gc->hwDep.cvgDep.tileSlopP = ((xTileNum & 0x01) != 0x00);
    11681172        gc->hwDep.cvgDep.xTilePages = (xTileNum >> 1);
    1169        
     1173
    11701174        gc->hwDep.cvgDep.yTileShift = (gc->scanline_interleaved ? 6 : 5);
    11711175
     
    11941198        const FxU32 memEnd = MB2B(gc->fbuf_size);                                 /* size of hw memory */
    11951199        FxU32 maxOffset = ((xTileNum * yres) << 6) * (nColBuffers + nAuxBuffers); /* Bytes for buffers */
    1196        
     1200
    11971201        /* Align on a page boundary */
    11981202        if ((maxOffset & kPageBoundaryMask) != 0x00) {
    11991203          maxOffset = ((maxOffset + kPageBoundarySlop) & ~kPageBoundaryMask);
    12001204        }
    1201        
     1205
    12021206#if GLIDE_USE_DEBUG_FIFO
    12031207        fifoSize = 0x1000UL;
    12041208#else /* !GLIDE_USE_DEBUG_FIFO */
    1205         /* Too much memory claimed for other stuff? */     
     1209        /* Too much memory claimed for other stuff? */
    12061210        fifoSize = MIN(memEnd - maxOffset, (0x01 << 18));
    12071211        rv = (maxOffset < memEnd);
     
    12101214                    maxOffset, memEnd);
    12111215          goto BAILOUT;
    1212         }         
     1216        }
    12131217#endif /* !GLIDE_USE_DEBUG_FIFO */
    1214        
     1218
    12151219        /* Place fifo in hw. Taking all of the remainging memory up to the
    12161220         * byte swizzling bit in the cmd fifo address.
    1217          */         
     1221         */
    12181222        gc->cmdTransportInfo.fifoOffset = memEnd - fifoSize;
    12191223
     
    12221226                              0, /* which fifo - always 0 for cvg */
    12231227                              /* V fifoStart - offset from hw base V */
    1224                               gc->cmdTransportInfo.fifoOffset, 
     1228                              gc->cmdTransportInfo.fifoOffset,
    12251229                              fifoSize, /* size - in bytes */
    12261230                              FXFALSE, /* directExec */
     
    12361240           */
    12371241          FxU32 fifoStart = 0;
    1238          
     1242
    12391243          rv = sst1InitCmdFifo(gc->reg_ptr, FXTRUE,
    12401244                               &fifoStart,
     
    12521256        }
    12531257#endif /* GLIDE_USE_DEBUG_FIFO */
    1254        
     1258
    12551259#if GLIDE_USE_SHADOW_FIFO
    12561260        /* If we're debugging its nice to know what we really wrote
    1257          * into the fifo space, just in case tracing is off. 
     1261         * into the fifo space, just in case tracing is off.
    12581262         */
    12591263        {
     
    12911295        gc->cmdTransportInfo.fifoSize  = fifoSize;
    12921296
    1293         /* Adjust room values. 
     1297        /* Adjust room values.
    12941298         * RoomToEnd needs enough room for the jmp packet since we
    12951299         * never allow the hw to auto-wrap. RoomToRead needs to be
     
    12971301         *
    12981302         * fifoRoom is generally the min of roomToEnd and roomToRead,
    1299          * but we 'know' here that roomToRead < roomToEnd. 
     1303         * but we 'know' here that roomToRead < roomToEnd.
    13001304         */
    13011305        gc->cmdTransportInfo.roomToEnd       = fifoSize - FIFO_END_ADJUST;
    13021306        gc->cmdTransportInfo.fifoRoom        =
    13031307        gc->cmdTransportInfo.roomToReadPtr   =
    1304           gc->cmdTransportInfo.roomToEnd - sizeof(FxU32); 
     1308          gc->cmdTransportInfo.roomToEnd - sizeof(FxU32);
    13051309
    13061310        /* Set initial fifo state. hw read and sw write pointers at
     
    13101314        gc->cmdTransportInfo.fifoRead = HW_FIFO_PTR(FXTRUE);
    13111315
    1312         GDBG_INFO(gc->myLevel, 
     1316        GDBG_INFO(gc->myLevel,
    13131317                  "Fifo Parameters:\n"
    13141318                  "\tStart: 0x%X\n"
     
    13321336
    13331337#if !GLIDE_INIT_HAL && 0
    1334     /* dpc - 24 jan 1998 - FixMe! 
     1338    /* dpc - 24 jan 1998 - FixMe!
    13351339     * This is currently being done in _grDetectResources so that we
    1336      * can match the nt driver semantics in win95. 
     1340     * can match the nt driver semantics in win95.
    13371341     */
    13381342    if (_GlideRoot.CPUType >= 6) {
     
    13441348#endif
    13451349  }
    1346  
     1350
    13471351  /* We're effectively open now */
    13481352  gc->open = FXTRUE;
     
    13621366  gc->lockPtrs[GR_LFB_WRITE_ONLY] = (FxU32)-1;
    13631367  gc->fbStride = fbStride;
    1364  
     1368
    13651369  /* Initialize the read/write registers to all 0 */
    13661370  gc->state.fbi_config.fbzColorPath  = 0;
     
    13821386    FxU32 textureMode = (FxU32)SST_SEQ_8_DOWNLD;
    13831387
    1384     if ((hwConfig->SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_VOODOO) && 
     1388    if ((hwConfig->SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_VOODOO) &&
    13851389        (hwConfig->SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev == 0)) {
    13861390      textureMode = 0;
     
    13991403    gc->state.tmu_config[tmu].evenOdd         = GR_MIPMAPLEVELMASK_BOTH;
    14001404    gc->state.tmu_config[tmu].nccTable        = GR_NCCTABLE_NCC0;
    1401   } 
     1405  }
    14021406
    14031407  /*------------------------------------------------------
    1404     3D State Init 
     1408    3D State Init
    14051409    ------------------------------------------------------*/
    14061410  GDBG_INFO(gc->myLevel, "  3D State Init\n");
    1407   gc->state.fbi_config.fbzMode = (SST_ENRECTCLIP | 
    1408                                   SST_ENZBIAS    | 
     1411  gc->state.fbi_config.fbzMode = (SST_ENRECTCLIP |
     1412                                  SST_ENZBIAS    |
    14091413                                  SST_DRAWBUFFER_BACK);
    1410  
     1414
    14111415  grHints(GR_HINT_ALLOW_MIPMAP_DITHER, 0);
    14121416  grSstOrigin(origin);
    1413   grAlphaBlendFunction(GR_BLEND_ONE , GR_BLEND_ZERO, 
     1417  grAlphaBlendFunction(GR_BLEND_ONE , GR_BLEND_ZERO,
    14141418                       GR_BLEND_ONE, GR_BLEND_ZERO);
    14151419  grAlphaTestFunction(GR_CMP_ALWAYS);
     
    14171421  grChromakeyMode(GR_CHROMAKEY_DISABLE);
    14181422  grConstantColorValue((FxU32) ~0);
    1419   grClipWindow(0, 0, gc->state.screen_width, 
     1423  grClipWindow(0, 0, gc->state.screen_width,
    14201424               gc->state.screen_height);
    14211425  _grColorCombineDelta0Mode(FXFALSE);
     
    14461450    char* str;
    14471451    /*
    1448     ** if we decided to enable gammargb and gammatable, we need to 
     1452    ** if we decided to enable gammargb and gammatable, we need to
    14491453    ** bump the buffer size in GETENV
    14501454    */
     
    15171521    grTexClampMode(GR_TMU2, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP);
    15181522    grTexDetailControl(GR_TMU2, 0, 1, 1.0F);
    1519     grTexFilterMode(GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 
     1523    grTexFilterMode(GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED,
    15201524                    GR_TEXTUREFILTER_POINT_SAMPLED);
    15211525    grTexLodBiasValue(GR_TMU2, 0.0F);
     
    15281532    grTexClampMode(GR_TMU1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP);
    15291533    grTexDetailControl(GR_TMU1, 0, 1, 1.0F);
    1530     grTexFilterMode(GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 
     1534    grTexFilterMode(GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED,
    15311535                    GR_TEXTUREFILTER_POINT_SAMPLED);
    15321536    grTexLodBiasValue(GR_TMU1, 0.0F);
     
    15381542    grTexClampMode(GR_TMU0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP);
    15391543    grTexDetailControl(GR_TMU0, 0, 1, 1.0F);
    1540     grTexFilterMode(GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 
     1544    grTexFilterMode(GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED,
    15411545                    GR_TEXTUREFILTER_POINT_SAMPLED);
    15421546    grTexLodBiasValue(GR_TMU0, 0.0F);
     
    15611565      if (fxSplash = GetProcAddress(newSplash, "_fxSplash@16")) {
    15621566        fxSplash(hWnd, gc->state.screen_width, gc->state.screen_height, nAuxBuffers);
    1563         _GlideRoot.environment.noSplash = 1;       
    1564       } 
     1567        _GlideRoot.environment.noSplash = 1;
     1568      }
    15651569    }
    15661570  }
     
    15691573        /* If it's still 0, then do the old one */
    15701574  if (!_GlideRoot.environment.noSplash) {
    1571     grSplash(0.0f, 0.0f, 
     1575    grSplash(0.0f, 0.0f,
    15721576             (float) gc->state.screen_width,
    15731577             (float) gc->state.screen_height,
     
    15931597  Shutdown has 4 steps
    15941598
    1595   3D Idle 
     1599  3D Idle
    15961600    the 3D engine must be idled to make sure that there are no
    15971601    commands executing in the transport when the registers are
     
    16441648     */
    16451649    sst1InitIdle(gc->reg_ptr);
    1646    
     1650
    16471651    /*--------------------------
    16481652      Command Transport Disable
     
    16551659     */
    16561660    /* When disabling all of the parameters other than sstBase and the
    1657      * enable flag are ignored. 
     1661     * enable flag are ignored.
    16581662     */
    16591663    sst1InitCmdFifo(gc->reg_ptr, FXFALSE, NULL, NULL, NULL, NULL);
    1660    
     1664
    16611665    /*--------------------------
    1662       Video Restore 
     1666      Video Restore
    16631667      --------------------------*/
    16641668    GDBG_INFO(gc->myLevel, "  Restore Video");
     
    16911695    GDBG_INFO(gc->myLevel, "  GC Reset");
    16921696
    1693     /* open and hwInitP are really two different things. 
     1697    /* open and hwInitP are really two different things.
    16941698     *
    16951699     * hwInitP indicates whether the init code mapping/init sequence
    1696      * is active for this hw. 
     1700     * is active for this hw.
    16971701     *
    16981702     * open includes setting up video, command transport, and the
     
    17011705    gc->hwInitP = FXFALSE;
    17021706    if (gc->scanline_interleaved) (gc + 1)->hwInitP = FXFALSE;
    1703      
     1707
    17041708    /* If we swapped the monitor sense on open then switch these
    17051709     * back so that any later re-mappings of the board are in sync
    1706      * w/ the init code's mappings. 
     1710     * w/ the init code's mappings.
    17071711     */
    17081712    if (gc->swapMasterSenseP) {
     
    17191723        (gc + 1)->slave_ptr = NULL;
    17201724      }
    1721      
     1725
    17221726      gc->swapMasterSenseP = FXFALSE;
    17231727    }
     
    17331737  }
    17341738  gc->open = FXFALSE;
    1735    
     1739
    17361740  GR_END();
    17371741#undef FN_NAME
    17381742} /* grSstWinClose */
    17391743
    1740 GR_ENTRY(grSstControl, FxBool, (GrControl_t code)) 
     1744GR_ENTRY(grSstControl, FxBool, (GrControl_t code))
    17411745{
    17421746  GR_DCL_GC;
    1743 #define FN_NAME "grSstControl" 
     1747#define FN_NAME "grSstControl"
    17441748  GDBG_INFO(41, "%s:  code = 0x%x, windowsInit = %d\n", FN_NAME,
    17451749            code, _GlideRoot.windowsInit);
    1746  
     1750
    17471751  if (_GlideRoot.windowsInit && gc->open) {
    17481752#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
    17491753    /* For VG96, windows haven't been created, so there's no point
    1750      * trying to control it. 
     1754     * trying to control it.
    17511755     */
    1752    
     1756
    17531757    /* Believe it or not, the following code really should be bracketed
    17541758       like this.  The reason is that GR_BEGIN_NOFIFOCHECK seg faults
     
    17611765      xRes, yRes,
    17621766      clipLeftRight, clipBottomTop;
    1763    
     1767
    17641768    GR_BEGIN_NOFIFOCHECK(FN_NAME,80);
    1765    
     1769
    17661770    xRes = initControl(code);
    1767    
     1771
    17681772    GDBG_INFO((80, "%s:  initControl returned 0x%x\n", FN_NAME, xRes));
    17691773
    17701774    if (!xRes) return FXFALSE;
    1771  
     1775
    17721776    yRes = xRes >> 16;
    17731777    xRes = xRes & 0xffff;
    1774  
     1778
    17751779    /* !! FIXME +++ this call should properly update the gc->fbStride,
    17761780       this information is known only to the init layer and needs to be
    17771781       exposed, it is only really necessary to lfblock right now,
    17781782       and therefore is returned by initGetBufferPtr */
    1779  
     1783
    17801784    gc->state.screen_width = xRes;
    17811785    gc->state.screen_height = yRes;
    17821786
    17831787    /* Wait for Idle. */
    1784  
     1788
    17851789    nTries = 0;
    17861790    do {
    17871791      if (nTries++ > 999) {
    1788         GDBG_INFO((80, "%s:  returning FALSE after %d checks for idle\n", 
     1792        GDBG_INFO((80, "%s:  returning FALSE after %d checks for idle\n",
    17891793                   FN_NAME, nTries));
    17901794        return FXFALSE;
     
    17921796
    17931797      status = GET(hw->status);
    1794        
     1798
    17951799    } while (status & 0x1);
    17961800
     
    18341838
    18351839    }
    1836 #endif   
     1840#endif
    18371841  }
    18381842
    18391843  GDBG_INFO(41, "%s:  Returning TRUE\n", FN_NAME);
    1840   return FXTRUE; 
     1844  return FXTRUE;
    18411845#undef FN_NAME
    18421846} /* grSstControl */
     
    18441848/*---------------------------------------------------------------------------
    18451849**  grSstPerfStats
    1846 */ 
     1850*/
    18471851GR_ENTRY(grSstPerfStats, void, (GrSstPerfStats_t *pStats))
    18481852{
     
    18871891  {
    18881892    const FxU32 stat = GR_GET(hw->status);
    1889    
     1893
    18901894    GDBG_INFO(84,"grSstStatus() => 0x%x\n", stat);
    1891    
     1895
    18921896    return stat;
    18931897  }
     
    19471951  /* dpc - 22 may 1997 - FixMe!
    19481952   * Seems like the simplest way to do it, but is this really the way
    1949    * to do it? 
     1953   * to do it?
    19501954   */
    19511955  if (nopP) {
     
    20102014    fbzMode &= ~(SST_YORIGIN);
    20112015
    2012   /* dpc - 22 may 1997 - FixMe! 
     2016  /* dpc - 22 may 1997 - FixMe!
    20132017   * Do we need to do anything here for the HAL?
    20142018   */
     
    20182022   * need to do here?
    20192023   *
    2020    * initOrigin(origin); 
     2024   * initOrigin(origin);
    20212025   */
    20222026#endif
  • trunk/src/opengl/glide/cvg/glide/gstrip.c

    r2888 r6653  
     1/* $Id: gstrip.c,v 1.2 2001-09-05 14:30:28 bird Exp $ */
    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/cvg/glide/gstrip.c,v 1.1 2000-02-25 00:37:41 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gstrip.c,v 1.2 2001-09-05 14:30:28 bird Exp $
    2122** $Log: gstrip.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:41  sandervl
     23** Revision 1.2  2001-09-05 14:30:28  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:41  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 19    12/12/97 12:43p Atai
    2731 * move i and dateElem into the set up loop
    28  * 
     32 *
    2933 * 17    12/08/97 10:38a Atai
    3034 * added grDrawVertexArrayLinear()
    31  * 
     35 *
    3236 * 16    11/21/97 6:05p Atai
    3337 * use one datalist (tsuDataList) in glide3
    34  * 
     38 *
    3539 * 15    11/06/97 6:10p Atai
    3640 * update GrState size
    3741 * rename grDrawArray to grDrawVertexArray
    3842 * update _grDrawPoint and _grDrawVertexList
    39  * 
     43 *
    4044 * 14    11/04/97 6:35p Atai
    4145 * 1. sync with data structure changes
    4246 * 2. break up aa triangle routine
    43  * 
     47 *
    4448 * 13    11/04/97 4:57p Atai
    4549 * use byte offset
    46  * 
     50 *
    4751 * 12    11/03/97 3:43p Peter
    4852 * h3/cvg cataclysm
    49  * 
     53 *
    5054 * 11    10/17/97 2:11p Atai
    5155 * added grContinueArray. We only support non aa mode for now.
    52  * 
     56 *
    5357 * 10    10/16/97 1:50p Atai
    5458 * fix drawarray bugs
    55  * 
     59 *
    5660 * 9     10/14/97 6:16p Atai
    5761 * reverse triangle order in _grAADrawVertexList
    58  * 
     62 *
    5963 * 8     10/14/97 5:41p Atai
    6064 * added _grAADrawVertexList()
    61  * 
     65 *
    6266 * 7     10/14/97 4:57p Dow
    6367 * Clamping
    64  * 
     68 *
    6569 * 6     10/09/97 8:02p Dow
    6670 * State Monster 1st Cut
    67  * 
     71 *
    6872 * 5     10/08/97 11:32a Peter
    6973 * pre-computed packet headers for packet 3
    70  * 
     74 *
    7175 * 4     9/29/97 1:26p Dow
    7276 * Fixed packed color strips/fans
    73  * 
     77 *
    7478 * 3     9/26/97 10:24a Dow
    7579 * Fixed state Muckage in Glide3 parameter data
    76  * 
     80 *
    7781 * 2     9/23/97 2:35p Dow
    7882 * One less loop
    79  * 
     83 *
    8084 * 1     9/23/97 2:04p Dow
    8185 * DD code for strips
     
    98102        Sends a triangle strip to CVG.
    99103  Arguments:
    100  
     104
    101105  Return:
    102106  -------------------------------------------------------------------*/
     
    150154        FxU32 i, dataElem;
    151155        float *vPtr;
    152        
     156
    153157        vPtr = pointers;
    154158        if (mode)
    155159          vPtr = *(float **)vPtr;
    156160        (float *)pointers += stride;
    157        
     161
    158162        TRI_SETF(FARRAY(vPtr, GR_VERTEX_X_OFFSET << 2));
    159163        dataElem = 0;
     
    177181     */
    178182    float oow;
    179    
     183
    180184    while (count > 0) {
    181185      FxI32 k, vcount = count >= 15 ? 15 : count;
     
    184188      for (k = 0; k < vcount; k++) {
    185189        float *vPtr;
    186        
     190
    187191        vPtr = pointers;
    188192        if (mode)
     
    215219  Sends an aa triangle strip/fan to CVG.
    216220  Arguments:
    217  
     221
    218222  Return:
    219223  -------------------------------------------------------------------*/
     
    259263        _grAADrawTriangles(1, type, 3, v);
    260264      else
    261         _grAAVpDrawTriangles(1, type, 3, v);   
     265        _grAAVpDrawTriangles(1, type, 3, v);
    262266    }
    263267  }
     
    275279        }
    276280      }
    277       else { 
     281      else {
    278282        if (mode) {
    279283          v[0] = *(float **)pointers;
     
    289293        _grAADrawTriangles(1, type, 3, v);
    290294      else
    291         _grAAVpDrawTriangles(1, type, 3, v);   
     295        _grAAVpDrawTriangles(1, type, 3, v);
    292296      (float *)pointers += stride;
    293297      flip = ~flip;
  • trunk/src/opengl/glide/cvg/glide/gtex.c

    r2888 r6653  
     1/* $Id: gtex.c,v 1.2 2001-09-05 14:30:28 bird Exp $ */
    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/cvg/glide/gtex.c,v 1.1 2000-02-25 00:37:42 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gtex.c,v 1.2 2001-09-05 14:30:28 bird Exp $
    2122** $Log: gtex.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:42  sandervl
     23** Revision 1.2  2001-09-05 14:30:28  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:42  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 42    6/24/98 5:19p Peter
    2731** cleanedup version merged w/ banshee
    28 ** 
     32**
    2933** 41    6/23/98 5:39p Peter
    3034** gary's trilinear hell bug
    31 ** 
     35**
    3236** 40    6/06/98 12:06p Peter
    3337** gmt's trilinear hell bug
    34 ** 
     38**
    3539** 39    5/18/98 12:14p Peter
    3640** crybaby check in grTexCombine
    37 ** 
     41**
    3842** 38    5/07/98 4:12p Peter
    3943** lbe texture thing
    40 ** 
     44**
    4145** 37    4/16/98 3:54p Peter
    4246** 1x1 lod fix, sorry John
    43 ** 
     47**
    4448** 36    4/01/98 1:51p Peter
    4549** fixed resetting unused tmu muckage
    46 ** 
     50**
    4751** 35    3/13/98 1:27p Peter
    4852** lodDither vs tri-linear
    49 ** 
     53**
    5054** 34    2/20/98 5:31p Peter
    5155** crybaby glide
    52 ** 
     56**
    5357** 33    2/20/98 11:00a Peter
    5458** removed glide3 from glid2 tree
    55  * 
     59 *
    5660 * 32    1/13/98 12:42p Atai
    5761 * fixed grtexinfo, grVertexLayout, and draw triangle
    58  * 
     62 *
    5963 * 31    1/09/98 6:48p Atai
    6064 * grTexInfo, GR_LOD_* and GR_ASPECT_*
    61  * 
     65 *
    6266 * 30    1/08/98 7:09p Peter
    6367 * real hw stuff modulo makefile change
    64  * 
     68 *
    6569 * 29    1/08/98 4:58p Atai
    6670 * tex table broadcast, grVertexLayout enable/disable, stq, and some
    6771 * defines
    68  * 
     72 *
    6973 * 28    1/07/98 10:22a Peter
    7074 * lod dithering env var
    71  * 
     75 *
    7276 * 27    1/05/98 6:06p Atai
    7377 * glide extension stuff
    74  * 
     78 *
    7579 * 26    12/18/97 10:52a Atai
    7680 * fixed grGet(GR_VIDEO_POS)
    77  * 
     81 *
    7882 * 25    12/17/97 4:45p Peter
    7983 * groundwork for CrybabyGlide
    80  * 
     84 *
    8185 * 24    12/11/97 4:15p Peter
    8286 * fixed assertions
    83  * 
     87 *
    8488 * 23    12/05/97 4:26p Peter
    8589 * watcom warnings
    86  * 
     90 *
    8791 * 22    11/20/97 6:57p Dow
    8892 * baseaddress for banshee
    89  * 
     93 *
    9094 * 21    11/18/97 4:36p Peter
    9195 * chipfield stuff cleanup and w/ direct writes
    92  * 
     96 *
    9397 * 20    11/17/97 4:55p Peter
    9498 * watcom warnings/chipfield stuff
    95  * 
     99 *
    96100 * 19    11/03/97 3:43p Peter
    97101 * h3/cvg cataclysm
    98  * 
     102 *
    99103 * 18    9/15/97 7:31p Peter
    100104 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    101105 * place, lfb's are on, Hmmmm.. probably more
    102  * 
     106 *
    103107 * 17    9/05/97 12:31p Peter
    104108 * more reg write grouping
    105  * 
     109 *
    106110 * 16    7/08/97 2:48p Peter
    107  * 
     111 *
    108112 * 15    6/06/97 10:47a Peter
    109113 * texture downloading, fixed 640x480 dimension, changed cvg dep to be the
    110114 * same as sst1
    111  * 
     115 *
    112116 * 14    5/27/97 1:16p Peter
    113  * Basic cvg, w/o cmd fifo stuff. 
    114  * 
     117 * Basic cvg, w/o cmd fifo stuff.
     118 *
    115119 * 13    5/21/97 6:05a Peter
    116  * 
     120 *
    117121 * 12    3/04/97 9:08p Dow
    118  * 
     122 *
    119123 * 11    3/03/97 10:58a Jdt
    120124 * Fixe for 2-pass trilinear
    121  * 
     125 *
    122126 * 10    12/23/96 1:37p Dow
    123127 * chagnes for multiplatform glide
     
    142146 * we have multiple tmu's, but this state is really setup across
    143147 * multiple calls (grTexCombine, grTexMipMapMode, and
    144  * grTexSource). 
    145  * 
     148 * grTexSource).
     149 *
    146150 * NB: This must be called after the shadows are updated because
    147151 * _grTexCheckTriLinear() will use the shadow register values
    148  * to determine the current state of trilinearness. 
     152 * to determine the current state of trilinearness.
    149153 *
    150154 * FixMe: This should eventually get merged in w/ the texture
     
    180184     * of teh tmu's together to get the correct effect. Within this
    181185     * state there are two sub-states: two-pass trilinear and single
    182      * pass using both tmu's w/ split levels. 
     186     * pass using both tmu's w/ split levels.
    183187     *
    184188     * Case 1 - TMU set for lod blending and has both even/odd levels
     
    186190    if (((curTmu->textureMode & SST_TRILINEAR) == SST_TRILINEAR) &&
    187191        (curTmu->evenOdd == GR_MIPMAPLEVELMASK_BOTH)) {
    188      
     192
    189193      /* Check the 'other' tmu to see if it is active, if not then we
    190194       * are doing two pass trilinear so check that we have the
     
    200204                                 ? SST_LOD_ODD
    201205                                 : 0);
    202        
     206
    203207        GDBG_INFO(gc->myLevel, FN_NAME": Two-pass trilinear fixup (0x%X) : tLOD : (0x%X : 0x%X)\n",
    204208                  tmu, curTmu->tLOD, ((curTmu->tLOD & ~SST_MIPMAP_LEVEL_MASK) | levelMask));
    205        
     209
    206210        GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
    207         GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD, 
     211        GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD,
    208212               ((curTmu->tLOD & ~SST_MIPMAP_LEVEL_MASK) | levelMask));
    209213        GR_CHECK_SIZE();
     
    214218         * two tmu's. There are basically three cases based on what
    215219         * the user might have already set on the other tmu.
    216          */       
     220         */
    217221        if (((tmu0->textureMode & SST_TC_BLEND) == SST_TC_BLEND) &&
    218222            ((tmu1->textureMode & SST_TC_REPLACE) == SST_TC_REPLACE)) {
    219223          FxU32  evenOdd[GLIDE_NUM_TMU];
    220224          FxU32* curEvenOdd = evenOdd + tmu;
    221          
     225
    222226          {
    223227            FxU32 i;
    224            
     228
    225229            for(i = 0; i < GLIDE_NUM_TMU; i++) {
    226230              evenOdd[i] = gc->state.tmu_config[i].tLOD & SST_LOD_ODD;
    227231            }
    228232          }
    229              
     233
    230234          /* 1 - The other tmu already has the even levels. */
    231235          if ((otherTmu->evenOdd == GR_MIPMAPLEVELMASK_EVEN) &&
     
    244248          /* 3 - The other tmu already has both the levels. If the
    245249           * downstream tmu's factor is lodFrac then the upstream tmu
    246            * needs to be (1 - lodFrac) and vice-versa. 
     250           * needs to be (1 - lodFrac) and vice-versa.
    247251           */
    248252          if (otherTmu->evenOdd == GR_MIPMAPLEVELMASK_BOTH) {
     
    265269            GR_SET_EXPECTED_SIZE((sizeof(FxU32) << 1), 2);
    266270            {
    267               GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD, 
     271              GR_SET(eChipTMU0, SST_TMU(hw, 0), tLOD,
    268272                     ((tmu0->tLOD & ~SST_MIPMAP_LEVEL_MASK) | evenOdd[0]));
    269               GR_SET(eChipTMU1, SST_TMU(hw, 1), tLOD, 
     273              GR_SET(eChipTMU1, SST_TMU(hw, 1), tLOD,
    270274                     ((tmu1->tLOD & ~SST_MIPMAP_LEVEL_MASK) | evenOdd[1]));
    271275            }
     
    276280    }
    277281  }
    278  
     282
    279283  GR_END();
    280284#undef FN_NAME
     
    284288** grTexClampMode
    285289*/
    286 GR_ENTRY(grTexClampMode, void, 
    287          (GrChipID_t tmu, 
     290GR_ENTRY(grTexClampMode, void,
     291         (GrChipID_t tmu,
    288292          GrTextureClampMode_t s_clamp_mode, GrTextureClampMode_t t_clamp_mode))
    289293{
     
    296300  GDBG_INFO_MORE(gc->myLevel,"(%d, %d,%d)\n",tmu,s_clamp_mode,t_clamp_mode);
    297301  GR_CHECK_TMU(FN_NAME, tmu);
    298  
     302
    299303  texturemode  = gc->state.tmu_config[tmu].textureMode;
    300304  texturemode &= ~(SST_TCLAMPS | SST_TCLAMPT);
     
    310314** grTexCombine
    311315*/
    312 GR_ENTRY(grTexCombine, void, 
     316GR_ENTRY(grTexCombine, void,
    313317         (GrChipID_t tmu,
    314           GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, 
    315           GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, 
     318          GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor,
     319          GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor,
    316320          FxBool rgb_invert, FxBool alpha_invert))
    317321{
     
    325329  GR_BEGIN_NOFIFOCHECK("grTexCombine",88);
    326330  GDBG_INFO_MORE(gc->myLevel,"(%d, %d,%d, %d,%d, %d,%d)\n",
    327                  tmu, rgb_function, rgb_factor, 
     331                 tmu, rgb_function, rgb_factor,
    328332                 alpha_function, alpha_factor,
    329333                 rgb_invert, alpha_invert);
     
    356360                          ((alpha_factor & 0x07UL) == GR_COMBINE_FACTOR_LOD_FRACTION)),
    357361                         "Incompatible texture combine factors (rgb vs alpha) based on lod");
    358  
     362
    359363  texturemode = gc->state.tmu_config[tmu].textureMode;
    360364  texturemode &= ~(SST_TCOMBINE | SST_TACOMBINE);
     
    363367
    364368  /* tmuMask tells grColorCombineFunction what to turn off an on if
    365    * the ccFunc requires texture mapping 
     369   * the ccFunc requires texture mapping
    366370   */
    367371  tmuMask = GR_TMUMASK_TMU0 << tmu;
     
    444448    break;
    445449  }
    446  
     450
    447451  switch (alpha_function) {
    448452  case GR_COMBINE_FUNCTION_ZERO:
     
    503507    break;
    504508  }
    505  
     509
    506510  /* Hack to enable TWO-PASS Trilinear */
    507511  if (texturemode & SST_TRILINEAR) {
     
    532536      if (localColorP && localAlphaP) {
    533537        SstRegs* tmuHw = SST_TMU(hw, upstreamTmu);
    534        
     538
    535539        GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
    536540        GR_SET((0x02UL << upstreamTmu), tmuHw, tLOD, SST_TLOD_MINMAX_INT(GR_LOD_1, GR_LOD_1));
    537541        GR_CHECK_SIZE();
    538        
     542
    539543        gc->hwDep.cvgDep.tmuLodDisable[upstreamTmu] = FXTRUE;
    540        
    541         GDBG_INFO(gc->myLevel, FN_NAME": Disabling tmu(%ld) : (0x%X : 0x%X)\n", 
     544
     545        GDBG_INFO(gc->myLevel, FN_NAME": Disabling tmu(%ld) : (0x%X : 0x%X)\n",
    542546                  upstreamTmu, rgb_function, alpha_function);
    543547      } else if (gc->hwDep.cvgDep.tmuLodDisable[upstreamTmu]) {
    544548        SstRegs* tmuHw = SST_TMU(hw, upstreamTmu);
    545        
     549
    546550        GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
    547551        GR_SET((0x02UL << upstreamTmu), tmuHw, tLOD, gc->state.tmu_config[upstreamTmu].tLOD);
    548552        GR_CHECK_SIZE();
    549        
     553
    550554        gc->hwDep.cvgDep.tmuLodDisable[upstreamTmu] = FXFALSE;
    551555      }
     
    564568  {
    565569    SstRegs* tmuHw = SST_TMU(hw, tmu);
    566    
     570
    567571    REG_GROUP_BEGIN((0x02 << tmu), textureMode, 2, 0x3);
    568572    {
     
    577581   * we have multiple tmu's, but this state is really setup across
    578582   * multiple calls (grTexCombine, grTexMipMapMode, and
    579    * grTexSource). 
    580    * 
     583   * grTexSource).
     584   *
    581585   * NB: This must happen after the shadows are updated because
    582586   * _grTexCheckTriLinear() will use the shadow register values
     
    613617*/
    614618
    615 GR_ENTRY(grTexFilterMode, void, 
     619GR_ENTRY(grTexFilterMode, void,
    616620         (GrChipID_t tmu, GrTextureFilterMode_t minfilter, GrTextureFilterMode_t magfilter))
    617621{
     
    639643*/
    640644
    641 GR_ENTRY(grTexLodBiasValue, void, 
     645GR_ENTRY(grTexLodBiasValue, void,
    642646         (GrChipID_t tmu, float fvalue))
    643647{
    644648#define FN_NAME "grTexLodBiasValue"
    645649  FxU32 tLod;
    646  
     650
    647651  GR_BEGIN("grTexLodBiasValue",88,4, 1);
    648652  GDBG_INFO_MORE(gc->myLevel,"(%d,%g)\n",tmu,fvalue);
    649653  GR_CHECK_TMU(FN_NAME, tmu);
    650  
     654
    651655  tLod = gc->state.tmu_config[tmu].tLOD;
    652656  tLod &= ~(SST_LODBIAS);
     
    667671  Description:
    668672    Sets the mip map mode for the specified TMU
    669     "Ex" because glide's grTexMipMapMode is inadequate for 
     673    "Ex" because glide's grTexMipMapMode is inadequate for
    670674    low level texture memory management
    671675  Arguments:
    672676    tmu       - tmu to update
    673     mmMode   - mipmap mode 
     677    mmMode   - mipmap mode
    674678      One of:
    675679        GR_MIPMAP_DISABLE
     
    683687  -------------------------------------------------------------------*/
    684688
    685 GR_ENTRY(grTexMipMapMode, void, 
     689GR_ENTRY(grTexMipMapMode, void,
    686690         (GrChipID_t tmu, GrMipMapMode_t mmMode, FxBool lodBlend))
    687691{
     
    726730  case GR_MIPMAP_NEAREST:
    727731    /*----------------------------------------------------------
    728       Set LODMIN and LODMAX in the tLod register to the 
     732      Set LODMIN and LODMAX in the tLod register to the
    729733      actual min and max LODs of the current texture.
    730734      ----------------------------------------------------------*/
     
    752756    full textures.  The assumption here is that the only reason
    753757    you would ever set up Multiply by LODFRAC w/o REVERSE BLEND
    754     is for the ODD pass of trilinear. 
     758    is for the ODD pass of trilinear.
    755759    --------------------------------------------------------------*/
    756760  if (lodBlend) {
    757761    /* If we're doing trilinear for real then nuke the lod dithering
    758      * at the same time because it just looks bad. 
     762     * at the same time because it just looks bad.
    759763     */
    760764    texMode = ((texMode & ~SST_TLODDITHER) | SST_TRILINEAR);
     
    767771  }
    768772  tLod |= _gr_evenOdd_xlate_table[gc->state.tmu_config[tmu].evenOdd];
    769  
     773
    770774  /*--------------------------------------------------------------
    771775    Write State To Hardware and Update Glide Shadow State
     
    786790   * we have multiple tmu's, but this state is really setup across
    787791   * multiple calls (grTexCombine, grTexMipMapMode, and
    788    * grTexSource). 
    789    * 
     792   * grTexSource).
     793   *
    790794   * NB: This must happen after the shadows are updated because
    791795   * _grTexCheckTriLinear() will use the shadow register values
     
    830834  -------------------------------------------------------------------*/
    831835
    832 GR_ENTRY(grTexNCCTable, void, 
     836GR_ENTRY(grTexNCCTable, void,
    833837         (GrChipID_t tmu, GrNCCTable_t table))
    834838{
    835839#define FN_NAME "grTexNCCTable"
    836840  FxU32 texMode;
    837  
     841
    838842  GR_BEGIN("grTexNCCTable",88,4, 1);
    839843  GDBG_INFO_MORE(gc->myLevel,"(%d)\n",tmu);
     
    845849    ------------------------------------------------------------------*/
    846850  gc->state.tmu_config[tmu].nccTable = table;
    847  
     851
    848852  /*------------------------------------------------------------------
    849853    Grab shadow texMode, update TexMode, update shadow/real register
     
    853857  if (table == GR_TEXTABLE_NCC1)
    854858    texMode |= SST_TNCCSELECT;
    855   else 
     859  else
    856860    texMode &= ~(SST_TNCCSELECT);
    857861
     
    877881                the selected texture
    878882                One of:
    879                   GR_MIPMAPLEVELMASK_EVEN 
     883                  GR_MIPMAPLEVELMASK_EVEN
    880884                  GR_MIPMAPLEVELMASK_ODD
    881885                  GR_MIPMAPLEVELMASK_BOTH
     
    885889    none
    886890  -------------------------------------------------------------------*/
    887 GR_ENTRY(grTexSource, void, 
     891GR_ENTRY(grTexSource, void,
    888892         (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info))
    889893{
     
    894898  GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x,%d,0x%x)\n",tmu,startAddress,evenOdd,info);
    895899  GR_CHECK_TMU(FN_NAME, tmu);
    896   GR_CHECK_COMPATABILITY(FN_NAME, 
    897                          startAddress >= gc->tmu_state[tmu].total_mem, 
     900  GR_CHECK_COMPATABILITY(FN_NAME,
     901                         startAddress >= gc->tmu_state[tmu].total_mem,
    898902                         "invalid startAddress");
    899903
    900904  GR_CHECK_COMPATABILITY(FN_NAME,
    901                          (startAddress + grTexTextureMemRequired(evenOdd, info) >= 
     905                         (startAddress + grTexTextureMemRequired(evenOdd, info) >=
    902906                          gc->tmu_state[tmu].total_mem),
    903907                         "insufficient texture ram at startAddress");
    904908  GR_CHECK_F(FN_NAME, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid");
    905909  GR_CHECK_F(FN_NAME, !info, "invalid info pointer");
    906  
     910
    907911  /*-------------------------------------------------------------
    908912    Update Texture Unit State
     
    910914  gc->state.tmu_config[tmu].smallLod = info->smallLod;
    911915  gc->state.tmu_config[tmu].largeLod = info->largeLod;
    912   gc->state.tmu_config[tmu].evenOdd  = evenOdd; 
    913  
     916  gc->state.tmu_config[tmu].evenOdd  = evenOdd;
     917
    914918  /*-------------------------------------------------------------
    915919    Calculate Base Address
     
    924928  baseAddress += 0x200000;
    925929#endif
    926  
     930
    927931  /*-------------------------------------------------------------
    928932    Update Texture Mode
     
    931935  texMode &= ~SST_TFORMAT;
    932936  texMode |= (info->format << SST_TFORMAT_SHIFT) | SST_TPERSP_ST | SST_TCLAMPW;
    933  
     937
    934938  /*-------------------------------------------------------------
    935939    Compute TLOD (keep LODBIAS in tact)
    936940    -------------------------------------------------------------*/
    937941  tLod = gc->state.tmu_config[tmu].tLOD;
    938   tLod &= ~(SST_LODMIN | 
    939             SST_LODMAX | 
     942  tLod &= ~(SST_LODMIN |
     943            SST_LODMAX |
    940944            SST_LOD_ASPECT |
    941             SST_LOD_TSPLIT | 
    942             SST_LOD_ODD | 
     945            SST_LOD_TSPLIT |
     946            SST_LOD_ODD |
    943947            SST_LOD_S_IS_WIDER);
    944948  tLod |= SST_TLOD_MINMAX_INT(info->largeLod,
     
    958962  }
    959963  REG_GROUP_END();
    960  
     964
    961965  /* update shadows */
    962   gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 
    963   gc->state.tmu_config[tmu].textureMode = texMode; 
    964   gc->state.tmu_config[tmu].tLOD        = tLod; 
     966  gc->state.tmu_config[tmu].texBaseAddr = baseAddress;
     967  gc->state.tmu_config[tmu].textureMode = texMode;
     968  gc->state.tmu_config[tmu].tLOD        = tLod;
    965969
    966970  /* Make sure that the trilinear blending bits are set in a
     
    968972   * we have multiple tmu's, but this state is really setup across
    969973   * multiple calls (grTexCombine, grTexMipMapMode, and
    970    * grTexSource). 
    971    * 
     974   * grTexSource).
     975   *
    972976   * NB: This must happen after the shadows are updated because
    973977   * _grTexCheckTriLinear() will use the shadow register values
     
    975979   */
    976980  if (gc->num_tmu > 1) _grTexCheckTriLinear(tmu);
    977  
     981
    978982  GR_END();
    979983#undef FN_NAME
     
    994998  -------------------------------------------------------------------*/
    995999
    996 GR_ENTRY(grTexMultibase, void, 
     1000GR_ENTRY(grTexMultibase, void,
    9971001         (GrChipID_t tmu, FxBool enable))
    9981002{
    9991003#define FN_NAME "grTexMultibase"
    10001004  FxU32 tLod;
    1001    
     1005
    10021006  GR_BEGIN("grTexMultibase",88,4,1);
    10031007  GDBG_INFO_MORE(gc->myLevel,"(%d,%d)\n",tmu,enable);
    10041008  GR_CHECK_TMU(FN_NAME,tmu);
    1005  
     1009
    10061010  tLod  = gc->state.tmu_config[tmu].tLOD;
    10071011  if (enable)
     
    10341038             GR_TEXBASE_64
    10351039             GR_TEXBASE_32_TO_1
    1036     startAddress - start address that data was downloaded to 
     1040    startAddress - start address that data was downloaded to
    10371041                    hardware with using grTexDownload/Level
    10381042    info         - pointer to GrTexInfo structure containing
     
    10421046  -------------------------------------------------------------------*/
    10431047
    1044 GR_ENTRY(grTexMultibaseAddress, void, 
     1048GR_ENTRY(grTexMultibaseAddress, void,
    10451049         (GrChipID_t tmu, GrTexBaseRange_t range, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info))
    10461050{
     
    10551059  GR_CHECK_F(FN_NAME, evenOdd > 0x3, "evenOdd mask invalid");
    10561060  GR_CHECK_F(FN_NAME, info, "invalid info pointer");
    1057  
     1061
    10581062
    10591063  /* Write relevant registers out to hardware and shadows */
     
    10671071                                          evenOdd) >> 3;
    10681072      GR_SET(tmuChip, hw, texBaseAddr, baseAddress);
    1069       gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 
     1073      gc->state.tmu_config[tmu].texBaseAddr = baseAddress;
    10701074      break;
    10711075
     
    10771081                                          evenOdd) >> 3;
    10781082      GR_SET(tmuChip, hw, texBaseAddr1, baseAddress);
    1079       gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 
     1083      gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress;
    10801084      break;
    10811085
     
    10871091                                          evenOdd) >> 3;
    10881092      GR_SET(tmuChip, hw, texBaseAddr2, baseAddress);
    1089       gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 
     1093      gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress;
    10901094      break;
    10911095
     
    10971101                                          evenOdd) >> 3;
    10981102      GR_SET(tmuChip, hw, texBaseAddr38, baseAddress);
    1099       gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress; 
     1103      gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress;
    11001104      break;
    11011105  }
  • trunk/src/opengl/glide/cvg/glide/gtexdl.c

    r2888 r6653  
     1/* $Id: gtexdl.c,v 1.2 2001-09-05 14:30:29 bird Exp $ */
    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/cvg/glide/gtexdl.c,v 1.1 2000-02-25 00:37:42 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gtexdl.c,v 1.2 2001-09-05 14:30:29 bird Exp $
    2122** $Log: gtexdl.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:42  sandervl
     23** Revision 1.2  2001-09-05 14:30:29  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:42  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 61    5/18/98 12:11p Peter
    2731** removed unnecesasry fencing
    28 ** 
     32**
    2933** 60    4/29/98 2:32p Peter
    3034** fixed texture palette broadcast
    31 ** 
     35**
    3236** 59    3/30/98 2:46p Peter
    3337** fixed texture download muckage
    34 ** 
     38**
    3539** 58    3/29/98 10:54p Jdt
    3640** Unset GLIDE_POINTCAST_PALETTE
    37 ** 
     41**
    3842** 57    2/20/98 5:31p Peter
    3943** crybaby glide
    40 ** 
     44**
    4145** 56    2/20/98 11:00a Peter
    4246** removed glide3 from glid2 tree
    43 ** 
     47**
    4448** 55    2/02/98 2:14p Atai
    4549** fixed palette broadcasts in  _grTexDownloadNccTable and
    46 ** _grTexDownloadPalette 
    47  * 
     50** _grTexDownloadPalette
     51 *
    4852 * 54    1/09/98 6:48p Atai
    4953 * grTexInfo, GR_LOD_* and GR_ASPECT_*
    50  * 
     54 *
    5155 * 53    1/08/98 7:09p Peter
    5256 * real hw stuff modulo makefile change
    53  * 
     57 *
    5458 * 52    1/08/98 4:58p Atai
    5559 * tex table broadcast, grVertexLayout enable/disable, stq, and some
    5660 * defines
    57  * 
     61 *
    5862 * 51    1/08/98 11:06a Dow
    5963 * Set palette downloads to broadcast.
    60  * 
     64 *
    6165 * 50    12/11/97 4:15p Peter
    6266 * fixed assertions
    63  * 
     67 *
    6468 * 49    12/09/97 12:20p Peter
    6569 * mac glide port
    66  * 
     70 *
    6771 * 48    12/05/97 4:26p Peter
    6872 * watcom warnings
    69  * 
     73 *
    7074 * 47    12/02/97 9:48a Dow
    7175 * Got rid of Texelfx rev 0 warning
    72  * 
     76 *
    7377 * 46    11/21/97 1:03p Peter
    7478 * small texture download problem
    75  * 
     79 *
    7680 * 45    11/20/97 6:57p Dow
    7781 * Texture Downloads for Banshee
    78  * 
     82 *
    7983 * 44    11/18/97 4:36p Peter
    8084 * chipfield stuff cleanup and w/ direct writes
    81  * 
     85 *
    8286 * 43    11/17/97 4:55p Peter
    8387 * watcom warnings/chipfield stuff
    84  * 
     88 *
    8589 * 42    11/14/97 12:09a Peter
    8690 * comdex thing and some other stuff
    87  * 
     91 *
    8892 * 41    11/12/97 11:16a Peter
    8993 * cleaned up assertions
    90  * 
     94 *
    9195 * 40    11/05/97 1:50p Peter
    9296 * fixed partial palette downloads
    93  * 
     97 *
    9498 * 39    11/03/97 3:43p Peter
    9599 * h3/cvg cataclysm
    96  * 
     100 *
    97101 * 38    10/08/97 11:33a Peter
    98102 * reg group for palette download
    99  * 
     103 *
    100104 * 37    9/15/97 7:31p Peter
    101105 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    102106 * place, lfb's are on, Hmmmm.. probably more
    103  * 
     107 *
    104108 * 36    9/04/97 3:32p Peter
    105109 * starting grouping serial reg writes
    106  * 
     110 *
    107111 * 35    8/18/97 3:52p Peter
    108112 * pre-hw arrival fixes/cleanup
    109  * 
     113 *
    110114 * 34    7/26/97 5:18p Peter
    111115 * fixed macro muckage
    112  * 
     116 *
    113117 * 33    7/08/97 2:49p Peter
    114  * 
     118 *
    115119 * 32    7/02/97 12:28p Peter
    116120 * removed spurious NOP, tex dl
    117  * 
     121 *
    118122 * 31    6/30/97 3:22p Peter
    119123 * cmd fifo sanity
    120  * 
     124 *
    121125**
    122126*/
     
    216220  GR_CHECK_F(FN_NAME, start < 0, "invalid start index");
    217221  GR_CHECK_F(FN_NAME, end > 255, "invalid end index");
    218    
     222
    219223  /* NOTE:
    220224  **
     
    223227  **  there are.  This is fallout from the fact that future hardware
    224228  **  has a unified memory architecture.
    225   ** 
     229  **
    226230  **  Source licensees (meaning arcade or LBE vendors that) require the
    227231  **  one palette/tmu mode should define GLIDE_POINTCAST_PALETTE on
     
    232236#ifdef GLIDE_POINTCAST_PALETTE
    233237  /*
    234   **  FURTHER NOTE: 
     238  **  FURTHER NOTE:
    235239  **  There is a sublety (nice way of saying BUG) here.
    236240  **  If TMU0 is specified, then the palette will be broadcast to all
     
    252256   * format: stuff before the 8 word alignment, aligned writes, and
    253257   * stuff after the 8 word alignment to the end. The slop regions
    254    * are one packet apiece. 
     258   * are one packet apiece.
    255259   */
    256260  {
     
    265269
    266270    /* Is the start of the palette range unaligned or is the end of
    267      * the range less than a completely aligned range? 
     271     * the range less than a completely aligned range?
    268272     */
    269273    if (((start & 0x07) != 0) || (end < ((start + 8) & ~0x07))) {
    270274      const FxI32 slopCount = startSlop - start + 1;
    271275      GR_ASSERT((slopCount > 0) && (slopCount <= 8));
    272    
    273       REG_GROUP_BEGIN(chipId, nccTable0[4 + (start & 0x07)], 
     276
     277      REG_GROUP_BEGIN(chipId, nccTable0[4 + (start & 0x07)],
    274278                      slopCount, (0xFF >> (8 - slopCount)));
    275279      while(i < start + slopCount) {
     
    284288    while(i < endSlop) {
    285289      const int endIndex = i + 8;
    286      
     290
    287291      REG_GROUP_BEGIN(chipId, nccTable0[4], 8, 0xFF);
    288292      while(i < endIndex) {
     
    293297      REG_GROUP_END();
    294298    }
    295  
     299
    296300    /* Do we have any more slop at the end of the ragne? */
    297301    if (i <= end) {
    298302      const FxU32 slopCount = end - endSlop + 1;
    299      
    300       REG_GROUP_BEGIN(chipId, nccTable0[4], 
     303
     304      REG_GROUP_BEGIN(chipId, nccTable0[4],
    301305                      slopCount, (0xFF >> (8 - slopCount)));
    302306      while(i <= end) {
     
    308312    }
    309313  }
    310    
     314
    311315  GR_END();
    312316#undef FN_NAME
     
    368372    thisLod      - lod constant that describes the mipmap level
    369373                    to be downloaded
    370     largeLod     - largest level of detail in complete mipmap to 
     374    largeLod     - largest level of detail in complete mipmap to
    371375                   be downloaded at startAddress of which level to
    372376                   be downloaded is a part
     
    376380                    the selected texture
    377381                    One of:
    378                       GR_MIPMAPLEVELMASK_EVEN 
     382                      GR_MIPMAPLEVELMASK_EVEN
    379383                      GR_MIPMAPLEVELMASK_ODD
    380384                      GR_MIPMAPLEVELMASK_BOTH
     
    399403                 tmu,startAddress,thisLod,largeLod,aspectRatio,
    400404                 format,evenOdd,data,t,max_t);
    401  
     405
    402406  /* Check fo silly things */
    403407  {
    404     const FxU32 size = _grTexTextureMemRequired(thisLod, thisLod, 
     408    const FxU32 size = _grTexTextureMemRequired(thisLod, thisLod,
    405409                                                aspectRatio, format, evenOdd);
    406410
    407411  GR_CHECK_TMU(FN_NAME, tmu);
    408   GR_CHECK_COMPATABILITY(FN_NAME, 
     412  GR_CHECK_COMPATABILITY(FN_NAME,
    409413                         startAddress + size > gc->tmu_state[tmu].total_mem,
    410414                         "insufficient texture ram at startAddress");
    411   GR_CHECK_COMPATABILITY(FN_NAME, 
     415  GR_CHECK_COMPATABILITY(FN_NAME,
    412416                         startAddress & 0x7,
    413417                         "unaligned startAddress");
     
    418422  GR_CHECK_F(FN_NAME, thisLod < largeLod,
    419423             "thisLod may not be larger than largeLod");
    420   GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 || 
     424  GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 ||
    421425             aspectRatio < GR_ASPECT_8x1,
    422426             "aspectRatio invalid");
     
    444448    ------------------------------------------------------------*/
    445449    const FxU32 baseAddress = _grTexCalcBaseAddress(startAddress,
    446                                       largeLod, 
     450                                      largeLod,
    447451                                      aspectRatio,
    448452                                      format,
    449453                                                    evenOdd) >> 3;
    450  
    451   /*------------------------------------------------------------
    452     Compute pertinant contents of tLOD and texMode registers 
     454
     455  /*------------------------------------------------------------
     456    Compute pertinant contents of tLOD and texMode registers
    453457    ------------------------------------------------------------*/
    454458    FxU32 tLod = SST_TLOD_MINMAX_INT(largeLod, GR_LOD_1);
    455459    FxU32 texMode = format << SST_TFORMAT_SHIFT;
    456    
     460
    457461  tLod |= _gr_evenOdd_xlate_table[evenOdd];
    458462  tLod |= _gr_aspect_xlate_table[aspectRatio];
    459    
     463
    460464  if (gc->state.tmu_config[tmu].textureMode & SST_SEQ_8_DOWNLD) {
    461465    sh = 2;
     
    506510    case 1:
    507511      for (; t <= max_t; t++) {
    508         LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 
     512        LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
    509513                           (FxU32)tex_address - (FxU32)gc->tex_ptr,
    510514                           0x00UL, 0x00UL);
    511515        LINEAR_WRITE_SET_8(tex_address, (const FxU32)*(const FxU8*)src8);
    512516        LINEAR_WRITE_END();
    513      
     517
    514518        src8 += width;
    515519        tex_address += TEX_ROW_ADDR_INCR(1, thisLod);
     
    519523    case 2:
    520524      for (; t <= max_t; t++) {
    521         LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 
     525        LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
    522526                           (FxU32)tex_address - (FxU32)gc->tex_ptr,
    523527                           0x00UL, 0x00UL);
    524528        LINEAR_WRITE_SET_8(tex_address, (const FxU32)*(const FxU16*)src8);
    525529        LINEAR_WRITE_END();
    526            
     530
    527531        src8 += width;
    528532        tex_address += TEX_ROW_ADDR_INCR(1, thisLod);
     
    532536    case 4:
    533537      for (; t <= max_t; t++) {
    534         LINEAR_WRITE_BEGIN(1, kLinearWriteTex, 
     538        LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
    535539                           (FxU32)tex_address - (FxU32)gc->tex_ptr,
    536540                           0x00UL, 0x00UL);
    537541        LINEAR_WRITE_SET_8(tex_address, *(const FxU32*)src8);
    538542        LINEAR_WRITE_END();
    539        
     543
    540544        src8 += width;
    541545        tex_address += TEX_ROW_ADDR_INCR(1, thisLod);
     
    559563          const FxU32 t0 = *(const FxU32*)(src8   );
    560564          const FxU32 t1 = *(const FxU32*)(src8 + sizeof(FxU32));
    561                    
     565
    562566          LINEAR_WRITE_SET_8(tex_address                , t0);
    563567          LINEAR_WRITE_SET_8(tex_address + sizeof(FxU32), t1);
     
    585589        LINEAR_WRITE_SET_16(tex_address, (const FxU32)*(const FxU16*)src16);
    586590          LINEAR_WRITE_END();
    587          
     591
    588592          src16 += width;
    589593          tex_address += TEX_ROW_ADDR_INCR(1, thisLod);
    590594        }
    591595      break;
    592      
     596
    593597    case 2:
    594598      for (; t <= max_t; t++) {
     
    598602        LINEAR_WRITE_SET_16(tex_address, *(const FxU32*)src16);
    599603        LINEAR_WRITE_END();
    600        
     604
    601605        src16 += width;
    602606        tex_address += TEX_ROW_ADDR_INCR(1, thisLod);
     
    610614        tex_address = tmu_baseaddress + TEX_ROW_ADDR_INCR(t, thisLod);
    611615
    612         /* Loop unrolled to process 2 dwords per iteration */           
     616        /* Loop unrolled to process 2 dwords per iteration */
    613617        LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex,
    614618                           (FxU32)tex_address - (FxU32)gc->tex_ptr,
     
    622626          LINEAR_WRITE_SET_16(tex_address    , t0);
    623627          LINEAR_WRITE_SET_16(tex_address + 4, t1);
    624                
     628
    625629          tex_address += 8;
    626630          src16 += 4;
    627631        }
    628              
     632
    629633        LINEAR_WRITE_END();
    630634      }
     
    633637    }
    634638  }
    635  
     639
    636640  /*------------------------------------------------------------
    637641    Restore TLOD, texMode, baseAddress
     
    650654} /* grTexDownloadMipmapLevelPartial */
    651655
    652 /* 
     656/*
    653657   Let me take this opportunity to register my formal opposition to
    654658   this function.  Either we do this or we don't.  Let's not hack like
     
    678682#define FN_NAME "ConvertAndDownloadRLE"
    679683  GR_BEGIN_NOFIFOCHECK(FN_NAME, 89);
    680    
     684
    681685  /* make sure even number */
    682686  width&=0xFFFFFFFE;
    683    
     687
    684688  max_s=width>>1;
    685689  max_t=height;
    686    
     690
    687691  GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d)\n",
    688692                 tmu,startAddress,thisLod,largeLod,aspectRatio,
    689693                 format,evenOdd,bm_data,max_t);
    690    
     694
    691695  size = _grTexTextureMemRequired(thisLod, thisLod, aspectRatio, format, evenOdd);
    692696  GR_CHECK_TMU(FN_NAME, tmu);
     
    697701  GR_CHECK_F(FN_NAME, largeLod > GR_LOD_1, "largeLod invalid");
    698702  GR_CHECK_F(FN_NAME, thisLod < largeLod, "thisLod may not be larger than largeLod");
    699   GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 || 
     703  GR_CHECK_F(FN_NAME, aspectRatio > GR_ASPECT_1x8 ||
    700704             aspectRatio < GR_ASPECT_8x1,
    701705             "aspectRatio invalid");
     
    714718  if (!(evenOdd & (thisLod & 0x1 ? GR_MIPMAPLEVELMASK_ODD:GR_MIPMAPLEVELMASK_EVEN)))
    715719    goto all_done;
    716  
     720
    717721  /*------------------------------------------------------------
    718722    Compute Base Address Given Start Address Offset
    719723    ------------------------------------------------------------*/
    720724  baseAddress = _grTexCalcBaseAddress(startAddress,
    721                                       largeLod, 
     725                                      largeLod,
    722726                                      aspectRatio,
    723727                                      format,
     
    733737  tmu_baseaddress = (FxU32)gc->tex_ptr;
    734738  tmu_baseaddress += (((FxU32)tmu)<<21) + (((FxU32)thisLod)<<17);
    735  
    736   /*------------------------------------------------------------
    737     Compute pertinant contents of tLOD and texMode registers 
     739
     740  /*------------------------------------------------------------
     741    Compute pertinant contents of tLOD and texMode registers
    738742    ------------------------------------------------------------*/
    739743  tLod = SST_TLOD_MINMAX_INT(largeLod, GR_LOD_1);
     
    759763  }
    760764  REG_GROUP_END();
    761  
     765
    762766  _GlideRoot.stats.texBytes += dest_width * (dest_height) * 2;
    763  
     767
    764768  /* here I can do my writes and conversion and I will be so happy */
    765769  offset=4+bm_h;
    766770  for (i=0; i<v0; i++)
    767771    offset += bm_data[4+i];
    768  
     772
    769773  max_s=dest_width>>1;
    770774  expected_size=max_s*5;
    771  
     775
    772776  rle_line_end=rle_line+width+u0;
    773777  for(t=0;t<max_t;t++) {
    774778    tex_address = tmu_baseaddress + TEX_ROW_ADDR_INCR(t, thisLod);
    775779    src = rle_line + u0;
    776      
     780
    777781    rle_decode_line_asm(tlut,&bm_data[offset],rle_line);
    778      
    779     LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 
     782
     783    LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex,
    780784                       (FxU32)tex_address - (FxU32)gc->tex_ptr,
    781                        0x00UL, 0x00UL);         
     785                       0x00UL, 0x00UL);
    782786    for(s = 0; s < max_s; s++) {
    783787      LINEAR_WRITE_SET(tex_address + (s << 2), *(FxU32 *) src);
     
    785789    }
    786790    LINEAR_WRITE_END();
    787      
     791
    788792    offset+=bm_data[4+i++];
    789793  }
     
    793797    src=rle_line+u0;
    794798
    795     LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex, 
     799    LINEAR_WRITE_BEGIN(max_s, kLinearWriteTex,
    796800                       (FxU32)tex_address - (FxU32)gc->tex_ptr,
    797                        0x00UL, 0x00UL);           
     801                       0x00UL, 0x00UL);
    798802    for(s = 0; s < max_s; s++) {
    799803      LINEAR_WRITE_SET(tex_address + (s << 2), *(FxU32 *) src);
    800804      src += 2;
    801805    }
    802     LINEAR_WRITE_END();         
     806    LINEAR_WRITE_END();
    803807  }
    804808
  • trunk/src/opengl/glide/cvg/glide/gu.c

    r2888 r6653  
     1/* $Id: gu.c,v 1.2 2001-09-05 14:30:30 bird Exp $ */
    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/cvg/glide/gu.c,v 1.1 2000-02-25 00:37:42 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gu.c,v 1.2 2001-09-05 14:30:30 bird Exp $
    2122** $Log: gu.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:42  sandervl
     23** Revision 1.2  2001-09-05 14:30:30  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:42  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 14    12/18/97 2:13p Peter
    2731 * fogTable cataclysm
    28  * 
     32 *
    2933 * 13    5/27/97 1:16p Peter
    30  * Basic cvg, w/o cmd fifo stuff. 
    31  * 
     34 * Basic cvg, w/o cmd fifo stuff.
     35 *
    3236 * 12    5/21/97 6:05a Peter
    33  * 
     37 *
    3438 * 11    3/09/97 10:31a Dow
    3539 * Added GR_DIENTRY for di glide functions
    36  * 
     40 *
    3741 * 10    3/05/97 9:36p Jdt
    3842 * Added guEncodeRLE16
    39  * 
     43 *
    4044 * 9     12/23/96 1:37p Dow
    4145 * chagnes for multiplatform glide
     
    6468  switch ( mode ) {
    6569  case GR_ALPHASOURCE_CC_ALPHA:
    66     grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, 
    67                     GR_COMBINE_FACTOR_NONE, 
    68                     GR_COMBINE_LOCAL_CONSTANT, 
    69                     GR_COMBINE_OTHER_NONE, 
     70    grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL,
     71                    GR_COMBINE_FACTOR_NONE,
     72                    GR_COMBINE_LOCAL_CONSTANT,
     73                    GR_COMBINE_OTHER_NONE,
    7074                    FXFALSE );
    7175    break;
    7276
    7377  case GR_ALPHASOURCE_ITERATED_ALPHA:
    74     grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, 
    75                     GR_COMBINE_FACTOR_NONE, 
    76                     GR_COMBINE_LOCAL_ITERATED, 
    77                     GR_COMBINE_OTHER_NONE, 
     78    grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL,
     79                    GR_COMBINE_FACTOR_NONE,
     80                    GR_COMBINE_LOCAL_ITERATED,
     81                    GR_COMBINE_OTHER_NONE,
    7882                    FXFALSE );
    7983    break;
    8084
    8185  case GR_ALPHASOURCE_TEXTURE_ALPHA:
    82     grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, 
    83                     GR_COMBINE_FACTOR_ONE, 
    84                     GR_COMBINE_LOCAL_NONE, 
    85                     GR_COMBINE_OTHER_TEXTURE, 
     86    grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
     87                    GR_COMBINE_FACTOR_ONE,
     88                    GR_COMBINE_LOCAL_NONE,
     89                    GR_COMBINE_OTHER_TEXTURE,
    8690                    FXFALSE );
    8791    break;
    8892
    8993  case GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA:
    90     grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, 
    91                     GR_COMBINE_FACTOR_LOCAL, 
    92                     GR_COMBINE_LOCAL_ITERATED, 
    93                     GR_COMBINE_OTHER_TEXTURE, 
     94    grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
     95                    GR_COMBINE_FACTOR_LOCAL,
     96                    GR_COMBINE_LOCAL_ITERATED,
     97                    GR_COMBINE_OTHER_TEXTURE,
    9498                    FXFALSE );
    9599    break;
     
    182186    grColorCombine( GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_NONE, FXTRUE );
    183187    break;
    184    
     188
    185189  default:
    186190    GR_CHECK_F("grColorCombineFunction", 1, "unsupported color combine function");
     
    217221*/
    218222GR_DIENTRY(guFogGenerateExp, void,
    219            ( GrFog_t fogtable[], float density )) 
     223           ( GrFog_t fogtable[], float density ))
    220224{
    221225  int   i;
     
    274278** guFogGenerateLinear
    275279*/
    276 GR_DIENTRY(guFogGenerateLinear, void, 
     280GR_DIENTRY(guFogGenerateLinear, void,
    277281           ( GrFog_t fogtable[kInternalFogTableEntryCount],
    278282             float nearZ, float farZ ))
     
    287291    if ( world_w > 65535.0F )
    288292      world_w = 65535.0F;
    289    
     293
    290294    f = ( world_w - nearZ ) / ( farZ - nearZ );
    291295    if ( f > 1.0F )
     
    430434
    431435            srcPixels+=length;
    432             sourceImageSizeInWords-=length;           
     436            sourceImageSizeInWords-=length;
    433437        }
    434438    } else {
     
    446450            byteCount+=4;
    447451            srcPixels+=length;
    448             sourceImageSizeInWords-=length;           
     452            sourceImageSizeInWords-=length;
    449453        }
    450454    }
  • trunk/src/opengl/glide/cvg/glide/guclip.c

    r2888 r6653  
     1/* $Id: guclip.c,v 1.2 2001-09-05 14:30:30 bird Exp $ */
    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/cvg/glide/guclip.c,v 1.1 2000-02-25 00:37:42 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/guclip.c,v 1.2 2001-09-05 14:30:30 bird Exp $
    2122** $Log: guclip.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:42  sandervl
     23** Revision 1.2  2001-09-05 14:30:30  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:42  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 12    12/15/97 5:52p Atai
    2731 * disable obsolete glide2 api for glide3
    28  * 
     32 *
    2933 * 11    12/09/97 12:20p Peter
    3034 * mac glide port
    31  * 
     35 *
    3236 * 10    12/08/97 12:06p Atai
    3337 * change prototype for grDrawPoint, grDrawLine, grDrawTriangel
    34  * 
     38 *
    3539 * 9     8/18/97 3:52p Peter
    3640 * pre-hw arrival fixes/cleanup
    37  * 
     41 *
    3842 * 8     7/31/97 11:14a Peter
    3943 * merge w/ sst1 glide tree, hopefully
    40  * 
     44 *
    4145 * 5     6/27/97 4:16p Atai
    4246 * fixed guDrawTriangleWithClip bug (#484) by removing +1.0F and -1.0F in
    4347 * intersectTop(), intersectBottom(), intersectLeft(), and
    4448 * intersectRight() routine
    45  * 
     49 *
    4650 * 4     3/09/97 10:31a Dow
    4751 * Added GR_DIENTRY for di glide functions
     
    6872    isect->b = a->b + d * ( b->b - a->b );
    6973  }
    70    
     74
    7175  if (gc->state.paramIndex & STATE_REQUIRES_IT_ALPHA) {
    7276    isect->a        = a->a        + d * ( b->a - a->a );
     
    112116} /* calcParams */
    113117
    114 static void 
     118static void
    115119intersectTop( const GrVertex *a, const GrVertex *b, GrVertex *intersect )
    116120{
     
    118122  float
    119123    d = ( gc->state.clipwindowf_ymin - a->y ) / ( b->y - a->y );
    120  
     124
    121125  intersect->x        = a->x        + d * ( b->x - a->x );
    122   intersect->y        = gc->state.clipwindowf_ymin; 
    123  
     126  intersect->y        = gc->state.clipwindowf_ymin;
     127
    124128  calcParams(a, b, intersect, d);
    125129
     
    132136  float
    133137    d = ( gc->state.clipwindowf_ymax - a->y ) / ( b->y - a->y );
    134  
     138
    135139  intersect->x        = a->x        + d * ( b->x - a->x );
    136   intersect->y        = gc->state.clipwindowf_ymax; 
     140  intersect->y        = gc->state.clipwindowf_ymax;
    137141
    138142  calcParams(a, b, intersect, d);
     
    146150  float
    147151    d = ( gc->state.clipwindowf_xmax - a->x ) / ( b->x - a->x );
    148  
    149   intersect->x        = gc->state.clipwindowf_xmax; 
     152
     153  intersect->x        = gc->state.clipwindowf_xmax;
    150154  intersect->y        = a->y        + d * ( b->y - a->y );
    151155
     
    160164  float
    161165    d = ( gc->state.clipwindowf_xmin - a->x ) / ( b->x - a->x );
    162  
     166
    163167  intersect->x        = gc->state.clipwindowf_xmin;
    164168  intersect->y        = a->y        + d * ( b->y - a->y );
     
    174178  return (( p->y > gc->state.clipwindowf_ymin ) ? FXTRUE : FXFALSE);
    175179} /* aboveYMin */
    176      
     180
    177181
    178182static FxBool
     
    216220  int
    217221    j;
    218  
     222
    219223  *outlength = 0;
    220  
     224
    221225  s = invertexarray[inlength-1];
    222226  for ( j = 0; j < inlength; j++ ) {
     
    310314  input_array[1] = *b;
    311315  input_array[2] = *c;
    312  
     316
    313317  shClipPolygon( input_array,   output_array,  3,         &outlength, belowXMax, intersectRight );
    314318  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
    315319  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
    316320  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
    317  
     321
    318322  /*
    319323   ** snap vertices then decompose the n-gon into triangles
     
    379383  input_array[1] = *b;
    380384  input_array[2] = *c;
    381  
     385
    382386  shClipPolygon( input_array,   output_array,  3,         &outlength, belowXMax, intersectRight );
    383387  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
    384388  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
    385389  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
    386  
     390
    387391  /*
    388392   ** snap vertices then decompose the n-gon into triangles
  • trunk/src/opengl/glide/cvg/glide/gump.c

    r2888 r6653  
     1/* $Id: gump.c,v 1.2 2001-09-05 14:30:30 bird Exp $ */
    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/cvg/glide/gump.c,v 1.1 2000-02-25 00:37:42 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gump.c,v 1.2 2001-09-05 14:30:30 bird Exp $
    2122** $Log: gump.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:42  sandervl
     23** Revision 1.2  2001-09-05 14:30:30  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:42  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25  * 
     29 *
    2630 * 10    12/09/97 12:20p Peter
    2731 * mac glide port
    28  * 
     32 *
    2933 * 9     11/12/97 5:12p Pgj
    3034 * stubs for evil guFb{Read|Write}Region() calls
    31  * 
     35 *
    3236 * 8     5/27/97 1:16p Peter
    33  * Basic cvg, w/o cmd fifo stuff. 
    34  * 
     37 * Basic cvg, w/o cmd fifo stuff.
     38 *
    3539 * 7     5/21/97 6:05a Peter
    36  * 
     40 *
    3741 * 6     3/09/97 10:31a Dow
    3842 * Added GR_DIENTRY for di glide functions
    39  * 
     43 *
    4044 * 5     12/23/96 1:37p Dow
    4145 * chagnes for multiplatform glide
     
    7074}
    7175
    72 GR_DIENTRY(guMPTexCombineFunction, void, 
     76GR_DIENTRY(guMPTexCombineFunction, void,
    7377           ( GrMPTextureCombineFnc_t tc_fnc ))
    7478{
     
    7781}
    7882
    79 GR_DIENTRY(guMPTexSource, void, 
     83GR_DIENTRY(guMPTexSource, void,
    8084           ( GrChipID_t virtual_tmu, GrMipMapId_t mmid ))
    8185{
  • trunk/src/opengl/glide/cvg/glide/gutex.c

    r2888 r6653  
     1/* $Id: gutex.c,v 1.2 2001-09-05 14:30:31 bird Exp $ */
    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/cvg/glide/gutex.c,v 1.1 2000-02-25 00:37:43 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gutex.c,v 1.2 2001-09-05 14:30:31 bird Exp $
    2122** $Log: gutex.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:43  sandervl
     23** Revision 1.2  2001-09-05 14:30:31  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:43  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 22    2/20/98 5:31p Peter
    2731** crybaby glide
    28 ** 
     32**
    2933** 21    2/20/98 11:00a Peter
    3034** removed glide3 from glid2 tree
    31  * 
     35 *
    3236 * 20    1/07/98 10:22a Peter
    3337 * lod dithering env var
    34  * 
     38 *
    3539 * 19    1/06/98 6:47p Atai
    3640 * undo grSplash and remove gu routines
    37  * 
     41 *
    3842 * 18    12/17/97 4:45p Peter
    3943 * groundwork for CrybabyGlide
    40  * 
     44 *
    4145 * 17    12/02/97 9:49a Dow
    4246 * rid the world of the "Setting the same state twice" message
    43  * 
     47 *
    4448 * 16    11/20/97 6:59p Dow
    4549 * Fixed baseAddress for Banshee (the Devil's Own Test still uses guTex
    4650 * Stuff).
    47  * 
     51 *
    4852 * 15    11/18/97 4:36p Peter
    4953 * chipfield stuff cleanup and w/ direct writes
    50  * 
     54 *
    5155 * 14    11/17/97 4:55p Peter
    5256 * watcom warnings/chipfield stuff
    53  * 
     57 *
    5458 * 13    11/03/97 3:43p Peter
    5559 * h3/cvg cataclysm
    56  * 
     60 *
    5761 * 12    9/15/97 7:31p Peter
    5862 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    5963 * place, lfb's are on, Hmmmm.. probably more
    60  * 
     64 *
    6165 * 11    9/04/97 3:32p Peter
    6266 * starting grouping serial reg writes
    63  * 
     67 *
    6468 * 10    6/06/97 10:47a Peter
    6569 * texture downloading, fixed 640x480 dimension, changed cvg dep to be the
    6670 * same as sst1
    67  * 
     71 *
    6872 * 9     5/27/97 1:16p Peter
    69  * Basic cvg, w/o cmd fifo stuff. 
    70  * 
     73 * Basic cvg, w/o cmd fifo stuff.
     74 *
    7175 * 8     5/21/97 6:05a Peter
    72  * 
     76 *
    7377 * 7     3/04/97 9:08p Dow
    74  * 
     78 *
    7579 * 6     12/23/96 1:37p Dow
    7680 * chagnes for multiplatform glide
    77  * 
     81 *
    7882 * 5     11/18/96 9:14a Sellers
    7983 * added checking for crossing of 2 MByte texture boundry
     
    138142
    139143  oldtexMode = gc->state.tmu_config[tmu].textureMode;
    140   oldtexMode &= ~(SST_TFORMAT | SST_TCLAMPT | 
    141                   SST_TCLAMPS | SST_TNCCSELECT | 
    142                   SST_TLODDITHER | SST_TCLAMPW | 
    143                   SST_TMAGFILTER | SST_TMINFILTER | 
     144  oldtexMode &= ~(SST_TFORMAT | SST_TCLAMPT |
     145                  SST_TCLAMPS | SST_TNCCSELECT |
     146                  SST_TLODDITHER | SST_TCLAMPW |
     147                  SST_TMAGFILTER | SST_TMINFILTER |
    144148                  SST_TRILINEAR);
    145149  texMode |= oldtexMode;
     
    207211  gc->state.tmu_config[tmu].textureMode = texMode;
    208212  gc->state.tmu_config[tmu].tLOD = tLod;
    209  
     213
    210214  GR_END();
    211215#undef FN_NAME
  • trunk/src/opengl/glide/cvg/glide/gxdraw.c

    r2888 r6653  
     1/* $Id: gxdraw.c,v 1.2 2001-09-05 14:30:31 bird Exp $ */
    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/cvg/glide/gxdraw.c,v 1.1 2000-02-25 00:37:43 sandervl Exp $
     21 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/gxdraw.c,v 1.2 2001-09-05 14:30:31 bird Exp $
    2122 ** $Log: gxdraw.c,v $
    22  ** Revision 1.1  2000-02-25 00:37:43  sandervl
     23 ** Revision 1.2  2001-09-05 14:30:31  bird
     24 ** Added $Id:$ keyword.
     25 **
     26 ** Revision 1.1  2000/02/25 00:37:43  sandervl
    2327 ** Created Voodoo 2 dir
    2428 **
    25 ** 
     29**
    2630** 61    3/17/98 3:00p Peter
    2731** removed vertex sorting
    28  * 
     32 *
    2933 * 60    12/01/97 6:13p Peter
    3034 * non-packet3 tsu triangles ooz vs z
    31  * 
     35 *
    3236 * 59    11/21/97 3:20p Peter
    3337 * direct writes tsu registers
    34  * 
     38 *
    3539 * 58    11/18/97 4:36p Peter
    3640 * chipfield stuff cleanup and w/ direct writes
    37  * 
     41 *
    3842 * 57    11/17/97 4:55p Peter
    3943 * watcom warnings/chipfield stuff
    40  * 
     44 *
    4145 * 56    11/12/97 9:54p Peter
    4246 * fixed all the muckage from new config
    43  * 
     47 *
    4448 * 55    11/03/97 4:38p Peter
    4549 * yapc fix
    46  * 
     50 *
    4751 * 54    11/01/97 10:01a Peter
    4852 * tri dispatch stuff
    49  * 
     53 *
    5054 * 53    10/29/97 2:45p Peter
    5155 * C version of Taco's packing code
    52  * 
     56 *
    5357 * 52    10/27/97 5:59p Peter
    5458 * removed some debugging code
    55  * 
     59 *
    5660 * 51    10/21/97 3:22p Peter
    5761 * hand pack rgb
    58  * 
     62 *
    5963 * 50    10/19/97 12:51p Peter
    6064 * no tsu happiness
    61  * 
     65 *
    6266 * 49    10/19/97 10:59a Peter
    6367 * fixed p1 tsu writes
    64  * 
     68 *
    6569 * 48    10/17/97 3:15p Peter
    6670 * removed unused addr field from datalist
    67  * 
     71 *
    6872 * 47    10/17/97 10:15a Peter
    6973 * packed rgb state cleanup
    70  * 
     74 *
    7175 * 46    10/16/97 5:33p Peter
    7276 * argb != rgba
    73  * 
     77 *
    7478 * 45    10/16/97 3:40p Peter
    7579 * packed rgb
    76  * 
     80 *
    7781 * 44    10/16/97 10:31a Peter
    7882 * fixed hoopti tsu-subtractor unsorted
    79  * 
     83 *
    8084 * 43    10/15/97 5:53p Peter
    8185 * hoopti tri compare code
    82  * 
     86 *
    8387 * 42    10/10/97 4:33p Peter
    8488 * non-packet3 tsu triangles
    85  * 
     89 *
    8690 * 41    10/08/97 5:19p Peter
    8791 * optinally clamp only texture params
    88  * 
     92 *
    8993 * 40    10/08/97 11:32a Peter
    9094 * pre-computed packet headers for packet 3
    91  * 
     95 *
    9296 * 39    9/20/97 4:42p Peter
    9397 * tri_setf fixup/big fifo
    94  * 
     98 *
    9599 * 38    9/16/97 2:50p Peter
    96100 * fixed watcom unhappiness w/ static initializers
    97  * 
     101 *
    98102 * 37    9/15/97 7:31p Peter
    99103 * more cmdfifo cleanup, fixed normal buffer clear, banner in the right
    100104 * place, lfb's are on, Hmmmm.. probably more
    101  * 
     105 *
    102106 * 36    9/10/97 10:13p Peter
    103107 * fifo logic from GaryT, non-normalized fp first cut
    104  * 
     108 *
    105109 * 35    9/03/97 2:11p Peter
    106110 * start gdbg_info cleanup, fixed zero area no-tsu triangle muckage
    107  * 
     111 *
    108112 * 34    9/01/97 3:19p Peter
    109113 * no-tsu w from vertex not tmuvtx
    110  * 
     114 *
    111115 * 33    8/31/97 4:06p Peter
    112116 * no tsu fix
    113  * 
     117 *
    114118 * 32    8/31/97 12:04p Peter
    115119 * hacked no-tsu code
    116  * 
     120 *
    117121 * 31    7/25/97 11:40a Peter
    118122 * removed dHalf, change field name to match real use for cvg
    119  * 
     123 *
    120124 * 30    6/30/97 3:22p Peter
    121125 * cmd fifo sanity
    122  * 
     126 *
    123127 * 29    6/24/97 4:02p Peter
    124128 * proper cmd fifo placement
    125  * 
     129 *
    126130 * 28    6/23/97 4:43p Peter
    127131 * cleaned up #defines etc for a nicer tree
     
    139143#ifdef GDBG_INFO_ON
    140144/* Some debugging information */
    141 static char *indexNames[] = { 
     145static char *indexNames[] = {
    142146  "GR_VERTEX_X_OFFSET",         /* 0 */
    143147  "GR_VERTEX_Y_OFFSET",         /* 1 */
     
    154158  "GR_VERTEX_SOW_TMU1_OFFSET",  /* 12 */
    155159  "GR_VERTEX_TOW_TMU1_OFFSET",  /* 13 */
    156   "GR_VERTEX_OOW_TMU1_OFFSET"   /* 14 */
    157 }; 
     160  "GR_VERTEX_OOW_TMU1_OFFSET"   /* 14 */
     161};
    158162#endif
    159163
     
    185189  const float *fc = &vc->x;
    186190  float dxAB, dxBC, dyAB, dyBC;
    187        
     191
    188192    /* Compute Area */
    189193    dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
    190194    dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
    191    
     195
    192196    dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
    193197    dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
    194    
     198
    195199    /* Stash the area in the float pool for easy access */
    196200    _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
    197    
     201
    198202#define FloatVal(__f) (((__f) < 786432.875) ? (__f) : ((__f) - 786432.875))
    199203    {
    200204      const FxI32 j = *(FxI32*)&_GlideRoot.pool.ftemp1;
    201205      const FxU32 culltest = (gc->state.cull_mode << 31UL);
    202      
     206
    203207      /* Zero-area triangles are BAD!! */
    204208      if ((j & 0x7FFFFFFF) == 0) {
    205209        GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
    206                   FloatVal(fa[0]), FloatVal(fa[1]), 
    207                   FloatVal(fb[0]), FloatVal(fb[1]), 
    208                   FloatVal(fc[0]), FloatVal(fc[1]), 
     210                  FloatVal(fa[0]), FloatVal(fa[1]),
     211                  FloatVal(fb[0]), FloatVal(fb[1]),
     212                  FloatVal(fc[0]), FloatVal(fc[1]),
    209213                  _GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
    210214
    211215        return 0;
    212216      }
    213      
     217
    214218      /* Backface culling, use sign bit as test */
    215219      if ((gc->state.cull_mode != GR_CULL_DISABLE) && (((FxI32)(j ^ culltest)) >= 0)) {
    216220        GDBG_INFO(291, FN_NAME": Culling (%g %g) (%g %g) (%g %g) : (%g : 0x%X : 0x%X)\n",
    217                   FloatVal(fa[0]), FloatVal(fa[1]), 
    218                   FloatVal(fb[0]), FloatVal(fb[1]), 
    219                   FloatVal(fc[0]), FloatVal(fc[1]), 
     221                  FloatVal(fa[0]), FloatVal(fa[1]),
     222                  FloatVal(fb[0]), FloatVal(fb[1]),
     223                  FloatVal(fc[0]), FloatVal(fc[1]),
    220224                  _GlideRoot.pool.ftemp1, gc->state.cull_mode, culltest);
    221        
     225
    222226        return -1;
    223227      }
     
    244248      for(vectorIndex = 0; vectorIndex < sizeof(vectorArray) / sizeof(float*); vectorIndex++) {
    245249        const float* const vector = vectorArray[vectorIndex];
    246      
     250
    247251        /* Triangle vertex coordinages (x, y) */
    248252        TRI_SETF(vector[GR_VERTEX_X_OFFSET]);
    249253        TRI_SETF(vector[GR_VERTEX_Y_OFFSET]);
    250      
     254
    251255        /* Other triangle parameters */
    252256        {
     
    257261            FxBool doColorP = FXFALSE;
    258262            FxU32 packedColor = 0x00;
    259            
     263
    260264            if (*dataList == (GR_VERTEX_R_OFFSET << 2)) {
    261               packedColor = (RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_B_OFFSET << 2)), B) | 
     265              packedColor = (RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_B_OFFSET << 2)), B) |
    262266                             RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_G_OFFSET << 2)), G) |
    263267                             RGBA_COMP_CLAMP(FARRAY(vector, (GR_VERTEX_R_OFFSET << 2)), R));
     
    271275              doColorP = FXTRUE;
    272276            }
    273            
     277
    274278            if (doColorP) TRI_SET(packedColor);
    275279          }
     
    284288          dataList++;
    285289#endif /* GLIDE_FP_CLAMP_TEX */
    286          
     290
    287291          while(*dataList != 0) {
    288292            TRI_SETF_CLAMP(FARRAY(vector, *dataList));
    289293            dataList++;
    290294          }
    291         }         
     295        }
    292296      }
    293297    }
     
    365369        GR_SET(BROADCAST_ID, hw, sSetupMode, sMode);
    366370        GR_CHECK_SIZE();
    367        
     371
    368372        for(vectorIndex = 0; vectorIndex < sizeof(vectorArray) / sizeof(float*); vectorIndex++) {
    369373          const GrVertex* curVertex = (const GrVertex*)vectorArray[vectorIndex];
    370          
     374
    371375          REG_GROUP_BEGIN(BROADCAST_ID, sVx, paramCount, paramMask);
    372376          {
     
    382386                                         (RGBA_COMP_CLAMP(curVertex->r) << 16UL));
    383387              if (hasAlpha) packedVal |= (RGBA_COMP_CLAMP(curVertex->a) << 24UL);
    384              
     388
    385389              REG_GROUP_SET(hw, sARGB, packedVal);
    386390            }
     
    441445      const float ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
    442446      volatile FxU32* hwAddr = &hw->FvA.x;
    443            
     447
    444448      /* Divide the deltas by the area for gradient calculation. */
    445449      dxBC *= ooa;
     
    447451      dxAB *= ooa;
    448452      dyBC *= ooa;
    449            
     453
    450454      GDBG_INFO(85, FN_NAME": No-TSU Triangle area: (%g %g) : (%g %g %g %g)\n",
    451455                _GlideRoot.pool.ftemp1, ooa,
    452456                dxAB, dxBC, dyAB, dyBC);
    453      
    454       /* write out X & Y for vertex A */ 
     457
     458      /* write out X & Y for vertex A */
    455459      TRI_NO_TSU_SETF(hwAddr++, fa[GR_VERTEX_X_OFFSET]);
    456460      TRI_NO_TSU_SETF(hwAddr++, fa[GR_VERTEX_Y_OFFSET]);
     
    458462      /* write out X & Y for vertex B */
    459463      TRI_NO_TSU_SETF(hwAddr++, fb[GR_VERTEX_X_OFFSET]);
    460       TRI_NO_TSU_SETF(hwAddr++, fb[GR_VERTEX_Y_OFFSET]); 
    461  
     464      TRI_NO_TSU_SETF(hwAddr++, fb[GR_VERTEX_Y_OFFSET]);
     465
    462466      /* write out X & Y for vertex C */
    463467      TRI_NO_TSU_SETF(hwAddr++, fc[GR_VERTEX_X_OFFSET]);
     
    493497          const float curGrad = (((fa[i] - fb[i]) * dyBC) -
    494498                                 ((fb[i] - fc[i]) * dyAB));
    495                    
     499
    496500          GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n",
    497501                    ((FxU32)hwAddr - (FxU32)hw) >> 2,
    498502                    fa[i], fb[i], fc[i], curGrad);
    499                    
     503
    500504          TRI_NO_TSU_SETF(hwAddr++, curGrad);
    501505          i++;
     
    503507
    504508        /* Skip fbi oow */
    505         i++; 
     509        i++;
    506510
    507511        /* FixMe? We currently only do one tmu. */
     
    509513          const float curGrad = (((fa[i] - fb[i]) * dyBC) -
    510514                                 ((fb[i] - fc[i]) * dyAB));
    511                    
     515
    512516          GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n",
    513517                    ((FxU32)hwAddr - (FxU32)hw) >> 2,
    514518                    fa[i], fb[i], fc[i], curGrad);
    515                    
     519
    516520          TRI_NO_TSU_SETF(hwAddr++, curGrad);
    517521          i++;
     
    521525          const float curGrad = (((fa[GR_VERTEX_OOW_OFFSET] - fb[GR_VERTEX_OOW_OFFSET]) * dyBC) -
    522526                                 ((fb[GR_VERTEX_OOW_OFFSET] - fc[GR_VERTEX_OOW_OFFSET]) * dyAB));
    523                    
     527
    524528          TRI_NO_TSU_SETF(hwAddr++, curGrad);
    525529        }
     
    533537          const float curGrad = (((fb[i] - fc[i]) * dxAB) -
    534538                                 ((fa[i] - fb[i]) * dxBC));
    535                    
     539
    536540          GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n",
    537541                    ((FxU32)hwAddr - (FxU32)hw) >> 2,
     
    549553          const float curGrad = (((fb[i] - fc[i]) * dxAB) -
    550554                                 ((fa[i] - fb[i]) * dxBC));
    551                    
     555
    552556          GDBG_INFO(285, FN_NAME": Gradient 0x%X : %g %g %g : %g\n",
    553557                    ((FxU32)hwAddr - (FxU32)hw) >> 2,
    554558                    fa[i], fb[i], fc[i], curGrad);
    555                    
     559
    556560          TRI_NO_TSU_SETF(hwAddr++, curGrad);
    557561          i++;
     
    561565          const float curGrad = (((fb[GR_VERTEX_OOW_OFFSET] - fc[GR_VERTEX_OOW_OFFSET]) * dxAB) -
    562566                                 ((fa[GR_VERTEX_OOW_OFFSET] - fb[GR_VERTEX_OOW_OFFSET]) * dxBC));
    563                    
     567
    564568          TRI_NO_TSU_SETF(hwAddr++, curGrad);
    565         }               
    566       }     
    567          
     569        }
     570      }
     571
    568572      /* Draw the triangle by writing the area to the triangleCMD register */
    569573      TRI_NO_TSU_SETF(hwAddr, _GlideRoot.pool.ftemp1);
     
    582586
    583587  return 1;
    584    
     588
    585589#undef FN_NAME
    586590} /* _trisetup_nogradients */
  • trunk/src/opengl/glide/cvg/glide/splshdat.c

    r2888 r6653  
     1/* $Id: splshdat.c,v 1.2 2001-09-05 14:30:32 bird Exp $ */
    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/cvg/glide/splshdat.c,v 1.1 2000-02-25 00:37:45 sandervl Exp $
     21** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/cvg/glide/splshdat.c,v 1.2 2001-09-05 14:30:32 bird Exp $
    2122** $Log: splshdat.c,v $
    22 ** Revision 1.1  2000-02-25 00:37:45  sandervl
     23** Revision 1.2  2001-09-05 14:30:32  bird
     24** Added $Id:$ keyword.
     25**
     26** Revision 1.1  2000/02/25 00:37:45  sandervl
    2327** Created Voodoo 2 dir
    2428**
    25 ** 
     29**
    2630** 7     2/20/98 11:00a Peter
    2731** removed glide3 from glid2 tree
    28  * 
     32 *
    2933 * 6     1/09/98 6:48p Atai
    3034 * grTexInfo, GR_LOD_* and GR_ASPECT_*
    31  * 
     35 *
    3236 * 5     12/09/97 10:20a Peter
    3337 * removed extraneous cruft
    34  * 
     38 *
    3539 * 4     6/02/97 4:09p Peter
    3640 * Compile w/ gcc for Dural
    37  * 
     41 *
    3842 * 3     5/21/97 6:05a Peter
    3943**
     
    35933597
    35943598
    3595 static Vert *vert[] = { 
     3599static Vert *vert[] = {
    35963600vert_0,
    35973601vert_1,
     
    36053609};
    36063610
    3607 static Face *face[] = { 
     3611static Face *face[] = {
    36083612face_0,
    36093613face_1,
     
    36193623static int total_num_frames = 75;
    36203624
    3621 static Matrix mat[][3] = 
     3625static Matrix mat[][3] =
    36223626{
    36233627  {
    3624     { 
     3628    {
    36253629      1.000000f, 0.000000f, 0.000000f, 0.000000f,
    36263630      0.000000f, 0.000000f, 1.000000f, 0.000000f,
    36273631      0.000000f, 1.000000f, 0.000000f, 0.000000f,
    36283632      -41.462547f, 14.736900f, 22198.351563f, 1.000000f
    3629     }, 
     3633    },
    36303634    {
    36313635      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    36413645    }
    36423646  },
    3643   { 
     3647  {
    36443648    {
    36453649      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    36613665    }
    36623666  },
    3663   { 
     3667  {
    36643668    {
    36653669      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    36813685    }
    36823686  },
    3683   { 
     3687  {
    36843688    {
    36853689      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    37013705    },
    37023706  },
    3703   { 
     3707  {
    37043708    {
    37053709      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    37213725    }
    37223726  },
    3723   { 
     3727  {
    37243728    {
    37253729      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    37413745    }
    37423746  },
    3743   { 
     3747  {
    37443748    {
    37453749      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    37613765    }
    37623766  },
    3763   { 
     3767  {
    37643768    {
    37653769      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    38013805    }
    38023806  },
    3803  
     3807
    38043808  {
    38053809    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    38213825    }
    38223826  },
    3823  
     3827
    38243828  {
    38253829    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    38413845    }
    38423846  },
    3843  
     3847
    38443848  {
    38453849    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    38613865    }
    38623866  },
    3863  
     3867
    38643868  {
    38653869    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    38813885    }
    38823886  },
    3883  
     3887
    38843888  {
    38853889    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    39013905    }
    39023906  },
    3903  
     3907
    39043908  {
    39053909    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    39413945    }
    39423946  },
    3943  
     3947
    39443948  {
    39453949    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    39613965    }
    39623966  },
    3963  
     3967
    39643968  {
    39653969    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    39813985    }
    39823986  },
    3983  
     3987
    39843988  {
    39853989    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    40014005    }
    40024006  },
    4003  
     4007
    40044008  {
    40054009    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    40214025    }
    40224026  },
    4023  
     4027
    40244028  {
    40254029    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    40414045    }
    40424046  },
    4043  
     4047
    40444048  {
    40454049    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    40614065    }
    40624066  },
    4063  
     4067
    40644068  {
    40654069    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    40814085    }
    40824086  },
    4083  
     4087
    40844088  {
    40854089    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    41014105    }
    41024106  },
    4103  
     4107
    41044108  {
    41054109    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    41214125    }
    41224126  },
    4123  
     4127
    41244128  {
    41254129    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    41414145    }
    41424146  },
    4143  
     4147
    41444148  {
    41454149    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    41614165    }
    41624166  },
    4163  
     4167
    41644168  {
    41654169    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    41814185    }
    41824186  },
    4183  
     4187
    41844188  {
    41854189    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    42014205    }
    42024206  },
    4203  
     4207
    42044208  {
    42054209    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    42214225    }
    42224226  },
    4223  
     4227
    42244228  {
    42254229    { 1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    42414245    }
    42424246  },
    4243   { 
     4247  {
    42444248    {
    42454249      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    42614265    }
    42624266  },
    4263   { 
     4267  {
    42644268    {
    42654269      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    42814285    }
    42824286  },
    4283   { 
     4287  {
    42844288    {
    42854289      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    43014305    }
    43024306  },
    4303   { 
     4307  {
    43044308    {
    43054309      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    43214325    }
    43224326  },
    4323   { 
     4327  {
    43244328    {
    43254329      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    43414345    }
    43424346  },
    4343   { 
     4347  {
    43444348    {
    43454349      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    43614365    }
    43624366  },
    4363   { 
     4367  {
    43644368    {
    43654369      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    43814385    }
    43824386  },
    4383   { 
     4387  {
    43844388    {
    43854389      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    44014405    }
    44024406  },
    4403   { 
     4407  {
    44044408    {
    44054409      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    44214425    }
    44224426  },
    4423   { 
     4427  {
    44244428    {
    44254429      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    44414445    }
    44424446  },
    4443   { 
     4447  {
    44444448    {
    44454449      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    44614465    }
    44624466  },
    4463   { 
     4467  {
    44644468    {
    44654469      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    44814485    }
    44824486  },
    4483   { 
     4487  {
    44844488    {
    44854489      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    45014505    }
    45024506  },
    4503   { 
     4507  {
    45044508    {
    45054509      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    45214525    }
    45224526  },
    4523   { 
     4527  {
    45244528    {
    45254529      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    45414545    }
    45424546  },
    4543   { 
     4547  {
    45444548    {
    45454549      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    45614565    }
    45624566  },
    4563   { 
     4567  {
    45644568    {
    45654569      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    45814585    }
    45824586  },
    4583   { 
     4587  {
    45844588    {
    45854589      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    46014605    }
    46024606  },
    4603   { 
     4607  {
    46044608    {
    46054609      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    46214625    }
    46224626  },
    4623   { 
     4627  {
    46244628    {
    46254629      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    46414645    }
    46424646  },
    4643   { 
     4647  {
    46444648    {
    46454649      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    46614665    }
    46624666  },
    4663   { 
     4667  {
    46644668    {
    46654669      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    46814685    }
    46824686  },
    4683   { 
     4687  {
    46844688    {
    46854689      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    47014705    }
    47024706  },
    4703   { 
     4707  {
    47044708    {
    47054709      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    47214725    }
    47224726  },
    4723   { 
     4727  {
    47244728    {
    47254729      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    47414745    }
    47424746  },
    4743   { 
     4747  {
    47444748    {
    47454749      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    47614765    }
    47624766  },
    4763   { 
     4767  {
    47644768    {
    47654769      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    47814785    }
    47824786  },
    4783   { 
     4787  {
    47844788    {
    47854789      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    48014805    }
    48024806  },
    4803   { 
     4807  {
    48044808    {
    48054809      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    48214825    }
    48224826  },
    4823   { 
     4827  {
    48244828    {
    48254829      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    48414845    }
    48424846  },
    4843   { 
     4847  {
    48444848    {
    48454849      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    48614865    }
    48624866  },
    4863   { 
     4867  {
    48644868    {
    48654869      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    48814885    }
    48824886  },
    4883   { 
     4887  {
    48844888    {
    48854889      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    49014905    }
    49024906  },
    4903   { 
     4907  {
    49044908    {
    49054909      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    49214925    }
    49224926  },
    4923   { 
     4927  {
    49244928    {
    49254929      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    49414945    }
    49424946  },
    4943   { 
     4947  {
    49444948    {
    49454949      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    49614965    }
    49624966  },
    4963   { 
     4967  {
    49644968    {
    49654969      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    49814985    }
    49824986  },
    4983   { 
     4987  {
    49844988    {
    49854989      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    50015005    }
    50025006  },
    5003   { 
     5007  {
    50045008    {
    50055009      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    50215025    }
    50225026  },
    5023   { 
     5027  {
    50245028    {
    50255029      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    50415045    }
    50425046  },
    5043   { 
     5047  {
    50445048    {
    50455049      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    50615065    }
    50625066  },
    5063   { 
     5067  {
    50645068    {
    50655069      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    50815085    }
    50825086  },
    5083   { 
     5087  {
    50845088    {
    50855089      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    51015105    }
    51025106  },
    5103   { 
     5107  {
    51045108    {
    51055109      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    51215125    }
    51225126  },
    5123   { 
     5127  {
    51245128    {
    51255129      1.000000f, 0.000000f, 0.000000f, 0.000000f,
     
    51565160      { /* yRGB */
    51575161        0x22, 0x22, 0x2b, 0x3c,
    5158         0x44, 0x44, 0x66, 0x77, 
    5159         0x88, 0x99, 0xaa, 0xbb, 
     5162        0x44, 0x44, 0x66, 0x77,
     5163        0x88, 0x99, 0xaa, 0xbb,
    51605164        0xcc, 0xdd, 0xee, 0xff
    51615165      },
     
    1478814792};
    1478914793
    14790 #undef RAW_NAME 
    14791 #undef IMAGE_NAME 
     14794#undef RAW_NAME
     14795#undef IMAGE_NAME
  • trunk/src/opengl/glide/cvg/init/dac.c

    r2888 r6653  
     1/* $Id: dac.c,v 1.2 2001-09-05 14:30:35 bird Exp $ */
    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:37:51 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:35 $
    2324**
    2425** Initialization code for initializing supported SST-1 DACs
     
    4546**  Read external DAC registers
    4647**  NOTE: The video unit of FBI must be in reset before calling this routine.
    47 **        The rendering engines of FBI and TREX must be idle before calling 
     48**        The rendering engines of FBI and TREX must be idle before calling
    4849**        this routine.
    4950**        fbiInit23 register remapping (PCI config. initEnable[2]=1) must be
     
    7879**  Write to external DAC registers
    7980**  NOTE: The video unit of FBI must be in reset before calling this routine.
    80 **        The rendering engines of FBI and TREX must be idle before calling 
     81**        The rendering engines of FBI and TREX must be idle before calling
    8182**        this routine.
    8283**
     
    613614    {
    614615        float calc;
    615        
     616
    616617        calc = ((float) 14.318 * (float) (m + 2)) /
    617618            ((float) (n + 2) * vcoFreqDivide);
     
    694695        vcoFreq = ((float) 14.31818 * (float) (clkTiming->clkTiming_M + 2)) /
    695696          ((float) (clkTiming->clkTiming_N + 2));
    696        
     697
    697698        printf("freq:%.3f  calc:%.3f\n", freq, clkFreq);
    698699        printf("m:%d p:%d n:%d vco:%.2f\n", clkTiming->clkTiming_M,
  • trunk/src/opengl/glide/cvg/init/gamma.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: gamma.c,v 1.2 2001-09-05 14:30:36 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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**
    2122**
    22 ** $Revision: 1.1 $
    23 ** $Date: 2000-02-25 00:37:51 $
     23** $Revision: 1.2 $
     24** $Date: 2001-09-05 14:30:36 $
    2425**
    2526** Initialization code for loading SST-1 gamma tables
     
    149150        FxU32 gcG = gammaTableG[(x<<3)];
    150151        FxU32 gcB = gammaTableB[(x<<3)];
    151         ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
     152        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) |
    152153                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
    153154                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
     
    217218        FxU32 gcG = gammaTableG[(x)];
    218219        FxU32 gcB = gammaTableB[(x)];
    219         ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
     220        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) |
    220221                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
    221222                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
  • trunk/src/opengl/glide/cvg/init/gdebug.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: gdebug.c,v 1.2 2001-09-05 14:30:37 bird Exp $ */
    23#include "vxd.h"
    34
     
    67** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    78** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    8 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    9 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    10 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     9** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     10** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     11** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    1112** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    12 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    13 ** 
     13** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     14**
    1415** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1516** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1718** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1819** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    19 ** THE UNITED STATES. 
    20 ** 
     20** THE UNITED STATES.
     21**
    2122** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    2223**
    23 ** $Revision: 1.1 $
    24 ** $Date: 2000-02-25 00:37:51 $
     24** $Revision: 1.2 $
     25** $Date: 2001-09-05 14:30:37 $
    2526*/
    2627
     
    6667#endif
    6768
    68 static char *gdbg_myname = "gd";                // default library name
    69 static char gdbg_debuglevel[GDBG_MAX_LEVELS];   // array of debuglevel controls
     69static char *gdbg_myname = "gd";        // default library name
     70static char gdbg_debuglevel[GDBG_MAX_LEVELS];   // array of debuglevel controls
    7071
    7172static long gdbg_errors = 0;
     
    8283{
    8384    if (level >= GDBG_MAX_LEVELS)
    84         level = GDBG_MAX_LEVELS - 1;
     85    level = GDBG_MAX_LEVELS - 1;
    8586
    8687    gdbg_debuglevel[level] = value;
     
    8990
    9091#ifndef KERNEL_NT
    91 // we need to call a kernal printf. 
     92// we need to call a kernal printf.
    9293extern int __cdecl klvfprintf(FILE        *stream,
    9394                              const char  *format,
     
    9596#endif
    9697
    97 static FILE *gdbg_msgfile;      // GDBG info/error file
     98static FILE *gdbg_msgfile;  // GDBG info/error file
    9899#else /* #ifdef KERNEL */
    99100
    100 static FILE *gdbg_msgfile = NULL; /*stdout;*/   // GDBG info/error file
     101static FILE *gdbg_msgfile = NULL; /*stdout;*/   // GDBG info/error file
    101102
    102103//----------------------------------------------------------------------
     
    107108    int r0,r1,pos;
    108109
    109     sscanf(buf,"%i%n",&r0,&pos);                // parse the first integer
    110     if (buf[pos]=='-' || buf[pos]==':') {       // if there's a second
    111         buf += pos+1;
    112         sscanf(buf,"%i%n",&r1,&pos);            // then parse it
     110    sscanf(buf,"%i%n",&r0,&pos);        // parse the first integer
     111    if (buf[pos]=='-' || buf[pos]==':') {   // if there's a second
     112    buf += pos+1;
     113    sscanf(buf,"%i%n",&r1,&pos);        // then parse it
    113114    }
    114115    else
    115         r1 = r0;
    116 
    117     if (r0 < 0) r0 = 0;                         // sanity checks
     116    r1 = r0;
     117
     118    if (r0 < 0) r0 = 0;             // sanity checks
    118119    if (r1 >= GDBG_MAX_LEVELS) r1 = GDBG_MAX_LEVELS-1;
    119120    if (r1 < r0) r1 = r0;
    120121
    121     while (r0 <= r1)                            // now set the debuglevel levels
    122         gdbg_debuglevel[r0++] = val;
    123 
    124     return buf + pos;                           // and return rest of string
     122    while (r0 <= r1)                // now set the debuglevel levels
     123    gdbg_debuglevel[r0++] = val;
     124
     125    return buf + pos;               // and return rest of string
    125126}
    126127
     
    131132
    132133    do {
    133         if (env[0] == ',')              // advance past commas
    134             env++;
    135         if (env[0] == '+')              // if + then enable a range
    136             env = setRange(env+1,1);
    137         else if (env[0] == '-')         // if - then disable a range
    138             env = setRange(env+1,0);
    139         else {                          // else just a number
    140             if (sscanf(env,"%i%n",&level,&pos) <= 0) return;
    141             if (pos==0) return;         // oops, guess not
    142             if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1;
    143             while (level >= 0)          // enable the range [0,#]
    144                 gdbg_debuglevel[level--] = 1;
    145             env += pos;
    146         }
     134    if (env[0] == ',')      // advance past commas
     135        env++;
     136    if (env[0] == '+')      // if + then enable a range
     137        env = setRange(env+1,1);
     138    else if (env[0] == '-')     // if - then disable a range
     139        env = setRange(env+1,0);
     140    else {              // else just a number
     141        if (sscanf(env,"%i%n",&level,&pos) <= 0) return;
     142        if (pos==0) return;     // oops, guess not
     143        if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1;
     144        while (level >= 0)      // enable the range [0,#]
     145        gdbg_debuglevel[level--] = 1;
     146        env += pos;
     147    }
    147148    } while (env[0] == ',');
    148149}
     
    153154gdbg_init(void)
    154155{
    155     static int done=0;                  // only execute once
     156    static int done=0;          // only execute once
    156157    char *env;
    157158
     
    163164
    164165#if __MWERKS__
    165         SIOUXSettings.standalone                                = false;
    166         SIOUXSettings.setupmenus                                = false;
    167         SIOUXSettings.autocloseonquit   = true;
    168         SIOUXSettings.asktosaveonclose  = false;
    169 #endif     
    170    
     166    SIOUXSettings.standalone                = false;
     167    SIOUXSettings.setupmenus                = false;
     168    SIOUXSettings.autocloseonquit   = true;
     169    SIOUXSettings.asktosaveonclose  = false;
     170#endif
     171
    171172#ifdef KERNEL
    172         // put code in here to set the default level
    173     gdbg_debuglevel[0] = 1;             // always enable level 0
    174     gdbg_debuglevel[120] = 1;           // always enable level 0
     173    // put code in here to set the default level
     174    gdbg_debuglevel[0] = 1;     // always enable level 0
     175    gdbg_debuglevel[120] = 1;       // always enable level 0
    175176    done = 1;
    176177    env = 0;
     
    178179#else /* #ifdef KERNEL */
    179180    done = 1;
    180     gdbg_debuglevel[0] = 1;             // always enable level 0
     181    gdbg_debuglevel[0] = 1;     // always enable level 0
    181182    env = GETENV("GDBG_FILE");
    182183    if (env != NULL) GDBG_SET_FILE(env);
     
    193194  gdbg_info(1,"gdbg_shutdown()\n");
    194195#ifndef KERNEL
    195   if (gdbg_msgfile != stdout) { // close any existing output file
     196  if (gdbg_msgfile != stdout) { // close any existing output file
    196197#if USE_DEBUG_STRING
    197     if (!UseDebugString) 
     198    if (!UseDebugString)
    198199#endif /* USE_DEBUG_STRING */
    199200      fclose(gdbg_msgfile);
     
    286287    __asm mov   ebx, format;
    287288    MyPrintf();
    288 #endif /* #ifndef KERNEL */   
     289#endif /* #ifndef KERNEL */
    289290
    290291}
     
    307308
    308309    if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level])
    309         return(0);
     310    return(0);
    310311#ifndef KERNEL
    311312    va_start(args, format);
     
    341342
    342343    if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level])
    343         return(0);
     344    return(0);
    344345#ifndef KERNEL
    345346    va_start(args, format);
     
    406407    va_start(args, format);
    407408    sprintf(newformat, "%s error (%s): ", gdbg_myname,kind);
    408     strcat(newformat,format);           // add a preamble to message
     409    strcat(newformat,format);       // add a preamble to message
    409410    gdbg_vprintf(newformat,args);
    410     gdbg_errors++;                      // increment the error counter
    411     va_end(args);
    412    
     411    gdbg_errors++;          // increment the error counter
     412    va_end(args);
     413
    413414    {
    414415       int i;
    415416       const int count = sizeof(errorProcList) / sizeof(errorProcList[0]);
    416        
     417
    417418       for(i = 0; i < count; i++) {
    418419          if (errorProcList[i] != NULL) {
     
    466467  FILE *outf;
    467468
    468   if (gdbg_msgfile != stdout) { // close any existing output file
     469  if (gdbg_msgfile != stdout) { // close any existing output file
    469470    fclose(gdbg_msgfile);
    470471    gdbg_msgfile = stdout;
     
    475476    gdbg_msgfile = (FILE *) 1;
    476477    UseDebugString = 1;
    477   } else 
     478  } else
    478479#endif /* USE_DEBUG_STRING */
    479480  {
    480     outf = fopen(name,"w");             // open up a new one
     481    outf = fopen(name,"w");     // open up a new one
    481482    if (outf) gdbg_msgfile = outf;
    482483  }
     
    485486#else /* #ifndef KERNEL */
    486487  return 0;
    487 #endif /* #ifndef KERNEL */   
    488 }
     488#endif /* #ifndef KERNEL */
     489}
  • trunk/src/opengl/glide/cvg/init/info.c

    r2888 r6653  
     1/* $Id: info.c,v 1.2 2001-09-05 14:30:37 bird Exp $ */
    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:37:52 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:37 $
    2324**
    2425** Routines to detect memory size, strapping pin, and other initialization
     
    4344#define XY_ONE (1<<SST_XY_FRACBITS)
    4445
    45 static FxBool 
    46 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 
    47                 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
     46static FxBool
     47readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y,
     48            FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
    4849{
    4950    FxU32 rd_x, rd_y;
     
    5657    sst1InitIdle(sstbase);
    5758    if (x & 1) {
    58         INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
    59         return(FXFALSE);
     59    INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
     60    return(FXFALSE);
    6061    }
    6162
     
    6566    *b_sum = 0;
    6667
    67     for (rd_y = 0; rd_y < 4; rd_y++) {          /* read 4 scanlines */
    68         for (rd_x = 0; rd_x < 4; rd_x ++) {
    69             if ((rd_x & 1)==0) {                /* read 2 pixels at a time */
    70                 rd_col =
    71                   IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);
    72             }
    73             else rd_col >>= 16;
    74             rd_r = ((rd_col >> 11) & 0x1f) << 3;
    75             rd_g = ((rd_col >>  5) & 0x3f) << 2;
    76             rd_b = ((rd_col >>  0) & 0x1f) << 3;
    77             *r_sum += rd_r;
    78             *g_sum += rd_g;
    79             *b_sum += rd_b;
    80             INIT_INFO((4,"%d,%d = rd_col: 0x%04x   rgb: %02x %02x %02x\n",
    81                     rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));
    82         }
     68    for (rd_y = 0; rd_y < 4; rd_y++) {      /* read 4 scanlines */
     69    for (rd_x = 0; rd_x < 4; rd_x ++) {
     70        if ((rd_x & 1)==0) {        /* read 2 pixels at a time */
     71        rd_col =
     72          IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);
     73        }
     74        else rd_col >>= 16;
     75        rd_r = ((rd_col >> 11) & 0x1f) << 3;
     76        rd_g = ((rd_col >>  5) & 0x3f) << 2;
     77        rd_b = ((rd_col >>  0) & 0x1f) << 3;
     78        *r_sum += rd_r;
     79        *g_sum += rd_g;
     80        *b_sum += rd_b;
     81        INIT_INFO((4,"%d,%d = rd_col: 0x%04x   rgb: %02x %02x %02x\n",
     82            rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));
     83    }
    8384    }
    8485    INIT_INFO((3,"sums:  r_sum=0x%03x  g_sum=0x%03x  b_sum=0x%03x\n",
    85                     *r_sum, *g_sum, *b_sum));
    86         return(FXTRUE);
     86            *r_sum, *g_sum, *b_sum));
     87    return(FXTRUE);
    8788}
    8889
     
    123124    /* init sum array */
    124125    for (r_sum = 0; r_sum <= 0xfff; r_sum++) {
    125         rb_tbl[r_sum] = -1;
    126         g_tbl[r_sum] = -1;
     126    rb_tbl[r_sum] = -1;
     127    g_tbl[r_sum] = -1;
    127128    }
    128129
     
    132133    /* fill sum array */
    133134    for (tst_color = 0; tst_color <= 255; tst_color++) {
    134         INIT_INFO((2,"tst_color=0x%02x\n", tst_color));
    135         ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);
    136 
    137         drawTriangle(sst, x,y,36);
    138         if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)
    139                 return(FXFALSE);
    140 
    141         /* check sums for uniqueness and then store away */
    142         if (r_sum != b_sum) {
    143             INIT_PRINTF(("ERROR:  b_sum=0x%03x  r_sum=0x%03x\n", r_sum, b_sum));
    144                 return(FXFALSE);
    145         }
    146         if (rb_tbl[r_sum] != -1) {
    147             INIT_PRINTF(("ERROR:  non-unique r/b_sum=0x%03x\n", r_sum));
    148                 return(FXFALSE);
    149         }
    150         rb_tbl[r_sum] = tst_color;
    151         if (g_tbl[g_sum] != -1) {
    152             INIT_PRINTF(("ERROR:  non-unique g_sum=0x%03x\n", g_sum));
    153                 return(FXFALSE);
    154         }
    155         g_tbl[g_sum] = tst_color;
    156     }
    157         return(FXTRUE);
     135    INIT_INFO((2,"tst_color=0x%02x\n", tst_color));
     136    ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);
     137
     138    drawTriangle(sst, x,y,36);
     139    if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)
     140        return(FXFALSE);
     141
     142    /* check sums for uniqueness and then store away */
     143    if (r_sum != b_sum) {
     144        INIT_PRINTF(("ERROR:  b_sum=0x%03x  r_sum=0x%03x\n", r_sum, b_sum));
     145        return(FXFALSE);
     146    }
     147    if (rb_tbl[r_sum] != -1) {
     148        INIT_PRINTF(("ERROR:  non-unique r/b_sum=0x%03x\n", r_sum));
     149        return(FXFALSE);
     150    }
     151    rb_tbl[r_sum] = tst_color;
     152    if (g_tbl[g_sum] != -1) {
     153        INIT_PRINTF(("ERROR:  non-unique g_sum=0x%03x\n", g_sum));
     154        return(FXFALSE);
     155    }
     156    g_tbl[g_sum] = tst_color;
     157    }
     158    return(FXTRUE);
    158159}
    159160
     
    164165    if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1)
    165166    {
    166         INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
    167         return(FXFALSE);
     167    INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
     168    return(FXFALSE);
    168169    }
    169170    *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum];
    170         return(FXTRUE);
     171    return(FXTRUE);
    171172}
    172173
     
    177178    FxU32 r_sum, g_sum, b_sum;
    178179    SstRegs *sst = (SstRegs *) sstbase;
    179         FxU32 tmuRevision;
     180    FxU32 tmuRevision;
    180181
    181182    /* set trex's (all 3) to output configuration bits */
     
    186187    /* render into the frame buffer */
    187188    ISET(sst->fbzColorPath,
    188           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     189      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    189190    ISET(sst->texBaseAddr, 0);
    190191    ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS);
     
    193194
    194195    readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum);
    195         if(GETENV(("SSTV2_TEXMAP_DISABLE"))) {
    196                 info->tmuConfig = 0x0;
    197         } else {
    198             if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)
    199                         return(FXFALSE);
    200         }
    201 
    202         /////////////////////////
    203         // Get new revision...
    204         /////////////////////////
     196    if(GETENV(("SSTV2_TEXMAP_DISABLE"))) {
     197        info->tmuConfig = 0x0;
     198    } else {
     199        if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)
     200            return(FXFALSE);
     201    }
     202
     203    /////////////////////////
     204    // Get new revision...
     205    /////////////////////////
    205206    ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0] | (1 << 18) |
    206           (5 << SST_TEX_SEND_CONFIG_SEL_SHIFT));
     207      (5 << SST_TEX_SEND_CONFIG_SEL_SHIFT));
    207208    ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1] | (1 << 18));
    208209    ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2] | (1 << 18));
     
    210211    /* render into the frame buffer */
    211212    ISET(sst->fbzColorPath,
    212           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     213      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    213214    ISET(sst->texBaseAddr, 0);
    214215    ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS);
     
    217218
    218219    readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum);
    219         if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE)
    220                 return(FXFALSE);
    221 
    222         info->tmuFab[0] = (tmuRevision >> 4) & 0xf;
    223         info->tmuFab[1] = (tmuRevision >> 12) & 0xf;
    224         info->tmuFab[2] = (tmuRevision >> 20) & 0xf;
    225 
    226         /* Adjust configuration structure for "new" revision ID */
    227         info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14));
    228         info->tmuConfig |= (((tmuRevision & 0x7) + 3) |
    229           ((((tmuRevision >> 8) & 0x7) + 3) << 7) |
    230           ((((tmuRevision >> 16) & 0x7) + 3) << 14));
     220    if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE)
     221        return(FXFALSE);
     222
     223    info->tmuFab[0] = (tmuRevision >> 4) & 0xf;
     224    info->tmuFab[1] = (tmuRevision >> 12) & 0xf;
     225    info->tmuFab[2] = (tmuRevision >> 20) & 0xf;
     226
     227    /* Adjust configuration structure for "new" revision ID */
     228    info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14));
     229    info->tmuConfig |= (((tmuRevision & 0x7) + 3) |
     230      ((((tmuRevision >> 8) & 0x7) + 3) << 7) |
     231      ((((tmuRevision >> 16) & 0x7) + 3) << 14));
    231232
    232233    /* reset trex's init registers */
     
    235236    ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]);
    236237
    237         if(GETENV(("SSTV2_TMUCFG")))
     238    if(GETENV(("SSTV2_TMUCFG")))
    238239        SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig);
    239240
    240         return(FXTRUE);
     241    return(FXTRUE);
    241242}
    242243
     
    246247
    247248static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
    248                    FxU32 mem, FxU32 init)
     249           FxU32 mem, FxU32 init)
    249250{
    250251    SstRegs *sst = (SstRegs *) sstbase;
     
    256257    sst1InitIdle(sstbase);
    257258
    258     ISET(sst->texBaseAddr, 0x200000>>3);        /* set to 2 MB */
    259     ISET(texAddr[0], SENSE2);           /* write a random value */
    260    
    261     ISET(sst->texBaseAddr, 0x100000>>3);        /* set to 1 MB */
    262     ISET(texAddr[0], SENSE1);           /* write a random value */
    263    
    264     ISET(sst->texBaseAddr, 0x000000>>3);        /* set to 0 MB */
    265     ISET(texAddr[0], SENSE0);           /* write a random value */
    266 
    267     ISET(sst->texBaseAddr, mem>>3);             /* reset to 2 MB */
    268     drawTriangle(sst,0,0,4);            /* draw a 4x4 right triangle */
     259    ISET(sst->texBaseAddr, 0x200000>>3);    /* set to 2 MB */
     260    ISET(texAddr[0], SENSE2);       /* write a random value */
     261
     262    ISET(sst->texBaseAddr, 0x100000>>3);    /* set to 1 MB */
     263    ISET(texAddr[0], SENSE1);       /* write a random value */
     264
     265    ISET(sst->texBaseAddr, 0x000000>>3);    /* set to 0 MB */
     266    ISET(texAddr[0], SENSE0);       /* write a random value */
     267
     268    ISET(sst->texBaseAddr, mem>>3);     /* reset to 2 MB */
     269    drawTriangle(sst,0,0,4);        /* draw a 4x4 right triangle */
    269270    sst1InitIdle(sstbase);
    270271
     
    281282FX_EXPORT FxBool FX_CSTYLE
    282283sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
    283         FxU32 *TmuMemorySize)
     284    FxU32 *TmuMemorySize)
    284285{
    285286    FxU32 i,data;
     
    288289    INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu));
    289290
    290         if(GETENV(("SSTV2_TMU_MEMSIZE"))) {
    291                 *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE")));
    292                 // If user specifies 2 MBytes on a 4 MBytes board, disable the
    293                 // second RAS so that apps which may incorrectly store data in the
    294                 // upper 2 Mbytes will not function properly...
    295                 if(*TmuMemorySize == 2) {
    296                         info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS;
    297                 sst1InitIdle(sstbase);
    298                     ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]);
    299                     sst1InitIdle(sstbase);
    300                 }
    301                 return(FXTRUE);
    302         }
     291    if(GETENV(("SSTV2_TMU_MEMSIZE"))) {
     292        *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE")));
     293        // If user specifies 2 MBytes on a 4 MBytes board, disable the
     294        // second RAS so that apps which may incorrectly store data in the
     295        // upper 2 Mbytes will not function properly...
     296        if(*TmuMemorySize == 2) {
     297            info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS;
     298            sst1InitIdle(sstbase);
     299            ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]);
     300            sst1InitIdle(sstbase);
     301        }
     302        return(FXTRUE);
     303    }
    303304
    304305    ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER);
    305306    ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK);
    306307    ISET(sst->fbzColorPath,
    307           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     308      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    308309    ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE);
    309310    ISET(sst->tLOD, 0);
     
    311312    /* setup all downstream TMUs to be in pass-thru mode */
    312313    for (i=0; i<tmu; i++)
    313         ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
     314    ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
    314315
    315316    /* first see if we have 4 Mbytes by writing a texel at 2MB followed by
     
    331332
    332333    INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n"));
    333         return(FXFALSE);
     334    return(FXFALSE);
    334335}
    335336
    336337/*---------------------------------------------------------------------------
    337338   NOTES:
    338         assumes that board and registers are initialized
    339         destroys part of the framebuffer
     339    assumes that board and registers are initialized
     340    destroys part of the framebuffer
    340341  ---------------------------------------------------------------------------*/
    341342FX_EXPORT FxBool FX_CSTYLE
     
    345346
    346347    if(initSumTables(sstbase) == FXFALSE)
    347                 return(FXFALSE);
     348        return(FXFALSE);
    348349    if(getTmuConfigData(sstbase,info) == FXFALSE)
    349                 return(FXFALSE);
     350        return(FXFALSE);
    350351
    351352    info->numberTmus = 1;
    352         if(GETENV(("SSTV2_TEXMAP_DISABLE"))) {
    353             info->tmuRevision = 4;
    354             sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]);
    355                 info->tmuMemSize[0] = 2;
    356         } else {
    357             /* Get TMU memory size */
    358             info->tmuRevision = info->tmuConfig & 0x7;
    359             if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) ==
    360                   FXFALSE)
    361                         return(FXFALSE);
    362         }
     353    if(GETENV(("SSTV2_TEXMAP_DISABLE"))) {
     354        info->tmuRevision = 4;
     355        sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]);
     356        info->tmuMemSize[0] = 2;
     357    } else {
     358        /* Get TMU memory size */
     359        info->tmuRevision = info->tmuConfig & 0x7;
     360        if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) ==
     361          FXFALSE)
     362            return(FXFALSE);
     363    }
    363364
    364365    INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0]));
    365     if (info->tmuConfig & FXBIT(6)) {           /* if TMU 1 exists */
    366         info->numberTmus++;                     /* increment TMU count */
    367         trev = (info->tmuConfig>>7) & 0x7;      /* get its revision */
     366    if (info->tmuConfig & FXBIT(6)) {       /* if TMU 1 exists */
     367    info->numberTmus++;         /* increment TMU count */
     368    trev = (info->tmuConfig>>7) & 0x7;  /* get its revision */
    368369#if 0 // Ignore for now...
    369         if (info->tmuRevision != trev) {
    370             INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
    371             return(FXFALSE);
    372         }
     370    if (info->tmuRevision != trev) {
     371        INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
     372        return(FXFALSE);
     373    }
    373374#endif
    374375    if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE)
    375                 return(FXFALSE);
    376     }
    377     if (info->tmuConfig & FXBIT(13)) {          /* if TMU 2 exists */
    378         info->numberTmus++;                     /* increment TMU count */
    379         trev = (info->tmuConfig>>14) & 0x7;     /* get its revision */
     376        return(FXFALSE);
     377    }
     378    if (info->tmuConfig & FXBIT(13)) {      /* if TMU 2 exists */
     379    info->numberTmus++;         /* increment TMU count */
     380    trev = (info->tmuConfig>>14) & 0x7; /* get its revision */
    380381#if 0 // Ignore for now...
    381         if (info->tmuRevision != trev) {
    382             INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
    383             return(FXFALSE);
    384         }
     382    if (info->tmuRevision != trev) {
     383        INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
     384        return(FXFALSE);
     385    }
    385386#endif
    386387    if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE)
    387                 return(FXFALSE);
    388     }
    389         if(GETENV(("SSTV2_NUM_TMUS")))
    390           info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS")));
     388        return(FXFALSE);
     389    }
     390    if(GETENV(("SSTV2_NUM_TMUS")))
     391      info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS")));
    391392
    392393    INIT_INFO((1,"numberTMus = %d\n", info->numberTmus));
     
    401402**
    402403*/
    403 #define LFB_PUTPIXEL(X, Y, DATA)        \
    404         ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)
    405 #define LFB_GETPIXEL(X, Y)                      \
    406         IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])
     404#define LFB_PUTPIXEL(X, Y, DATA)    \
     405    ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)
     406#define LFB_GETPIXEL(X, Y)          \
     407    IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])
    407408
    408409static int fbiMemSize(FxU32 *sstbase)
    409410{
    410         SstRegs *sst = (SstRegs *) sstbase;
    411         volatile unsigned short *lfbptr = (unsigned short *) sstbase;
    412         FxU32 init0Save = IGET(sst->fbiInit0);
    413         FxU32 init1Save = IGET(sst->fbiInit1);
    414         FxU32 init2Save = IGET(sst->fbiInit2);
    415         int retval = 0;
    416 
    417         if(GETENV(("SSTV2_FBI_MEMSIZE")))
    418                 return(ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))));
    419 
    420         /* Enable dram refresh, disable memory fifo, and setup memory */
    421         /* for rendering */
    422         ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);
     411    SstRegs *sst = (SstRegs *) sstbase;
     412    volatile unsigned short *lfbptr = (unsigned short *) sstbase;
     413    FxU32 init0Save = IGET(sst->fbiInit0);
     414    FxU32 init1Save = IGET(sst->fbiInit1);
     415    FxU32 init2Save = IGET(sst->fbiInit2);
     416    int retval = 0;
     417
     418    if(GETENV(("SSTV2_FBI_MEMSIZE")))
     419        return(ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))));
     420
     421    /* Enable dram refresh, disable memory fifo, and setup memory */
     422    /* for rendering */
     423    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);
    423424    ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH);
    424         sst1InitIdleFBI(sstbase);
    425 
    426         /* Setup Basic rendering datapath */
    427         ISET(sst->fbzColorPath, SST_CC_MONE);
    428         ISET(sst->fogMode, 0x0);
    429         ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);
    430         sst1InitIdleFBI(sstbase);
     425    sst1InitIdleFBI(sstbase);
     426
     427    /* Setup Basic rendering datapath */
     428    ISET(sst->fbzColorPath, SST_CC_MONE);
     429    ISET(sst->fogMode, 0x0);
     430    ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);
     431    sst1InitIdleFBI(sstbase);
    431432
    432433    sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1);
    433         sst1InitIdleFBI(sstbase);
    434 
    435         ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |
    436                 SST_LFB_READDEPTHABUFFER);
    437         sst1InitIdleFBI(sstbase);
    438 
    439         /* Check for 4 MBytes... */
    440         /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */
    441         LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */
    442         LFB_PUTPIXEL(0, 0, 0x0);
    443         LFB_PUTPIXEL(798, 599, 0xffff);
    444         LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */
    445         LFB_PUTPIXEL(20, 20, 0xffff);
    446         LFB_PUTPIXEL(400, 400, 0x0);
    447         sst1InitIdleFBI(sstbase);
    448         if((LFB_GETPIXEL(128, 100) == 0xdead) &&
    449            (LFB_GETPIXEL(200, 200) == 0x55aa)) {
    450                 retval = 4;
    451                 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
    452                 sst1InitIdleFBI(sstbase);
    453                 goto fbiMemSizeDone;
    454         }
    455 
    456         /* Check for 2 MBytes... */
    457         /* Write to color buffer in 640x480 resolution */
     434    sst1InitIdleFBI(sstbase);
     435
     436    ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |
     437        SST_LFB_READDEPTHABUFFER);
     438    sst1InitIdleFBI(sstbase);
     439
     440    /* Check for 4 MBytes... */
     441    /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */
     442    LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */
     443    LFB_PUTPIXEL(0, 0, 0x0);
     444    LFB_PUTPIXEL(798, 599, 0xffff);
     445    LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */
     446    LFB_PUTPIXEL(20, 20, 0xffff);
     447    LFB_PUTPIXEL(400, 400, 0x0);
     448    sst1InitIdleFBI(sstbase);
     449    if((LFB_GETPIXEL(128, 100) == 0xdead) &&
     450       (LFB_GETPIXEL(200, 200) == 0x55aa)) {
     451        retval = 4;
     452        ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
     453        sst1InitIdleFBI(sstbase);
     454        goto fbiMemSizeDone;
     455    }
     456
     457    /* Check for 2 MBytes... */
     458    /* Write to color buffer in 640x480 resolution */
    458459    sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0);
    459         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
    460                 SST_LFB_READFRONTBUFFER);
    461         sst1InitIdleFBI(sstbase);
    462         LFB_PUTPIXEL(50, 100, 0xdead);  /* maps to row:0x1e, col:0x99, bank:0x0 */
    463         LFB_PUTPIXEL(0, 0, 0x0);
    464         LFB_PUTPIXEL(638, 479, 0xffff);
    465         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |
    466                 SST_LFB_READFRONTBUFFER);
    467         sst1InitIdleFBI(sstbase);
    468         LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */
    469         LFB_PUTPIXEL(20, 20, 0x0);
    470         LFB_PUTPIXEL(400, 400, 0xffff);
    471         sst1InitIdleFBI(sstbase);
    472         if(LFB_GETPIXEL(50, 100) != 0xdead)
    473                 goto check1MByte;
    474         ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
    475         sst1InitIdleFBI(sstbase);
    476         if(LFB_GETPIXEL(178, 436) == 0xaa55) {
    477                 retval = 2;
    478                 goto fbiMemSizeDone;
    479         }
     460    ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
     461        SST_LFB_READFRONTBUFFER);
     462    sst1InitIdleFBI(sstbase);
     463    LFB_PUTPIXEL(50, 100, 0xdead);  /* maps to row:0x1e, col:0x99, bank:0x0 */
     464    LFB_PUTPIXEL(0, 0, 0x0);
     465    LFB_PUTPIXEL(638, 479, 0xffff);
     466    ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |
     467        SST_LFB_READFRONTBUFFER);
     468    sst1InitIdleFBI(sstbase);
     469    LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */
     470    LFB_PUTPIXEL(20, 20, 0x0);
     471    LFB_PUTPIXEL(400, 400, 0xffff);
     472    sst1InitIdleFBI(sstbase);
     473    if(LFB_GETPIXEL(50, 100) != 0xdead)
     474        goto check1MByte;
     475    ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
     476    sst1InitIdleFBI(sstbase);
     477    if(LFB_GETPIXEL(178, 436) == 0xaa55) {
     478        retval = 2;
     479        goto fbiMemSizeDone;
     480    }
    480481
    481482check1MByte:
    482         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
    483                 SST_LFB_READFRONTBUFFER);
    484         sst1InitIdleFBI(sstbase);
    485         LFB_PUTPIXEL(10, 10, 0xdead);   /* maps to row:0x0, col:0x145, bank:0x0 */
    486         LFB_PUTPIXEL(8, 8, 0x0);
    487         LFB_PUTPIXEL(340, 340, 0xffff);
    488         LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */
    489         LFB_PUTPIXEL(66, 0, 0x0);
    490         LFB_PUTPIXEL(360, 360, 0xffff);
    491         sst1InitIdleFBI(sstbase);
    492         if((LFB_GETPIXEL(10, 10) == 0xdead) &&
    493            (LFB_GETPIXEL(100, 200) == 0x5a5a))
    494                 retval = 1;
     483    ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
     484        SST_LFB_READFRONTBUFFER);
     485    sst1InitIdleFBI(sstbase);
     486    LFB_PUTPIXEL(10, 10, 0xdead);   /* maps to row:0x0, col:0x145, bank:0x0 */
     487    LFB_PUTPIXEL(8, 8, 0x0);
     488    LFB_PUTPIXEL(340, 340, 0xffff);
     489    LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */
     490    LFB_PUTPIXEL(66, 0, 0x0);
     491    LFB_PUTPIXEL(360, 360, 0xffff);
     492    sst1InitIdleFBI(sstbase);
     493    if((LFB_GETPIXEL(10, 10) == 0xdead) &&
     494       (LFB_GETPIXEL(100, 200) == 0x5a5a))
     495        retval = 1;
    495496
    496497fbiMemSizeDone:
    497         /* Restore init registers to original state */
    498         ISET(sst->fbiInit0, init0Save);
    499         ISET(sst->fbiInit1, init1Save);
    500         ISET(sst->fbiInit2, init2Save);
    501         sst1InitIdleFBI(sstbase);
    502 
    503         return(retval);
     498    /* Restore init registers to original state */
     499    ISET(sst->fbiInit0, init0Save);
     500    ISET(sst->fbiInit1, init1Save);
     501    ISET(sst->fbiInit2, init2Save);
     502    sst1InitIdleFBI(sstbase);
     503
     504    return(retval);
    504505}
    505506
     
    507508sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
    508509{
    509         SstRegs *sst = (SstRegs *) sstbase;
     510    SstRegs *sst = (SstRegs *) sstbase;
    510511
    511512    info->fbiMemSize = fbiMemSize(sstbase);
    512513
    513         /* Detect board identification and memory speed */
    514         if(GETENV(("SSTV2_FBICFG")))
     514    /* Detect board identification and memory speed */
     515    if(GETENV(("SSTV2_FBICFG")))
    515516        SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig);
    516517    else
    517                 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
    518                         SST_FBI_MEM_TYPE_SHIFT;
    519 
    520         info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf;
    521         if(IGET(sst->fbiInit7) & BIT(0))
    522                 info->fbiBoardID |= 0x10;
    523 
    524         /* Detect scanline interleaving */
    525         info->sliPaired   = sst1InitSliPaired(sstbase);
    526         info->sliDetected = sst1InitSliDetect(sstbase);
     518        info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
     519            SST_FBI_MEM_TYPE_SHIFT;
     520
     521    info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf;
     522    if(IGET(sst->fbiInit7) & BIT(0))
     523        info->fbiBoardID |= 0x10;
     524
     525    /* Detect scanline interleaving */
     526    info->sliPaired   = sst1InitSliPaired(sstbase);
     527    info->sliDetected = sst1InitSliDetect(sstbase);
    527528
    528529    return FXTRUE;
     
    563564    if(GETENV(("SSTV2_NODEVICEINFO"))) {
    564565        /* fill device info struct with sane values... */
    565         INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));
    566 
    567                 if(GETENV(("SSTV2_FBICFG")))
    568                 SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig);
    569                 else
    570                 info->fbiConfig = 0x0;
    571 
    572                 if(GETENV(("SSTV2_TMUCFG")))
    573                 SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig);
    574                 else
    575                 info->tmuConfig = 0x0;
     566        INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));
     567
     568        if(GETENV(("SSTV2_FBICFG")))
     569            SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig);
     570        else
     571            info->fbiConfig = 0x0;
     572
     573        if(GETENV(("SSTV2_TMUCFG")))
     574            SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig);
     575        else
     576            info->tmuConfig = 0x0;
    576577
    577578        info->numberTmus = 1;
    578         if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */
    579                         info->numberTmus++;
    580             if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */
    581                         info->numberTmus++;
    582 
    583         info->tmuRevision = info->tmuConfig & 0x7;
    584 
    585                 if(GETENV(("SSTV2_FBI_MEMSIZE")))
    586                         info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE")));
    587                 else
    588                 info->fbiMemSize = 2;
    589 
    590                 if(GETENV(("SSTV2_TMU_MEMSIZE")))
    591                         info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE")));
    592                 else
    593                 info->tmuMemSize[0] = 2;
    594                 info->tmuMemSize[1] = info->tmuMemSize[0];
    595                 info->tmuMemSize[2] = info->tmuMemSize[0];
     579        if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */
     580            info->numberTmus++;
     581        if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */
     582            info->numberTmus++;
     583
     584        info->tmuRevision = info->tmuConfig & 0x7;
     585
     586        if(GETENV(("SSTV2_FBI_MEMSIZE")))
     587            info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE")));
     588        else
     589            info->fbiMemSize = 2;
     590
     591        if(GETENV(("SSTV2_TMU_MEMSIZE")))
     592            info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE")));
     593        else
     594            info->tmuMemSize[0] = 2;
     595        info->tmuMemSize[1] = info->tmuMemSize[0];
     596        info->tmuMemSize[2] = info->tmuMemSize[0];
    596597    } else {
    597                 int i;
    598 
    599                 for(i=0; i<5; i++) {
    600                         if(i)
    601                                 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
    602                 /* GetFbiInfo() must be called before GetTmuInfo() */
    603                 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
    604                                 continue;
    605                 /* get the revision ID of each TMU and verify that they are all the
    606                            same */
    607                 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)
    608                                 continue;
    609                         break;
    610                 }
    611                 if(i == 5)
    612                         return(FXFALSE);
    613     }
    614         // Measure silicon performance
     598        int i;
     599
     600        for(i=0; i<5; i++) {
     601            if(i)
     602                INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
     603            /* GetFbiInfo() must be called before GetTmuInfo() */
     604            if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
     605                continue;
     606            /* get the revision ID of each TMU and verify that they are all the
     607               same */
     608            if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)
     609                continue;
     610            break;
     611        }
     612        if(i == 5)
     613            return(FXFALSE);
     614    }
     615    // Measure silicon performance
    615616    sst1InitMeasureSiProcess(sstbase, 0); // measure NAND-tree
    616617    sst1InitMeasureSiProcess(sstbase, 1); // measure NOR-tree
    617618
    618         INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID));
     619    INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID));
    619620    INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n",
    620621        info->fbiConfig, info->tmuConfig));
     
    630631    if(sst1InitUseVoodooFile == FXTRUE) {
    631632        if(iniDac == (sst1InitDacStruct *) NULL)
    632                         INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
    633                 else
    634                 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
    635                           iniDac->dacManufacturer, iniDac->dacDevice));
    636         } else {
    637             INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
    638             if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT)
    639                 INIT_PRINTF(("AT&T ATT20C409\n"));
    640             else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS)
    641                 INIT_PRINTF(("ICS ICS5342\n"));
    642             else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI)
    643                 INIT_PRINTF(("TI TVP3409\n"));
    644             else
    645                 INIT_PRINTF(("Unknown\n"));
    646         }
     633            INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
     634        else
     635            INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
     636              iniDac->dacManufacturer, iniDac->dacDevice));
     637    } else {
     638        INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
     639        if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT)
     640            INIT_PRINTF(("AT&T ATT20C409\n"));
     641        else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS)
     642            INIT_PRINTF(("ICS ICS5342\n"));
     643        else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI)
     644            INIT_PRINTF(("TI TVP3409\n"));
     645        else
     646            INIT_PRINTF(("Unknown\n"));
     647    }
    647648    INIT_PRINTF(("sst1DeviceInfo: SLI Detected:%d\n", info->sliDetected));
    648649
  • trunk/src/opengl/glide/cvg/init/parse.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: parse.c,v 1.2 2001-09-05 14:30:38 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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**
    2122**
    22 ** $Revision: 1.1 $
    23 ** $Date: 2000-02-25 00:37:52 $
     23** $Revision: 1.2 $
     24** $Date: 2001-09-05 14:30:38 $
    2425**
    2526** Parsing code for grabbing information from "voodoo2.ini" initialization file
     
    8485  int helper = (getenv(("SSTV2_DEBUGDAC"))) ? 1 : 0;
    8586
    86         filename[0] = '\0';
    87         if (checkedFileP) goto __errExit;
    88        
     87    filename[0] = '\0';
     88    if (checkedFileP) goto __errExit;
     89
    8990#if __DOS32__
    90         {
    91           char fixedFilename[512], *tmpPtr;
    92           char path[512];
    93           int i;
    94 
    95 
    96           if(getenv("VOODOO2_FILE")) {
    97             /* Override voodoo2.ini name */
    98             strcpy(filename, getenv("VOODOO2_FILE"));
    99             if(!(file = fopen(filename, "r"))) goto __errExit;
    100           } else {
    101             /* Override path setting */
    102             if(getenv("VOODOO2_PATH"))
    103               strcpy(path, getenv("VOODOO2_PATH"));
    104             else if(getenv("PATH")) {
    105               strcpy(path, ".;");
    106               strcat(path, getenv("PATH"));
    107             } else
    108               strcpy(path, ".;");
    109 
    110             i = 0;
    111             while(1) {
    112               if(!i) {
    113                 if((tmpPtr = strtok(path, ";")) == NULL)
    114                   break;
    115               } else {
    116                 if((tmpPtr = strtok(NULL, ";")) == NULL)
    117                   break;
    118               }
    119               strcpy(filename, tmpPtr);
    120               sst1InitFixFilename(fixedFilename, filename);
    121               if(fixedFilename[strlen(fixedFilename)-1] == '\\')
    122                 sprintf(filename, "%svoodoo2.var", filename);
    123               else
    124                 sprintf(filename, "%s\\voodoo2.var", filename);
    125               i++;
    126               if((file = fopen(filename, "r")))
    127                 break;
    128             }
    129           }
    130         }
     91    {
     92      char fixedFilename[512], *tmpPtr;
     93      char path[512];
     94      int i;
     95
     96
     97      if(getenv("VOODOO2_FILE")) {
     98        /* Override voodoo2.ini name */
     99        strcpy(filename, getenv("VOODOO2_FILE"));
     100        if(!(file = fopen(filename, "r"))) goto __errExit;
     101      } else {
     102        /* Override path setting */
     103        if(getenv("VOODOO2_PATH"))
     104          strcpy(path, getenv("VOODOO2_PATH"));
     105        else if(getenv("PATH")) {
     106          strcpy(path, ".;");
     107          strcat(path, getenv("PATH"));
     108        } else
     109          strcpy(path, ".;");
     110
     111        i = 0;
     112        while(1) {
     113          if(!i) {
     114            if((tmpPtr = strtok(path, ";")) == NULL)
     115              break;
     116          } else {
     117            if((tmpPtr = strtok(NULL, ";")) == NULL)
     118              break;
     119          }
     120          strcpy(filename, tmpPtr);
     121          sst1InitFixFilename(fixedFilename, filename);
     122          if(fixedFilename[strlen(fixedFilename)-1] == '\\')
     123            sprintf(filename, "%svoodoo2.var", filename);
     124          else
     125            sprintf(filename, "%s\\voodoo2.var", filename);
     126          i++;
     127          if((file = fopen(filename, "r")))
     128            break;
     129        }
     130      }
     131    }
    131132#elif __MWERKS__
    132         {
    133                 FSSpec iniSpec = {
    134                         0, 0,
    135                         "\pvoodoo2.var"
    136                 };
    137                 Boolean foundP = false;
    138                
    139                 /* Check the app's directory */
    140                 if (!foundP) {
    141                         ProcessSerialNumber curApp;
    142                         ProcessInfoRec appInfo;
    143                         FSSpec appSpec;
    144                        
    145                         if (GetCurrentProcess(&curApp) != noErr) goto __errAppDir;
    146 
    147                         /* We only care about the app's location */
    148                         appInfo.processInfoLength = sizeof(ProcessInfoRec);
    149                         appInfo.processName = NULL;
    150                         appInfo.processAppSpec = &appSpec;
    151                         if (GetProcessInformation(&curApp, &appInfo) != noErr) goto __errAppDir;
    152                        
    153                         {
    154                                 CInfoPBRec thePB;
    155 
    156                                 thePB.hFileInfo.ioCompletion = NULL;
    157                                 thePB.hFileInfo.ioNamePtr = iniSpec.name;
    158                                 thePB.hFileInfo.ioVRefNum = appSpec.vRefNum;
    159                                 thePB.hFileInfo.ioDirID = appSpec.parID;
    160 
    161                                 thePB.hFileInfo.ioFDirIndex = 0;
    162 
    163                                 foundP = ((PBGetCatInfoSync(&thePB) == noErr) &&
    164                                                                         ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0));
    165                                 if (foundP) {
    166                                         iniSpec.vRefNum = appSpec.vRefNum;
    167                                         iniSpec.parID = appSpec.parID;
    168                                 }
    169                         }                       
    170                        
    171                 __errAppDir:
    172                         ;
    173                 }
    174                
    175                 /* Check the mac's version of the 'search path' */
    176                 if (!foundP) {
    177                         OSType folderList[] = { kPreferencesFolderType, kExtensionFolderType };
    178                         int i;
    179 
    180                         for(i = 0; i < sizeof(folderList) / sizeof(folderList[0]); i++) {
    181                                 short vRefNum;
    182                                 long dirId;
    183                                
    184                                 if (FindFolder(kOnSystemDisk, folderList[i], false,
    185                                                                                         &vRefNum, &dirId) == noErr) {
    186                                
    187                                         CInfoPBRec thePB;
    188                                        
    189                                         thePB.hFileInfo.ioCompletion = NULL;
    190                                         thePB.hFileInfo.ioNamePtr = iniSpec.name;
    191                                         thePB.hFileInfo.ioVRefNum = vRefNum;
    192                                         thePB.hFileInfo.ioDirID = dirId;
    193                                        
    194                                         thePB.hFileInfo.ioFDirIndex = 0;
    195                                        
    196                                         foundP = ((PBGetCatInfoSync(&thePB) == noErr) &&
    197                                                                                 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0));
    198                                         if (foundP) {
    199                                                 iniSpec.vRefNum = vRefNum;
    200                                                 iniSpec.parID = dirId;
    201                                                
    202                                                 break;
    203                                         }
    204                                 }
    205                         }
    206                 }
    207                
    208                 if (foundP) {
    209                         short wdRefNum;
    210                         long  wdDirId;
    211                        
    212                         /* Change working directories, just in case the app did something else */
    213                         if (HGetVol(NULL, &wdRefNum, &wdDirId) != noErr) goto __errFile;
    214                         if (HSetVol(NULL, iniSpec.vRefNum, iniSpec.parID) != noErr) goto __errFile;
    215                        
    216                         /* NB: We leave the name trashed after this */
    217                         p2cstr(iniSpec.name);
    218                         file = fopen((const char*)iniSpec.name, "r");
    219                        
    220                         HSetVol(NULL, wdRefNum, wdDirId);
    221                        
    222                 __errFile:
    223                         ;
    224                 }
    225         }
     133    {
     134        FSSpec iniSpec = {
     135            0, 0,
     136            "\pvoodoo2.var"
     137        };
     138        Boolean foundP = false;
     139
     140        /* Check the app's directory */
     141        if (!foundP) {
     142            ProcessSerialNumber curApp;
     143            ProcessInfoRec appInfo;
     144            FSSpec appSpec;
     145
     146            if (GetCurrentProcess(&curApp) != noErr) goto __errAppDir;
     147
     148            /* We only care about the app's location */
     149            appInfo.processInfoLength = sizeof(ProcessInfoRec);
     150            appInfo.processName = NULL;
     151            appInfo.processAppSpec = &appSpec;
     152            if (GetProcessInformation(&curApp, &appInfo) != noErr) goto __errAppDir;
     153
     154            {
     155                CInfoPBRec thePB;
     156
     157                thePB.hFileInfo.ioCompletion = NULL;
     158                thePB.hFileInfo.ioNamePtr = iniSpec.name;
     159                thePB.hFileInfo.ioVRefNum = appSpec.vRefNum;
     160                thePB.hFileInfo.ioDirID = appSpec.parID;
     161
     162                thePB.hFileInfo.ioFDirIndex = 0;
     163
     164                foundP = ((PBGetCatInfoSync(&thePB) == noErr) &&
     165                                    ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0));
     166                if (foundP) {
     167                    iniSpec.vRefNum = appSpec.vRefNum;
     168                    iniSpec.parID = appSpec.parID;
     169                }
     170            }
     171
     172        __errAppDir:
     173            ;
     174        }
     175
     176        /* Check the mac's version of the 'search path' */
     177        if (!foundP) {
     178            OSType folderList[] = { kPreferencesFolderType, kExtensionFolderType };
     179            int i;
     180
     181            for(i = 0; i < sizeof(folderList) / sizeof(folderList[0]); i++) {
     182                short vRefNum;
     183                long dirId;
     184
     185                if (FindFolder(kOnSystemDisk, folderList[i], false,
     186                                            &vRefNum, &dirId) == noErr) {
     187
     188                    CInfoPBRec thePB;
     189
     190                    thePB.hFileInfo.ioCompletion = NULL;
     191                    thePB.hFileInfo.ioNamePtr = iniSpec.name;
     192                    thePB.hFileInfo.ioVRefNum = vRefNum;
     193                    thePB.hFileInfo.ioDirID = dirId;
     194
     195                    thePB.hFileInfo.ioFDirIndex = 0;
     196
     197                    foundP = ((PBGetCatInfoSync(&thePB) == noErr) &&
     198                                        ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0));
     199                    if (foundP) {
     200                        iniSpec.vRefNum = vRefNum;
     201                        iniSpec.parID = dirId;
     202
     203                        break;
     204                    }
     205                }
     206            }
     207        }
     208
     209        if (foundP) {
     210            short wdRefNum;
     211            long  wdDirId;
     212
     213            /* Change working directories, just in case the app did something else */
     214            if (HGetVol(NULL, &wdRefNum, &wdDirId) != noErr) goto __errFile;
     215            if (HSetVol(NULL, iniSpec.vRefNum, iniSpec.parID) != noErr) goto __errFile;
     216
     217            /* NB: We leave the name trashed after this */
     218            p2cstr(iniSpec.name);
     219            file = fopen((const char*)iniSpec.name, "r");
     220
     221            HSetVol(NULL, wdRefNum, wdDirId);
     222
     223        __errFile:
     224            ;
     225        }
     226    }
    226227#endif
    227228
     
    261262
    262263__errExit:
    263         checkedFileP = FXTRUE;
     264    checkedFileP = FXTRUE;
    264265#endif /* !DIRECTX */
    265266
     
    294295    /* Override voodoo2.ini name */
    295296    strcpy(filename, getenv("VOODOO2_FILE"));
    296     if (!(file = fopen(filename, "r"))) 
     297    if (!(file = fopen(filename, "r")))
    297298      goto __errExit;
    298299  } else {
     
    307308    while(1) {
    308309      if (!i) {
    309         if ((tmpPtr = strtok(path, ":")) == NULL)
    310           break;
     310    if ((tmpPtr = strtok(path, ":")) == NULL)
     311      break;
    311312      } else {
    312         if ((tmpPtr = strtok(NULL, ":")) == NULL)
    313           break;
     313    if ((tmpPtr = strtok(NULL, ":")) == NULL)
     314      break;
    314315      }
    315316      strcpy(filename, tmpPtr);
    316317      if (filename[strlen(filename)-1] == '\\')
    317         sprintf(filename, "%voodoo2", filename);
     318    sprintf(filename, "%voodoo2", filename);
    318319      else
    319         sprintf(filename, "%s/voodoo2", filename);
     320    sprintf(filename, "%s/voodoo2", filename);
    320321      i++;
    321322      if ((file = fopen(filename, "r")))
    322         break;
     323    break;
    323324    }
    324325  }
     
    638639                break;
    639640            }
    640             if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 
     641            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct))))
    641642                return(0);
    642643
     
    982983
    983984#if __WIN32__
    984 FxBool GetRegistryKey(HKEY hKey, const char* keyName, 
     985FxBool GetRegistryKey(HKEY hKey, const char* keyName,
    985986                      char* regValBuf, FxU32 bufSize)
    986987{
     
    10041005    }
    10051006  }
    1006  
     1007
    10071008  return retVal;
    1008 } 
     1009}
    10091010#endif /* __WIN32__ */
    10101011
     
    10201021   * string table has been freed by the c runtime but has not been set
    10211022   * to NULL. Bad things happen if this memory has been unmapped by
    1022    * the system or if the string cannot be found. 
     1023   * the system or if the string cannot be found.
    10231024   */
    10241025  {
     
    10511052{
    10521053  const char* retVal;
    1053  
     1054
    10541055  /* Does the real environment variable exist?
    10551056   * This overrides everything for glide.
     
    10841085    }
    10851086#endif /* __WIN32__ */
    1086  
     1087
    10871088    /* Does the requested environment variable exist in "voodoo2.ini"? */
    10881089    /* Dump CFG Data... */
    10891090    if (!checkedFileP) {
    1090         static FxBool inProc = FXFALSE;
    1091        
    1092         if (!inProc) {
    1093                 inProc = FXTRUE;
    1094                 sst1InitVoodooFile();
    1095                 inProc = FXFALSE;
    1096             }
    1097     }
    1098    
     1091        static FxBool inProc = FXFALSE;
     1092
     1093        if (!inProc) {
     1094            inProc = FXTRUE;
     1095            sst1InitVoodooFile();
     1096            inProc = FXFALSE;
     1097        }
     1098    }
     1099
    10991100    {
    11001101      sst1InitEnvVarStruct *envVarsPtr = envVarsBase;
  • trunk/src/opengl/glide/cvg/init/print.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: print.c,v 1.2 2001-09-05 14:30:39 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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**
    2122**
    22 ** $Revision: 1.1 $
    23 ** $Date: 2000-02-25 00:37:53 $
     23** $Revision: 1.2 $
     24** $Date: 2001-09-05 14:30:39 $
    2425**
    2526** Print functions for SST-1 Initialization routines
     
    5455    if(firstPass == FXTRUE) {
    5556        firstPass = FXFALSE;
    56         if (sst1InitMsgFile == NULL)
    57         {
    58           /* I couldn't initialize to stdout because stdout is not constant */
    59           sst1InitMsgFile = stdout;
    60         }
     57    if (sst1InitMsgFile == NULL)
     58    {
     59      /* I couldn't initialize to stdout because stdout is not constant */
     60      sst1InitMsgFile = stdout;
     61    }
    6162        if(GETENV(("SSTV2_INITDEBUG")) || GDBG_GET_DEBUGLEVEL(5))
    6263            printIt = FXTRUE;
     
    6465          printIt = ((sst1InitMsgFile = fopen(GETENV(("SSTV2_INITDEBUG_FILE")), "w")) != NULL);
    6566          if (!printIt) {
    66             fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n", 
     67            fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n",
    6768                    GETENV(("SSTV2_INITDEBUG_FILE")));
    6869          }
  • trunk/src/opengl/glide/cvg/init/sli.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: sli.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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:37:53 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:42 $
    2324**
    2425** Initialization code for initializing scanline interleaving
     
    182183        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    183184        PCICFG_WR(SST1_PCI_INIT_ENABLE,
    184             ((j & ~SST_SCANLINE_SLV_OWNPCI) | SST_SCANLINE_SLI_SLV)); 
     185            ((j & ~SST_SCANLINE_SLV_OWNPCI) | SST_SCANLINE_SLI_SLV));
    185186        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) |
    186187          (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE));
     
    226227          SST_VID_CLK_DAC_DATA16_SEL);
    227228        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) &
    228           ~SST_VIDEO_VID_CLK_SLAVE); 
     229          ~SST_VIDEO_VID_CLK_SLAVE);
    229230        sst1CurrentBoard->fbiInit6 &= ~SST_SLI_SYNC_MASTER;
    230231        sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 &
     
    250251            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
    251252                    ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
    252                       SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 
     253                      SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) |
    253254                SST_EN_SCANLINE_INTERLEAVE |
    254255                // SST_VIDEO_VID_CLK_SLAVE |
    255256                // SST_VIDEO_VID_CLK_2X |
    256                 // SST_VIDEO_INVERT_VID_CLK_2X | 
     257                // SST_VIDEO_INVERT_VID_CLK_2X |
    257258                SST_VIDEO_VCLK_SEL |
    258259                SST_PCI_WRWS_1 |
     
    264265            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
    265266                    ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
    266                       SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 
     267                      SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) |
    267268                SST_EN_SCANLINE_INTERLEAVE |
    268269                // SST_VIDEO_VID_CLK_SLAVE |
     
    371372      SST_VID_CLK_DAC_DATA16_SEL);
    372373    ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) &
    373       ~SST_VIDEO_VID_CLK_SLAVE); 
     374      ~SST_VIDEO_VID_CLK_SLAVE);
    374375    sst1CurrentBoard->fbiInit6 |= SST_SLI_SYNC_MASTER;
    375376    sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 &
     
    379380    ISET(sstMaster->fbiInit6, sst1CurrentBoard->fbiInit6);
    380381
    381     // Following work well up to around 100 MHz... 
     382    // Following work well up to around 100 MHz...
    382383    // masterVInClkDel = 2;
    383384    // masterVOutClkDel = 0;
     
    400401                ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
    401402                  SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL |
    402                   SST_VIDEO_BLANK_EN)) | 
     403                  SST_VIDEO_BLANK_EN)) |
    403404            SST_EN_SCANLINE_INTERLEAVE |
    404405            // SST_VIDEO_VID_CLK_2X |
     
    417418                ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
    418419                  SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL |
    419                   SST_VIDEO_BLANK_EN)) | 
     420                  SST_VIDEO_BLANK_EN)) |
    420421            SST_EN_SCANLINE_INTERLEAVE |
    421422            // SST_VIDEO_VID_CLK_2X |
     
    458459    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    459460    PCICFG_WR(SST1_PCI_INIT_ENABLE,
    460         (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 
     461        (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)));
    461462    MasterPhysAddr = sst1CurrentBoard->physAddr[0];
    462463    sst1InitReturnStatus(sstbase0); // flush pci packer with reads
     
    485486      if (!sst1InitCheckBoard(sstbase1)) return FXFALSE;
    486487      infoSlave = sst1CurrentBoard;
    487      
     488
    488489      /* fbi and tmu clock freqs should be equal since they are
    489490       * both set from sst1InitCalcGrxClk.
     
    491492      if (infoMaster->fbiGrxClkFreq != infoSlave->fbiGrxClkFreq) {
    492493        /* Recompute the actual clock rates before any clocking down
    493          * due to sli for some board revisions. 
     494         * due to sli for some board revisions.
    494495         */
    495496        if (!sst1InitCalcGrxClk(sstbase0)) return FXFALSE;
     
    513514         * They no longer need to match, but any future calls to
    514515         * sst1InitGetDeviceInfo should now reflect the current
    515          * minimized state of the world. 
     516         * minimized state of the world.
    516517         */
    517518        {
     
    520521          if (infoMaster->fbiMemSize != infoSlave->fbiMemSize) {
    521522            memSize = MIN(infoMaster->fbiMemSize, infoSlave->fbiMemSize);
    522             infoMaster->fbiMemSize = 
     523            infoMaster->fbiMemSize =
    523524            infoSlave->fbiMemSize  = memSize;
    524525          }
     
    581582    sst1InitReturnStatus(sstbase1);
    582583
    583     // De-assert reset to Graphics core... 
     584    // De-assert reset to Graphics core...
    584585    ISET(sstMaster->fbiInit0, IGET(sstMaster->fbiInit0) & ~SST_GRX_RESET);
    585586    sst1InitReturnStatus(sstbase0);
     
    587588    sst1InitReturnStatus(sstbase1);
    588589
    589     // De-assert reset to Video core... 
     590    // De-assert reset to Video core...
    590591    ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & ~SST_VIDEO_RESET);
    591592    sst1InitReturnStatus(sstbase0);
     
    707708    else
    708709      sliDetected = sst1InitSliPaired(sstbase);
    709        
     710
    710711    return sliDetected;
    711712        }
     
    717718**
    718719*/
    719 FX_ENTRY FxU32 FX_CALL 
     720FX_ENTRY FxU32 FX_CALL
    720721sst1InitSliPaired(FxU32 *sstbase)
    721722{
     
    725726    if(firstTime) {
    726727      SstRegs* sst = (SstRegs *) sstbase;
    727      
     728
    728729      sliPaired = (((IGET(sst->fbiInit5) & SST_SLI_DETECT) == SST_SLI_DETECT) &&
    729730                   (boardsInSystem > 1));
  • trunk/src/opengl/glide/cvg/init/sst1init.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: sst1init.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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:37:54 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:42 $
    2324**
    2425*/
     
    2930** NOTE: This code must compiled with optimizations DISABLED!!
    3031**
    31 ** The following environment variables can optionally be used to alter 
     32** The following environment variables can optionally be used to alter
    3233** functionality (A value of X is a "don't care"):
    3334**
     
    99100**                               960,    (960x720)
    100101**                               1024}   (1024x768)
    101 ** SSTV2_SLOWMEM_RTW             X       Insert wait state for read-to-write 
     102** SSTV2_SLOWMEM_RTW             X       Insert wait state for read-to-write
    102103**                                       transitions
    103 ** SSTV2_SLOWMEM_WTR             X       Insert wait state for write-to-read 
     104** SSTV2_SLOWMEM_WTR             X       Insert wait state for write-to-read
    104105**                                       transitions
    105106** SSTV2_SLOWPCIWR               X       Enable 1 wait-state PCI writes
     
    186187static FxU32 clearBoardInfo = FXTRUE;
    187188
    188 FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber, 
     189FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber,
    189190                                                   FxBool resetSLI)
    190191{
     
    204205    // Open PCI library (necessary for multiple calls to init routines, after
    205206    // PCI library is closed by pciClose() call in sst1InitShutdown().
    206     // 
     207    //
    207208    // NB: It is safe to do this even if we never called pciClose.
    208209    pciOpen();
     
    231232        // Clear board info structure
    232233        sst1InitClearBoardInfo();
    233        
     234
    234235        clearBoardInfo = FXFALSE;
    235236
     
    239240         * the vxd etc. This is not functionally longer fatal, but w/o
    240241         * it we will not be able to do things like set the caching on
    241          * the board's memory etc. This is bad. 
     242         * the board's memory etc. This is bad.
    242243         *
    243244         * The actual cost of doing the re-mapping again is pretty low
     
    323324       FxU32 k;
    324325       SstRegs *sst;
    325  
     326
    326327       for(k=0; k<boardsInSystemReally; k++) {
    327328          // Disable SLI if detected...
     
    331332          sst1CurrentBoard = &sst1BoardInfo[k];
    332333          sst = (SstRegs *) sstbase;
    333    
     334
    334335          if(IGET(sst->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) {
    335336             INIT_PRINTF(("sst1InitMapBoard(): Disabling Scanline Interleaving (board #%d)...\n", (k+1)));
     
    424425    PCICFG_WR(SST1_PCI_BUS_SNOOP0, SST_PCI_BUS_SNOOP_DEFAULT);
    425426    PCICFG_WR(SST1_PCI_BUS_SNOOP1, SST_PCI_BUS_SNOOP_DEFAULT);
    426     sst1InitReturnStatus(sstbase); // Stall - can't call IdleFbi because 
     427    sst1InitReturnStatus(sstbase); // Stall - can't call IdleFbi because
    427428    sst1InitReturnStatus(sstbase); // FBI could be hung at this stage
    428429    sst1InitReturnStatus(sstbase);
    429    
     430
    430431    // Adjust Trex-to-Fbi FIFO
    431432    if(GETENV(("SSTV2_TF_FIFO_THRESH")))
     
    573574            (tf2_clkdel<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
    574575    }
    575     INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 
     576    INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n",
    576577        sst1CurrentBoard->tmuInit1[2]));
    577578
     
    662663    sst1InitIdleFBINoNOP(sstbase);
    663664
    664     sst1InitRenderingRegisters(sstbase);   
     665    sst1InitRenderingRegisters(sstbase);
    665666    sst1CurrentBoard->tmuRevision = 0xdead; // Force sst1InitFillDeviceInfo()
    666667    if(sst1InitFillDeviceInfo(sstbase, sst1CurrentBoard) == FXFALSE) {
     
    909910#ifndef __linux__
    910911        pciUnmapPhysical((FxU32)sst1CurrentBoard->virtAddr[0],
    911                         0x1000000UL);
     912            0x1000000UL);
    912913#endif
    913        
     914
    914915        if((++n > 1) || !sliEnabled)
    915916            break;
    916917    }
    917    
     918
    918919    /* sst1InitIdle(sstbase);  */
    919920
    920921#if !DIRECTX
    921     // 
     922    //
    922923    // HACK alert.
    923924    //
     
    940941    // cleared next time sst1InitMapBoard() is called.
    941942    clearBoardInfo = FXTRUE;
    942      
     943
    943944    return(FXTRUE);
    944945}
     
    980981      devInfo.sliDetected &&
    981982      !devInfo.monitorDetected) {
    982    
     983
    983984    SstRegs* tempAddr = NULL;
    984985
     
    997998    if (tempAddr != NULL) sstBaseAddr = tempAddr;
    998999  }
    999  
     1000
    10001001  return (FxU32*)sstBaseAddr;
    10011002}
     
    11001101**
    11011102*/
    1102 FX_ENTRY FxBool FX_CSTYLE 
     1103FX_ENTRY FxBool FX_CSTYLE
    11031104sst1InitCaching(FxU32* sstBase, FxBool enableP)
    11041105{
     
    11091110  if (enableP && (GETENV("SSTV2_IGNORE_CACHING") == NULL)) {
    11101111    FxU32 physAddr;
    1111    
     1112
    11121113    /* Get the board's base. Isn't this the same as what we
    11131114     * cary around in sst1CurrentBoard->physAddr[0]?
    11141115     */
    11151116    pciGetConfigData(PCI_BASE_ADDRESS_0, sst1CurrentBoard->deviceNumber, &physAddr);
    1116    
     1117
    11171118    // For some reason, there sometimes is a 008 at the end of the
    11181119    // physical address, so mask that puppy RTF out
     
    11341135#define kCacheSizeUncacheable  (0x1000UL)
    11351136      FxBool hasWC = pciFindMTRRMatch(physAddr, kCacheSizeWriteCombine,
    1136                                       PciMemTypeWriteCombining, 
     1137                                      PciMemTypeWriteCombining,
    11371138                                      &sst1CurrentBoard->mtrrWriteCombine);
    11381139      FxBool hasUC = pciFindMTRRMatch(physAddr, kCacheSizeUncacheable,
     
    11671168
    11681169      /* We only succeed if we have them both since having only uswc
    1169        * seems to cause problems. 
     1170       * seems to cause problems.
    11701171       */
    11711172      retVal = (hasWC && hasUC);
  • trunk/src/opengl/glide/cvg/init/util.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: util.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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:37:55 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:42 $
    2324**
    2425** Utility routines for SST-1 Initialization code
     
    345346    if(enable) {
    346347        // VGA controls monitor
    347         ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 
     348        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) |
    348349            sst1CurrentBoard->vgaPassthruEnable);
    349350        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN);
    350351    } else {
    351352        // SST-1 controls monitor
    352         ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 
     353        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) |
    353354            sst1CurrentBoard->vgaPassthruDisable);
    354355        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_BLANK_EN);
     
    493494   * they are managing. However, some registers cannot be accessed via
    494495   * the command fifo, and, inconveniently, these are not contiguously
    495    * allocated. 
     496   * allocated.
    496497   */
    497498  const FxU32 addrOffset = ((const FxU32)addr - (const FxU32)sst1CurrentBoard->virtAddr[0]);
     
    545546**
    546547*/
    547 FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable, 
     548FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable,
    548549  FxU32 *virtAddrStart, FxU32 *memAddrStart, FxU32 *size, FxSet32Proc set32Proc)
    549550{
     
    566567    if(enable == FXFALSE) {
    567568       // Remove any client set callbacks before continuing since
    568        // these must go straight to the hw. 
     569       // these must go straight to the hw.
    569570       sst1CurrentBoard->set32 = NULL;
    570571       sst1CurrentBoard->fbiCmdFifoEn = 0;
     
    621622    *size = fifoSize;
    622623
    623     if(!sst1InitCmdFifoDirect(sstbase, 0, 
    624                               fifoStart, fifoSize, 
     624    if(!sst1InitCmdFifoDirect(sstbase, 0,
     625                              fifoStart, fifoSize,
    625626                              directExec, disableHoles,
    626627                              set32Proc)) {
     
    628629      return(FXFALSE);
    629630    }
    630    
     631
    631632    if(sst1CurrentBoard->sliSlaveVirtAddr) {
    632633      if(!sst1InitCmdFifoDirect(sst1CurrentBoard->sliSlaveVirtAddr, 0,
    633                                fifoStart, fifoSize, 
     634                               fifoStart, fifoSize,
    634635                               directExec, disableHoles,
    635636                               set32Proc)) {
     
    646647**
    647648** sst1InitCmdFifoDirect():
    648 **   Explicitly initialize Command FIFO.  This routine is typically not 
     649**   Explicitly initialize Command FIFO.  This routine is typically not
    649650**   called directly from apps.
    650651**
     
    653654**
    654655*/
    655 FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which, 
    656   FxU32 start, FxU32 size, FxBool directExec, FxBool disableHoles, 
     656FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which,
     657  FxU32 start, FxU32 size, FxBool directExec, FxBool disableHoles,
    657658  FxSet32Proc set32Proc)
    658659{
     
    686687    // Disable memory-backed fifo, and disallow lfb and texture writes
    687688    // through command fifo...
    688     ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & 
     689    ISET(sst->fbiInit0, (IGET(sst->fbiInit0) &
    689690      ~(SST_MEM_FIFO_EN | SST_EN_LFB_MEMFIFO | SST_EN_TEX_MEMFIFO)));
    690691    sst1InitReturnStatus(sstbase);
     
    751752**   and texture accesses do not pass through the command fifo.
    752753**   WARNING: No register writes of any kind may be performed between a
    753 **   sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 
     754**   sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and
    754755**   writes are allowed.
    755756*/
     
    810811**   and texture accesses do not pass through the command fifo.
    811812**   WARNING: No register writes of any kind may be performed between a
    812 **   sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 
     813**   sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and
    813814**   writes are allowed.
    814815*/
     
    925926        (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) |
    926927         SST_SIPROCESS_OSC_CNTR_RESET_N | SST_SIPROCESS_OSC_NAND_SEL);
    927    
     928
    928929       // Allow oscillator to run...
    929930       PCICFG_RD(SST1_PCI_SIPROCESS, siProcess);
     
    931932        (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) |
    932933         SST_SIPROCESS_OSC_CNTR_RUN | SST_SIPROCESS_OSC_NAND_SEL);
    933    
     934
    934935       // Loop until PCI counter decrements to 0
    935936       cntr = 0 ;
     
    938939          PCICFG_RD(SST1_PCI_SIPROCESS, siProcess);
    939940       } while(siProcess & SST_SIPROCESS_PCI_CNTR);
    940    
     941
    941942       PCICFG_RD(SST1_PCI_SIPROCESS, siProcess);
    942943       siProcess &= SST_SIPROCESS_OSC_CNTR;
     
    954955        (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) |
    955956         SST_SIPROCESS_OSC_CNTR_RESET_N | SST_SIPROCESS_OSC_NOR_SEL);
    956    
     957
    957958       // Allow oscillator to run...
    958959       PCICFG_RD(SST1_PCI_SIPROCESS, siProcess);
     
    960961       (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) |
    961962         SST_SIPROCESS_OSC_CNTR_RUN | SST_SIPROCESS_OSC_NOR_SEL);
    962    
     963
    963964       // Loop until PCI counter decrements to 0
    964965       cntr = 0 ;
     
    967968          PCICFG_RD(SST1_PCI_SIPROCESS, siProcess);
    968969       } while(siProcess & SST_SIPROCESS_PCI_CNTR);
    969    
     970
    970971       PCICFG_RD(SST1_PCI_SIPROCESS, siProcess);
    971972       siProcess &= SST_SIPROCESS_OSC_CNTR;
  • trunk/src/opengl/glide/cvg/init/video.c

    r2888 r6653  
    11/*-*-c++-*-*/
     2/* $Id: video.c,v 1.2 2001-09-05 14:30:43 bird Exp $ */
    23/*
    34** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    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:37:55 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:43 $
    2324**
    2425** Initialization code for initializing SST-1 video unit
     
    161162      memSizeInPages <<= 1;
    162163
    163     // To be compatible with Voodoo1, if there is enough memory to 
     164    // To be compatible with Voodoo1, if there is enough memory to
    164165    // allocate an aux buffer, then do it...
    165166    if(nCol == 2 && nAux == 0) {
     
    211212    // Reset Video Refresh Unit
    212213    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
    213    
     214
    214215    // Setup SST video timing registers
    215216    if(GETENV(("SSTV2_HSYNC"))) {
     
    267268    // Setup SST memory mapper for desired resolution
    268269    if(sst1CurrentBoard->fbiMemSize == 4)
    269         sst1InitSetResolution(sstbase, sstVideoRez, 1); 
     270        sst1InitSetResolution(sstbase, sstVideoRez, 1);
    270271    else
    271         sst1InitSetResolution(sstbase, sstVideoRez, 0); 
     272        sst1InitSetResolution(sstbase, sstVideoRez, 0);
    272273
    273274    // Calculate graphics clock frequency
     
    342343    if(sst1InitAllocBuffers(sstbase, nCol, nAux) == FXFALSE)
    343344       return(FXFALSE);
    344    
    345     INIT_PRINTF(("sst1InitVideo(): Allocating %d Color Buffers and %d Aux Buffer(s)...\n", 
     345
     346    INIT_PRINTF(("sst1InitVideo(): Allocating %d Color Buffers and %d Aux Buffer(s)...\n",
    346347                 sst1CurrentBoard->fbiVideoColBuffs, sst1CurrentBoard->fbiVideoAuxBuffs));
    347348    ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
     
    389390        INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n",
    390391            sst1CurrentBoard->memFifoStatusLwm,
    391             sst1CurrentBoard->memFifoStatusLwm)); 
     392            sst1CurrentBoard->memFifoStatusLwm));
    392393    }
    393394
     
    665666**
    666667*/
    667 static FxBool 
     668static FxBool
    668669sst1InitAllocBuffersDirect(FxU32 *sstbase, FxU32 nColorBuffs, FxU32 nAuxBuffs)
    669670{
     
    689690       SST_BUFFER_ALLOC_3C1Z);
    690691   else {
    691      INIT_PRINTF(("sst1InitAllocBuffers(): Unsupported Color/Aux buffer combination (%d/%d)\n", 
     692     INIT_PRINTF(("sst1InitAllocBuffers(): Unsupported Color/Aux buffer combination (%d/%d)\n",
    692693                  nCol, nAux));
    693694     return(FXFALSE);
     
    698699}
    699700
    700 FX_EXPORT FxBool FX_CSTYLE 
     701FX_EXPORT FxBool FX_CSTYLE
    701702sst1InitAllocBuffers(FxU32 *sstbase, FxU32 nColorBuffs, FxU32 nAuxBuffs)
    702703{
     
    712713       return(FXFALSE);
    713714
    714    retVal = sst1InitAllocBuffersDirect(sstbase, 
     715   retVal = sst1InitAllocBuffersDirect(sstbase,
    715716                                       nColorBuffs, nAuxBuffs);
    716717
    717718   if (retVal && sst1CurrentBoard->sliDetected) {
    718719     /* NB: When writing to the slave we need to make sure that it does
    719       * not have a client callback installed. 
     720      * not have a client callback installed.
    720721      */
    721722     FxSet32Proc saveProc = sst1CurrentBoard->set32;
     
    797798**
    798799*/
    799 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 
    800                                                sst1VideoTimingStruct *sstVideoRez, 
     800FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase,
     801                                               sst1VideoTimingStruct *sstVideoRez,
    801802                                               FxU32 Banked)
    802803{
     
    907908*/
    908909FX_EXPORT FxBool FX_CSTYLE sst1InitVideoBorder(FxU32 *sstbase,
    909                                                FxU32 mask, 
     910                                               FxU32 mask,
    910911                                               FxU32 color)
    911912{
     
    949950
    950951FX_EXPORT sst1VideoTimingStruct* FX_CSTYLE
    951 sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 
     952sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution,
    952953                              GrScreenRefresh_t screenRefresh)
    953954{
     
    10141015
    10151016        case(GR_RESOLUTION_512x384):
    1016        
     1017
    10171018          if( GETENV( ("SSTV2_REFRESH_512x384") ) )
    10181019            refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_512x384") ) ) );
    1019            
     1020
    10201021          if(refreshRate == GR_REFRESH_120Hz)
    10211022             return(&SST_VREZ_512X384_120);
     
    10391040
    10401041        case(GR_RESOLUTION_640x400):
    1041        
     1042
    10421043          if( GETENV( ("SSTV2_REFRESH_640x400") ) )
    10431044            refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_640x400") ) ) );
    1044        
     1045
    10451046          if(refreshRate == GR_REFRESH_120Hz)
    10461047             return(&SST_VREZ_640X400_120);
     
    10541055
    10551056        case(GR_RESOLUTION_640x480):
    1056        
     1057
    10571058          if( GETENV( ("SSTV2_REFRESH_640x480") ) )
    10581059            refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_640x480") ) ) );
    1059            
     1060
    10601061          if(refreshRate == GR_REFRESH_120Hz)
    10611062             return(&SST_VREZ_640X480_120);
     
    10691070
    10701071        case(GR_RESOLUTION_800x600):
    1071        
     1072
    10721073          if( GETENV( ("SSTV2_REFRESH_800x600") ) )
    10731074            refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_800x600") ) ) );
    1074            
     1075
    10751076          if(refreshRate == GR_REFRESH_120Hz)
    10761077             return(&SST_VREZ_800X600_120);
     
    10901091          if( GETENV( ("SSTV2_REFRESH_960x720") ) )
    10911092            refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_960x720") ) ) );
    1092            
     1093
    10931094          if(refreshRate == GR_REFRESH_85Hz)
    10941095             return(&SST_VREZ_960X720_85);
     
    11001101
    11011102        case(GR_RESOLUTION_1024x768):
    1102        
     1103
    11031104          if( GETENV( ("SSTV2_REFRESH_1024x768") ) )
    11041105            refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_1024x768") ) ) );
    1105            
     1106
    11061107          if(refreshRate == GR_REFRESH_85Hz)
    11071108             return(&SST_VREZ_1024X768_85);
     
    11731174          j = IGET(sst->status);
    11741175      } while(!(j & SST_VRETRACE));
    1175  
     1176
    11761177      // Wait for active vsync
    11771178      do {
     
    12641265      else
    12651266         tf2_clkdel = 0x6;
    1266    } else 
     1267   } else
    12671268      tf2_clkdel = 0x6;
    12681269
     
    12741275      else
    12751276         tf1_clkdel = 0x6;
    1276    } else 
     1277   } else
    12771278      tf1_clkdel = 0x6;
    12781279
  • trunk/src/opengl/glide/cvg/initterm.cpp

    r5135 r6653  
     1/* $Id: initterm.cpp,v 1.5 2001-09-05 14:30:18 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/cvg/texus/3df.c

    r2888 r6653  
     1/* $Id: 3df.c,v 1.2 2001-09-05 14:30:43 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/cvg/texus/clamp.c

    r2888 r6653  
     1/* $Id: clamp.c,v 1.2 2001-09-05 14:30:44 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:37:58 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:44 $
    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/cvg/texus/dequant.c

    r2888 r6653  
     1/* $Id: dequant.c,v 1.2 2001-09-05 14:30:44 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:37:58 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:44 $
    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/cvg/texus/diffuse.c

    r2888 r6653  
     1/* $Id: diffuse.c,v 1.2 2001-09-05 14:30:44 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:37:58 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:44 $
    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/cvg/texus/gldutil.c

    r2888 r6653  
     1/* $Id: gldutil.c,v 1.2 2001-09-05 14:30:45 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:37:59 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:45 $
    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/cvg/texus/mipmap.c

    r2888 r6653  
     1/* $Id: mipmap.c,v 1.2 2001-09-05 14:30:45 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:37:59 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:45 $
    2324*/
    2425
  • trunk/src/opengl/glide/cvg/texus/ncc.c

    r2888 r6653  
     1/* $Id: ncc.c,v 1.2 2001-09-05 14:30:45 bird Exp $ */
    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:37:59 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:30:45 $
    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/cvg/texus/nccnnet.c

    r2888 r6653  
     1/* $Id: nccnnet.c,v 1.2 2001-09-05 14:30:45 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:37:59 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:45 $
    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/cvg/texus/pal256.c

    r2888 r6653  
     1/* $Id: pal256.c,v 1.2 2001-09-05 14:30:45 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/cvg/texus/ppm.c

    r2888 r6653  
     1/* $Id: ppm.c,v 1.2 2001-09-05 14:30:46 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:38:00 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:46 $
    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/cvg/texus/quantize.c

    r2888 r6653  
     1/* $Id: quantize.c,v 1.2 2001-09-05 14:30:46 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:38:00 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:46 $
    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/cvg/texus/read.c

    r2888 r6653  
     1/* $Id: read.c,v 1.2 2001-09-05 14:30:46 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:38:00 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:30:46 $
    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/cvg/texus/resample.c

    r2888 r6653  
     1/* $Id: resample.c,v 1.2 2001-09-05 14:30:46 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:38:00 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:46 $
    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/cvg/texus/rgt.c

    r2888 r6653  
     1/* $Id: rgt.c,v 1.2 2001-09-05 14:30:46 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:38:00 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:46 $
    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++ ) {
  • trunk/src/opengl/glide/cvg/texus/texuslib.c

    r2888 r6653  
     1/* $Id: texuslib.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */
    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 ** $Id: texuslib.c,v 1.1 2000-02-25 00:38:01 sandervl Exp $
     21** $Id: texuslib.c,v 1.2 2001-09-05 14:30:47 bird Exp $
    2122*/
    2223#include <string.h>
     
    5960
    6061/* size in texels  */
    61 static FxU32 _grMipMapHostSize[4][16] = 
     62static FxU32 _grMipMapHostSize[4][16] =
    6263{
    6364    {   /* 1:1 aspect ratio */
     
    7172            4, /* 7 :   2x2    */
    7273            1, /* 8 :   1x1    */
    73     }, 
     74    },
    7475    {   /* 2:1 aspect ratio */
    7576        32768, /* 0 : 256x128  */
     
    8283            2, /* 7 :   2x1    */
    8384            1, /* 8 :   1x1    */
    84     }, 
     85    },
    8586    {   /* 4:1 aspect ratio */
    8687        16384, /* 0 : 256x64   */
     
    129130#else
    130131           _grMipMapHostSize[_gr_aspect_index_table[aspect]] [lod] << (format>=GR_TEXFMT_16BIT);
    131 #endif 
     132#endif
    132133    }
    133134    return memRequired ;
     
    296297}
    297298
    298 void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table ) 
     299void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table )
    299300{
    300301  int i, j;
     
    304305      pal[i] = ncc_table->yRGB[i];
    305306    }
    306      
     307
    307308  for( i = 0; i < 4; i++ )
    308309    {
     
    322323      ncc_table->yRGB[i] = ( FxU8 )pal[i];
    323324    }
    324      
     325
    325326  for( i = 0; i < 4; i++ )
    326327    {
     
    331332        }
    332333    }
    333  
     334
    334335  /*
    335336  ** pack the table Y entries
     
    338339    {
    339340      FxU32 packedvalue;
    340      
     341
    341342      packedvalue  = ( ( FxU32 )( ncc_table->yRGB[i*4+0] & 0xff ) );
    342343      packedvalue |= ( ( FxU32 )( ncc_table->yRGB[i*4+1] & 0xff ) ) << 8;
     
    346347      ncc_table->packed_data[i] = packedvalue;
    347348    }
    348  
     349
    349350  /*
    350351  ** pack the table I entries
     
    353354    {
    354355      FxU32 packedvalue;
    355      
     356
    356357      packedvalue  = ( ( FxU32 )( ncc_table->iRGB[i][0] & 0x1ff ) ) << 18;
    357358      packedvalue |= ( ( FxU32 )( ncc_table->iRGB[i][1] & 0x1ff ) ) << 9;
    358359
    359360      packedvalue |= ( ( FxU32 )( ncc_table->iRGB[i][2] & 0x1ff ) ) << 0;
    360      
     361
    361362      ncc_table->packed_data[i+4] = packedvalue;
    362363    }
    363  
     364
    364365  /*
    365366  ** pack the table Q entries
     
    368369    {
    369370      FxU32 packedvalue;
    370      
     371
    371372      packedvalue  = ( ( FxU32 )( ncc_table->qRGB[i][0] & 0x1ff ) ) << 18;
    372373      packedvalue |= ( ( FxU32 )( ncc_table->qRGB[i][1] & 0x1ff ) ) << 9;;
    373374      packedvalue |= ( ( FxU32 )( ncc_table->qRGB[i][2] & 0x1ff ) ) << 0;
    374      
     375
    375376      ncc_table->packed_data[i+8] = packedvalue;
    376377    }
    377378}
    378379
    379 size_t txInit3dfInfoFromFile( FILE *file, 
     380size_t txInit3dfInfoFromFile( FILE *file,
    380381                              Gu3dfInfo *info, GrTextureFormat_t destFormat,
    381382                              int *destWidth, int *destHeight,
     
    415416
    416417  /*
    417    * Set the file offset back to where it was when we entered this 
     418   * Set the file offset back to where it was when we entered this
    418419   * function.
    419420   */
    420421  fseek( file, file_start_position, SEEK_SET );
    421  
     422
    422423  /*
    423424   * Return the memory required for this texture.
     
    452453          *destHeight = txCeilPow2( *destHeight );
    453454        }
    454      
     455
    455456      /*
    456457       * Make sure the dimensions are in range.
     
    520521   */
    521522  info->header.format   = destFormat;
    522  
     523
    523524  info->mem_required = txTexCalcMemRequired( info->header.small_lod,
    524525                                             info->header.large_lod,
     
    534535
    535536
    536 FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info, 
     537FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info,
    537538                          FxU32 flags, const void *palNcc )
    538539{
     
    540541  FxBool retval;
    541542  TxMip txMip;
    542  
     543
    543544  /*
    544545   * Save the current position of the input file so that we can
     
    609610
    610611  /*
    611    * Set to one level only since we only want to dequant the first 
     612   * Set to one level only since we only want to dequant the first
    612613   * level.
    613614   */
     
    620621
    621622  /*
    622    * We realy have more than one level, so. . . 
     623   * We realy have more than one level, so. . .
    623624   */
    624625#ifdef GLIDE3
     
    633634
    634635  /*
    635    * Resample the true color version of the input image to 
     636   * Resample the true color version of the input image to
    636637   * the passed in size. . . . this should be a valid
    637638   * size for the hardware to handle.
     
    653654#endif
    654655    }
    655    
    656  
     656
     657
    657658#if 0
    658659  if( _heapchk() != _HEAPOK )
     
    691692  txMipSetMipPointers( &outputMip );
    692693#endif
    693  
     694
    694695  if( ( flags & TX_TARGET_PALNCC_MASK ) == TX_TARGET_PALNCC_SOURCE )
    695696    {
    696       txMipTrueToFixedPal( &outputMip, &trueColorMip, palNcc, 
     697      txMipTrueToFixedPal( &outputMip, &trueColorMip, palNcc,
    697698                           flags & TX_FIXED_PAL_QUANT_MASK );
    698699    }
    699700  else
    700701    {
    701       txMipQuantize( &outputMip, &trueColorMip, outputMip.format, 
     702      txMipQuantize( &outputMip, &trueColorMip, outputMip.format,
    702703                     flags & TX_DITHER_MASK, flags & TX_COMPRESSION_MASK );
    703704    }
     
    710711      txPalToNcc( &info->table.nccTable, outputMip.pal );
    711712    }
    712  
     713
    713714  if( info->header.format == GR_TEXFMT_P_8 || info->header.format == GR_TEXFMT_AP_88 )
    714715    {
  • trunk/src/opengl/glide/cvg/texus/tga.c

    r2888 r6653  
     1/* $Id: tga.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */
    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:38:01 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:30:47 $
    2223*/
    2324
     
    5253
    5354/* Definitions for image types. */
    54 #define TGA_NULL        0
    55 #define TGA_CMAP        1
    56 #define TGA_TRUE        2
    57 #define TGA_MONO        3
    58 #define TGA_CMAP_RLE    9
    59 #define TGA_TRUE_RLE    10
    60 #define TGA_MONO_RLE    11
     55#define TGA_NULL    0
     56#define TGA_CMAP    1
     57#define TGA_TRUE    2
     58#define TGA_MONO    3
     59#define TGA_CMAP_RLE    9
     60#define TGA_TRUE_RLE    10
     61#define TGA_MONO_RLE    11
    6162
    6263FxBool
    6364_txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info)
    6465{
    65     TgaHeader   *tgaHeader = (TgaHeader *) info->pal;
    66     int                 i;
    67 
    68     // Fill up rest of the TGA header. 
    69     if ( fread( &(tgaHeader->ImgType), 1, sizeof(TgaHeader)-2, stream ) != 
    70         sizeof(TgaHeader)-2) {
    71         txPanic("Unexpected end of file.");
    72         return FXFALSE;
    73     }
    74     tgaHeader->IDLength = (FxU8) ((cookie >>  8) & 0xFF);
     66    TgaHeader   *tgaHeader = (TgaHeader *) info->pal;
     67    int         i;
     68
     69    // Fill up rest of the TGA header.
     70    if ( fread( &(tgaHeader->ImgType), 1, sizeof(TgaHeader)-2, stream ) !=
     71        sizeof(TgaHeader)-2) {
     72        txPanic("Unexpected end of file.");
     73        return FXFALSE;
     74    }
     75    tgaHeader->IDLength = (FxU8) ((cookie >>  8) & 0xFF);
    7576    tgaHeader->CMapType = (FxU8) ((cookie      ) & 0xFF);
    7677
    7778    // Optionally, skip the image id fields.
    7879    for (i= (tgaHeader->IDLength) & 0xFF; i; i--) {
    79         int     c;
    80 
    81         if ((c = getc(stream)) == EOF) {
    82                 txPanic("Unexpected EOF.");
    83                 return FXFALSE;
    84         }
     80        int c;
     81
     82        if ((c = getc(stream)) == EOF) {
     83            txPanic("Unexpected EOF.");
     84            return FXFALSE;
     85        }
    8586    }
    8687
     
    9192
    9293    if ((info->width <= 0) || (info->height <= 0)) {
    93         txError("TGA Image: width or height is 0.");
    94         return FXFALSE;
     94        txError("TGA Image: width or height is 0.");
     95        return FXFALSE;
    9596    }
    9697
    9798    switch(tgaHeader->ImgType) {
    9899    case TGA_MONO:
    99     case TGA_MONO_RLE:                  // True color image.
    100         if (tgaHeader->PixelDepth != 8) {
    101             txError("TGA Image: Mono image is not 8 bits/pixel.");
    102             return FXFALSE;
    103         }
    104         info->format = GR_TEXFMT_I_8;
    105         break;
     100    case TGA_MONO_RLE:          // True color image.
     101        if (tgaHeader->PixelDepth != 8) {
     102        txError("TGA Image: Mono image is not 8 bits/pixel.");
     103        return FXFALSE;
     104        }
     105        info->format = GR_TEXFMT_I_8;
     106        break;
    106107
    107108    case TGA_TRUE:
    108109    case TGA_TRUE_RLE:
    109         switch (tgaHeader->PixelDepth ) {
    110         case    15:
    111         case    16:
    112                         info->format = GR_TEXFMT_ARGB_1555; break;
    113         case    24:
    114         case    32:
    115                         info->format = GR_TEXFMT_ARGB_8888; break;
    116         default:       
    117                         txError("TGA Image: True color image is not 24/32 bits/pixel.");
    118                         return FXFALSE;
    119                         break;
    120         }
    121         break;
    122      
     110        switch (tgaHeader->PixelDepth ) {
     111        case    15:
     112        case    16:
     113            info->format = GR_TEXFMT_ARGB_1555; break;
     114        case    24:
     115        case    32:
     116            info->format = GR_TEXFMT_ARGB_8888; break;
     117        default:
     118                txError("TGA Image: True color image is not 24/32 bits/pixel.");
     119                return FXFALSE;
     120                break;
     121        }
     122        break;
     123
    123124    case TGA_CMAP:
    124     case TGA_CMAP_RLE:                  // Color mapped image.
    125         if ( tgaHeader->CMapType     != 1 ) {
    126                 txError("TGA Image: Color-mapped TGA image has no palette");
    127                 return FXFALSE;
    128         }
    129         if (((tgaHeader->CMapLengthLo + tgaHeader->CMapLengthHi * 256L)
    130             +(tgaHeader->CMapStartLo + tgaHeader->CMapStartHi * 256L)) > 256){
    131                 txError("TGA Image: Color-mapped image has > 256 colors");
    132                 return FXFALSE;
    133         }
    134         info->format = GR_TEXFMT_P_8;
    135         break;
     125    case TGA_CMAP_RLE:          // Color mapped image.
     126        if ( tgaHeader->CMapType     != 1 ) {
     127            txError("TGA Image: Color-mapped TGA image has no palette");
     128            return FXFALSE;
     129        }
     130        if (((tgaHeader->CMapLengthLo + tgaHeader->CMapLengthHi * 256L)
     131            +(tgaHeader->CMapStartLo + tgaHeader->CMapStartHi * 256L)) > 256){
     132            txError("TGA Image: Color-mapped image has > 256 colors");
     133            return FXFALSE;
     134        }
     135        info->format = GR_TEXFMT_P_8;
     136        break;
    136137
    137138    default:
    138         txError("TGA Image: unsupported format");
    139         return  FXFALSE;
     139        txError("TGA Image: unsupported format");
     140        return  FXFALSE;
    140141    }
    141142    info->size = info->width*info->height*GR_TEXFMT_SIZE(info->format);
     
    147148_txReadTGAColorMap(FILE *stream, const TgaHeader *tgaHeader, FxU32 *palette)
    148149{
    149     int         cmapStart;
    150     int         cmapLength;
    151     int         cmapDepth;
    152     int         i;
     150    int     cmapStart;
     151    int     cmapLength;
     152    int     cmapDepth;
     153    int     i;
    153154
    154155    cmapStart   = tgaHeader->CMapStartLo;
     
    160161    cmapDepth   = tgaHeader->CMapDepth;
    161162
    162     if (tgaHeader->CMapType == 0) return FXTRUE;                // no colormap.
     163    if (tgaHeader->CMapType == 0) return FXTRUE;        // no colormap.
    163164
    164165    /* Validate some parameters */
    165166    if (cmapStart < 0) {
    166         txError("TGA Image: Bad Color Map start value.");
    167         return FXFALSE;
    168     }
    169 
    170     cmapDepth = (cmapDepth + 1) >> 3;           // to bytes.
     167        txError("TGA Image: Bad Color Map start value.");
     168        return FXFALSE;
     169    }
     170
     171    cmapDepth = (cmapDepth + 1) >> 3;       // to bytes.
    171172    if ((cmapDepth <= 0) || (cmapDepth > 4)) {
    172         txError("TGA Image: Bad Color Map depth.");
    173         return FXFALSE;
     173        txError("TGA Image: Bad Color Map depth.");
     174        return FXFALSE;
    174175    }
    175176
    176177    // May have to skip the color map.
    177     if ((tgaHeader->ImgType != TGA_CMAP) && 
    178         (tgaHeader->ImgType != TGA_CMAP_RLE)) {
    179         /* True color, yet there is a palette, this is OK, just skip. */
    180 
    181         cmapLength *= cmapDepth;
    182         while (cmapLength--) {
    183                 int             c;
    184 
    185                 c = getc(stream);
    186                 if (c == EOF) {
    187                         txError("TGA Image: Unexpected EOF reading Color Map.");
    188                         return FXFALSE;
    189                 }
    190         }
    191         return FXTRUE;
    192     }
    193 
    194     // This is a real palette that's going to be used. 
     178    if ((tgaHeader->ImgType != TGA_CMAP) &&
     179        (tgaHeader->ImgType != TGA_CMAP_RLE)) {
     180        /* True color, yet there is a palette, this is OK, just skip. */
     181
     182        cmapLength *= cmapDepth;
     183        while (cmapLength--) {
     184            int     c;
     185
     186            c = getc(stream);
     187            if (c == EOF) {
     188                txError("TGA Image: Unexpected EOF reading Color Map.");
     189                return FXFALSE;
     190            }
     191        }
     192        return FXTRUE;
     193    }
     194
     195    // This is a real palette that's going to be used.
    195196
    196197    // Verify that it's not too large.
    197198    if ((cmapStart + cmapLength) > 256) {
    198         txError("TGA Image: Color Map > 256 entries.");
    199         return FXFALSE;
     199        txError("TGA Image: Color Map > 256 entries.");
     200        return FXFALSE;
    200201    }
    201202
    202203
    203204    // printf("cmapdepth = %d, start = %d, length = %d\n", cmapDepth,
    204     //  cmapStart, cmapLength);
     205    //  cmapStart, cmapLength);
    205206    for (i=0; i<256; i++) {
    206         int     r, g, b, a;
    207 
    208         if ((i < cmapStart) || (i >= (cmapStart + cmapLength))) {
    209                 palette[i] = 0;
    210                 // printf("Skipping palette entry %d\n", i);
    211                 continue;
    212         }
    213 
    214         // Read this colormap entry.
    215         switch (cmapDepth) {
    216         case 1: // 8 bpp
    217                 r = getc(stream);
    218                 if (r == EOF) {
    219                     txError("TGA Image: Unexpected End of File.");
    220                     return FXFALSE;
    221                 }
    222                 r &= 0xFF;
    223                 palette[i] = (r << 24) | (r << 16) | (r << 8) | (r);
    224                 break;
    225 
    226         case 2: // 15, 16 bpp.
    227 
    228                 b = getc(stream);
    229                 r = getc(stream);
    230                 if ((r == EOF) || (b == EOF)) {
    231                         txError("TGA Image: Unexpected End of File.");
    232                         return FXFALSE;
    233                 }
    234                 r &= 0xFF;
    235                 b &= 0xFF;
    236                 g = ((r & 0x3) << 6) + ((b & 0xE0) >> 2);
    237                 r = (r & 0x7C) << 1;
    238                 b = (b & 0x1F) << 3;
    239 
    240                 palette[i] = (r << 16) | (g << 8) | (b) | 0xFF000000L;
    241                 break;
    242 
    243         case 3:
    244         case 4:
    245                 b = getc(stream);
    246                 g = getc(stream);
    247                 r = getc(stream);
    248                 a = (cmapDepth == 4) ? getc(stream) : 0x0FF;
    249 
    250                 if ((r == EOF) || (g == EOF) || (b == EOF) | (a == EOF)) {
    251                         txError("TGA Image: Unexpected End of File.");
    252                         return FXFALSE;
    253                 }
    254                 palette[i] = (a << 24) | (r << 16) | (g << 8) | b;
    255                 // printf("Setting palette %3d to %.08x\n", i, palette[i]);
    256                 break;
    257 
    258         default:
    259                 txError("TGA Image: Bad Color Map depth.");
    260                 return FXFALSE;
    261         }
     207        int r, g, b, a;
     208
     209        if ((i < cmapStart) || (i >= (cmapStart + cmapLength))) {
     210            palette[i] = 0;
     211            // printf("Skipping palette entry %d\n", i);
     212            continue;
     213        }
     214
     215        // Read this colormap entry.
     216        switch (cmapDepth) {
     217        case 1: // 8 bpp
     218            r = getc(stream);
     219            if (r == EOF) {
     220            txError("TGA Image: Unexpected End of File.");
     221            return FXFALSE;
     222            }
     223            r &= 0xFF;
     224            palette[i] = (r << 24) | (r << 16) | (r << 8) | (r);
     225        break;
     226
     227        case 2: // 15, 16 bpp.
     228
     229        b = getc(stream);
     230        r = getc(stream);
     231        if ((r == EOF) || (b == EOF)) {
     232            txError("TGA Image: Unexpected End of File.");
     233            return FXFALSE;
     234        }
     235        r &= 0xFF;
     236        b &= 0xFF;
     237        g = ((r & 0x3) << 6) + ((b & 0xE0) >> 2);
     238        r = (r & 0x7C) << 1;
     239        b = (b & 0x1F) << 3;
     240
     241        palette[i] = (r << 16) | (g << 8) | (b) | 0xFF000000L;
     242        break;
     243
     244        case 3:
     245        case 4:
     246        b = getc(stream);
     247        g = getc(stream);
     248        r = getc(stream);
     249        a = (cmapDepth == 4) ? getc(stream) : 0x0FF;
     250
     251        if ((r == EOF) || (g == EOF) || (b == EOF) | (a == EOF)) {
     252            txError("TGA Image: Unexpected End of File.");
     253            return FXFALSE;
     254        }
     255        palette[i] = (a << 24) | (r << 16) | (g << 8) | b;
     256        // printf("Setting palette %3d to %.08x\n", i, palette[i]);
     257        break;
     258
     259        default:
     260            txError("TGA Image: Bad Color Map depth.");
     261            return FXFALSE;
     262        }
    262263    }
    263264    return FXTRUE;
    264265}
    265266
    266 static  int     tgaRLE, tgaRLEflag, tgaRLEcount, tgaRLEsav[4];
    267 
    268 static  FxBool
     267static  int tgaRLE, tgaRLEflag, tgaRLEcount, tgaRLEsav[4];
     268
     269static  FxBool
    269270_txReadTGARLEPixel( FILE *stream, FxU8 *data, int pixsize)
    270271{
    271     int         c, i;
     272    int     c, i;
    272273
    273274    // Run length encoded data Only
    274275    if (tgaRLEcount == 0) {
    275         // Need to restart the run.
    276         if ( (tgaRLEcount = c = getc( stream )) == EOF) {
    277                 txError("TGA Image: Unexpected End of File.");
    278                 return FXFALSE;
    279         }
    280         tgaRLEflag = tgaRLEcount & 0x80;
    281         tgaRLEcount = (tgaRLEcount & 0x7F) + 1;
    282 
    283         if (tgaRLEflag) {
    284             // Replicated color, read the color to be replicated
    285             for (i=0; i<pixsize; i++) {
    286                 if ( (c = getc( stream )) == EOF) {
    287                     txError("TGA Image: Unexpected End of File\n");
    288                     return FXFALSE;
    289                 }
    290                 tgaRLEsav[i] = (FxU8) c;
    291             }
    292         }
     276        // Need to restart the run.
     277        if ( (tgaRLEcount = c = getc( stream )) == EOF) {
     278            txError("TGA Image: Unexpected End of File.");
     279            return FXFALSE;
     280        }
     281        tgaRLEflag = tgaRLEcount & 0x80;
     282        tgaRLEcount = (tgaRLEcount & 0x7F) + 1;
     283
     284        if (tgaRLEflag) {
     285        // Replicated color, read the color to be replicated
     286            for (i=0; i<pixsize; i++) {
     287        if ( (c = getc( stream )) == EOF) {
     288                txError("TGA Image: Unexpected End of File\n");
     289                return FXFALSE;
     290            }
     291            tgaRLEsav[i] = (FxU8) c;
     292            }
     293        }
    293294    }
    294295
     
    296297    tgaRLEcount--;
    297298    if (tgaRLEflag) {
    298         // deliver from saved data.
    299         for (i=0; i<pixsize; i++) *data++ = (FxU8) tgaRLEsav[i];
     299        // deliver from saved data.
     300        for (i=0; i<pixsize; i++) *data++ = (FxU8) tgaRLEsav[i];
    300301    } else {
    301         for (i=0; i<pixsize; i++) {
    302             if ( (c = getc( stream )) == EOF) {
    303                 txError("TGA Image: Unexpected End of File\n");
    304                 return FXFALSE;
    305             }
    306             *data++ = (FxU8) c;
    307         }
     302        for (i=0; i<pixsize; i++) {
     303            if ( (c = getc( stream )) == EOF) {
     304            txError("TGA Image: Unexpected End of File\n");
     305            return FXFALSE;
     306        }
     307            *data++ = (FxU8) c;
     308        }
    308309    }
    309310    return FXTRUE;
     
    314315{
    315316    if (tgaRLE == 0) {
    316         if ( fread( data, 1, w * pixsize, stream) != (FxU32)(w * pixsize)) {
    317                 txError("TGA Image: Unexpected End of File\n");
    318                 return FXFALSE;
    319         }
    320         return FXTRUE;
     317        if ( fread( data, 1, w * pixsize, stream) != (FxU32)(w * pixsize)) {
     318            txError("TGA Image: Unexpected End of File\n");
     319            return FXFALSE;
     320        }
     321        return FXTRUE;
    321322    }
    322323
    323324    // Otherwise, RLE data.
    324325    while (w--) {
    325         if (!_txReadTGARLEPixel( stream, data, pixsize)) {
    326             return FXFALSE;
    327         }
    328         data += pixsize;
     326        if (!_txReadTGARLEPixel( stream, data, pixsize)) {
     327        return FXFALSE;
     328        }
     329        data += pixsize;
    329330    }
    330331    return FXTRUE;
     
    334335_txReadTGAData( FILE *stream, TxMip *info)
    335336{
    336     TgaHeader   *tgaHeader = (TgaHeader *) info->pal;
    337     int         i, stride;
    338     int         bpp;                    // bytesPerPixel
    339     FxU8*       data;
    340     long        BigEndian = 0xff000000;
     337    TgaHeader   *tgaHeader = (TgaHeader *) info->pal;
     338    int     i, stride;
     339    int     bpp;            // bytesPerPixel
     340    FxU8*   data;
     341    long    BigEndian = 0xff000000;
    341342
    342343    // printf("TxREAD TGA DATA\n");
     
    346347
    347348    switch (tgaHeader->ImgType) {
    348     case TGA_MONO:      tgaRLE = 0; info->format = GR_TEXFMT_I_8; break;
    349     case TGA_MONO_RLE:  tgaRLE = 1; info->format = GR_TEXFMT_I_8; break;
    350 
    351     case TGA_TRUE:      tgaRLE = 0; info->format = (bpp == 2) ?
    352                         GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break;
    353     case TGA_TRUE_RLE:  tgaRLE = 1; info->format = (bpp == 2) ?
    354                         GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break;
    355 
    356     case TGA_CMAP:      tgaRLE = 0; info->format = GR_TEXFMT_P_8; break;
    357     case TGA_CMAP_RLE:  tgaRLE = 1; info->format = GR_TEXFMT_P_8; break;
     349    case TGA_MONO:  tgaRLE = 0; info->format = GR_TEXFMT_I_8; break;
     350    case TGA_MONO_RLE:  tgaRLE = 1; info->format = GR_TEXFMT_I_8; break;
     351
     352    case TGA_TRUE:  tgaRLE = 0; info->format = (bpp == 2) ?
     353                GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break;
     354    case TGA_TRUE_RLE:  tgaRLE = 1; info->format = (bpp == 2) ?
     355                GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break;
     356
     357    case TGA_CMAP:  tgaRLE = 0; info->format = GR_TEXFMT_P_8; break;
     358    case TGA_CMAP_RLE:  tgaRLE = 1; info->format = GR_TEXFMT_P_8; break;
    358359    }
    359360
     
    363364    data   =  info->data[0];
    364365    if ((tgaHeader->ImageDescriptor & 0x20) == 0) {
    365         // Origin is lower left
    366         data   = data + (info->height-1) * stride;
    367         stride = -stride;
     366        // Origin is lower left
     367        data   = data + (info->height-1) * stride;
     368        stride = -stride;
    368369    }
    369370
    370371    /* If there's a colormap, read it now. */
    371     if (!_txReadTGAColorMap(stream, tgaHeader, (FxU32 *) &(info->pal[0]))) 
    372         return FXFALSE;
     372    if (!_txReadTGAColorMap(stream, tgaHeader, (FxU32 *) &(info->pal[0])))
     373        return FXFALSE;
    373374    // printf("read in color map\n");
    374375
    375376    /* Read in all the data */
    376377    for ( i = 0; i < info->height; i++) {
    377         if (!_txReadTGASpan( stream, data, info->width, bpp)) {
    378                         txError("TGA Image: Unexpected end of file.");
    379                         return FXFALSE;
    380         }
    381         data += stride;
     378        if (!_txReadTGASpan( stream, data, info->width, bpp)) {
     379                txError("TGA Image: Unexpected end of file.");
     380                return FXFALSE;
     381        }
     382        data += stride;
    382383    }
    383384
     
    390391    // printf("Repacking\n");
    391392    if (bpp == 3) {
    392         int             npixels = info->width * info->height;
    393         FxU8    *src = ((FxU8 *) info->data[0]) + (npixels - 1) * 3;
    394         FxU8    *dst = ((FxU8 *) info->data[0]) + (npixels - 1) * 4;
    395 
    396         while (npixels--) {
    397                 dst[3] = 0xFF;
    398                 dst[2] = src[2];
    399                 dst[1] = src[1];
    400                 dst[0] = src[0];
    401                 dst -= 4;
    402                 src -= 3;
    403         }
     393        int     npixels = info->width * info->height;
     394        FxU8    *src = ((FxU8 *) info->data[0]) + (npixels - 1) * 3;
     395        FxU8    *dst = ((FxU8 *) info->data[0]) + (npixels - 1) * 4;
     396
     397        while (npixels--) {
     398            dst[3] = 0xFF;
     399            dst[2] = src[2];
     400            dst[1] = src[1];
     401            dst[0] = src[0];
     402            dst -= 4;
     403            src -= 3;
     404        }
    404405    }
    405406    // printf("Done\n");
    406407    if (*(FxU8 *)&BigEndian) {
    407         /* Repack 16bpp and 32bpp cases */
     408    /* Repack 16bpp and 32bpp cases */
    408409        if (bpp == 2) {
    409             int         npixels = info->width * info->height;
    410             FxU16       *src = (FxU16 *) info->data[0];
    411 
    412             while (npixels--) {
    413                 *src = (*src << 8) | ((*src >> 8) & 0xff);
     410            int     npixels = info->width * info->height;
     411            FxU16   *src = (FxU16 *) info->data[0];
     412
     413            while (npixels--) {
     414                *src = (*src << 8) | ((*src >> 8) & 0xff);
    414415                src++;
    415             }
     416            }
    416417        }
    417418        if ((bpp == 3) || (bpp == 4)) {
    418             int         npixels = info->width * info->height;
    419             FxU32       *src = (FxU32 *) info->data[0];
    420 
    421             while (npixels--) {
    422                 *src = (((*src      ) & 0xff)  << 24)|
    423                        (((*src >>  8) & 0xff)  << 16)|
    424                        (((*src >> 16) & 0xff)  <<  8)|
    425                        (((*src >> 24) & 0xff)       );
     419            int     npixels = info->width * info->height;
     420            FxU32   *src = (FxU32 *) info->data[0];
     421
     422            while (npixels--) {
     423                *src = (((*src      ) & 0xff)  << 24)|
     424                       (((*src >>  8) & 0xff)  << 16)|
     425                       (((*src >> 16) & 0xff)  <<  8)|
     426                       (((*src >> 24) & 0xff)       );
    426427                src++;
    427             }
     428            }
    428429        }
    429430    }
  • trunk/src/opengl/glide/cvg/texus/util.c

    r2888 r6653  
     1/* $Id: util.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */
    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:38:01 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:30:47 $
    2324*/
    2425
     
    3334
    3435char *Format_Name[] = {
    35          "rgb332",                              // GR_TEXFMT_RGB_332 
     36         "rgb332",                              // GR_TEXFMT_RGB_332
    3637         "yiq",                                 // GR_TEXFMT_YIQ_422
    3738         "a8",                                  // GR_TEXFMT_ALPHA_8
     
    136137txYABtoPal256(long *palette, const long* yabTable)
    137138{
    138         // Convert YAB table to a 256 color palette 
     139        // Convert YAB table to a 256 color palette
    139140        // Assume yabTable[] has first 16Y's, 12 A's, 12 B's
    140141
     
    268269txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int ncolors)
    269270{
    270         int             i, d; 
     271        int             i, d;
    271272        int             mindist, minpos;                // closest distance to input
    272273
     
    274275                txPanic("Bad explode\n");
    275276
    276         mindist = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 
     277        mindist = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff,
    277278                ir, ig, ib);
    278279        minpos  = 0;
     
    281282        /* Find closest color */
    282283        for (i=1; i<ncolors; i++, pal ++) {
    283                 d = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 
     284                d = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff,
    284285                        ir, ig, ib);
    285286                if (d < mindist) { mindist = d; minpos = i; }
     
    327328
    328329void
    329 txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride, 
     330txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride,
    330331        int width, int height)
    331332{
     
    414415{
    415416        /* Strip the pathname and leave us with filename.ext */
    416         char    *s; 
     417        char    *s;
    417418        const   char *p, *slash;
    418419
     
    428429        for (s = basename; *s; s++);
    429430
    430         // Walk backwards; replace any . with 0 
     431        // Walk backwards; replace any . with 0
    431432        while (--s >= basename) {
    432433                if (*s == '.') {*s = 0; break;}
     
    463464        }
    464465
    465         if (ext) 
     466        if (ext)
    466467            while (*ext)  *extname++ = *ext++;
    467        
     468
    468469        *extname = 0;
    469470}
  • trunk/src/opengl/glide/cvg/texus/view.c

    r2888 r6653  
     1/* $Id: view.c,v 1.2 2001-09-05 14:30:47 bird Exp $ */
    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:38:02 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:30:47 $
    2223*/
    2324
  • trunk/src/opengl/glide/cvg/texus/write.c

    r2888 r6653  
     1/* $Id: write.c,v 1.2 2001-09-05 14:30:48 bird Exp $ */
    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*/
     
    3031 */
    3132static  char *Version = "1.1";
    32 static char* aspect_names[] = { "8 1", "4 1", "2 1", "1 1", 
     33static char* aspect_names[] = { "8 1", "4 1", "2 1", "1 1",
    3334                                                        "1 2", "1 4", "1 8" };
    3435
    3536/*************************************** tga files ****************************/
    36 /* 
     37/*
    3738 * Write a tga file from an ARGB8888 mipmap.
    3839 */
    39 static FxBool 
     40static FxBool
    4041txWriteTGA( FILE *stream, TxMip *txMip)
    4142{
     
    7374        return FXFALSE;
    7475    }
    75    
     76
    7677    outW = txMip->width;
    7778    outH = txMip->height;
    7879    if (txMip->depth > 1) outW += outW/2;
    79    
     80
    8081    tgaHeader.IDLength         = 0;
    8182    tgaHeader.ColorMapType     = 0;
     
    9697    tgaHeader.PixelDepth       = 32;
    9798    tgaHeader.ImageDescriptor  = 0x20;          // image always right side up.
    98        
     99
    99100
    100101    if ( fwrite( &tgaHeader, 1, 18, stream ) != 18 ) {
     
    110111
    111112    /* Copy level 0 into malloc'd area */
    112     txRectCopy( data, outW * 4, txMip->data[0], txMip->width * 4, 
     113    txRectCopy( data, outW * 4, txMip->data[0], txMip->width * 4,
    113114        txMip->width * 4, txMip->height);
    114115
     
    116117
    117118    /* Copy the rest of the levels to the right of level 0 */
    118     w = txMip->width; 
    119     h = txMip->height; 
     119    w = txMip->width;
     120    h = txMip->height;
    120121    for (i=1; i< txMip->depth; i++) {
    121122        // printf("Copying: level = %d\n", i);
     
    129130    data32 = (FxU32 *) data;
    130131    for (i=outW*outH; i; i--) {
    131         putc(((*data32      ) & 0xff)    , stream);     
    132         putc(((*data32 >>  8) & 0xff)    , stream);     
    133         putc(((*data32 >> 16) & 0xff)    , stream);     
    134         putc(((*data32 >> 24) & 0xff)    , stream);     
     132        putc(((*data32      ) & 0xff)    , stream);
     133        putc(((*data32 >>  8) & 0xff)    , stream);
     134        putc(((*data32 >> 16) & 0xff)    , stream);
     135        putc(((*data32 >> 24) & 0xff)    , stream);
    135136        data32++;
    136137    }
     
    142143/* Write word, msb first */
    143144
    144 static FxBool 
     145static FxBool
    145146_txWrite16 (FILE *stream, FxU16 data)
    146147{
     
    155156/* Write long word, msb first */
    156157
    157 static FxBool 
     158static FxBool
    158159_txWrite32 (FILE *stream, FxU32 data)
    159160{
     
    169170
    170171/* Write NCC table */
    171 static FxBool 
     172static FxBool
    172173_txWrite3dfNCCTable (FILE *stream, FxU32 *yab)
    173174{
     
    177178        if (!_txWrite16 (stream, (FxU16) (yab[i] & 0x00ff))) return FXFALSE;
    178179
    179     for (i = 0; i < 12; i++) 
     180    for (i = 0; i < 12; i++)
    180181        if (!_txWrite16 (stream, (FxU16) (yab[16+i] & 0xffff))) return FXFALSE;
    181182
    182     for (i = 0; i < 12; i++) 
     183    for (i = 0; i < 12; i++)
    183184        if (!_txWrite16 (stream, (FxU16) (yab[28+i] & 0xffff))) return FXFALSE;
    184185
     
    197198}
    198199
    199 static FxBool 
     200static FxBool
    200201txWrite3df (FILE *stream, TxMip *txMip)
    201202{
     
    213214
    214215    // printf("Writing header...\n");
    215     if (EOF == fprintf (stream, 
     216    if (EOF == fprintf (stream,
    216217        "3df v%s\n%s\nlod range: %d %d\naspect ratio: %s\n",
    217         Version, 
     218        Version,
    218219        Format_Name[txMip->format],
    219220        small_lod,
     
    226227        (txMip->format == GR_TEXFMT_AYIQ_8422)) {
    227228                if (!_txWrite3dfNCCTable (stream, txMip->pal)) return FXFALSE;
    228     } 
     229    }
    229230
    230231    else if ((txMip->format == GR_TEXFMT_P_8) ||
    231232        (txMip->format == GR_TEXFMT_AP_88)) {
    232233                if (!_txWrite3dfPalTable (stream, txMip->pal)) return FXFALSE;
    233     } 
     234    }
    234235
    235236
     
    289290        if( txVerbose )
    290291          {
    291             printf("Writing file \"%s\" (format: %s)\n", 
     292            printf("Writing file \"%s\" (format: %s)\n",
    292293                   filename, Format_Name[txMip->format]);
    293294          }
     
    380381      break;
    381382    case TX_WRITE_TGA:
    382       if( mip.format == GR_TEXFMT_YIQ_422 || 
     383      if( mip.format == GR_TEXFMT_YIQ_422 ||
    383384          mip.format == GR_TEXFMT_AYIQ_8422 )
    384385        {
Note: See TracChangeset for help on using the changeset viewer.