Cleaned up win32 makefiles. Added work around for v5 6000 dac problem. Completed merging screen shot routines.

This commit is contained in:
koolsmoky
2003-06-05 08:24:00 +00:00
parent ba980646b9
commit 9a64ace60c
21 changed files with 1137 additions and 458 deletions

View File

@@ -5,172 +5,148 @@
# 1 ve3d 1.0 KoolSmoky global config
#
# moved this to win32mak.bat
# BUILD_DRIVE = $(HOMEDRIVE)
# use this for 95 DDK compatiblity
#!include $(BUILD_DRIVE)\98DDK\inc\master.mk
# moved this to win32mak.bat
# BUILD_ROOT=$(BUILD_DRIVE)\work\Glide3x
INCLUDE=$(INCLUDE)
# moved this to win32mak.bat
# BUILD_ROOT_SWLIBS=$(BUILD_ROOT)\swlibs
# moved this to win32mak.bat
# DIRECTXSDK=$(BUILD_DRIVE)\DXSDK
#
# Variables local to the build.
#
# moved this to win32mak.bat
# FX_HW_PROJECTS=glide
#
# --enable-fx-glide-hw chooses which ASIC to build for.
#
# FX_GLIDE_HW=h5
#
INSTALL_DESTINATION=$(BUILD_ROOT)\$(FX_GLIDE_HW)
#
# --enable-fx-dri-build chooses to build with or without DRI.
#
#DRI_BUILD=0
#
# This is makefile.linux behavior. I don't know exactly
# what this does.
#
# if voodoo2 use HAL_HW=true
#HAL_HW=1
#
# Define debuging
# FX_GLIDE_SYMBOLICS=1 enables us to get stuff from SoftIce etc even when
# building an optimized version. Supports minimal debug info on default. if you don't
# want any, CEASE_ALL_GDBG=1 comments out #define GDBG_INFO_ON in
# minihwc.c and win_mode.c .
#FX_GLIDE_SYMBOLICS=1
#DEBUG = 1
#CEASE_ALL_GDBG=1
#BETA = 1
!if "$(CEASE_ALL_GDBG)"=="1" && "$(DEBUG)"!="1"
LCDEFS = $(LCDEFS) -DCEASE_ALL_GDBG=1
!endif
!if "$(BETA)"=="1"
LCDEFS = $(LCDEFS) -DBETA=1
!endif
#
# More debuging
# use output to nt kernel debugger
#KERNEL_NT=1
# Yet more debuging
#FX_GLIDE_VTUNE=
#
# Define --enable-amd3d
#
#enable_amd3d=false
#GL_AMD3D=1
#
# --enable-fx-texlib=texus2 enables new texus library.
#
TEXTURE_UTILITIES_DIR=texus2
#
# These are conditional variables whose value is set by
# one of the other enable macros.
#
#FX_GLIDE_H3=0
FX_GLIDE_H5=1
#FX_GLIDE_CVG=0
#
# Architecture
# current, i386,i486,i586,i685,alpha
# default=current
FX_GLIDE_BUILD_ARCHITECTURE=i686
#
# Various tests needed at points in the build
# First, we set defaults.
#
#FX_GLIDE_PACKET_FIFO=1
#FX_GLIDE3=1
#
# There is no entry for this for H5
#FX_CHRIS_DENIS_ANTHONY_HACK=1
#
# FX_GLIDE_ALT_TAB already in makefile of h5\glide3x\src but commented
# out there. Need IS_ALT_TAB=1 to complete alt-tab in NT5.1
GLIDE_ALT_TAB=1
#FX_GLIDE_ALT_TAB=1
#IS_ALT_TAB=1
#!if "$(FX_GLIDE_ALT_TAB)"=="1" && "$(IS_ALT_TAB)"=="1"
#LCDEFS = $(LCDEFS) -DIS_ALT_TAB=1
#!endif
# Colourless
# Remove this line to disable the WinXP Alt Tab fix. There will be a speed up
# Shouldn't use this anymore. Faster generally works better, in particular for SDL
# app. Doing it this way doesn't always detect vid mode switches
#LCDEFS = $(LCDEFS) -DWINXP_ALT_TAB_FIX=1
# Colourless
# Remove this line to disable the faster WinXP Alt Tab fix. There will be a minor speed up
LCDEFS = $(LCDEFS) -DWINXP_FASTER_ALT_TAB_FIX=1
#
# use direct i/o writes
#FX_GLIDE_DIRECT_WRITE=1
#
# HAL_CSIM has to be 1 or NULL (Simulator=1, Hardware=NULL)
HAL_CSIM=
#
# 1 turns on cpu optimizations.
# HAL_CSIM must be NULL for this to work.
FX_GLIDE_CPUOPTS=1
#
#FX_GLIDE_NO_FIFO=1
#
!if "$(DEBUG)"=="1"
#FX_GLIDE_DEBUG_FIFO=1
!endif
#
#LCDEFS = $(LCDEFS) -D_FIFODUMP=1
#
# disable 3dfx watermark
FX_GLIDE_NO_PLUG=0
#
# disable 3dfx splashscreen
FX_GLIDE_NO_SPLASH=0
#
#
# Make a static link library.
FX_DLL_BUILD=1
#
# HW setup
# it's now faster to cull backfaced/zero area triangles in sw before the fifo
# forced to sw when using amd asm optimization.
#FX_GLIDE_HW_CULL=1
# Stick one more slot in the dataList so that the clamping loop does
# not go one more iteration.
#GLIDE_FP_CLAMP=1
# if we're going to stick one more 0 in the texture datalist we need to
# have GLIDE_FP_CLAMP=1 ofcourse
#GLIDE_FP_CLAMP_TEX=1
#
# use C trisetup instead of asm setup.
#FX_GLIDE_CTRISETUP=1
#
#setting this to 1 will disable hw TSU for triangle rendering.
#FX_GLIDE_SW_SETUP=1
#
#
# compiler defs
FX_COMPILER=MICROSOFT
FX_TARGET=WIN32
FX_HOST=WIN32
FX_PCI_TARGET=NT
#FX_TARGET_MINOR=WIN95
# FX_TARGET_MINOR=WIN95
INCLUDE=$(INCLUDE)
INSTALL_DESTINATION=$(BUILD_ROOT)\$(FX_GLIDE_HW)
# Make a static link library.
FX_DLL_BUILD=1
# Define beta release
# LCDEFS = $(LCDEFS) -DBETA=1
# Define debuging
# DEBUG = 1
# Enables us to get stuff from SoftIce etc even when building
# an optimized version.
# FX_GLIDE_SYMBOLICS=1
# Supports minimal debug info on default even when building an
# optimized version. Use this to disable all debug info.
# CEASE_ALL_GDBG=1
# Use output to nt kernel debugger
# KERNEL_NT=1
# Use Intel VTune
# FX_GLIDE_VTUNE=1
# HAL_CSIM has to be 1 or NULL (Simulator=1, Hardware=NULL)
HAL_CSIM=
# Use CPU optimizations.
# HAL_CSIM must be NULL for this to work.
FX_GLIDE_CPUOPTS=1
# disable 3dfx watermark
FX_GLIDE_NO_PLUG=0
# disable 3dfx splashscreen
FX_GLIDE_NO_SPLASH=0
# it's now faster to cull backfaced/zero area triangles in sw before the fifo
# forced to sw when using amd asm optimization.
# FX_GLIDE_HW_CULL=1
# Stick one more slot in the dataList so that the clamping loop does
# not go one more iteration.
# GLIDE_FP_CLAMP=1
# if we're going to stick one more 0 in the texture datalist we need to
# have GLIDE_FP_CLAMP=1 ofcourse
# GLIDE_FP_CLAMP_TEX=1
# use C trisetup instead of asm setup.
# FX_GLIDE_CTRISETUP=1
# setting this to 1 will disable hw TSU for triangle rendering.
# FX_GLIDE_SW_SETUP=1
# use direct i/o writes
# FX_GLIDE_DIRECT_WRITE=1
# FX_GLIDE_NO_FIFO=1
# FX_GLIDE_DEBUG_FIFO=1
# LCDEFS = $(LCDEFS) -D_FIFODUMP=1
# are we compiling for glide3x?
!if "$(FX_HW_PROJECTS)"=="glide3"
FX_GLIDE3 = 1
!endif
# use dxdrvr.c instead of win_mode.c for minihwc.lib
# HWC_DXDRVR = 1
# if 1, HWC_EXT_INIT is not used
# HWC_INIT_VXD = 1
# VXD stuff: need the LCDEFS options for win95 DDK compatiblity, just in case.
HWC_WIN40COMPAT = 1
# ABJ- hack
# use the minivdd to setup SLI/AA mode for hwcRestoreVideo().
# This is need till the not lazy stuff is properly done on a multichip comp.
HWC_MINIVDD_HACK = 1
# Obsolete. We now use Colourless's Alt Tab fix for winnt5.1
# LCDEFS = $(LCDEFS) -DIS_ALT_TAB=1
# Colourless
# Remove this line to disable the WinXP Alt Tab fix. There will be a speed up
# Shouldn't use this anymore. Faster generally works better, in particular for SDL
# app. Doing it this way doesn't always detect vid mode switches
# LCDEFS = $(LCDEFS) -DWINXP_ALT_TAB_FIX=1
# Colourless
# Remove this line to disable the faster WinXP Alt Tab fix. There will be a minor speed up
LCDEFS = $(LCDEFS) -DWINXP_FASTER_ALT_TAB_FIX=1
# profiling
# LLDOPTS = /PROFILE
#
# misc options
#
LCDEFS = $(LCDEFS) -DSTRICT -DWIN32_LEAN_AND_MEAN
LADEFS = $(LADEFS) -DSTRICT
LCDEFS = $(LCDEFS) -D_MSC_VER=1200 -DWINVER=0x0400
# LCDEFS = $(LCDEFS) -DGLIDE3_VERTEX_LAYOUT=1
# LCDEFS = $(LCDEFS) -DGLIDE_VERTEX_TABLE=1
# LCDEFS = $(LCDEFS) -DGLIDE3_SCALER=1
# LCDEFS = $(LCDEFS) -DGLIDE_TEST_TEXTURE_ALIGNMENT=1
# LCDEFS = $(LCDEFS) -DLFB_DISABLE_SLAVE_FIFO=1
# LCDEFS = $(LCDEFS) -DGLIDE_MULTIPLATFORM=1
# LCDEFS = $(LCDEFS) -DPCI_BUMP_N_GRIND=1 machintosh?
# LCDEFS = $(LCDEFS) -DGLIDE_USE_ALT_REGMAP=1
#
#THISDIR = devel
# Sandro's fast C clipping routine. GLIDE_USE_C_TRISETUP=1 must be set.
# LCDEFS = $(LCDEFS) -DFAST_C_CLIP=1
#
# Check for trilinearness
# LCDEFS = $(LCDEFS) -DGLIDE_CHECK_TRILINEAR=1
#
# Protected hacks for Glide/Win. Working 1-window command fifo.
# enables 1 window glide in window. removed! we'll never use it.
# LCDEFS = $(LCDEFS) -DTACO_MEMORY_FIFO_HACK=1
#
# for WINNT Global structure used to store app state, used by the display driver
# LCDEFS = $(LCDEFS) -DWINNT=1 -D_WIN32_WINNT=0x0500
#
# Called once when we start using the command fifo in order to tell
# NT / W2K to hold off on unmapping that view of the frame buffer and
# then called again once Glide knows it's lost its context so that
# the driver knows that it's now ok to unmap the memory.
# need WINNT=1 to work.
# LCDEFS = $(LCDEFS) -DENABLE_V3_W2K_GLIDE_CHANGES=1
# LCDEFS = $(LCDEFS) -DSLI_AA=1
#
# We branched glide starting w/ Voodoo2(aka CVG) so
# make sure that the right thing happens. If this sort
@@ -178,114 +154,18 @@ FX_PCI_TARGET=NT
#
!if "$(FX_GLIDE_HW)" == "sst1"
SUBDIRS = swlibs sst1
!else
!if "$(FX_GLIDE_HW)" == "sst96"
!else if "$(FX_GLIDE_HW)" == "sst96"
SUBDIRS = swlibs sst1
!else
!if "$(FX_GLIDE_HW)" == "cvg"
!else if "$(FX_GLIDE_HW)" == "cvg"
FX_GLIDE_CVG=1
SUBDIRS = swlibs cvg
!ifndef HAL_HW
HAL_HW = 1
!endif
!else
!if "$(FX_GLIDE_HW)" == "h3"
!else if "$(FX_GLIDE_HW)" == "h3"
FX_GLIDE_H3=1
SUBDIRS = swlibs h3
!else
!if "$(FX_GLIDE_HW)" == "h5"
!else if "$(FX_GLIDE_HW)" == "h5"
FX_GLIDE_H5=1
SUBDIRS = swlibs h5
!else
FX_GLIDE_HW = h3
SUBDIRS = swlibs h3
!endif
!endif
!endif
!endif
!endif
#
# Other variables we need to set
#
!if "$(FX_HW_PROJECTS)"=="glide3"
FX_GLIDE3 = 1
!endif
############################
#
# variables added
#
############################
# use dxdrvr.c instead of win_mode.c for minihwc.lib
#HWC_DXDRVR = 1
#
#
# VXD stuff: need the LCDEFS options for win95 DDK compatiblity, just in case.
HWC_WIN40COMPAT = 1
#
#
# ABJ- hack
# use the minivdd to setup SLI/AA mode for hwcRestoreVideo().
# This is need till the not lazy stuff is properly done on a multichip comp.
HWC_MINIVDD_HACK = 1
#
#
# Save the initial vidScreenSize, lfbMemoryConfig, and bpp at hwcinitvideo
# and restore them at resetVideo().
HWC_WINXP_MINIVDD_HACK = 0
!if "$(HWC_MINIVDD_HACK)"!="1"
HWC_WINXP_MINIVDD_HACK = 0
!endif
#
#
# if 1, HWC_EXT_INIT is not used
#HWC_INIT_VXD = 1
#
#
# STRICT
STRICT=1
!if "$(STRICT)"=="1"
LCDEFS = $(LCDEFS) -DSTRICT -DWIN32_LEAN_AND_MEAN
#LADEFS = $(LADEFS) -DSTRICT
!endif
#
#
# other stuff
LCDEFS = $(LCDEFS) -D_MSC_VER=1200 -DWINVER=0x0400
#
!if "$(FX_GLIDE3)"=="1"
LCDEFS = $(LCDEFS) -DGLIDE3_VERTEX_LAYOUT=1 -DGLIDE3_SCALER=1
!endif
#
#-DGLIDE_VERTEX_TABLE=1
#-DGLIDE3_SCALER=1
#-D_MSC_VER=1200
#-DWINVER=0x0501
#-DGLIDE_TEST_TEXTURE_ALIGNMENT=1
#-DGLIDE_CHECK_TRILINEAR=1 use this if we want to check for trilinearness
#-DGLIDE3_VERTEX_LAYOUT=1 this was removed.
#-DLFB_DISABLE_SLAVE_FIFO=1
#-DGLIDE_MULTIPLATFORM=1
#-DPCI_BUMP_N_GRIND=1 machintosh?
#-DGLIDE_USE_ALT_REGMAP=1
#
# Protected hacks for Glide/Win. Working 1-window command fifo.
# enables 1 window glide in window. removed! we'll never use it.
#-DTACO_MEMORY_FIFO_HACK=1
#
# for WINNT Global structure used to store app state, used by the display driver
#LCDEFS = $(LCDEFS) -DWINNT=1 -D_WIN32_WINNT=0x0500
# Called once when we start using the command fifo in order to tell
# NT / W2K to hold off on unmapping that view of the frame buffer and
# then called again once Glide knows it's lost its context so that
# the driver knows that it's now ok to unmap the memory.
# need WINNT=1 to work.
#ENABLE_V3_W2K_GLIDE_CHANGES = 1
!if "$(ENABLE_V3_W2K_GLIDE_CHANGES)"=="1"
LCDEFS = $(LCDEFS) -DENABLE_V3_W2K_GLIDE_CHANGES=1
!endif
# need WINNT=1 to work.
#SLI_AA = 1
!if "$(SLI_AA)"=="1"
LCDEFS = $(LCDEFS) -DSLI_AA=1
!endif
#
#LLDOPTS = /PROFILE

View File

@@ -37,7 +37,6 @@ rem +-include---nmake
rem |
rem +-newpci---pcilib
rem
rem ///////////////////////////////////////////////////////////////////
set BUILD_ROOT=%cd%
set BUILD_ROOT_SWLIBS=%BUILD_ROOT%\swlibs
set FX_GLIDE_HW=h5
@@ -46,11 +45,13 @@ rem
rem ///////////////////////////////////////////////////////////////////
rem Compiler Environment
rem These are usually preconfigured in the command prompt environment.
rem ///////////////////////////////////////////////////////////////////
rem
rem set DXSDKROOT=c:\dxsdk
rem set CC=%C32_ROOT%\bin\cl.exe
rem set AS=%MASM_ROOT%\bin\ml.exe
rem
rem ///////////////////////////////////////////////////////////////////
rem
if "%1" == "" goto error
goto %1
REM ----------build routine from here -------------

View File

@@ -350,8 +350,6 @@ GR_DIENTRY(grGlideInit, void, (void))
GDBG_INFO(80,"grGlideInit()\n");
FXUNUSED(*glideIdent);
/* dBorca - play safe */
grErrorSetCallback(_grErrorDefaultCallback);
@@ -370,23 +368,16 @@ GR_DIENTRY(grGlideInit, void, (void))
#endif
}
// _GlideInitEnvironment(); /* the main init code */
// FXUNUSED(*glideIdent);
#if GDBG_INFO_ON
GDBG_ERROR_SET_CALLBACK(_grErrorCallback);
#endif
// if (_GlideRoot.initialized) {
// initThreadStorage();
// initCriticalSection();
/* NB: We need to select the default device here so that grGetXXX
* routines work before grSstWinOpen or the surface attachment
* routines are called.
*/
grSstSelect(0);
// }
/* NB: We need to select the default device here so that grGetXXX
* routines work before grSstWinOpen or the surface attachment
* routines are called.
*/
grSstSelect(0);
FXUNUSED(*glideIdent);
_grResetTriStats();
GDBG_INFO(281,"grGlideInit --done---------------------------------------\n");

View File

@@ -178,6 +178,7 @@ GR_DIENTRY(grSstQueryHardware, FxBool, ( GrHwConfiguration *hwc ))
GR_DIENTRY(grSstSelect, void, ( int which ))
{
static FxBool initialized[HWC_MAX_BOARDS];
FxU32 i;
/* NB: We cannot use GR_DCL_GC here because we may be setting
* a context into tls.
*/
@@ -186,15 +187,19 @@ GR_DIENTRY(grSstSelect, void, ( int which ))
if ( which >= _GlideRoot.hwConfig.num_sst )
GrErrorCallback( "grSstSelect: non-existent SST", FXTRUE );
if(!initialized[which]) _GlideRoot.initialized = FXFALSE;
_GlideInitEnvironment(which); /* the main init code */
initialized[which] = FXTRUE;
if(!initialized[which]) {
_GlideRoot.initialized = FXFALSE;
_GlideInitEnvironment(which); /* the main init code */
}
for(i = 0; i < HWC_MAX_BOARDS; i++) initialized[i] = FXFALSE;
#if GDBG_INFO_ON
GDBG_ERROR_SET_CALLBACK(_grErrorCallback);
#endif
if (_GlideRoot.initialized) {
initialized[which] = FXTRUE;
initThreadStorage();
initCriticalSection();
_GlideRoot.current_sst = which;

View File

@@ -1176,9 +1176,11 @@ GR_DIENTRY(grRenderBuffer, void , (GrBuffer_t buffer) )
#ifdef FX_GLIDE_NAPALM
if (gc->grPixelSample > 1)
{
_grAAOffsetValue(_GlideRoot.environment.aaXOffset[gc->sampleOffsetIndex],
_GlideRoot.environment.aaYOffset[gc->sampleOffsetIndex],
0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer) ;
if (!gc->state.grEnableArgs.aaMultisampleDisableCount) {
_grAAOffsetValue(_GlideRoot.environment.aaXOffset[gc->sampleOffsetIndex],
_GlideRoot.environment.aaYOffset[gc->sampleOffsetIndex],
0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer) ;
}
}
#endif
@@ -2046,6 +2048,7 @@ _grValidateState()
/* Check for alpha test optimization */
if (NOTVALID(alphaMode) || NOTVALID(fbzMode) || NOTVALID(stencilMode)) {
updateAlphaMode = FXTRUE;
// KoolSmoky - need to recheck this.
/*if((LOADARG(grAlphaBlendFunction, rgb_sf) == GR_BLEND_SRC_ALPHA) &&
(LOADARG(grAlphaBlendFunction, rgb_df) == GR_BLEND_ONE_MINUS_SRC_ALPHA) &&
(LOADARG(grAlphaBlendFunction, rgb_op) == GR_BLEND_OP_ADD) &&
@@ -2787,11 +2790,15 @@ GR_DIENTRY(grDisable, void , (GrEnableMode_t mode) )
#ifdef FX_GLIDE_NAPALM
case GR_AA_MULTI_SAMPLE:
{
gc->state.grEnableArgs.aaMultisampleDisableCount++;
if (!gc->state.grEnableArgs.aaMultisampleDisableCount)
{
_grAAOffsetValue(_GlideRoot.environment.aaXOffset[0],
_GlideRoot.environment.aaYOffset[0],
0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer) ;
}
gc->state.grEnableArgs.aaMultisampleDisableCount++;
_grAAOffsetValue(_GlideRoot.environment.aaXOffset[0],
_GlideRoot.environment.aaYOffset[0],
0, gc->chipCount - 1, FXTRUE, gc->enableSecondaryBuffer) ;
}
break;
#endif

View File

@@ -777,6 +777,44 @@ typedef struct {
#define VRETRACEMASK 0x00000fff
#define HRETRACEPOS 16
struct tmuState_s {
#define OOOO_OOOO_OIII_IIII 0x007f
#define SR_MASK_4 OOOO_OOOO_OIII_IIII
FxU32 texPkt4Hdr_0;
FxU32 textureMode; /* 0x300 ( 0 ) */
FxU32 tLOD; /* 0x304 ( 1 ) */
FxU32 tDetail; /* 0x308 ( 2 ) */
FxU32 texBaseAddr; /* 0x30C ( 3 ) */
FxU32 texBaseAddr_1; /* 0x310 ( 4 ) */
FxU32 texBaseAddr_2; /* 0x314 ( 5 ) */
FxU32 texBaseAddr_3_8; /* 0x318 ( 6 ) */
/* ----------- end packet -------------*/
#define OOOO_OOOO_OOOO_OOII 0x0002
#define SR_MASK_5 OOOO_OOOO_OOOO_OOII
FxU32 texPkt4Hdr_1;
FxU32 texchromaKey;
FxU32 texchromaRange;
/* ----------- end packet -------------*/
#define SR_WORDS_6 24
FxU32 texPkt1Hdr_2;
FxU32 nccTable0[12];
FxU32 nccTable1[12];
/* ----------- end packet -------------*/
#ifdef FX_GLIDE_NAPALM
#define OOOO_OOOO_OOOO_OOOI 0x0001
#define SR_MASK_7 OOOO_OOOO_OOOO_OOOI
FxU32 texPkt4Hdr_3;
FxU32 combineMode;
/* ----------- end packet -------------*/
#endif /* FX_GLIDE_NAPALM */
};
/*--------------------------------------------------------------------------
State Restoration Buffer
@@ -852,44 +890,7 @@ typedef struct {
/* ----------- end packet -------------*/
#endif /* FX_GLIDE_NAPALM */
struct tmuState {
#define OOOO_OOOO_OIII_IIII 0x007f
#define SR_MASK_4 OOOO_OOOO_OIII_IIII
FxU32 texPkt4Hdr_0;
FxU32 textureMode; /* 0x300 ( 0 ) */
FxU32 tLOD; /* 0x304 ( 1 ) */
FxU32 tDetail; /* 0x308 ( 2 ) */
FxU32 texBaseAddr; /* 0x30C ( 3 ) */
FxU32 texBaseAddr_1; /* 0x310 ( 4 ) */
FxU32 texBaseAddr_2; /* 0x314 ( 5 ) */
FxU32 texBaseAddr_3_8; /* 0x318 ( 6 ) */
/* ----------- end packet -------------*/
#define OOOO_OOOO_OOOO_OOII 0x0002
#define SR_MASK_5 OOOO_OOOO_OOOO_OOII
FxU32 texPkt4Hdr_1;
FxU32 texchromaKey;
FxU32 texchromaRange;
/* ----------- end packet -------------*/
#define SR_WORDS_6 24
FxU32 texPkt1Hdr_2;
FxU32 nccTable0[12];
FxU32 nccTable1[12];
/* ----------- end packet -------------*/
#ifdef FX_GLIDE_NAPALM
#define OOOO_OOOO_OOOO_OOOI 0x0001
#define SR_MASK_7 OOOO_OOOO_OOOO_OOOI
FxU32 texPkt4Hdr_3;
FxU32 combineMode;
/* ----------- end packet -------------*/
#endif /* FX_GLIDE_NAPALM */
} tmuState[GLIDE_NUM_TMU];
struct tmuState_s tmuState[GLIDE_NUM_TMU];
struct PaletteRow {
#define SR_WORDS_P 8
@@ -939,7 +940,7 @@ typedef struct {
FxU32 tmuAlphaPassthrough; /* TMU alpha combine is in passthrough */
GrStateBuffer shadow; /* shadow of all hw state registers */
struct tmuState tmuShadow[GLIDE_NUM_TMU]; /* shadow of TMU registers */
struct tmuState_s tmuShadow[GLIDE_NUM_TMU]; /* shadow of TMU registers */
GrColor_t tmuColor[GLIDE_NUM_TMU]; /* Shadow of TMU constant color values */
FxU32 tmuMaskShadow; /* Intermediate tmuMask value before grValidateTMUState() */
@@ -2140,9 +2141,10 @@ struct _GlideRoot_s {
FxBool memFIFOHack; /* flush FIFO as much as possible */
#endif
FxU32 oglLfbLockHack; /* Enables disable hack to get around forced 32bit problems in OpenGL */
FxU32 oglLfbLockHack; /* Enables disable hack to get around forced 32bit problems in OpenGL */
FxU32 useHwcAAforLfbRead; /* Specifies whether to use HwcAAReadRegion for read Locks and LfbReadRegion calls */
FxU32 ditherHwcAA; /* Specifies whether to use HwcAAReadRegion should dither */
FxU32 ditherHwcAA; /* Specifies whether to use HwcAAReadRegion should dither */
FxI32 lockCounter;
} environment;
GrHwConfiguration hwConfig;

View File

@@ -236,9 +236,18 @@ GR_ENTRY(grDrawPoint, void, (const void *p))
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
GDBG_INFO_MORE(gc->myLevel, "(p = 0x%x)\n", p);
(gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_POINTS_MASK
? _grAADrawPoints
: _grDrawPoints)(GR_VTX_PTR_ARRAY, 1, (void *)&p);
#if defined(__linux__) || defined(__DJGPP__)
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_POINTS_MASK)
_grAADrawPoints(GR_VTX_PTR_ARRAY, 1, (void *)&p);
else
_grDrawPoints(GR_VTX_PTR_ARRAY, 1, (void *)&p);
#else
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_POINTS_MASK)
_grAADrawPoints(GR_VTX_PTR_ARRAY, 1, &(void *)p);
else
_grDrawPoints(GR_VTX_PTR_ARRAY, 1, &(void *)p);
#endif
#undef FN_NAME
} /* grDrawPoint */
@@ -281,7 +290,7 @@ GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
else
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
}
}
#else
#if defined(__linux__) || defined(__DJGPP__)
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)

View File

@@ -2621,7 +2621,21 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval))
GR_BEGIN_NOFIFOCHECK(FN_NAME,86);
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",swapInterval);
// First thing first. Decrement the lockCounter
if (_GlideRoot.environment.lockCounter > -10) _GlideRoot.environment.lockCounter--;
#ifdef FX_GLIDE_NAPALM
#if !defined(__linux__) && !defined(__DJGPP__)
/* Window hacky stuff */
if (gc->windowed)
{
extern void _grFlipWindowSurface();
grFinish();
_grFlipWindowSurface();
gc->stats.bufferSwaps++;
return;
}
#endif
// 4x FSAA or greater FSAA
if (0 && gc->grPixelSample >= 4) {

View File

@@ -343,11 +343,13 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
FxBool pixelPipeline, GrLfbInfo_t *info)
{
#define FN_NAME "grLfbLock"
#define FN_NAME "_grLfbLock"
FxBool
rv = FXTRUE;
const FxBool
idleLockP = ((type & GR_LFB_NOIDLE) == 0);
FxBool
noRead = FXFALSE;
FxU32
lfbMode,
zaColor,
@@ -357,7 +359,7 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t fbMode = 0;
GrLfbWriteMode_t depthMode = 0;
GR_BEGIN_NOFIFOCHECK_RET("grLfbLock", 82);
GR_BEGIN_NOFIFOCHECK_RET("_grLfbLock", 82);
GDBG_INFO_MORE(gc->myLevel,"(%d,%d,0x%x)\n", type, buffer, info);
GR_CHECK_COMPATABILITY(FN_NAME, !info,
@@ -368,6 +370,13 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
type = type & ~(GR_LFB_NOIDLE);
// LFBWOEXP Extension
if (type == GR_LFB_WRITE_ONLY_EXPLICIT_EXT)
{
type = GR_LFB_WRITE_ONLY;
noRead = FXTRUE;
}
/* Pray that no one has made any glide calls that touch the hardware... */
#ifdef FX_GLIDE_NAPALM
if((gc->sliCount > 1) &&
@@ -724,7 +733,7 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
we just return the current buffer lfbPtr as the write ptr.
This fixes those games that use the lfb write pointer to do
lfb reads. --mikec */
if((writeMode == (FxI32)fbMode) &&
if((writeMode == (FxI32)fbMode) && (!noRead) &&
(!pixelPipeline) &&
/* Origin must be upper left since we will return raw lfb */
(origin != GR_ORIGIN_LOWER_LEFT)){
@@ -771,7 +780,7 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
* take both a read and write lock, but only save off the stride value
* from the latter one. So if we return different strides OpenGL's lfb
* accesses will be whacked. -- KCD */
if((writeMode == fbMode) &&
if((writeMode == fbMode) && (!noRead) &&
(!pixelPipeline) &&
/* Origin must be upper left since we will return raw lfb */
(origin != GR_ORIGIN_LOWER_LEFT)){
@@ -917,7 +926,7 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
GR_RETURN(rv);
#undef FN_NAME
} /* grLfbLock */
} /* _grLfbLock */
/* Hack to correct locks of forced 32 bit surfaces */
static FxU16 *forced_32bpp_lock_buffer = 0;
@@ -934,6 +943,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
#define FN_NAME "grLfbLock"
FxBool rv = FXTRUE;
FxBool wantHwc;
FxBool forbidden = FXFALSE;
GrLock_t type;
@@ -951,17 +961,41 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
GDBG_INFO(79, "Read lock failure due to existing lock");
return FXFALSE;
}
/* Ok, we will disallow all Hwc reads (regardless of what the app might want) */
/* If we detect that the buffer is being locked far too much (aka a lock every frame) */
if (_GlideRoot.environment.lockCounter > 3)
{
/* Disable HwcAAforLfbRead */
if (_GlideRoot.environment.useHwcAAforLfbRead & 2)
{
_GlideRoot.environment.useHwcAAforLfbRead |= 4;
_GlideRoot.environment.useHwcAAforLfbRead &= ~2;
}
forbidden = FXTRUE;
}
/* Re-allow it if we drop back to 0 */
else if ((_GlideRoot.environment.lockCounter) == -10 && (_GlideRoot.environment.useHwcAAforLfbRead & 4))
{
/* Re-enable HwcAAforLfbRead */
_GlideRoot.environment.useHwcAAforLfbRead |= 2;
_GlideRoot.environment.useHwcAAforLfbRead &= ~4;
forbidden = FXFALSE;
}
/* We want to read using HWC if we using FSAA with 4 chips or want dithering */
/* or we are using forced 32 bit mode and want dithering */
wantHwc = (_GlideRoot.environment.useHwcAAforLfbRead & 2) &&
((gc->state.forced32BPP != 0 && _GlideRoot.environment.ditherHwcAA) ||
(gc->bInfo->h3pixelSample >= 2 && (gc->chipCount == 4 || _GlideRoot.environment.ditherHwcAA)));
/* Incrememt the lockCounter */
if (type == GR_LFB_READ_ONLY) _GlideRoot.environment.lockCounter++;
/* If we are using forced 32 bpp mode, the app is expecting 16 bit data */
/* Or we want to be using HwcAA for the Lfb read lock */
/* We need to use a hack for reading in OpenGL since they do 2 locks. Why, oh why, oh why...*/
if ((gc->state.forced32BPP || wantHwc) &&
if (!forbidden && (gc->state.forced32BPP || wantHwc) &&
(!_GlideRoot.environment.is_opengl || _GlideRoot.environment.oglLfbLockHack) &&
(buffer == GR_BUFFER_FRONTBUFFER || buffer == GR_BUFFER_BACKBUFFER))
{
@@ -1000,6 +1034,9 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
/* Reset the useHwcAAforLfbRead setting */
_GlideRoot.environment.useHwcAAforLfbRead = old_useHwcAAforLfbRead;
/* Increment the lock counter again */
_GlideRoot.environment.lockCounter++;
/* Failed to read */
if (!rv)
@@ -1045,10 +1082,10 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
static FxBool _grLfbUnlock (GrLock_t type, GrBuffer_t buffer)
{
#define FN_NAME "grLfbUnlock"
#define FN_NAME "_grLfbUnlock"
FxBool rval = FXFALSE;
GR_BEGIN_NOFIFOCHECK_RET("grLfbUnLock", 83);
GR_BEGIN_NOFIFOCHECK_RET("_grLfbUnLock", 83);
GDBG_INFO_MORE(gc->myLevel,"(%d, %d)\n", type, buffer);
type = type & ~(GR_LFB_NOIDLE);
@@ -1148,7 +1185,7 @@ static FxBool _grLfbUnlock (GrLock_t type, GrBuffer_t buffer)
GR_RETURN(rval);
#undef FN_NAME
} /* grLfbUnlock */
} /* _grLfbUnlock */
/* Hack to correct locks of forced 32 bit surfaces */
GR_ENTRY(grLfbUnlock, FxBool, (GrLock_t _type, GrBuffer_t buffer))
@@ -1157,7 +1194,7 @@ GR_ENTRY(grLfbUnlock, FxBool, (GrLock_t _type, GrBuffer_t buffer))
FxBool rval = FXFALSE;
GrLock_t type;
GR_BEGIN_NOFIFOCHECK_RET("_grLfbUnLock", 83);
GR_BEGIN_NOFIFOCHECK_RET("grLfbUnLock", 83);
GDBG_INFO_MORE(gc->myLevel,"(%d, %d)\n", _type, buffer);
type = _type & ~(GR_LFB_NOIDLE);
@@ -1312,7 +1349,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
info.size = sizeof(info);
if (grLfbLock(GR_LFB_WRITE_ONLY,
if (_grLfbLock(GR_LFB_WRITE_ONLY_EXPLICIT_EXT,
dst_buffer,
writeMode,
GR_ORIGIN_UPPER_LEFT,
@@ -1327,7 +1364,6 @@ _grLfbWriteRegion(FxBool pixPipelineP,
FxU32 scanline; /* scanline number */
int aligned; /* word aligned? */
srcData = (FxU32 *) src_data;
dstData = (FxU32 *) (((char*)info.lfbPtr)+ (dst_y*info.strideInBytes));
scanline = src_height;
@@ -1417,7 +1453,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
rv = FXFALSE;
break;
}
grLfbUnlock(GR_LFB_WRITE_ONLY, dst_buffer);
_grLfbUnlock(GR_LFB_WRITE_ONLY, dst_buffer);
} else {
rv = FXFALSE;
}
@@ -1514,6 +1550,7 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
#define FN_NAME "grLfbReadRegion"
FxU32 bpp;
FxBool rv;
FxBool wantHwc;
GrLfbInfo_t info;
GR_BEGIN_NOFIFOCHECK_RET("grLfbReadRegion",82);
@@ -1531,7 +1568,61 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
}
rv=FXFALSE;
if (grLfbLock(GR_LFB_READ_ONLY,
/* We want to read using HWC if we using FSAA with 4 chips or want dithering */
/* or we are using forced 32 bit mode and want dithering */
wantHwc = (_GlideRoot.environment.useHwcAAforLfbRead & 1) &&
((gc->state.forced32BPP != 0 && _GlideRoot.environment.ditherHwcAA) ||
(gc->bInfo->h3pixelSample >= 2 && (gc->chipCount == 4 || _GlideRoot.environment.ditherHwcAA)));
/* We want to use the 'advanced' and slow capture method */
if (wantHwc)
{
FxU32 colBufferIndex = 0;
FxU32 bpp = 0;
if (gc->state.forced32BPP) bpp = gc->state.forced32BPP;
else switch(gc->grPixelFormat)
{
case GR_PIXFMT_ARGB_1555:
case GR_PIXFMT_AA_2_ARGB_1555:
case GR_PIXFMT_AA_4_ARGB_1555:
case GR_PIXFMT_AA_8_ARGB_1555: /* 8xaa */
bpp = 15;
break;
case GR_PIXFMT_ARGB_8888:
case GR_PIXFMT_AA_2_ARGB_8888:
case GR_PIXFMT_AA_4_ARGB_8888:
case GR_PIXFMT_AA_8_ARGB_8888: /* 8xaa */
bpp = 32;
break;
case GR_PIXFMT_RGB_565:
case GR_PIXFMT_AA_2_RGB_565:
case GR_PIXFMT_AA_4_RGB_565:
case GR_PIXFMT_AA_8_RGB_565: /* 8xaa */
default:
bpp = 16;
break;
}
switch(src_buffer)
{
case GR_BUFFER_FRONTBUFFER:
colBufferIndex = gc->frontBuffer;
break;
case GR_BUFFER_BACKBUFFER:
colBufferIndex = gc->backBuffer;
break;
}
hwcAAReadRegion(gc->bInfo, colBufferIndex, src_x, src_y,
src_width, src_height, dst_stride, dst_data,
bpp, _GlideRoot.environment.ditherHwcAA);
rv=FXTRUE;
goto done;
}
if (_grLfbLock(GR_LFB_READ_ONLY,
src_buffer,
GR_LFBWRITEMODE_ANY,
GR_ORIGIN_UPPER_LEFT,
@@ -1554,9 +1645,9 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
dst_adjust=dst_stride - tmp;
/* should be endian and pixel size safe */
/* it would be nice to test if quad blocks were faster */
/* like mmx loads and stores */
while(src_height--)
/* it would be nice to test if quad blocks were faster */
/* like mmx loads and stores */
if (!gc->state.forced32BPP) while(src_height--)
{
/* adjust starting alignment */
if (((FxU32)src)&3)
@@ -1582,9 +1673,57 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
((FxU8 *)src)+=src_adjust;
((FxU8 *)dst)+=dst_adjust;
}
/* Nice I've got to convert it from 32 bit to 16 bit */
else if (gc->state.forced32BPP == 16) while(src_height--) {
/* read in dwords of pixels */
if(length)
{
FxU32 byte_index=0;
FxU32 byte_index2=0;
/* copies aligned dwords */
do
{
FxU32 s =*((FxU32 *)(((FxU32)src) + byte_index));
FxU16 d = (FxU16) (s & 0xF8) >> 3;
d |= (s & 0xFC00) >> 5;
d |= (s & 0xF80000) >> 8;
*((FxU16 *)(((FxU32)dst) + (byte_index2))) = d;
byte_index +=4;
}while((byte_index2+=2)<(src_width*2));
}
/* adjust for next line */
((FxU8 *)src)+=info.strideInBytes;
((FxU8 *)dst)+=dst_stride;
}
else if (gc->state.forced32BPP == 15) while(src_height--) {
/* read in dwords of pixels */
if(length)
{
FxU32 byte_index=0;
FxU32 byte_index2=0;
/* copies aligned dwords */
do
{
FxU32 s =*((FxU32 *)(((FxU32)src) + byte_index));
FxU16 d = (FxU16) (s & 0xF8) >> 3;
d |= (s & 0xF800) >> 6;
d |= (s & 0xF80000) >> 9;
*((FxU16 *)(((FxU32)dst) + (byte_index2))) = d;
byte_index +=4;
}while((byte_index2+=2)<(src_width*2));
}
/* adjust for next line */
((FxU8 *)src)+=info.strideInBytes;
((FxU8 *)dst)+=dst_stride;
}
rv=FXTRUE;
/* unlock buffer */
grLfbUnlock(GR_LFB_READ_ONLY,src_buffer);
/* unlock buffer */
_grLfbUnlock(GR_LFB_READ_ONLY,src_buffer);
}
done:
GR_RETURN(rv);
@@ -1617,7 +1756,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
src_width, src_height, dst_stride, dst_data);
info.size = sizeof(info);
if (grLfbLock(GR_LFB_READ_ONLY,
if (_grLfbLock(GR_LFB_READ_ONLY,
src_buffer,
GR_LFBWRITEMODE_ANY,
GR_ORIGIN_UPPER_LEFT,
@@ -1729,7 +1868,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
}
}
#endif
grLfbUnlock(GR_LFB_READ_ONLY, src_buffer);
_grLfbUnlock(GR_LFB_READ_ONLY, src_buffer);
} else {
rv = FXFALSE;
}

View File

@@ -266,6 +266,8 @@ typedef FxU32 GrLock_t;
#define GR_LFB_IDLE 0x00
#define GR_LFB_NOIDLE 0x10
#define GR_LFB_WRITE_ONLY_EXPLICIT_EXT 0x02 // explicitly not allow reading from the lfb pointer
typedef FxI32 GrLfbBypassMode_t;
#define GR_LFBBYPASS_DISABLE 0x0
#define GR_LFBBYPASS_ENABLE 0x1

View File

@@ -42,8 +42,8 @@
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION MANVERSION, MANREVISION, MINVERSION, BUILD_NUMBER
PRODUCTVERSION MANVERSION, MANREVISION, MINVERSION, BUILD_NUMBER
FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
FILEFLAGSMASK 0x0030003FL
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
@@ -56,13 +56,22 @@ BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "3dfx Interactive, Inc.\0"
#ifdef BETA
VALUE "FileDescription", "*BETA* do NOT distribute without permission.\0"
VALUE "FileVersion", VERSIONSTR " BETA"
#else
VALUE "FileDescription", "3dfx Interactive, Inc. Glide\256 DLL\0"
VALUE "FileVersion", VERSIONSTR
#endif
VALUE "InternalName", VERSIONNAME
VALUE "LegalCopyright", "Copyright \251 3dfx Interactive, Inc. 2003\0"
VALUE "OriginalFilename", VERSIONNAME
VALUE "ProductName", PRODNAME
#ifdef BETA
VALUE "ProductVersion", VERSIONSTR " BETA"
#else
VALUE "ProductVersion", VERSIONSTR
#endif
VALUE "Graphics Subsystem", HWSTR
VALUE "Contact", CONTACTSTR
END

View File

@@ -1095,8 +1095,8 @@ _grSstDetectResources(void)
hwcInfo
*hInfo; /* Info about all the relavent boards */
int tmu;
char* envChipNum;
FxU32 chipCount = 1;
//char* envChipNum; /* unused */
//FxU32 chipCount = 1; /* unused */
if ((hInfo = hwcInit(0x121a, 0x9)) == NULL)
if ((hInfo = hwcInit(0x121a, 0x5)) == NULL) /* Voodoo3 */
@@ -1116,10 +1116,10 @@ _grSstDetectResources(void)
** KoolSmoky - chipCount should be after hwcInit(0x....) because
** it calls GETENV.
*/
envChipNum = GETENV("FX_GLIDE_NUM_CHIPS", GC.bInfo->RegPath);
/*envChipNum = GETENV("FX_GLIDE_NUM_CHIPS", GC.bInfo->RegPath);
if (envChipNum)
chipCount = atoi(envChipNum);
chipCount = atoi(envChipNum);*/ /* unused */
if (bInfo->pciInfo.deviceID == SST_DEVICE_ID_H3)
SST.type = GR_SSTTYPE_Banshee;
@@ -1876,15 +1876,15 @@ _GlideInitEnvironment(int which)
GDBG_INFO(80," snapshot: %d\n",_GlideRoot.environment.snapshot);
_GlideRoot.environment.guardbandclipping = GLIDE_GETENV("FX_GLIDE_GBC", GC.bInfo->RegPath, 1L);
GDBG_INFO(80," guardbandclipping: %d\n",_GlideRoot.environment.guardbandclipping);
/* KoolSmoky - enable 2ppc only in certain condition. -1=disable 1=enable 0=glide desides. enabled for now */
_GlideRoot.environment.do2ppc = GLIDE_GETENV("FX_GLIDE_2PPC", GC.bInfo->RegPath, 1L);
/* KoolSmoky - enable 2ppc only in certain condition. -1=disable 1=enable 0=glide desides. disabled for now */
_GlideRoot.environment.do2ppc = GLIDE_GETENV("FX_GLIDE_2PPC", GC.bInfo->RegPath, 0L);
GDBG_INFO(80," do2ppc : %d\n",_GlideRoot.environment.do2ppc);
_GlideRoot.environment.band2ppc = GLIDE_GETENV("FX_GLIDE_2PPC_BAND", GC.bInfo->RegPath, 2L);
GDBG_INFO(80," band2ppc : %d\n",_GlideRoot.environment.band2ppc);
_GlideRoot.environment.sliBandHeight = GLIDE_GETENV("FX_GLIDE_SLI_BAND_HEIGHT", GC.bInfo->RegPath, 0L);
GDBG_INFO(80," sliBandHeight : %d\n",_GlideRoot.environment.sliBandHeight);
_GlideRoot.environment.aaClip = GLIDE_GETENV("FX_GLIDE_AA_CLIP", GC.bInfo->RegPath, 1L);
GDBG_INFO(80," aaClip : %d\n",_GlideRoot.environment.aaClip);
_GlideRoot.environment.aaClip = GLIDE_GETENV("FX_GLIDE_AA_CLIP", GC.bInfo->RegPath, 1L);
GDBG_INFO(80," aaClip : %d\n",_GlideRoot.environment.aaClip);
/* KoolSmoky - there is a possibility that grEnable(GR_OPENGL_MODE_EXT) is called once
* but grSstSelect is called multiple times, so we won't retreive the sliBandHeightForce

View File

@@ -1572,6 +1572,18 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
GDBG_INFO(80, "Setting hwnd to foreground.\n");
SetForegroundWindow((HWND)hWnd);
*/
/* Want Windowed Mode */
if (resolution == GR_RESOLUTION_NONE)
{
extern GrContext_t _grCreateWindowSurface(FxU32 hWnd,
GrColorFormat_t format,
GrOriginLocation_t origin,
GrPixelFormat_t pixelformat,
int nAuxBuffer);
return _grCreateWindowSurface(hWnd, format, origin, pixelformat, nAuxBuffers);
}
#endif /* defined(__linux__) || defined(__DJGPP__) */
/* NB: TLS must be setup before the 'declaration' which grabs the
@@ -2011,17 +2023,14 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
{
switch (gc->grSstRez)
{
case GR_RESOLUTION_1600x1024:
gc->do2ppc = FXTRUE;
break ;
case GR_RESOLUTION_1600x1200:
break;
case GR_RESOLUTION_1792x1344:
case GR_RESOLUTION_1856x1392:
case GR_RESOLUTION_1920x1440:
case GR_RESOLUTION_2048x1536:
case GR_RESOLUTION_2048x2048:
gc->bInfo->h3analogSli = 1 ;
gc->do2ppc = FXTRUE;
break;
case GR_RESOLUTION_400x300:
case GR_RESOLUTION_320x200:
@@ -2043,8 +2052,6 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
switch (gc->grSstRez)
{
case GR_RESOLUTION_1600x1024:
gc->bInfo->h3analogSli = 1 ;
break ;
case GR_RESOLUTION_1600x1200:
case GR_RESOLUTION_1792x1344:
case GR_RESOLUTION_1856x1392:
@@ -2064,6 +2071,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
gc->chipCount = 1 ;
gc->grPixelSample = 1 ;
default:
gc->do2ppc = FXTRUE;
break;
}
}
@@ -3075,10 +3083,21 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
if (!gc)
return 0;
#if !defined(__linux__) && !defined(__DJGPP__)
/* We are in Windowed Mode */
if (gc->windowed)
{
extern void _grReleaseWindowSurface(GrContext_t ctx);
_grReleaseWindowSurface(context);
return FXTRUE;
}
#endif
/* If we are OpenGL, we need to release Exclusive mode so other
** OpenGL fullscreen apps can run. If not, we will cause a lot
** of problems.
*/
#if 0
if (_GlideRoot.environment.is_opengl == FXTRUE) {
/* KoolSmoky- don't release Exclusive mode if we're running
* in NT5.1. This may cause probems. but, ohwell.
@@ -3086,6 +3105,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
if( !gc->bInfo->osNT51 )
hwcRestoreVideo(gc->bInfo);
}
#endif
#ifndef __linux__
if (gc->lostContext) {

View File

@@ -732,10 +732,57 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
const FxU32
texelSize = _grBitsPerTexel[format],
texStrideBytes = memInfo->texStrideBytes;
FxU32 maxS;
FxU32 minS = 0, maxS = 0;
FxU32 texOffset = 0x00UL;
if (thisLod < largeLod) {
switch(format) {
case GR_TEXFMT_ARGB_CMP_FXT1:
minS = 0;
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD_FXT1(aspectRatio, thisLod);
else if (maxS < 8) maxS = 8;
break;
case GR_TEXFMT_ARGB_CMP_DXT1:
minS = 0;
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD_DXT(aspectRatio, thisLod);
else if (maxS < 8) maxS = 4;
break;
case GR_TEXFMT_ARGB_CMP_DXT2:
case GR_TEXFMT_ARGB_CMP_DXT3:
case GR_TEXFMT_ARGB_CMP_DXT4:
case GR_TEXFMT_ARGB_CMP_DXT5:
minS = 0;
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD_DXT(aspectRatio, thisLod);
else if (maxS < 8) maxS = 4;
break;
default:
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD(aspectRatio, thisLod);
// 32bit Align minS
if (texelSize == 8) minS &= 4;
else if (texelSize == 16) minS &= 2;
maxS -= minS;
// 32bit Align maxS, and add minS to offset
if (texelSize == 8)
{
if (maxS>4) maxS = (maxS+3)&4;
texOffset+=minS;
}
else if (texelSize == 16)
{
if (maxS>2) maxS = (maxS+1)&2;
texOffset+=minS*2;
}
else
{
texOffset+=minS*4;
}
break;
}
data = texOffset+(char*)data;
if (thisLod < largeLod) {
texOffset = _grTexCalcMipmapLevelOffsetTiled(tmu,
thisLod, largeLod,
aspectRatio,
@@ -748,22 +795,6 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
GR_CHECK_F(FN_NAME, texelSize == 0, "invalid texture format");
switch(format) {
case GR_TEXFMT_ARGB_CMP_FXT1:
maxS = WIDTH_BY_ASPECT_LOD_FXT1(aspectRatio, thisLod);
break;
case GR_TEXFMT_ARGB_CMP_DXT1:
case GR_TEXFMT_ARGB_CMP_DXT2:
case GR_TEXFMT_ARGB_CMP_DXT3:
case GR_TEXFMT_ARGB_CMP_DXT4:
case GR_TEXFMT_ARGB_CMP_DXT5:
maxS = WIDTH_BY_ASPECT_LOD_DXT(aspectRatio, thisLod);
break;
default:
maxS = WIDTH_BY_ASPECT_LOD(aspectRatio, thisLod);
break;
}
switch(texelSize) {
case 4: /* 4-bit textures */
{
@@ -880,7 +911,7 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
case 16: /* 16-bit textures */
{
const FxU16
*src16 = (const FxU16*)data;
*src16 = minS + (const FxU16*)data;
switch(maxS) {
case 1:
@@ -1158,7 +1189,9 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
* restriction.
* same for DXT1 ((4x4x1/2)x2) minimum level size is 16 bytes
*/
if((format < GR_TEXFMT_ARGB_CMP_DXT1) && (format != GR_TEXFMT_ARGB_CMP_FXT1)) {
if(format != GR_TEXFMT_ARGB_CMP_FXT1 && format != GR_TEXFMT_ARGB_CMP_DXT1 &&
format != GR_TEXFMT_ARGB_CMP_DXT2 && format != GR_TEXFMT_ARGB_CMP_DXT3 &&
format != GR_TEXFMT_ARGB_CMP_DXT4 && format != GR_TEXFMT_ARGB_CMP_DXT5 ) {
const FxU32
aspectIndex = ((aspectRatio < GR_ASPECT_LOG2_1x1)
? -aspectRatio

View File

@@ -78,16 +78,11 @@ FxU32 getThreadValueSLOW( void ) {
#elif 1
__GR_GET_TLSC_VALUE();
#else
/* __asm {
__asm mov esi, DWORD PTR fs:[WNT_TEB_PTR]
__asm add esi, DWORD PTR _GlideRoot.tlsOffset \
__asm mov eax, DWORD PTR [esi] \
}
*/
__asm {
__asm mov esi, DWORD PTR fs:[WNT_TEB_PTR];
__asm add esi, DWORD PTR _GlideRoot.tlsOffset;
__asm mov eax, DWORD PTR [esi];
mov esi, DWORD PTR fs:[WNT_TEB_PTR]
add esi, DWORD PTR _GlideRoot.tlsOffset
mov eax, DWORD PTR [esi]
}
#endif

View File

@@ -347,8 +347,10 @@ CFILES = $(CFILES) gsplash.c g3df.c gu.c gthread.c \
gpci.c diglide.c disst.c ditex.c gsfc.c\
gbanner.c gerror.c gaa.c gdraw.c gglide.c $(GLIDE3FILES) \
glfb.c gsst.c gtex.c gtexdl.c $(HWSPEC) cpuid.c
CPPFILES = $(CPPFILES) winsurf.cpp
OFILES = $(CFILES:.c=.obj)
OFILES = $(CFILES:.c=.obj) $(CPPFILES:.cpp=.obj)
OTHER_CFILES = fxgasm.c fxbldno.c fxinline.h

View File

@@ -23,14 +23,14 @@
#define MANVERSION 3
#define MANREVISION 10
#define MINVERSION 01
#define MINVERSION 00
#ifdef __WIN32__
#define BUILD_NUMBER 0001
#define BUILD_NUMBER 3001 /* hmm, must be at least 674 for the 3dfx OpenGL ICD to work correctly */
#endif
#define VERSIONSTR "3.10.01.0001"
#define CONTACTSTR "The Glide Open Source Project http://glide.sourceforge.net/\0"
#define VERSIONSTR "3.10.00.3001"
#define CONTACTSTR "The Glide Open Source Project http://glide.sourceforge.net/"
#if defined(__WIN32__)
#define _TRADEMARK_ "(tm)"

View File

@@ -0,0 +1,450 @@
//
// This sets up Windowed rendering
//
#include <math.h>
extern "C" {
// All this is C Linked
#include <3dfx.h>
#define FX_DLL_DEFINITION
#include <fxdll.h>
#include <glide.h>
#include "fxglide.h"
#include "fxcmd.h"
#include "gsfc.h"
};
/* Begin hacky stuff to enable windowed Glide rendering in Windows */
#include <ddraw.h>
static LPDIRECTDRAW lpDDraw1 = 0;
static LPDIRECTDRAW2 lpDDraw2 = 0;
static LPDIRECTDRAWSURFACE lpPrimSurf = 0;
static LPDIRECTDRAWSURFACE lpColSurf = 0;
static LPDIRECTDRAWSURFACE lpAuxSurf = 0;
static LPDIRECTDRAWSURFACE lpTexSurf0 = 0;
static LPDIRECTDRAWSURFACE lpTexSurf1 = 0;
static HWND thehWnd = 0;
static DWORD surfWidth = 0;
static DWORD surfHeight = 0;
static DWORD screenWidth = 0;
static DWORD screenHeight = 0;
static DWORD bpp = 0;
static BOOL useDDOverlay = FALSE;
static INT WindowPosX = 0;
static INT WindowPosY = 0;
extern "C" void doSplash( void );
extern "C" void _grReleaseWindowSurface(GrContext_t ctx);
#define OVERLAY_COLOUR 0x0D0E0F
/* This will create our DirectDraw surfaces and create the context */
extern "C" GrContext_t _grCreateWindowSurface(FxU32 hWnd,
GrColorFormat_t format,
GrOriginLocation_t origin,
GrPixelFormat_t pixelformat,
int nAuxBuffer)
{
/* Disable this for now */
// return 0;
/* Allocate a context */
GrContext_t ctx = grSurfaceCreateContext(GR_SURFACECONTEXT_WINDOWED);
GrGC *gc = (GrGC *)ctx;
thehWnd = (HWND) hWnd;
screenWidth = GetSystemMetrics(SM_CXSCREEN);
screenHeight = GetSystemMetrics(SM_CYSCREEN);
RECT clientRect;
GetClientRect(thehWnd, &clientRect);
surfWidth = clientRect.right - clientRect.left;
surfHeight = clientRect.bottom - clientRect.top;
switch(pixelformat)
{
case GR_PIXFMT_ARGB_8888:
case GR_PIXFMT_AA_2_ARGB_8888:
case GR_PIXFMT_AA_4_ARGB_8888:
case GR_PIXFMT_AA_8_ARGB_8888:
bpp = 32;
break;
default:
if (0 && _GlideRoot.environment.outputBpp == 32)
{
gc->state.forced32BPP = 16;
bpp = 32;
}
else
bpp = 16;
break;
}
bpp = 16;
/* Now, create DirectDraw */
if ( DirectDrawCreate( NULL, &lpDDraw1, NULL ) != DD_OK)
{
GDBG_INFO(80, "DDraw Obj Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
GDBG_INFO(80, "DDraw Obj created!\n");
/* Get us a DirectDraw2 interface */
if ( lpDDraw1->QueryInterface (IID_IDirectDraw2, (LPVOID*)&lpDDraw2 ) != DD_OK )
{
GDBG_INFO(80, "DDraw2 Obj Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
GDBG_INFO(80, "DDraw2 Obj created!\n");
/* Set the Coop level to normal */
lpDDraw2->SetCooperativeLevel((HWND) hWnd, DDSCL_NORMAL);
/* Now create us a Primary surface */
DDSURFACEDESC ddsd;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE|DDSCAPS_VIDEOMEMORY;
if (lpDDraw2->CreateSurface(&ddsd, &lpPrimSurf, NULL) != DD_OK)
{
GDBG_INFO(80, "Primary Surface Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
/* Now create us a Colour surface */
if (useDDOverlay) do
{
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY|DDSCAPS_VIDEOMEMORY;
ddsd.dwWidth = surfWidth;
ddsd.dwHeight = screenHeight;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
ddsd.ddpfPixelFormat.dwRGBBitCount = bpp;
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
ddsd.ddpfPixelFormat.dwRBitMask = 0xF800;
ddsd.ddpfPixelFormat.dwGBitMask = 0x07E0;
ddsd.ddpfPixelFormat.dwBBitMask = 0x001F;
if (lpDDraw2->CreateSurface(&ddsd, &lpColSurf, NULL) != DD_OK)
{
GDBG_INFO(80, "Overlay Colour Surface Create Failed!\n");
lpColSurf = 0;
break;
}
RECT rectOverlay = {0,0,surfWidth,surfHeight};
RECT rectClient;
DDOVERLAYFX ddofx;
POINT p = {0, 0};
GetClientRect(thehWnd, &rectClient);
ClientToScreen(thehWnd, &p);
rectClient.bottom += p.y;
rectClient.top = p.y;
rectClient.left = p.x;
rectClient.right += p.x;
WindowPosX = p.x;
WindowPosY = p.y;
memset(&ddofx, 0, sizeof(ddofx));
ddofx.dwSize = sizeof(ddofx);
ddofx.dckDestColorkey.dwColorSpaceLowValue = OVERLAY_COLOUR;
ddofx.dckDestColorkey.dwColorSpaceHighValue = OVERLAY_COLOUR;
HRESULT ddrval = lpColSurf->UpdateOverlay(&rectOverlay, lpPrimSurf,
&rectClient,
DDOVER_SHOW|DDOVER_DDFX | DDOVER_KEYDESTOVERRIDE,
&ddofx);
if(ddrval != DD_OK)
{
GDBG_INFO(80, "Unable to update overlay!\n");
lpColSurf->Release();
lpColSurf = 0;
break;
}
/* Now Fill Primary with the col */
DDBLTFX ddbfx;
memset(&ddbfx, 0, sizeof(ddbfx));
ddbfx.dwSize = sizeof(DDBLTFX);
ddbfx.dwFillColor = OVERLAY_COLOUR;
lpPrimSurf->Blt(&rectClient, NULL, &rectClient, DDBLT_COLORFILL|DDBLT_WAIT, &ddbfx);
//lpColSurf->Release();
//lpColSurf = 0;
}
while(0);
if (!lpColSurf)
{
useDDOverlay = FALSE;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM;
ddsd.dwWidth = surfWidth;
ddsd.dwHeight = screenHeight;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
ddsd.ddpfPixelFormat.dwRGBBitCount = bpp;
if (lpDDraw2->CreateSurface(&ddsd, &lpColSurf, NULL) != DD_OK)
{
GDBG_INFO(80, "Colour Surface Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
}
/* Now create us a Aux surface */
if (nAuxBuffer)
{
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM;
ddsd.dwWidth = surfWidth;
ddsd.dwHeight = screenHeight;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
ddsd.ddpfPixelFormat.dwRGBBitCount = bpp;
if (lpDDraw2->CreateSurface(&ddsd, &lpAuxSurf, NULL) != DD_OK)
{
GDBG_INFO(80, "Aux Surface Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
}
/* Now create us a Tex surface */
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM;
ddsd.dwWidth = 2048;
ddsd.dwHeight = 2048;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
if (lpDDraw2->CreateSurface(&ddsd, &lpTexSurf0, NULL) != DD_OK)
{
GDBG_INFO(80, "Tex Surface Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
if (gc->num_tmu == 2)
{
if (lpDDraw2->CreateSurface(&ddsd, &lpTexSurf1, NULL) != DD_OK)
{
GDBG_INFO(80, "Tex Surface Create Failed!\n");
_grReleaseWindowSurface(ctx);
return 0;
}
}
/* Select the Context */
grSelectContext(ctx);
/* Set the Render Buffer */
grSurfaceSetRenderingSurface((GrSurface_t*) lpColSurf, FXFALSE);
/* Set the Aux Buffer */
if (nAuxBuffer) grSurfaceSetAuxSurface((GrSurface_t*) lpAuxSurf);
/* Now create the texture buffer0 and 1 */
grSurfaceSetTextureSurface(GR_TMU0, (GrSurface_t*) lpTexSurf0);
if (gc->num_tmu == 2) grSurfaceSetTextureSurface(GR_TMU1, (GrSurface_t*) lpTexSurf1);
/* Set some 'crap' */
gc->grHwnd = hWnd;
gc->grColBuf = gc->state.num_buffers = 2;
gc->grAuxBuf = nAuxBuffer;
gc->grPixelFormat = (int) pixelformat;
gc->chipmask = SST_CHIP_MASK_ALL_CHIPS;
gc->state.color_format = format;
gc->sliCount = 1;
grSstOrigin(origin);
/* Clear the buffers */
grBufferClear( 0x0, 0, 0 );
return ctx;
}
/* This will blit/flip our surfaces */
extern "C" void _grFlipWindowSurface()
{
// Blit from col to prim
if (lpPrimSurf && lpColSurf)
{
POINT ptClient;
ptClient.x = 0;
ptClient.y = 0;
ClientToScreen(thehWnd, &ptClient);
if (!useDDOverlay)
{
RECT region;
region.bottom = min(surfHeight,screenHeight-ptClient.y);
region.right = min(surfWidth,screenWidth-ptClient.x);
region.top = 0;
region.left = 0;
if (ptClient.y < 0)
{
region.top = -ptClient.y;
ptClient.y = 0;
}
if (ptClient.x < 0)
{
region.left = -ptClient.x;
ptClient.x = 0;
}
if (region.bottom != region.top && region.left != region.right)
lpPrimSurf->BltFast(ptClient.x, ptClient.y, lpColSurf, &region, 0);
}
else
{
/* Need to update the overlay */
if (ptClient.x != WindowPosX || ptClient.y != WindowPosY)
{
WindowPosX = ptClient.x;
WindowPosY = ptClient.y;
RECT region;
RECT rectClient;
region.bottom = min(surfHeight,screenHeight-ptClient.y);
region.right = min(surfWidth,screenWidth-ptClient.x);
region.top = 0;
region.left = 0;
if (ptClient.y < 0)
{
region.top = -ptClient.y;
rectClient.top = 0;
}
else
{
rectClient.top = ptClient.y;
}
if (ptClient.x < 0)
{
region.left = -ptClient.x;
rectClient.left = 0;
}
else
{
rectClient.left = ptClient.x;
}
// Now we need to work out dest width and height
rectClient.right = (region.right-region.left)+rectClient.left;
rectClient.bottom = (region.bottom-region.top)+rectClient.top;
DDOVERLAYFX ddofx;
memset(&ddofx, 0, sizeof(ddofx));
ddofx.dwSize = sizeof(ddofx);
ddofx.dckDestColorkey.dwColorSpaceLowValue = OVERLAY_COLOUR;
ddofx.dckDestColorkey.dwColorSpaceHighValue = OVERLAY_COLOUR;
HRESULT ddrval = lpColSurf->UpdateOverlay(&region, lpPrimSurf,
&rectClient,
DDOVER_SHOW|DDOVER_DDFX|DDOVER_KEYDESTOVERRIDE,
&ddofx);
if(ddrval != DD_OK)
{
GDBG_INFO(80, "Unable to update overlay!\n");
lpColSurf->Release();
lpColSurf = 0;
}
else
{
/* Now Fill Primary with the col */
DDBLTFX ddbfx;
memset(&ddbfx, 0, sizeof(ddbfx));
ddbfx.dwSize = sizeof(DDBLTFX);
ddbfx.dwFillColor = OVERLAY_COLOUR;
lpPrimSurf->Blt(&rectClient, NULL, &rectClient, DDBLT_COLORFILL|DDBLT_WAIT, &ddbfx);
}
}
}
}
}
/* This will release the context, and release the surfaces, and destroy the DDRAW objects */
extern "C" void _grReleaseWindowSurface(GrContext_t ctx)
{
// Release Context
grSurfaceReleaseContext(ctx);
GDBG_INFO(80, "Released context!\n");
// Now release all the surfaces
if (lpTexSurf1)
{
lpTexSurf1->Release();
lpTexSurf1 = 0;
}
if (lpTexSurf0)
{
lpTexSurf0->Release();
lpTexSurf0 = 0;
}
if (lpAuxSurf)
{
lpAuxSurf->Release();
lpAuxSurf = 0;
}
if (lpColSurf)
{
lpColSurf->Release();
lpColSurf = 0;
}
if (lpPrimSurf)
{
lpPrimSurf->Release();
lpPrimSurf = 0;
}
GDBG_INFO(80, "All surfaces released\n");
// And the DirectDraw objects
if (lpDDraw2)
{
lpDDraw2->Release();
lpDDraw2 = NULL;
}
if (lpDDraw1)
{
lpDDraw1->Release();
lpDDraw1 = NULL;
}
GDBG_INFO(80, "Direct Draw released\n");
}

View File

@@ -3042,7 +3042,7 @@ $clip_setup_fog_oow:
add dataElem, 4 ; dataElem++
movss xmm3,[gc + depth_range] ;
pfmul xmm3,xmm0 ;
mulss xmm3,xmm0 ;
movss xmm4,[gc + depth_range] ; depth range
subss xmm4,xmm3 ;

View File

@@ -27,6 +27,9 @@
!if "$(DEBUG)" == "1"
VCDEFS = $(VCDEFS) -DGDBG_INFO_ON=1 -DGLIDE_DEBUG=1
!if "$(CEASE_ALL_GDBG)"=="1"
VCDEFS = $(VCDEFS) -DCEASE_ALL_GDBG=1
!endif
!endif
!if "$(FX_TARGET)" == "DOS"

View File

@@ -19,6 +19,7 @@
**
** $Header$
** $Log:
** 100 1.72.8 05/30/03 KoolSmoky fixed up asm routines
** 99 GlideXP 1.72.7 12/28/01 Ryan Nunn Removing stupid debug
** comments.
** 98 GlideXP 1.72.6 12/28/01 Ryan Nunn Improving faster WinXP
@@ -3237,6 +3238,13 @@ hwcGetSurfaceInfo(const hwcBoardInfo* bInfo,
ret->height = desc.dwHeight;
ret->width = desc.dwWidth;
ret->bitdepth = _hwcPixelFormatToBitDepth(&desc.ddpfPixelFormat);
GDBG_INFO(80, "h %d\n", desc.dwHeight);
GDBG_INFO(80, "w %d\n", desc.dwWidth);
GDBG_INFO(80, "f %X\n", desc.dwFlags);
GDBG_INFO(80, "p %X\n", desc.ddpfPixelFormat.dwFlags);
GDBG_INFO(80, "c %X\n", desc.ddsCaps.dwCaps);
retVal = (ret->bitdepth != 0x00UL);
if (!retVal) {
sprintf(errorString, "%s: Invalid surface pixel format (0x%X)\n",
@@ -3530,6 +3538,12 @@ hwcAllocWinFifo(hwcBoardInfo* bInfo,
goto __errSurfaceFifo;
}
GDBG_INFO(80, "ph %d\n", primaryDesc.dwHeight);
GDBG_INFO(80, "pw %d\n", primaryDesc.dwWidth);
GDBG_INFO(80, "pf %X\n", primaryDesc.dwFlags);
GDBG_INFO(80, "pp %X\n", primaryDesc.ddpfPixelFormat.dwFlags);
GDBG_INFO(80, "pc %X\n", primaryDesc.ddsCaps.dwCaps);
/* If the DirectDraw driver supports wide surfaces then we can
* specify what will align well w/ the underlying hw's page
* size. Otherwise we need to check the primary surface's
@@ -4774,10 +4788,14 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo *vidTiming,
if (NULL == GETENV("SSTH3_OVERLAYMODE", bInfo->RegPath))
{
/* We are in optimal mode by default */
if(bInfo->vidInfo.xRes < 1024)
vidProcCfg |= SST_OVERLAY_FILTER_2X2;
else
vidProcCfg |= SST_OVERLAY_FILTER_4X4;
if(bpp == 32 && !((bInfo->pciInfo.numChips == 4) && (bInfo->h3pixelSample >= 4))) { /* 32bpp and not 4x,8xfsaa on v56k */
vidProcCfg |= SST_OVERLAY_FILTER_POINT;
} else {
if(bInfo->vidInfo.xRes < 1024)
vidProcCfg |= SST_OVERLAY_FILTER_2X2;
else
vidProcCfg |= SST_OVERLAY_FILTER_4X4;
}
}
else
{
@@ -4785,10 +4803,14 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo *vidTiming,
{
default:
case 1: /* Optimal */
if(bInfo->vidInfo.xRes < 1024)
vidProcCfg |= SST_OVERLAY_FILTER_2X2;
else
vidProcCfg |= SST_OVERLAY_FILTER_4X4;
if(bpp == 32 && !((bInfo->pciInfo.numChips == 4) && (bInfo->h3pixelSample >= 4))) { /* 32bpp and not 4x,8xfsaa on v56k */
vidProcCfg |= SST_OVERLAY_FILTER_POINT;
} else {
if(bInfo->vidInfo.xRes < 1024)
vidProcCfg |= SST_OVERLAY_FILTER_2X2;
else
vidProcCfg |= SST_OVERLAY_FILTER_4X4;
}
break;
case 2: /* Normal */
vidProcCfg |= SST_OVERLAY_FILTER_4X4;
@@ -4864,13 +4886,13 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo *vidTiming,
/* Sorry, can only use 4x1 filter in this mode. */
if ( bInfo->h3nwaySli > 1 ) {
if( ((vidProcCfg & SST_OVERLAY_FILTER_BILINEAR) == SST_OVERLAY_FILTER_BILINEAR) ||
((vidProcCfg & SST_OVERLAY_FILTER_2X2) == SST_OVERLAY_FILTER_2X2) ) {
if(vidProcCfg & SST_OVERLAY_FILTER_MODE) {
vidProcCfg &= ~SST_OVERLAY_FILTER_MODE;
vidProcCfg |= SST_OVERLAY_FILTER_4X4;
}
}
#if 0 /* use optimal or let the user decide */
/* Disable video filter in 32-bit mode */
#if 1 /* looks better with filter when in 16bpp 2xfsaa */
if(bpp == 32 || bInfo->h3pixelSample > 2) {
@@ -4880,6 +4902,7 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo *vidTiming,
vidProcCfg &= ~SST_OVERLAY_FILTER_MODE;
vidProcCfg |= SST_OVERLAY_FILTER_POINT;
}
#endif
HWC_IO_STORE(bInfo->regInfo, vidProcCfg, vidProcCfg);
@@ -6499,7 +6522,9 @@ static void hwcReadRegion565(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
end_x = src_x + src_width;
end_y = src_y + src_height;
s = (FxU8 *)(src + src_x*2 + src_y*strideInBytes);
s = (FxU8 *)(src + src_x*4);
for (y = 0; y < src_y; y++) if((y & renderMask) == compareMask) s += strideInBytes;
stride_diff = strideInBytes - (src_width*2);
if (bInfo->CPUInfo.os_support & _CPU_FEATURE_MMX)
@@ -6515,6 +6540,8 @@ static void hwcReadRegion565(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
);
#else
__asm {
emms /* mmx */
/* mm7 = zero */
pXor mm7, mm7;
@@ -6535,10 +6562,11 @@ static void hwcReadRegion565(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
push 0x10401080; /* g=10000010 b=10000100 */
MovQ mm4, [esp]
Add esp, 8
}
#endif
for(y = 0; y < end_y; y++)
for(y = src_y; y < end_y; y++)
{
if((y & renderMask) == compareMask)
{
@@ -6551,10 +6579,10 @@ static void hwcReadRegion565(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
/* Scanline Setup */
Mov eax, s
Mov edx, dst
Mov edi, end_x
Mov edi, src_width
Shl edi, 3
Add edi, edx
Xor ebx, ebx
Xor ebx, ebx
align 8
@@ -6597,6 +6625,7 @@ static void hwcReadRegion565(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
add eax, stride_diff
mov s, eax
mov dst, edx
};
#endif
}
@@ -6604,20 +6633,25 @@ static void hwcReadRegion565(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
{
dst += src_width*4;
}
}
}
#ifndef __DJGPP__
__asm {
emms /* mmx */
}
#endif
/* Reset MMX State */
_m_empty();
}
else
{
/* Standard Unoptimized Loop */
for(y = 0; y < end_y; y++)
for(y = src_y; y < end_y; y++)
{
if((y & renderMask) == compareMask)
{
/* This chip owns this scanline. */
for(x = 0; x < end_x; x++) {
for(x = src_x; x < end_x; x++)
{
*dst++ += (FxU16) (((*(FxU16*) s) >> 00) & 0x1F) << 3;
*dst++ += (FxU16) (((*(FxU16*) s) >> 05) & 0x3F) << 2;
*dst++ += (FxU16) (((*(FxU16*) s) >> 11) & 0x1F) << 3;
@@ -6648,7 +6682,9 @@ static void hwcReadRegion1555(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
end_x = src_x + src_width;
end_y = src_y + src_height;
s = (FxU8 *)(src + src_x*2 + src_y*strideInBytes);
s = (FxU8 *)(src + src_x*4);
for (y = 0; y < src_y; y++) if((y & renderMask) == compareMask) s += strideInBytes;
stride_diff = strideInBytes - (src_width*2);
if (bInfo->CPUInfo.os_support & _CPU_FEATURE_MMX)
@@ -6664,6 +6700,8 @@ static void hwcReadRegion1555(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
);
#else
__asm {
emms /* mmx */
/* mm7 = zero */
pXor mm7, mm7;
@@ -6684,10 +6722,11 @@ static void hwcReadRegion1555(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
push 0x10801080; /* g=1000010000 b=1000010000 */
MovQ mm4, [esp]
Add esp, 8
}
#endif
for(y = 0; y < end_y; y++)
for(y = src_y; y < end_y; y++)
{
if((y & renderMask) == compareMask)
{
@@ -6700,7 +6739,7 @@ static void hwcReadRegion1555(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
/* Scanline Setup */
Mov eax, s
Mov edx, dst
Mov edi, end_x
Mov edi, src_width
Shl edi, 3
Add edi, edx
Xor ebx, ebx
@@ -6745,6 +6784,7 @@ static void hwcReadRegion1555(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
add eax, stride_diff
mov s, eax
mov dst, edx
};
#endif
}
@@ -6752,20 +6792,24 @@ static void hwcReadRegion1555(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
{
dst += src_width*4;
}
}
}
/* Reset MMX State */
_m_empty();
#ifndef __DJGPP__
__asm {
emms /* mmx */
}
#endif
}
else
{
/* Standard Unoptimized Loop */
for(y = 0; y < end_y; y++)
for(y = src_y; y < end_y; y++)
{
if((y & renderMask) == compareMask)
{
/* This chip owns this scanline. */
for(x = 0; x < end_x; x++) {
for(x = src_x; x < end_x; x++)
{
*dst++ += (FxU16) (((*(FxU16*) s) >> 00) & 0x1F) << 3;
*dst++ += (FxU16) (((*(FxU16*) s) >> 05) & 0x1F) << 3;
*dst++ += (FxU16) (((*(FxU16*) s) >> 10) & 0x1F) << 3;
@@ -6797,7 +6841,9 @@ static void hwcReadRegion8888(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
end_x = src_x + src_width;
end_y = src_y + src_height;
s = (FxU8 *)(src + src_x*4 + src_y*strideInBytes);
s = (FxU8 *)(src + src_x*4);
for (y = 0; y < src_y; y++) if((y & renderMask) == compareMask) s += strideInBytes;
stride_diff = strideInBytes - (src_width*4);
if (bInfo->CPUInfo.os_support & _CPU_FEATURE_MMX)
@@ -6806,10 +6852,14 @@ static void hwcReadRegion8888(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
#ifdef __DJGPP__
MMX_SETUP4();
#else
__asm pXor mm7, mm7;
__asm {
emms /* mmx */
pXor mm7, mm7
}
#endif
for(y = 0; y < end_y; y++)
for(y = src_y; y < end_y; y++)
{
if((y & renderMask) == compareMask)
{
@@ -6822,7 +6872,7 @@ static void hwcReadRegion8888(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
/* Scanline Setup */
Mov eax, s
Mov edx, dst
Mov edi, end_x
Mov edi, src_width
Shl edi, 3
Add edi, edx
@@ -6847,6 +6897,7 @@ static void hwcReadRegion8888(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
add eax, stride_diff
mov s, eax
mov dst, edx
};
#endif
}
@@ -6856,18 +6907,21 @@ static void hwcReadRegion8888(hwcBoardInfo *bInfo, FxU32 src, FxU32 src_x, FxU32
}
}
/* Reset MMX State */
_m_empty();
#ifndef __DJGPP__
__asm {
emms /* mmx */
}
#endif
}
else
{
/* Standard Unoptimized Loop */
for(y = 0; y < end_y; y++)
for(y = src_y; y < end_y; y++)
{
if((y & renderMask) == compareMask)
{
/* This chip owns this scanline. */
for(x = 0; x < end_x; x++)
for(x = src_x; x < end_x; x++)
{
*dst++ += (FxU16) ((*(FxU32*) s) >> 0) & 0xFF;
*dst++ += (FxU16) ((*(FxU32*) s) >> 8) & 0xFF;
@@ -6951,7 +7005,7 @@ FxU32 hwcAAReadRegion16(hwcBoardInfo *bInfo, FxU32 colBufNum,
* or 4 chip boards */
if ((bInfo->h3pixelSize == 2) ||
(bInfo->h3pixelSample == 2) ||
(numChips == 4)) {
(numChips == 4 && bInfo->h3pixelSample != 1)) {
/* Figure out framebuffer format (1555 or 565) */
HWC_IO_LOAD(bInfo->regInfo, vidProcCfg, vidProcCfg);
@@ -7135,6 +7189,8 @@ static void hwcCopyBuffer8888Flipped(hwcBoardInfo *bInfo, FxU16 *source, int w,
/* MMX Optimized Loop */
__asm
{
emms /* mmx */
Mov eax, src /* eax = source */
Mov edx, dst /* edx = dest */
Mov edi, endline /* edi = endline */
@@ -7181,9 +7237,9 @@ static void hwcCopyBuffer8888Flipped(hwcBoardInfo *bInfo, FxU16 *source, int w,
Sub eax, ebx /* src -= w*2; */
cmp edx, end /* if (dst!=end) */
jne loop_begin /* goto loop_begin; */
emms /* mmx */
/* Reset MMX State */
emms;
}
}
else
@@ -7217,6 +7273,8 @@ static void hwcCopyBuffer8888FlippedShifted(hwcBoardInfo *bInfo, FxU16 *source,
/* MMX Optimized Loop */
__asm
{
emms /* mmx */
Mov eax, src /* eax = source */
Mov edx, dst /* edx = dest */
Mov edi, endline /* edi = endline */
@@ -7265,9 +7323,9 @@ static void hwcCopyBuffer8888FlippedShifted(hwcBoardInfo *bInfo, FxU16 *source,
Sub eax, ebx /* src -= w*2; */
cmp edx, end /* if (dst!=end) */
jne loop_begin /* goto loop_begin; */
emms /* mmx */
/* Reset MMX State */
emms;
}
}
else
@@ -7312,6 +7370,8 @@ static void hwcCopyBuffer8888FlippedDithered(hwcBoardInfo *bInfo, FxU16 *source,
/* MMX Optimized Loop */
__asm
{
emms /* mmx */
/* mm7 = all ones */
Mov eax, 0xFFFFFFFF
MovD mm7, eax
@@ -7484,8 +7544,8 @@ static void hwcCopyBuffer8888FlippedDithered(hwcBoardInfo *bInfo, FxU16 *source,
jne mmx_loop_begin /* goto mmx_loop_begin; */
finished:
/* Reset MMX State */
emms;
emms /* mmx */
}
}
else
@@ -7569,10 +7629,7 @@ void hwcAAScreenShot(hwcBoardInfo *bInfo, FxU32 colBufNum, FxBool dither)
{
hwcCopyBuffer8888Flipped(bInfo, buffer, bInfo->vidInfo.xRes, bInfo->vidInfo.yRes, out, 0);
}
/* MMX Stuff */
_m_empty();
/* Write buffer to disk */
#ifdef _WIN32
GetLocalTime(&curtime);
@@ -7739,7 +7796,63 @@ static void hwcCopyBuffer565Shifted(hwcBoardInfo *bInfo, FxU16 *src, int w, int
gshift = 3 - aaShift;
rshift = 8 - aaShift;
while (dst<end)
if (bInfo->CPUInfo.os_support & _CPU_FEATURE_MMX)
{
/* MMX Optimized Loop */
__asm
{
emms /* mmx */
Mov eax, src /* eax = source */
Mov edx, dst /* edx = dest */
Mov edi, endline /* edi = endline */
/* mm6 = aaShift */
MovD mm6, aaShift
/* mm5 = mask */
push 0x0000F800; /* a r */
push 0xFC00F800; /* g b */
MovQ mm5, [esp]
Add esp, 8
align 8
loop_begin:
/* Read Pixel, Reduce to 32 bits */
MovQ mm0, mmword ptr [eax]
pSRLW mm0, mm6 /* AA Shift to 32 bit */
//pAnd mm0, mm5 /* 565 Mask */
PackUSWB mm0, mm0
MovD ebx, mm0
/* Convert to 565 */
Mov ecx, ebx
And ebx, 0x0000FCF8
And ecx, 0x00F80000
Shr bh, 2
Shr ecx, 8
Shr ebx, 3
Or ebx, ecx
/* Write */
Mov word ptr [edx], bx
/* Next Pixel */
Add eax, 8
Add edx, 2
cmp edx, edi /* if (dst!=endline) */
jne loop_begin /* goto loop_begin; */
/* Next Scanline */
Add edi, stride_dest/* endline += stride_dest; */
Add edx, stride_diff/* dest += stride_diff; */
cmp edx, end /* if (dst!=end) */
jne loop_begin /* goto loop_begin; */
emms /* mmx */
}
}
else while (dst<end)
{
while (dst<endline)
{
@@ -8041,7 +8154,7 @@ void hwcAAReadRegion(hwcBoardInfo *bInfo, FxU32 colBufNum,
{
hwcCopyBuffer1555(bInfo, buffer, src_width, src_height, dst_stride, dst_data, 0);
}
}
}
/* Free memory */
_aligned_free (buffer);
@@ -8052,7 +8165,7 @@ void hwcAAReadRegion(hwcBoardInfo *bInfo, FxU32 colBufNum,
#define BLUE_SHIFT 0
#define CLAMP(val, min, max) if (val > max) val = max; /*else if (val < min) val = min;*//* KoolSmoky */
#define CLAMP(val, min, max) if (val > max) val = max; else if (val < min) val = min
#define ADJUST(val, lowest, low, high, typ) if (high < lowest) val=(typ)(low); else val = (typ)(high)
#define GETFLOATENV(s, r, v) if (GETENV(s, r)) v = (FxFloat)(atof(GETENV(s, r)))
@@ -8159,11 +8272,15 @@ hwcGammaTable(hwcBoardInfo *bInfo, FxU32 nEntries, FxU32 *r, FxU32 *g, FxU32 *b)
GDBG_INFO(69,": gRamp[%d] = %d\n", i, gRamp[i]);
}
/* Colourless - Hack for V5 6000 4x and 8x FSAA*/
/* Colourless - Hack for V5 6000 4x and 8x FSAA */
/* KoolSmoky - Since the DAC is shared between 2 chips, the input to gamma look up
table is divided by extra 2 and the MSB is lost. To correct this the table should
be only 7 bits. The resulting image will have only 7.5 bits per prime */
if (bInfo->pciInfo.numChips == 4 && bInfo->h3pixelSample >= 4) {
/* Go through 0 to 127 */
for (i = 0; i < 128; i++) gRamp[i] = gRamp[(i*255)/127];
gRamp[0] = 0; /* KoolSmoky - if row 0 is not 0 on napalm, we get strange banding effects on exit to desktop */
/* Go through 1 to 127 */
for (i = 1; i < 128; i++) gRamp[i] = ((gRamp[(i*255)/127] >> 1) & 0x007F7F7F); /* KoolSmoky - dac output is doubled in 4x, 8xfsaa */
/* Go through 128 to 255 */
for (; i < 256; i++) gRamp[i] = gRamp[127];