From 88b0b8a65049bce61cdd2790a895326be9b875db Mon Sep 17 00:00:00 2001 From: dborca <> Date: Mon, 8 Mar 2004 07:42:24 +0000 Subject: [PATCH] Voodoo Rush fixes --- glide3x/README | 3 +- glide3x/cvg/glide3/src/distate.c | 11 ++-- glide3x/sst1/glide3/src/Makefile.DJ | 36 +++++++++- glide3x/sst1/glide3/src/diget.c | 39 +++++++---- glide3x/sst1/glide3/src/distate.c | 11 ++-- glide3x/sst1/glide3/src/fxglide.h | 20 +++++- glide3x/sst1/glide3/src/gerror.c | 7 +- glide3x/sst1/glide3/src/gglide.c | 83 +++++++++++++++++++++++- glide3x/sst1/glide3/src/gpci.c | 11 +++- glide3x/sst1/glide3/src/gsst.c | 9 ++- glide3x/sst1/glide3/src/makefile.linux | 56 +++++++++++++++- glide3x/sst1/glide3/src/readme | 10 ++- glide3x/sst1/glide3/src/xdraw96.asm | 81 +++++++++++++++++++++-- glide3x/sst1/glide3/tests/Makefile.DJ | 15 ++++- glide3x/sst1/glide3/tests/makefile.linux | 15 ++++- glide3x/sst1/init/init.c | 3 + glide3x/sst1/init/init96/dxdrvr.c | 7 ++ glide3x/sst1/init/init96/init96.c | 10 ++- glide3x/sst1/init/init96/initmcrx.c | 8 +++ glide3x/sst1/init/initvg/sst1init.c | 2 +- glide3x/sst1/init/vg96drvr.c | 2 +- 21 files changed, 388 insertions(+), 51 deletions(-) diff --git a/glide3x/README b/glide3x/README index efc903a..ba9f91e 100644 --- a/glide3x/README +++ b/glide3x/README @@ -12,8 +12,7 @@ h3: HW: Voodoo Banshee, Velocity 100/200, Voodoo3/4/5 Maintainers: Hiroshi Morii, Daniel Borca, Guillem Jover Notes: -1) sst1 branch must be compiled separately for V1 and VR. Currently, - VR support is broken. +1) sst1 branch must be compiled separately for V1 and VR. 2) h3 & h5 have experimental non-DRI versions; they don't work yet! --------------------------------------------------------------------- diff --git a/glide3x/cvg/glide3/src/distate.c b/glide3x/cvg/glide3/src/distate.c index db39ff7..c37cf6c 100644 --- a/glide3x/cvg/glide3/src/distate.c +++ b/glide3x/cvg/glide3/src/distate.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ + ** Revision 1.1.1.1.8.2 2003/11/03 13:34:29 dborca + ** Voodoo2 happiness (DJGPP & Linux) + ** ** Revision 1.1.1.1.8.1 2003/06/29 18:45:55 guillemj ** Fixed preprocessor invalid token errors. ** @@ -524,10 +527,10 @@ GR_DIENTRY(grStipplePattern, void , (GrStipplePattern_t stipple)) { #define FN_NAME "grStipplePattern" - /* [dBorca] TODO - * GR_BEGIN_NOFIFOCHECK("grStipplePattern\n", 85); + /* [dBorca] TODO + * INVALIDATE(stipple); STOREARG(grStipplePattern, stipple); @@ -550,10 +553,10 @@ GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) ) { #define FN_NAME "grStippleMode" - /* [dBorca] TODO - * GR_BEGIN_NOFIFOCHECK("grStippleMode\n", 85); + /* [dBorca] TODO + * INVALIDATE(fbzMode); STOREARG(grStippleMode, mode); diff --git a/glide3x/sst1/glide3/src/Makefile.DJ b/glide3x/sst1/glide3/src/Makefile.DJ index 757434d..6392b96 100644 --- a/glide3x/sst1/glide3/src/Makefile.DJ +++ b/glide3x/sst1/glide3/src/Makefile.DJ @@ -81,9 +81,10 @@ CDEFS += -DSST1 #CDEFS += -DGLIDE_USE_ALT_REGMAP else ifeq ($(FX_GLIDE_HW),sst96) -CDEFS += -DSST6 +CDEFS += -DSST96 CDEFS += -DSST96_FIFO #CDEFS += -DSST96_ALT_FIFO_WRAP +#CDEFS += -DINIT96VGASWAP -DINIT_ACCESS_DIRECT endif endif @@ -167,6 +168,15 @@ GLIDE_OBJECTS += \ endif endif +ifeq ($(FX_GLIDE_HW),sst96) +GLIDE_OBJECTS += \ + sst96.o \ + ../../init/init96/init96.o \ + ../../init/init96/dxdrvr.o \ + ../../init/init96/initat3d.o \ + ../../init/init96/initmcrx.o +endif + GLIDE_OBJECTS += \ ../../init/init.o \ ../../init/vgdrvr.o \ @@ -258,6 +268,29 @@ xdraw.o: xdraw.asm xdraw96.o: xdraw96.asm $(AS) -o $@ $(ASFLAGS) $< +ifeq ($(FX_GLIDE_HW),sst96) +../../init/initvg/gamma.o: ../../init/initvg/gamma.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/dac.o: ../../init/initvg/dac.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/video.o: ../../init/initvg/video.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/parse.o: ../../init/initvg/parse.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/sli.o: ../../init/initvg/sli.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/util.o: ../../init/initvg/util.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/info.o: ../../init/initvg/info.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/print.o: ../../init/initvg/print.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/gdebug.o: ../../init/initvg/gdebug.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/sst1init.o: ../../init/initvg/sst1init.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +endif + $(GLIDE_OBJECTS): fxinline.h fxgasm.h fxinline.h: fxgasm.exe @@ -277,6 +310,7 @@ clean: -$(call UNLINK,*.o) -$(call UNLINK,../../init/*.o) -$(call UNLINK,../../init/initvg/*.o) + -$(call UNLINK,../../init/init96/*.o) -$(call UNLINK,$(FX_GLIDE_SW)/newpci/pcilib/*.o) -$(call UNLINK,fxinline.h) -$(call UNLINK,fxgasm.h) diff --git a/glide3x/sst1/glide3/src/diget.c b/glide3x/sst1/glide3/src/diget.c index d735f80..d5912ea 100644 --- a/glide3x/sst1/glide3/src/diget.c +++ b/glide3x/sst1/glide3/src/diget.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.2.1 2004/03/02 07:55:29 dborca +** Bastardised Glide3x for SST1 +** ** Revision 1.1.1.1.8.2 2003/12/08 13:13:11 dborca ** better Texus2 integration ** @@ -454,10 +457,10 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params)) break; case GR_LFB_PIXEL_PIPE: if (plength == 4) { - if (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_VOODOO) - *params = FXTRUE; - else + if (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_SST96) *params = FXFALSE; + else + *params = FXTRUE; retVal = plength; } break; @@ -525,7 +528,7 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params)) #if GLIDE_INIT_HAL (_grSstDetectResources() ? _GlideRoot.hwConfig.num_sst : 0); #else /* !GLIDE_INIT_HAL */ - sst1InitNumBoardsInSystem(); + initNumBoardsInSystem(); #endif /* !GLIDE_INIT_HAL */ retVal = plength; } @@ -538,10 +541,8 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params)) break; case GR_NUM_FB: if (plength == 4) { - if (hwc->SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.sliDetect) - *params = 2; - else - *params = 1; + /* [dBorca] we can use sliDetect for GR_SSTTYPE_VOODOO only */ + *params = initNumBoardsInSystem(); retVal = plength; } break; @@ -564,7 +565,7 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params)) *params = hwc->SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.fbiRev; break; case GR_SSTTYPE_SST96: - retVal = FXFALSE; + *params = hwc->SSTs[_GlideRoot.current_sst].sstBoard.SST96Config.vg96Rev; break; default: retVal = FXFALSE; @@ -660,11 +661,17 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params)) } break; case GR_SWAP_HISTORY: - retVal = FXFALSE; + if (plength == 0) { + retVal = plength; + } break; case GR_SUPPORTS_PASSTHRU: if (plength == 4) { +#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) *params = FXTRUE; +#else ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) + *params = FXFALSE; +#endif retVal = plength; } break; @@ -679,8 +686,16 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params)) break; case GR_VIDEO_POSITION: if (plength == 8) { - *params = _grSstVideoLine(); - *(params+1) = 0; /* [dBorca] bogus value */ + switch(hwc->SSTs[_GlideRoot.current_sst].type) { + case GR_SSTTYPE_VOODOO: + *params = _grSstVideoLine(); + *(params+1) = 0; /* [dBorca] bogus value */ + break; + case GR_SSTTYPE_SST96: + *params = 0; + *(params+1) = 0; + break; + } retVal = plength; } break; diff --git a/glide3x/sst1/glide3/src/distate.c b/glide3x/sst1/glide3/src/distate.c index 9f28297..76ded2f 100644 --- a/glide3x/sst1/glide3/src/distate.c +++ b/glide3x/sst1/glide3/src/distate.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ + ** Revision 1.1.2.1 2004/03/02 07:55:29 dborca + ** Bastardised Glide3x for SST1 + ** ** Revision 1.1.1.1.8.2 2003/11/03 13:34:29 dborca ** Voodoo2 happiness (DJGPP & Linux) ** @@ -171,10 +174,10 @@ GR_DIENTRY(grStipplePattern, void , (GrStipplePattern_t stipple)) { #define FN_NAME "grStipplePattern" - /* [dBorca] TODO - * GR_BEGIN_NOFIFOCHECK("grStipplePattern\n", 85); + /* [dBorca] TODO + * INVALIDATE(stipple); STOREARG(grStipplePattern, stipple); @@ -197,10 +200,10 @@ GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) ) { #define FN_NAME "grStippleMode" - /* [dBorca] TODO - * GR_BEGIN_NOFIFOCHECK("grStippleMode\n", 85); + /* [dBorca] TODO + * INVALIDATE(fbzMode); STOREARG(grStippleMode, mode); diff --git a/glide3x/sst1/glide3/src/fxglide.h b/glide3x/sst1/glide3/src/fxglide.h index ed8167a..b04086b 100644 --- a/glide3x/sst1/glide3/src/fxglide.h +++ b/glide3x/sst1/glide3/src/fxglide.h @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.2.1 2004/03/02 07:55:29 dborca +** Bastardised Glide3x for SST1 +** ** Revision 1.1.1.1 1999/12/07 21:48:52 joseph ** Initial checkin into SourceForge. ** @@ -297,6 +300,7 @@ typedef struct GrVoodooConfig_St { typedef struct GrSst96Config_St { int fbRam; /* How much? */ + int vg96Rev; int nTexelfx; GrTMUConfig_t tmuConfig; } GrSst96Config_t; @@ -445,6 +449,7 @@ typedef struct FxU32 fogColor; FxU32 zaColor; FxU32 chromaKey; + FxU32 chromaRange; FxU32 stipple; FxU32 color0; @@ -474,7 +479,7 @@ typedef struct allowLODdither, /* allow LOD dithering */ checkFifo; /* Check fifo status as specified by hints */ - FxU16 + FxU32 lfb_constant_depth; /* Constant value for depth buffer (LFBs) */ GrAlpha_t lfb_constant_alpha; /* Constant value for alpha buffer (LFBs) */ @@ -514,6 +519,9 @@ typedef struct ** argment names. This is very important, as there are macros in distate.c ** that require that. */ + struct{ + /* [dBorca] used for delayed validation */ + } stateArgs; struct{ GrEnableMode_t primitive_smooth_mode; } grEnableArgs; @@ -1584,4 +1592,14 @@ GR_ENTRY(grSetNumPendingBuffers, void, (FxI32 NumPendingBuffers)); +/* +** Glide 3 extension APIs +*/ + +void FX_CALL +grChromaRangeMode(GrChromaRangeMode_t mode); + +void FX_CALL +grChromaRange( GrColor_t min, GrColor_t max , GrChromaRangeMode_t mode); + #endif /* __FXGLIDE_H__ */ diff --git a/glide3x/sst1/glide3/src/gerror.c b/glide3x/sst1/glide3/src/gerror.c index 874e5e9..3ec9a4c 100644 --- a/glide3x/sst1/glide3/src/gerror.c +++ b/glide3x/sst1/glide3/src/gerror.c @@ -20,6 +20,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.2.1 2004/03/02 07:55:30 dborca +** Bastardised Glide3x for SST1 +** ** Revision 1.1.1.1 1999/12/07 21:48:52 joseph ** Initial checkin into SourceForge. ** @@ -94,7 +97,7 @@ _grErrorWindowsCallback( const char *s, FxBool fatal ) { GDBG_ERROR("glide",s); MessageBox(NULL, s, NULL, MB_OK); - grSstWinClose(0); + grSstWinClose((GrContext_t)(_GlideRoot.GCs + _GlideRoot.current_sst)); grGlideShutdown(); exit(1); } else { @@ -108,7 +111,7 @@ _grErrorDefaultCallback( const char *s, FxBool fatal ) { if ( fatal ) { - grSstWinClose(0); + grSstWinClose((GrContext_t)(_GlideRoot.GCs + _GlideRoot.current_sst)); grGlideShutdown(); #if (GLIDE_PLATFORM & GLIDE_HW_SST96) && (GLIDE_PLATFORM & GLIDE_OS_DOS32) diff --git a/glide3x/sst1/glide3/src/gglide.c b/glide3x/sst1/glide3/src/gglide.c index 8096da5..82e8712 100644 --- a/glide3x/sst1/glide3/src/gglide.c +++ b/glide3x/sst1/glide3/src/gglide.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.2.1 2004/03/02 07:55:30 dborca +** Bastardised Glide3x for SST1 +** ** Revision 1.1.1.1 1999/12/07 21:48:52 joseph ** Initial checkin into SourceForge. ** @@ -718,6 +721,84 @@ GR_ENTRY(grChromakeyMode, void, ( GrChromakeyMode_t mode )) GR_END(); } /* grChromaKeyMode */ +/*------------------------------------------------------------------- + Function: grChromaModeExt + Date: 05-Jan-98 + Implementor(s): atai + Description: + + Arguments: + + Return: + -------------------------------------------------------------------*/ +GR_DIENTRY(grChromaRangeMode, void , (GrChromakeyMode_t mode) ) +{ +#define FN_NAME "grChromaRangeMode" + GR_BEGIN("grChromaRangeMode\n",85,8); + + FxU32 fbzMode = gc->state.fbi_config.fbzMode; + FxU32 chromaRange = gc->state.fbi_config.chromaRange; + + /* [dBorca] inclusive intersection (ganked from sst.h) */ +#define SST_CHROMARANGE_BLUE_EX BIT(24) // Blue value in exclusive mode +#define SST_CHROMARANGE_GREEN_EX BIT(25) // Green value in exclusive mode +#define SST_CHROMARANGE_RED_EX BIT(26) // Red value in exclusive mode +#define SST_CHROMARANGE_BLOCK_OR BIT(27) // Union of all colors. +#define SST_ENCHROMARANGE BIT(28) + + chromaRange &= ~(SST_CHROMARANGE_BLUE_EX | + SST_CHROMARANGE_GREEN_EX | + SST_CHROMARANGE_RED_EX | + SST_CHROMARANGE_BLOCK_OR); + + if (mode == GR_CHROMARANGE_ENABLE_EXT) { + chromaRange |= SST_ENCHROMARANGE; + /* + ** We need to enable both fbzMode chromakeymode and chrmarange mdoe + */ + fbzMode |= SST_ENCHROMAKEY; + } else { + chromaRange &= ~SST_ENCHROMARANGE; + /* + ** [dBorca] We need to disable chromakey only if it wasn't enabled (see above) + ** if (gc->state.stateArgs.grChromakeyModeArgs.mode == GR_CHROMAKEY_DISABLE) + */ + fbzMode &= ~SST_ENCHROMAKEY; + } + + GR_SET( hw->chromaRange, chromaRange ); + gc->state.fbi_config.chromaRange = chromaRange; + GR_SET( hw->fbzMode, fbzMode ); + gc->state.fbi_config.fbzMode = fbzMode; + GR_END(); + +#undef FN_NAME +} /* grChromaRangeMode */ + +/*--------------------------------------------------------------------------- +** grChromaRange +*/ + +GR_ENTRY(grChromaRange, void, (GrColor_t min, GrColor_t max, GrChromaRangeMode_t mode)) +{ + GR_BEGIN("grChromaRange", 85, 8); + GDBG_INFO_MORE((gc->myLevel, "(0x%x)\n", min)); + GDBG_INFO_MORE((gc->myLevel, "(0x%x)\n", max)); + GDBG_INFO_MORE((gc->myLevel, "(0x%x)\n", mode)); + + FxU32 chromaRange = gc->state.fbi_config.chromaRange & SST_ENCHROMARANGE; + + _grSwizzleColor(&min); + _grSwizzleColor(&max); + + chromaRange |= (max & 0x00ffffff) | (mode << 24); + GR_SET( hw->chromaKey, min ); + gc->state.fbi_config.chromaKey = min; + GR_SET( hw->chromaRange, chromaRange ); + gc->state.fbi_config.chromaRange = chromaRange; + GR_END(); +} /* grChromaRange */ + /*--------------------------------------------------------------------------- ** grChromakeyValue */ @@ -1328,7 +1409,7 @@ GR_ENTRY(grGlideShutdown, void, ( void )) for( i = 0; i < _GlideRoot.hwConfig.num_sst; i++ ) { grSstSelect( i ); - grSstWinClose(0); + grSstWinClose((GrContext_t)(_GlideRoot.GCs + i)); } initClose(); diff --git a/glide3x/sst1/glide3/src/gpci.c b/glide3x/sst1/glide3/src/gpci.c index 5c37bdb..5583edc 100644 --- a/glide3x/sst1/glide3/src/gpci.c +++ b/glide3x/sst1/glide3/src/gpci.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ + ** Revision 1.1.2.1 2004/03/02 07:55:30 dborca + ** Bastardised Glide3x for SST1 + ** ** Revision 1.1.1.1 1999/12/07 21:48:52 joseph ** Initial checkin into SourceForge. ** @@ -275,6 +278,8 @@ _grSstDetectResources(void) info.hwDep.vg96Info.nTFX; _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.fbRam = info.hwDep.vg96Info.vg96Ram >> 20; + _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.vg96Rev = + info.hwDep.vg96Info.vg96Rev; _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.tmuConfig.tmuRev = info.hwDep.vg96Info.tfxRev; _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.tmuConfig.tmuRam = @@ -380,7 +385,7 @@ _GlideInitEnvironment( void ) #if defined(FX_DLL_ENABLE) && (GLIDE_PLATFORM & GLIDE_OS_WIN32) { /* GMT: display the DLL pathname for sanity checking */ char buf[132]; - if (GetModuleFileName(GetModuleHandle("glide2x.dll"),buf,sizeof(buf))) { + if (GetModuleFileName(GetModuleHandle("glide3x.dll"),buf,sizeof(buf))) { #ifdef GLIDE_DEBUG GDBG_INFO((0,"DLL path: %s\n",buf)); /* unconditional display */ #else @@ -454,11 +459,11 @@ _GlideInitEnvironment( void ) char s[128]; #ifndef __linux__ sprintf(s, - "_GlideInitEnvironment: glide2x.dll expected %s, none detected\n", + "_GlideInitEnvironment: glide3x.dll expected %s, none detected\n", GLIDE_DRIVER_NAME); #else sprintf(s, - "_GlideInitEnvironment: libglide2x.so expected %s, none detected\n", + "_GlideInitEnvironment: libglide3x.so expected %s, none detected\n", GLIDE_DRIVER_NAME); #endif GrErrorCallback(s, FXTRUE); diff --git a/glide3x/sst1/glide3/src/gsst.c b/glide3x/sst1/glide3/src/gsst.c index a1b64ee..5254a8c 100644 --- a/glide3x/sst1/glide3/src/gsst.c +++ b/glide3x/sst1/glide3/src/gsst.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.2.1 2004/03/02 07:55:30 dborca +** Bastardised Glide3x for SST1 +** ** Revision 1.1.1.1 1999/12/07 21:48:53 joseph ** Initial checkin into SourceForge. ** @@ -624,7 +627,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( #if defined(FX_OEM_BUILD) && !defined(FX_STATIC_BUILD) else { GrErrorCallback("Missing fxoem2x.dll", FXTRUE); - grSstWinClose(0); + grSstWinClose((GrContext_t)(_GlideRoot.GCs + _GlideRoot.current_sst)); exit(0); } #endif /* FX_STATIC_BUILD */ @@ -1436,7 +1439,7 @@ GR_ENTRY(guGammaCorrectionRGB, void, (float r, float g, float b)) * * initGamma(gam); */ - sst1InitGammaRGB(gc->reg_ptr, r, g, b); + initGammaRGB(/*gc->reg_ptr, */r, g, b); #endif /* !GLIDE_INIT_HAL */ GR_END(); @@ -1462,7 +1465,7 @@ GR_DIENTRY(grLoadGammaTable, void, (FxU32 nentries, FxU32 *red, FxU32 *green, Fx grGet(GR_GAMMA_TABLE_ENTRIES, 4, &max); if (nentries > max) nentries = max; - sst1InitGammaTable(gc->reg_ptr, nentries, red, green, blue); + initGammaTable(/*gc->reg_ptr, */nentries, red, green, blue); GR_END(); #undef FN_NAME diff --git a/glide3x/sst1/glide3/src/makefile.linux b/glide3x/sst1/glide3/src/makefile.linux index aa5a0cb..21c7b59 100644 --- a/glide3x/sst1/glide3/src/makefile.linux +++ b/glide3x/sst1/glide3/src/makefile.linux @@ -77,7 +77,7 @@ CDEFS += -DSST1 #CDEFS += -DGLIDE_USE_ALT_REGMAP else ifeq ($(FX_GLIDE_HW),sst96) -CDEFS += -DSST6 +CDEFS += -DSST96 CDEFS += -DSST96_FIFO #CDEFS += -DSST96_ALT_FIFO_WRAP endif @@ -163,6 +163,15 @@ GLIDE_OBJECTS += \ endif endif +ifeq ($(FX_GLIDE_HW),sst96) +GLIDE_OBJECTS += \ + sst96.o \ + ../../init/init96/init96.o \ + ../../init/init96/dxdrvr.o \ + ../../init/init96/initat3d.o \ + ../../init/init96/initmcrx.o +endif + GLIDE_OBJECTS += \ ../../init/init.o \ ../../init/vgdrvr.o \ @@ -259,6 +268,50 @@ xdraw.lo: xdraw.o xdraw96.lo: xdraw96.o $(CP) $< $@ +ifeq ($(FX_GLIDE_HW),sst96) +../../init/initvg/gamma.o: ../../init/initvg/gamma.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/dac.o: ../../init/initvg/dac.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/video.o: ../../init/initvg/video.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/parse.o: ../../init/initvg/parse.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/sli.o: ../../init/initvg/sli.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/util.o: ../../init/initvg/util.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/info.o: ../../init/initvg/info.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/print.o: ../../init/initvg/print.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/gdebug.o: ../../init/initvg/gdebug.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< +../../init/initvg/sst1init.o: ../../init/initvg/sst1init.c + $(CC) -o $@ $(CFLAGS) -USST96 -c $< + +../../init/initvg/gamma.lo: ../../init/initvg/gamma.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/dac.lo: ../../init/initvg/dac.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/video.lo: ../../init/initvg/video.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/parse.lo: ../../init/initvg/parse.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/sli.lo: ../../init/initvg/sli.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/util.lo: ../../init/initvg/util.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/info.lo: ../../init/initvg/info.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/print.lo: ../../init/initvg/print.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/gdebug.lo: ../../init/initvg/gdebug.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +../../init/initvg/sst1init.lo: ../../init/initvg/sst1init.c + $(CC) -o $@ $(CFLAGS) -DPIC -fPIC -USST96 -c $< +endif + $(GLIDE_OBJECTS): fxinline.h fxgasm.h fxinline.h: fxgasm @@ -278,6 +331,7 @@ clean: -$(RM) *.o *.lo -$(RM) ../../init/*.o ../../init/*.lo -$(RM) ../../init/initvg/*.o ../../init/initvg/*.lo + -$(RM) ../../init/init96/*.o ../../init/init96/*.lo -$(RM) $(FX_GLIDE_SW)/newpci/pcilib/*.o $(FX_GLIDE_SW)/newpci/pcilib/*.lo -$(RM) fxinline.h -$(RM) fxgasm.h diff --git a/glide3x/sst1/glide3/src/readme b/glide3x/sst1/glide3/src/readme index e8ccdd7..e298746 100644 --- a/glide3x/sst1/glide3/src/readme +++ b/glide3x/sst1/glide3/src/readme @@ -59,9 +59,13 @@ ToDo list: - stipple - clip coordinates - {STRIP|FAN}_CONTINUE - - Rush INIT is kinda broken; - also, the xdraw96 doesn't currently - handle Packed Color Workaround (tm) + +Caveats: + - grDrawLine doesn't work for VoodooRush + - unlike the rest of Voodoo family, Rush + doesn't support ZBUFFER format with + WBUFFER functions. This is a special + case of depth buffering used in Mesa! Special note: The GCC optimizer sometimes delays FSTP in order to achieve diff --git a/glide3x/sst1/glide3/src/xdraw96.asm b/glide3x/sst1/glide3/src/xdraw96.asm index eb34d5b..86ff1b3 100644 --- a/glide3x/sst1/glide3/src/xdraw96.asm +++ b/glide3x/sst1/glide3/src/xdraw96.asm @@ -19,6 +19,9 @@ ;; $Header$ ;; $Revision$ ;; $Log$ +;; Revision 1.1.2.1 2004/03/02 07:55:30 dborca +;; Bastardised Glide3x for SST1 +;; ;; Revision 1.1.1.1 1999/12/07 21:48:55 joseph ;; Initial checkin into SourceForge. ;; @@ -452,12 +455,18 @@ next_parm: test i,1 jnz secondary_packet +%if 1 ; [dBorca] Packed Color Workaround (tm) + test i, i + js packed_color_workaround_tm +%endif + mov tmpy, [fa + i] ; tmpy = fa[i] flds [fa + i] ; pa fsubs [fb + i] ; dpAB flds [fb + i] ; | pb fsubs [fc + i] ; dpAB dpBC +parameters_loaded: fld st1 ; | | dpAB fmuls dword [zdyBC] ; | | p0x fld st1 ; | | | dpBC @@ -486,7 +495,7 @@ next_parm: align 4 triangle_command: ; Write Triangle Command - mov tmpx, zArea + mov tmpx, [zArea] GR_SET_GW_ENTRY fifo, 0, tmpx test fifo, 7h jnz no_padding0 @@ -498,8 +507,8 @@ no_padding0: pop esi pop ebx mov eax, 1h ; return 1 (triangle drawn) - ret 12 - + ret + align 4 zero_area: @@ -514,7 +523,7 @@ backfaced: pop esi pop ebx xor eax, eax ; return 0 (triangle drawn) - ret 12 + ret align 4 wrap: @@ -548,6 +557,59 @@ dofence: xchg eax, [P6FenceVar] pop eax jmp fenceDone + +%if 1 ; [dBorca] Packed Color Workaround (tm) + align 4 +packed_color_workaround_tm: + mov tmpy, i + and i, 0ffffffh + shr tmpy, 24 + and tmpy, 3 + add i, tmpy + mov tmpy, [fa + i] + and tmpy, 0ffh + push tmpy ;fa[i] + mov tmpy, [fb + i] + fild dword [esp] ; pa + and tmpy, 0ffh + fst dword [esp] ; pa + push tmpy ;fb[i] + mov tmpy, [fc + i] + fild dword [esp] ; | pb + and tmpy, 0ffh + fsub TO st1 ; dpAB pb + push tmpy ;fc[i] + fild dword [esp] ; dpAB pb pc + add esp, 8 + fsubp st1 ; dpAB dpBC + pop tmpy ; tmpy = fa[i] + jmp parameters_loaded + align 4 +packed_color_workaround_tm_1: + mov tmpy, i + and i, 0ffffffh + shr tmpy, 24 + and tmpy, 3 + add i, tmpy + mov tmpy, [fa + i] + and tmpy, 0ffh + push tmpy ;fa[i] + mov tmpy, [fb + i] + fild dword [esp] ; pa + and tmpy, 0ffh + fst dword [esp] ; pa + push tmpy ;fb[i] + mov tmpy, [fc + i] + fild dword [esp] ; | pb + and tmpy, 0ffh + fsub TO st1 ; dpAB pb + push tmpy ;fc[i] + fild dword [esp] ; dpAB pb pc + add esp, 8 + fsubp st1 ; dpAB dpBC + pop tmpy ; tmpy = fa[i] + jmp parameters_loaded_1 +%endif align 4 secondary_packet: @@ -576,12 +638,19 @@ no_padding1: add dlp, SIZEOF_dataList align 4 next_parm_1: + +%if 1 ; [dBorca] Packed Color Workaround (tm) + test i, i + js packed_color_workaround_tm_1 +%endif + mov tmpy, [fa + i] ; tmpy = fa[i] flds [fa + i] ; pa fsubs [fb + i] ; dpAB flds [fb + i] ; | pb fsubs [fc + i] ; dpAB dpBC +parameters_loaded_1: fld st1 ; | | dpAB fmuls dword [zdyBC] ; | | p0x fld st1 ; | | | dpBC @@ -617,7 +686,7 @@ triangle_command_packet: mov tmpy, 40000000h mov tmpx, [gc + gwCommand] - mov fa, zArea + mov fa, [zArea] GR_SET_GW_CMD fifo, 0, tmpx GR_SET_GW_HEADER fifo, 4, tmpy @@ -630,7 +699,7 @@ triangle_command_packet: pop esi pop ebx mov eax, 1h ; return 1 (triangle drawn) - ret 12 + ret align 4 no_interpolation: diff --git a/glide3x/sst1/glide3/tests/Makefile.DJ b/glide3x/sst1/glide3/tests/Makefile.DJ index 57e1c40..2c254f4 100644 --- a/glide3x/sst1/glide3/tests/Makefile.DJ +++ b/glide3x/sst1/glide3/tests/Makefile.DJ @@ -12,6 +12,8 @@ # Available options: # # Environment variables: +# FX_GLIDE_HW build for the given ASIC (sst1, sst96). +# default = sst1 # CPU optimize for the given processor. # default = pentium # DXE=1 use DXE modules. @@ -26,7 +28,16 @@ .SUFFIXES: .c .o .exe .SECONDARY: tlib.o -FX_GLIDE_HW = sst1 +FX_GLIDE_HW ?= sst1 +ifeq ($(FX_GLIDE_HW),sst1) +HWDEF = -DSST1 +else +ifeq ($(FX_GLIDE_HW),sst96) +HWDEF = -DSST96 +endif +endif + +override FX_GLIDE_HW = sst1 TOP = ../../.. CPU ?= pentium @@ -34,7 +45,7 @@ CC = gcc CFLAGS = -Wall -O2 -ffast-math -mcpu=$(CPU) CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc -I$(TOP)/$(FX_GLIDE_HW)/init CFLAGS += -I$(TOP)/swlibs/fxmisc -CFLAGS += -D__DOS__ -DSST1 +CFLAGS += -D__DOS__ $(HWDEF) CFLAGS += -D__DOS32__ LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib diff --git a/glide3x/sst1/glide3/tests/makefile.linux b/glide3x/sst1/glide3/tests/makefile.linux index 91f278f..258408e 100644 --- a/glide3x/sst1/glide3/tests/makefile.linux +++ b/glide3x/sst1/glide3/tests/makefile.linux @@ -12,6 +12,8 @@ # Available options: # # Environment variables: +# FX_GLIDE_HW build for the given ASIC (sst1, sst96). +# default = sst1 # CPU optimize for the given processor. # default = pentium # @@ -24,7 +26,16 @@ .SUFFIXES: .c .o .exe .SECONDARY: tlib.o -FX_GLIDE_HW = sst1 +FX_GLIDE_HW ?= sst1 +ifeq ($(FX_GLIDE_HW),sst1) +HWDEF = -DSST1 +else +ifeq ($(FX_GLIDE_HW),sst96) +HWDEF = -DSST96 +endif +endif + +override FX_GLIDE_HW = sst1 TOP = ../../.. CPU ?= pentium @@ -32,7 +43,7 @@ CC = gcc CFLAGS = -Wall -O2 -ffast-math -mcpu=$(CPU) CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc -I$(TOP)/$(FX_GLIDE_HW)/init CFLAGS += -I$(TOP)/swlibs/fxmisc -CFLAGS += -DSST1 +CFLAGS += $(HWDEF) LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib diff --git a/glide3x/sst1/init/init.c b/glide3x/sst1/init/init.c index a397afe..54de605 100644 --- a/glide3x/sst1/init/init.c +++ b/glide3x/sst1/init/init.c @@ -41,6 +41,9 @@ #define _outp(port, data) pioOutByte(port, data) #define _outpw(port, data) pioOutWord(port, data); +#endif +#ifdef __DJGPP__ +#include #endif #include diff --git a/glide3x/sst1/init/init96/dxdrvr.c b/glide3x/sst1/init/init96/dxdrvr.c index e7da448..c2d8602 100644 --- a/glide3x/sst1/init/init96/dxdrvr.c +++ b/glide3x/sst1/init/init96/dxdrvr.c @@ -18,6 +18,9 @@ ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** ** $Log$ +** Revision 1.1.2.1 2004/03/02 07:56:03 dborca +** Bastardised Glide3x for SST1 +** ** Revision 1.1.1.1 1999/12/07 21:49:06 joseph ** Initial checkin into SourceForge. ** @@ -58,8 +61,12 @@ #include #ifdef __DOS32__ +#ifdef __DJGPP__ +#include +#else #include #endif +#endif #include diff --git a/glide3x/sst1/init/init96/init96.c b/glide3x/sst1/init/init96/init96.c index ced6d1d..9682678 100644 --- a/glide3x/sst1/init/init96/init96.c +++ b/glide3x/sst1/init/init96/init96.c @@ -32,8 +32,12 @@ static char revString[] = "@#%$Workfile: INIT96.C $ $Revision$"; #endif #ifdef __DOS32__ +#ifdef __DJGPP__ +#include +#else #include #endif +#endif #ifdef __WIN32__ #include @@ -48,6 +52,10 @@ static char revString[] = "@#%$Workfile: INIT96.C $ $Revision$"; #define _outp outp #endif +#ifdef __DJGPP__ +#include +#endif + /* 3Dfx Headers */ #include <3dfx.h> #include @@ -698,9 +706,7 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d switch (vID) { case AT3DVID: -#if 0 curHALData = initAT3DGetHALData(); -#endif break; case MCRXVID: curHALData = initMCRXGetHALData(); diff --git a/glide3x/sst1/init/init96/initmcrx.c b/glide3x/sst1/init/init96/initmcrx.c index d8d454f..742495c 100644 --- a/glide3x/sst1/init/init96/initmcrx.c +++ b/glide3x/sst1/init/init96/initmcrx.c @@ -30,7 +30,11 @@ static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision$"; #include #include #ifndef __linux__ +#ifdef __DJGPP__ +#include +#else #include +#endif #else #include #define _inp(port) pioInByte(port); @@ -38,8 +42,12 @@ static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision$"; #define _outpw(port,data) pioOutWord(port, data); #endif #ifdef __DOS32__ +#ifdef __DJGPP__ +#include +#else #include #endif +#endif #ifdef __WIN32__ #include diff --git a/glide3x/sst1/init/initvg/sst1init.c b/glide3x/sst1/init/initvg/sst1init.c index 94635ea..e382ff0 100644 --- a/glide3x/sst1/init/initvg/sst1init.c +++ b/glide3x/sst1/init/initvg/sst1init.c @@ -714,7 +714,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdown(FxU32 *sstbase) * * We need to move this to the "appropriate" place, wherever that may be. */ - /*pciClose(); [dBorca] Frankenstein: HACK & SLASH */ + /*pciClose(); [dBorca] not just yet! We still need PCI to shutdown */ #endif if(GETENV(("SST_NOSHUTDOWN"))) diff --git a/glide3x/sst1/init/vg96drvr.c b/glide3x/sst1/init/vg96drvr.c index aa1fdd7..e0d9022 100644 --- a/glide3x/sst1/init/vg96drvr.c +++ b/glide3x/sst1/init/vg96drvr.c @@ -37,7 +37,7 @@ /* This is currently disabled, thus breaking rush, until we can get some * sources from Aliance Semiconductor */ -#if 0 +#if SST96 static FxBool setVideo( FxU32 hWnd, GrScreenResolution_t sRes, GrScreenRefresh_t vRefresh,