added extensions; QUERY, POINTCAST, MULTIRENDERING

This commit is contained in:
koolsmoky
2007-06-23 09:22:41 +00:00
parent 6385e41d0e
commit d6004952bd
12 changed files with 598 additions and 131 deletions

View File

@@ -864,6 +864,11 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params))
#else
#define QUERY_EXT_STR ""
#endif
#ifdef MULTIRENDERING
#define MULTIRENDERING_STR "MULTIRENDERING "
#else
#define MULTIRENDERING_STR ""
#endif
#define BASE_EXT_STR "CHROMARANGE TEXCHROMA TEXMIRROR TEXUMA PALETTE6666 FOGCOORD SURFACE COMMAND_TRANSPORT TEXTUREBUFFER GETGAMMA GETREGISTRY ALPHAFOG "
#define NAPALM_EXT_STR "PIXEXT COMBINE TEXFMT "
@@ -885,7 +890,7 @@ GR_DIENTRY(grGetString, const char *, (FxU32 pname))
if (!IS_NAPALM(gc->bInfo->pciInfo.deviceID))
rv = " " BASE_EXT_STR QUERY_EXT_STR POINTCAST_EXT_STR;
else
rv = " " BASE_EXT_STR NAPALM_EXT_STR QUERY_EXT_STR POINTCAST_EXT_STR;
rv = " " BASE_EXT_STR NAPALM_EXT_STR QUERY_EXT_STR POINTCAST_EXT_STR MULTIRENDERING_STR;
}
break;
case GR_HARDWARE:
@@ -1125,8 +1130,8 @@ static GrExtensionTuple _extensionTable[] = {
{ "grSstQueryHardware", (GrProc)grSstQueryHardware },
#endif
/* POINTCAST */
{ "grTexDownloadTableExt", (GrProc)grTexDownloadTableExt },
#if GLIDE_POINTCAST_PALETTE
{ "grTexDownloadTableExt", (GrProc)grTexDownloadTableExt },
{ "grTexDownloadTablePartialExt", (GrProc)grTexDownloadTablePartialExt },
{ "grTexNCCTableExt", (GrProc)grTexNCCTableExt },
#endif
@@ -1135,7 +1140,8 @@ static GrExtensionTuple _extensionTable[] = {
{ "txImgQuantize", (GrProc)txImgQuantize },
{ "txPalToNcc", (GrProc)txPalToNcc },
#endif
{ "grSetNumPendingBuffers", (GrProc)grSetNumPendingBuffers},
{ "grTexDownloadMipMapLevelPartialRowExt", (GrProc)grTexDownloadMipMapLevelPartialRowExt },
{ "grSetNumPendingBuffers", (GrProc)grSetNumPendingBuffers },
{ 0, 0 }
};

View File

@@ -134,7 +134,7 @@
**
** NOTE: it is OK to call this routine before grGlideInit
*/
#ifndef GLIDE3_ALPHA
#if !defined(GLIDE3_ALPHA) || QUERY_EXTENSION_SUPPORTED
GR_DIENTRY(grSstQueryBoards, FxBool, ( GrHwConfiguration *hwc ))
{
GDBG_INIT();

View File

@@ -2699,6 +2699,19 @@ GR_DIENTRY(grEnable, void , (GrEnableMode_t mode) )
_GlideRoot.environment.sliBandHeightForce = FXTRUE;
}
break;
#endif
#ifdef MULTIRENDERING
case GR_MULTIRENDERING_EXT:
{
/* EnableMultiRendering - Win_Mode.c
** Allow minihwc to know about MultiRendering mode
*/
void EnableMultiRendering();
EnableMultiRendering();
/* disable splash screen */
_GlideRoot.environment.noSplash = FXTRUE;
}
break;
#endif
}

View File

@@ -2171,6 +2171,7 @@ GR_DIENTRY(grTexDownloadTablePartial, void,
gc->state.tex_table = type;
GR_END();
#undef FN_NAME
} /* grTexDownloadTablePartial */
/*---------------------------------------------------------------------------
@@ -2223,3 +2224,34 @@ GR_DIENTRY(grTexDownloadMipMapLevel, void,
GR_END();
} /* grTexDownloadMipmapLevel */
#if GLIDE_POINTCAST_PALETTE
GR_EXT_ENTRY(grTexDownloadTablePartialExt, void,
( GrChipID_t tmu, GrTexTable_t type,
void *data, int start, int end ))
{
#define FN_NAME "grTexDownloadTablePartialExt"
GR_BEGIN_NOFIFOCHECK(FN_NAME, 89);
GDBG_INFO_MORE(gc->myLevel, "(%d, %d, 0x%X, %d, %d)\n",tmu, type,data,start,end);
GR_CHECK_F(myName, type > GR_TEXTABLE_PALETTE, "invalid table specified");
GR_CHECK_F(myName, !data, "invalid data pointer");
/* What type of palette is this? */
if ((type == GR_TEXTABLE_PALETTE) || (type == GR_TEXTABLE_PALETTE_6666_EXT)){
_grTexDownloadPalette( tmu, type, (GuTexPalette *)data, start, end );
} else {
_grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end );
}
/* NB: Set the current palette type after we do the download because
* the palette download code may need to know that there is a table
* type change and do something hoopti.
*/
gc->state.tex_table = type;
GR_END();
#undef FN_NAME
} /* grTexDownloadTablePartialExt */
#endif

View File

@@ -2034,7 +2034,7 @@ struct _GlideRoot_s {
FxU32 tlsOffset;
int current_sst;
FxI32 windowsInit; /* Is the fullscreen part of glide initialized? */
FxI32 windowsInit[MAX_NUM_SST]; /* Is the fullscreen part of glide initialized? */
#if GL_X86
_p_info CPUType; /* CPUID */
@@ -3343,4 +3343,42 @@ GR_EXT_ENTRY(grTexDownloadTableExt,
void,
(GrChipID_t tmu, GrTexTable_t type, void *data));
#if QUERY_EXTENSION_SUPPORTED
FxBool FX_CALL
grSstQueryBoards( GrHwConfiguration *hwc );
FxBool FX_CALL
grSstQueryHardware( GrHwConfiguration *hwc );
#endif /* QUERY_EXTENSION_SUPPORTED */
#if GLIDE_POINTCAST_PALETTE
void FX_CALL
grTexNCCTableExt( GrChipID_t tmu, GrNCCTable_t table );
void FX_CALL
grTexDownloadTableExt( GrChipID_t tmu,
GrTexTable_t type,
void *data );
void FX_CALL
grTexDownloadTablePartialExt( GrChipID_t tmu,
GrTexTable_t type,
void *data,
int start,
int end );
#endif /* GLIDE_POINTCAST_PALETTE */
FxBool FX_CALL
grTexDownloadMipMapLevelPartialRowExt(GrChipID_t tmu,
FxU32 startAddress,
GrLOD_t thisLod,
GrLOD_t largeLod,
GrAspectRatio_t aspectRatio,
GrTextureFormat_t format,
FxU32 evenOdd,
void *data,
int row,
int min_s,
int max_s);
#endif /* __FXGLIDE_H__ */

View File

@@ -111,6 +111,7 @@ typedef FxU32 GrStencilOp_t;
#define GR_TEXTURE_UMA_EXT 0x06
#define GR_STENCIL_MODE_EXT 0x07
#define GR_OPENGL_MODE_EXT 0x08
#define GR_MULTIRENDERING_EXT 0x09
typedef FxU32 GrCCUColor_t;

View File

@@ -3280,7 +3280,7 @@ _grClipNormalizeAndGenerateRegValues(FxU32 minx, FxU32 miny, FxU32 maxx,
}
if(_GlideRoot.environment.aaClip == FXTRUE) {
if((gc->grPixelSample > 1) && (_GlideRoot.windowsInit == 1)) {
if((gc->grPixelSample > 1) && (_GlideRoot.windowsInit[_GlideRoot.current_sst] == 1)) {
if(minx == 0) minx = 1;
if(miny == 0) miny = 1;
}
@@ -3313,7 +3313,7 @@ _grClipNormalizeAndGenerateRegValues(FxU32 minx, FxU32 miny, FxU32 maxx,
if (maxx > gc->state.screen_width) maxx = gc->state.screen_width;
if (maxy > gc->state.screen_height) maxy = gc->state.screen_height;
}
GDBG_INFO(85,
"%s: normalized minx = %d, maxx = %d, miny = %d, maxy = %d\n",
FN_NAME, minx, maxx, miny, maxy);
@@ -4098,11 +4098,11 @@ GR_ENTRY(grGlideShutdown, void, (void))
grSstSelect(i);
grSstWinClose((GrContext_t)gc);
}
/* Force all fullscreen contexts to be closed */
_GlideRoot.windowsInit[i] = 0;
}
/* Force all fullscreen contexts to be closed */
_GlideRoot.windowsInit = 0;
/* If there are any surface contexts close them up now too */
{
for(i = 0; i < MAX_NUM_CONTEXTS; i++) {

View File

@@ -1202,13 +1202,9 @@ _grSstDetectResources(void)
/* KoolSmoky - UMA for the TMUs */
GC.state.grEnableArgs.texture_uma_mode = GR_MODE_DISABLE;
if( GETENV("FX_GLIDE_TEXTURE_UMA") ) {
if( atoi(GETENV("FX_GLIDE_TEXTURE_UMA")) == 1 ) {
if( GETENV("FX_GLIDE_TEXTURE_UMA") )
if( atoi(GETENV("FX_GLIDE_TEXTURE_UMA")) == 1 )
GC.state.grEnableArgs.texture_uma_mode = GR_MODE_ENABLE;
} else {
GC.state.grEnableArgs.texture_uma_mode = GR_MODE_DISABLE;
}
}
SST.sstBoard.SST96Config.fbRam = GC.fbuf_size;
SST.sstBoard.SST96Config.nTexelfx = GC.num_tmu;
@@ -1885,15 +1881,16 @@ _GlideInitEnvironment(void)
GDBG_INFO(80," sliBandHeightForce : %d\n",_GlideRoot.environment.sliBandHeightForce);
_GlideRoot.environment.swapPendingCount = GLIDE_GETENV("FX_GLIDE_SWAPPENDINGCOUNT", 3L);
if (_GlideRoot.environment.swapPendingCount > 3)
_GlideRoot.environment.swapPendingCount = 3;
/* The hardware counter is 3 bits. Anything above this will cause a hang. */
if (_GlideRoot.environment.swapPendingCount > 6)
_GlideRoot.environment.swapPendingCount = 6;
if (_GlideRoot.environment.swapPendingCount < 0)
_GlideRoot.environment.swapPendingCount = 0;
GDBG_INFO(80," swapPendingCount : %d\n",_GlideRoot.environment.swapPendingCount);
_GlideRoot.environment.gammaR = GLIDE_FGETENV("SSTH3_RGAMMA", 1.3f);
_GlideRoot.environment.gammaG = GLIDE_FGETENV("SSTH3_GGAMMA", 1.3f);
_GlideRoot.environment.gammaB = GLIDE_FGETENV("SSTH3_BGAMMA", 1.3f);
_GlideRoot.environment.gammaR = GLIDE_FGETENV("SSTH3_RGAMMA", 1.0f);
_GlideRoot.environment.gammaG = GLIDE_FGETENV("SSTH3_GGAMMA", 1.0f);
_GlideRoot.environment.gammaB = GLIDE_FGETENV("SSTH3_BGAMMA", 1.0f);
_GlideRoot.environment.useAppGamma = GLIDE_GETENV("FX_GLIDE_USE_APP_GAMMA", 1L);
@@ -1986,7 +1983,7 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
*/
/* attach a fullscreen gc to the TLS slot if in fullscreen mode. */
if(_GlideRoot.initialized && /* scanned for hw? */
(_GlideRoot.windowsInit > 0)) { /* outstanding fullscreen contexts? */
(_GlideRoot.windowsInit[_GlideRoot.current_sst] > 0)) { /* outstanding fullscreen contexts? */
GR_DCL_GC;
/* If there is no current gc in tls then set the current context. */

View File

@@ -1094,9 +1094,6 @@ doSplash( void )
if(_GlideRoot.environment.sliBandHeightForce)
return;
if (_GlideRoot.environment.noSplash != 0)
return;
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
if (gc->pluginInfo.moduleHandle == NULL)
gc->pluginInfo.moduleHandle = LoadLibrary("3dfxspl3.dll");
@@ -1112,7 +1109,8 @@ doSplash( void )
gc->pluginInfo.plugProc = (GrSplashPlugProc) GetProcAddress(gc->pluginInfo.moduleHandle,
"_fxSplashPlug@16");
didLoad = ((gc->pluginInfo.initProc != NULL) &&
didLoad = (!_GlideRoot.environment.noSplash &&
(gc->pluginInfo.initProc != NULL) &&
(gc->pluginInfo.splashProc != NULL) &&
(gc->pluginInfo.plugProc != NULL) &&
(gc->pluginInfo.shutdownProc != NULL));
@@ -1148,7 +1146,8 @@ doSplash( void )
gc->pluginInfo.splashProc = fxSplash;
gc->pluginInfo.plugProc = fxSplashPlug;
didLoad = ((gc->pluginInfo.initProc != NULL) &&
didLoad = (!_GlideRoot.environment.noSplash &&
(gc->pluginInfo.initProc != NULL) &&
(gc->pluginInfo.splashProc != NULL) &&
(gc->pluginInfo.plugProc != NULL) &&
(gc->pluginInfo.shutdownProc != NULL));
@@ -2383,16 +2382,10 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
*gc->lostContext = FXFALSE;
#endif /* GLIDE_CHECK_CONTEXT */
if (_GlideRoot.environment.gammaR != 1.3f &&
_GlideRoot.environment.gammaG != 1.3f &&
_GlideRoot.environment.gammaB != 1.3f) {
hwcGammaRGB(gc->bInfo,
_GlideRoot.environment.gammaR,
_GlideRoot.environment.gammaG,
_GlideRoot.environment.gammaB);
} else {
hwcGammaRGB(gc->bInfo, 1.3f, 1.3f, 1.3f);
}
hwcGammaRGB(gc->bInfo,
_GlideRoot.environment.gammaR,
_GlideRoot.environment.gammaG,
_GlideRoot.environment.gammaB);
/* Setup memory configuration */
gc->fbOffset = bInfo->fbOffset;
@@ -3078,12 +3071,12 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
doSplash();
gc->windowed = FXFALSE;
_GlideRoot.windowsInit++; /* to avoid race with grSstControl() */
_GlideRoot.windowsInit[_GlideRoot.current_sst]++; /* to avoid race with grSstControl() */
retVal = (GrContext_t)gc;
if(_GlideRoot.environment.aaClip == FXTRUE) {
if((gc->grPixelSample > 1) && (_GlideRoot.windowsInit == 1)) {
if((gc->grPixelSample > 1) && (_GlideRoot.windowsInit[_GlideRoot.current_sst] == 1)) {
grClipWindow(0, 0, gc->state.screen_width, gc->state.screen_height);
}
}
@@ -3134,7 +3127,26 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
GDBG_INFO(80, FN_NAME"(0x%X)\n", context);
if (!gc)
return 0;
return FXFALSE;
/* NB: The gc that is being closed is the passed gc not the
* currently selected gc. This must be setup before the
* 'declaration' which grabs the current gc in grFlush. In
* addition, it is possible for us to have 'missed' a thread attach
* if the current thread came into existance before glide was
* explicitly loaded by an application. In this case we have to set
* the tls gc explicitly otherwise other whacky-ness (read 'random
* crashes' will ensue).
*/
setThreadValue((unsigned long)gc);
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
/* free splashscreen DLL */
if (gc->pluginInfo.moduleHandle) {
FreeLibrary(gc->pluginInfo.moduleHandle);
memset(&gc->pluginInfo, 0, sizeof(gc->pluginInfo));
}
#endif
#if !(GLIDE_PLATFORM & GLIDE_OS_UNIX) && !(GLIDE_PLATFORM & GLIDE_OS_DOS32)
/* We are in Windowed Mode */
@@ -3159,79 +3171,47 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
}
#endif
#if GLIDE_CHECK_CONTEXT
if (gc->lostContext) {
if (*gc->lostContext) {
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
/* KoolSmoky - splashscreen DLL needs to be freed */
if (gc->pluginInfo.moduleHandle) {
FreeLibrary(gc->pluginInfo.moduleHandle);
gc->pluginInfo.moduleHandle = 0L;
}
#endif
return 0;
}
}
#endif /* GLIDE_CHECK_CONTEXT */
/* NB: The gc that is being closed is the passed gc not the
* currently selected gc. This must be setup before the
* 'declaration' which grabs the current gc in grFlush. In
* addition, it is possible for us to have 'missed' a thread attach
* if the current thread came into existance before glide was
* explicitly loaded by an application. In this case we have to set
* the tls gc explicitly otherwise other whacky-ness (read 'random
* crashes' will ensue).
*/
setThreadValue((unsigned long)gc);
if ((gc != NULL) && gc->open) grFlush();
/* Make sure that the user specified gc is not whacked */
if ((gc != NULL) &&
(gc >= _GlideRoot.GCs) &&
(gc <= _GlideRoot.GCs + MAX_NUM_SST)) {
if (gc->open) {
#if GLIDE_INIT_HAL
/* dpc - 22 may 1997 - FixMe!
* We need the equivilant stuff in the hal layer too.
*/
#else /* !GLIDE_INIT_HAL */
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
/* KoolSmoky - splashscreen DLL needs to be freed */
if (gc->pluginInfo.moduleHandle) {
FreeLibrary(gc->pluginInfo.moduleHandle);
gc->pluginInfo.moduleHandle = 0L;
}
#endif
/*--------------------------
3D Idle
--------------------------*/
GDBG_INFO(gc->myLevel, " 3D Idle\n");
/*--------------------------
Command Transport Disable
--------------------------*/
GDBG_INFO(gc->myLevel, " Command Transport Disable\n");
#if __POWERPC__ && PCI_BUMP_N_GRIND
restoreCacheSettings();
#endif
/* Video Restore
*
* NB: The hwcRestoreVideo in addition to restoring the video also
* turns off the command fifo and then releases the hw context
* which can unmap the board at the driver level. The next time
* we use grSstWinOpen we need to re-map the board etc just to be
* safe everywhere.
*/
GDBG_INFO(gc->myLevel, " Restore Video\n");
#if GLIDE_CHECK_CONTEXT
if (!*gc->lostContext)
#endif /* GLIDE_CHECK_CONTEXT */
#if !DRI_BUILD
if (gc->lostContext && !*gc->lostContext)
#endif
{
/* disable SLI and AA */
grFlush();
#if GLIDE_INIT_HAL
/* dpc - 22 may 1997 - FixMe!
* We need the equivilant stuff in the hal layer too.
*/
#else /* !GLIDE_INIT_HAL */
/*--------------------------
3D Idle
--------------------------*/
GDBG_INFO(gc->myLevel, " 3D Idle\n");
/*--------------------------
Command Transport Disable
--------------------------*/
GDBG_INFO(gc->myLevel, " Command Transport Disable\n");
#if __POWERPC__ && PCI_BUMP_N_GRIND
restoreCacheSettings();
#endif
/* Video Restore
*
* NB: The hwcRestoreVideo in addition to restoring the video also
* turns off the command fifo and then releases the hw context
* which can unmap the board at the driver level. The next time
* we use grSstWinOpen we need to re-map the board etc just to be
* safe everywhere.
*/
GDBG_INFO(gc->myLevel, " Restore Video\n");
#if !DRI_BUILD
/* disable SLI and AA */
#ifdef FX_GLIDE_NAPALM
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
_grChipMask( SST_CHIP_MASK_ALL_CHIPS );
@@ -3243,15 +3223,20 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
}
if (gc->sliCount > 1)
_grDisableSliCtrl();
/* Idle the 3D pipe. */
grFinish();
}
#endif
#endif
hwcRestoreVideo(gc->bInfo);
}
#endif /* !DRI_BUILD */
#endif /* !GLIDE_INIT_HAL */
}
#if (GLIDE_OS & GLIDE_OS_WIN32)
else {
hwcResetVideo(gc->bInfo);
}
#endif
/*--------------------------
GC Reset
@@ -3275,15 +3260,18 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
gc->grSstRefresh = GR_REFRESH_NONE;
}
_GlideRoot.windowsInit--;
_GlideRoot.windowsInit[_GlideRoot.current_sst]--;
#if (GLIDE_OS & GLIDE_OS_WIN32)
if (_GlideRoot.environment.is_opengl != FXTRUE) {
if ( hwcIsOSWin9x() ) {
hwcUnmapMemory9x ( gc->bInfo );
} else {
/* we are using hwcUnmapMemory9x for both win9x and winNT
** to unmap the selected board
*/
/*if ( hwcIsOSWin9x() ) {*/
hwcUnmapMemory9x( gc->bInfo );
/*} else {
hwcUnmapMemory();
}
}*/
}
#endif
@@ -3308,6 +3296,12 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
GR_DIENTRY(grSetNumPendingBuffers, void, (FxI32 NumPendingBuffers))
{
_GlideRoot.environment.swapPendingCount = NumPendingBuffers;
/* Play safe. The hardware counter is 3 bits. */
if (_GlideRoot.environment.swapPendingCount > 6)
_GlideRoot.environment.swapPendingCount = 6;
else if (_GlideRoot.environment.swapPendingCount < 0)
_GlideRoot.environment.swapPendingCount = 0;
}
/*-------------------------------------------------------------------

View File

@@ -2540,6 +2540,7 @@ GR_ENTRY(grTexMipMapMode, void,
--------------------------------------------------------------*/
tLod &= ~(SST_LODMIN | SST_LODMAX | SST_LOD_ODD);
texMode &= ~(SST_TLODDITHER | SST_TRILINEAR);
gc->state.per_tmu[tmu].texSubLodDither = FXFALSE;
/*--------------------------------------------------------------
Encode Mipmap Mode Bits
@@ -2565,10 +2566,15 @@ GR_ENTRY(grTexMipMapMode, void,
----------------------------------------------------------*/
tLod |= SST_TLOD_MINMAX_INT(gc->state.per_tmu[tmu].largeLod,
gc->state.per_tmu[tmu].smallLod);
if(_GlideRoot.environment.texSubLodDither) {
#ifdef FX_GLIDE_NAPALM
if(!(gc->sliCount == gc->chipCount && gc->grSamplesPerChip == 1) &&
_GlideRoot.environment.texSubLodDither) {
gc->state.per_tmu[tmu].texSubLodDither = FXTRUE;
/* disable lod dithering if we are doing performance trilinear */
texMode &= ~SST_TLODDITHER;
mmMode = GR_MIPMAP_NEAREST;
}
#endif
break;
default:
@@ -2734,6 +2740,57 @@ GR_ENTRY(grTexNCCTable, void,
#undef FN_NAME
} /* grTexNCCTable */
#if GLIDE_POINTCAST_PALETTE
GR_EXT_ENTRY(grTexNCCTableExt, void, (GrChipID_t tmu, GrNCCTable_t table))
{
#define FN_NAME "grTexNCCTableExt"
FxU32 texMode;
GR_BEGIN("grTexNCCTable",88,4*GLIDE_NUM_TMU, GLIDE_NUM_TMU);
GDBG_INFO_MORE(gc->myLevel,"\n");
GR_CHECK_F(myName, table > GR_TEXTABLE_PALETTE, "invalid ncc table specified");
/* Disable 2PPC mode */
#ifdef FX_GLIDE_NAPALM
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
_grTex2ppc(FXFALSE);
}
#endif
/* Update local state */
gc->state.per_tmu[tmu].nccTable = table;
/* Grab shadow texMode, update TexMode, update shadow/real register */
texMode = gc->state.tmuShadow[tmu].textureMode;
texMode &= ~(SST_TNCCSELECT);
if (table == GR_TEXTABLE_NCC1)
texMode |= SST_TNCCSELECT;
else
texMode &= ~(SST_TNCCSELECT);
gc->state.tmuShadow[tmu].textureMode = texMode;
/* Update real shadows and update hardware immediately if we can. */
{
SstRegs* tmuHw = SST_TMU(hw, tmu);
gc->state.shadow.tmuState[tmu].textureMode = texMode;
_grChipMask( SST_CHIP_MASK_ALL_CHIPS );
REG_GROUP_BEGIN((0x02 << tmu), textureMode, 1, 0x1);
{
REG_GROUP_SET(tmuHw, textureMode, gc->state.shadow.tmuState[tmu].textureMode);
}
REG_GROUP_END();
_grChipMask( gc->chipmask );
}
GR_END();
#undef FN_NAME
} /* grTexNCCTableExt */
#endif
/*-------------------------------------------------------------------
Function: grTexSource
Date: 6/2
@@ -3763,8 +3820,8 @@ void g3LodBiasPerChip(GrChipID_t tmu, FxU32 tLod)
GR_BEGIN_NOFIFOCHECK("g3LodBiasPerChip", 88);
if( /*(_GlideRoot.environment.texSubLodDither != 1) ||*//* we won't get here if 0 */
((gc->sliCount == gc->chipCount) && (gc->grSamplesPerChip == 1)) ||
(gc->windowed) ||
/*((gc->sliCount == gc->chipCount) && (gc->grSamplesPerChip == 1)) ||*//* check done in grTexMipMapMode */
/*(gc->windowed) ||*/
(gc->state.per_tmu[tmu].evenOdd != 3) ||
(gc->state.tmuShadow[tmu].textureMode & SST_TRILINEAR) )
return;

View File

@@ -323,7 +323,6 @@
#include "fxglide.h"
#include "fxcmd.h"
#define GLIDE_POINTCAST_PALETTE 1
/*---------------------------------------------------------------------------
** _grTexDownloadNccTableExt
@@ -680,8 +679,6 @@ GR_EXT_ENTRY(grTexDownloadTableExt,
GR_END();
} /* grTexDownloadTableExt */
#undef GLIDE_POINTCAST_PALETTE
/*---------------------------------------------------------------------------
** _grTexDownloadNccTable
**
@@ -1672,3 +1669,342 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
return FXTRUE;
#undef FN_NAME
} /* grTexDownloadMipmapLevelPartial */
/*-------------------------------------------------------------------
Function: grTexDownloadMipMapLevelPartialRowExt
-------------------------------------------------------------------*/
GR_EXT_ENTRY(grTexDownloadMipMapLevelPartialRowExt,
FxBool, (GrChipID_t tmu, FxU32 startAddress,
GrLOD_t thisLod, GrLOD_t largeLod,
GrAspectRatio_t aspectRatio,
GrTextureFormat_t format, FxU32 evenOdd,
void *data,
int t, int min_s, int max_s))
{
#define FN_NAME "grTexDownloadMipMapLevelPartialRowExt"
FxBool didcompress = FXFALSE;
int max_t = t;
GR_BEGIN_NOFIFOCHECK_RET(FN_NAME, 89);
GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d, %d,%d)\n",
tmu, startAddress,
thisLod, largeLod, aspectRatio,
format, evenOdd,
data,
t,
min_s, max_s);
// We increment this
max_s++;
/* Sanity checking */
{
GR_CHECK_TMU(FN_NAME, tmu);
GR_CHECK_F(FN_NAME,
(gc->windowed ? FXFALSE :
(startAddress + _grTexTextureMemRequired(thisLod, largeLod,
aspectRatio,
format, evenOdd,
FXTRUE)
> gc->tmu_state[tmu].total_mem)),
"insufficient texture ram at startAddress");
GR_CHECK_F(FN_NAME, startAddress & SST_TEXTURE_ALIGN_MASK,
"unaligned startAddress");
GR_CHECK_F(FN_NAME, _grBitsPerTexel[format] == 0,
"invalid texture format");
if (!IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
/*
* Sanity checks for Banshee and Voodoo3
*/
GR_CHECK_F(FN_NAME, thisLod > GR_LOD_LOG2_256,
"thisLod invalid");
GR_CHECK_F(FN_NAME, largeLod > GR_LOD_LOG2_256,
"largeLod invalid");
GR_CHECK_F(FN_NAME, (_grBitsPerTexel[format] == 4),
"this hardware doesn't support 4-bit textures");
GR_CHECK_F(FN_NAME, (_grBitsPerTexel[format] == 32),
"this hardware doesn't support 32-bit textures");
} else {
/*
* Sanity checks for Napalm
*/
GR_CHECK_F(FN_NAME, thisLod > GR_LOD_LOG2_2048,
"thisLod invalid");
GR_CHECK_F(FN_NAME, largeLod > GR_LOD_LOG2_2048,
"largeLod invalid");
}
GR_CHECK_F(FN_NAME, thisLod > largeLod,
"thisLod may not be larger than largeLod");
GR_CHECK_F(FN_NAME,
((aspectRatio > GR_ASPECT_LOG2_8x1) ||
(aspectRatio < GR_ASPECT_LOG2_1x8)),
"aspectRatio invalid");
GR_CHECK_F(FN_NAME, evenOdd > 0x3 || evenOdd == 0,
"evenOdd mask invalid");
GR_CHECK_F(FN_NAME, !data,
"invalid data pointer");
#ifdef FX_GLIDE_NAPALM
switch(format) {
case GR_TEXFMT_ARGB_CMP_FXT1:
case GR_TEXFMT_ARGB_CMP_DXT1:
GR_CHECK_F(FN_NAME, max_t >=
_grMipMapHostWHCmp4Bit[G3_ASPECT_TRANSLATE(aspectRatio)]
[thisLod][1], "invalid end row for fxt1, dxt1");
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:
GR_CHECK_F(FN_NAME, max_t >=
_grMipMapHostWHDXT[G3_ASPECT_TRANSLATE(aspectRatio)]
[thisLod][1], "invalid end row for dxt2,3,4,5");
break;
default:
GR_CHECK_F(FN_NAME, max_t >=
_grMipMapHostWH[G3_ASPECT_TRANSLATE(aspectRatio)][thisLod][1],
"invalid end row");
}
#else
GR_CHECK_F(FN_NAME, max_t >=
_grMipMapHostWH[G3_ASPECT_TRANSLATE(aspectRatio)][thisLod][1],
"invalid end row");
#endif /* FX_GLIDE_NAPALM */
#ifdef GLIDE_TEST_TEXTURE_ALIGNMENT
/* always check texture alignment */
INTERNAL_CHECK(FN_NAME, startAddress & SST_TEXTURE_ALIGN_MASK,
"unaligned startAddress", FXTRUE);
#endif
}
/* Skip this level entirely if not in odd/even mask */
if (!(evenOdd & (thisLod & 0x1
? GR_MIPMAPLEVELMASK_ODD : GR_MIPMAPLEVELMASK_EVEN)))
goto all_done;
{
struct GrTmuMemInfo*
memInfo = gc->tmuMemInfo + tmu;
/* Part1 of the texel cache coherency stuff for avenger. According
* to the docs, the 3d nopCmd should do this all, but it does not
* work as advertised. But wait, there's more after the download...
*
* Force a pixel flush which should force all of the
* texture downloads to flush from internal fifos etc.
*/
GR_TEX_FLUSH_PRE(memInfo);
if (memInfo->texTiled) {
_grTexDownloadMipMapLevelPartialTiled(tmu,
startAddress,
thisLod, largeLod, aspectRatio,
format,
evenOdd, data,
t, max_t);
} else {
FxU32
baseAddress;
/* Compute physical start address for the download. */
{
FxU32
texOffset = 0x00UL;
/* We need to do some magic to pack the small levels and have a
* properly aligned baseAddr. If the current level is not going
* to start on an alignment boundary when working backwards in
* the chain we need to offset it into the block so that it is
* addressable with an aligned baseAddr.
*/
{
GrLOD_t minLod = thisLod;
/*
* We can safely skip this part if we're in FXT1-land
* because the minimum level size is 16 bytes (8x4x1/2)
* which matches the alignment restriction.
*/
if (format != GR_TEXFMT_ARGB_CMP_FXT1 && format < GR_TEXFMT_ARGB_CMP_DXT1 ) {
const FxU32
aspectIndex = ((aspectRatio < GR_ASPECT_LOG2_1x1)
? -aspectRatio
: aspectRatio),
lodIndex = ((thisLod == GR_LOD_LOG2_256)
? GR_LOD_LOG2_256 : thisLod + 1),
formatMult = _grBitsPerTexel[format];
FxU32
levelSize = (_grMipMapHostSize[aspectIndex][lodIndex]
* formatMult)>>3; /* Cvt from bits to bytes */
GR_CHECK_F(FN_NAME, formatMult == 0, "invalid texture format");
if (levelSize < SST_TEXTURE_ALIGN) {
GrLOD_t
maxLod = lodIndex;
/* Find the smallest level that naturally starts on an
* alignment boundary. If this is larger than the current
* mipmap chain's large lod then this we have to compute the
* offset within this alignment unit.
*
* NB: This could be a table lookup, but I'm writing the
* obvious code right now so that there aren't any
* mystic #'s being pulled out of the recesses of my
* colon.
*/
while(maxLod < GR_LOD_LOG2_256) {
levelSize = (_grMipMapHostSize[aspectIndex][maxLod]
* formatMult);
if (levelSize >= SST_TEXTURE_ALIGN) break;
maxLod++;
texOffset += levelSize;
}
/* maxLod is the index of the smallest level of this aspect
* ratio that takes up at least a full alignment unit. We
* reset the small lod to this so that we can compute the
* offset for the 'large' levels in the mipmap chain.
*/
GR_ASSERT(maxLod != GR_LOD_LOG2_256);
minLod = maxLod - 1;
}
}
if (minLod < largeLod) {
texOffset += _grTexTextureMemRequired(minLod + 1, largeLod,
aspectRatio,
format,
evenOdd,
FXFALSE);
}
}
/* Compute physical start address for the download.
*
* NB: This is going directly to the 2d lfb space rather than
* through the texture port so we have to add in the actual hw
* offset that the texture 'surface' starts at.
*/
baseAddress = (memInfo->tramOffset +
startAddress +
texOffset);
}
/* Do the download */
{
const FxU32 bitsPerTexel = _grBitsPerTexel[format];
FxU32 width, formatSel, widthSel;
switch(format) {
case GR_TEXFMT_ARGB_CMP_FXT1:
width =_grMipMapHostWHCmp4Bit[G3_ASPECT_TRANSLATE(aspectRatio)][thisLod][0];
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:
width =_grMipMapHostWHDXT[G3_ASPECT_TRANSLATE(aspectRatio)][thisLod][0];
break;
default:
{
int real_width =_grMipMapHostWH[G3_ASPECT_TRANSLATE(aspectRatio)][thisLod][0];
width = max_s;
// 64 bit Align minS if possible
if (bitsPerTexel == 8) min_s &= 8;
else if (bitsPerTexel == 16) min_s &= 4;
else if (bitsPerTexel == 32) min_s &= 2;
// Get difference
width -= min_s;
// 64 bit Align width if possible
if (bitsPerTexel == 8 && width == 3) width = (width+3)&(~3);
else if (bitsPerTexel == 8 && width > 4) width = (width+7)&(~7);
else if (bitsPerTexel == 16 && width > 2) width = (width+3)&(~3);
else if (bitsPerTexel == 32 && width > 1) width = (width+1)&(~1);
// No width, no download
if (!width) goto all_done;
// Convert min_s into bytes
min_s = (min_s*bitsPerTexel)/8;
// Now the baseAddress
data = min_s+(char*)data;
baseAddress +=min_s;
// One 'minor' issue with this... the actual download functions will fail to
// properly select the position to start downloading from
// so we have to compensate
baseAddress += real_width * t * bitsPerTexel / 8;
t = 0;
max_t = 0;
}
}
widthSel = (width >> 1); // 0 = 1 pixel, 1 = 2 pixels, 2 = 4 pixels, 3 = 8 pixels, 4 = 16 pixels
/*
* Interpretations:
* formatSel: Chooses among 4, 8, 16, and 32-bit download procedures.
* We want formatSel == log2(bitsPerTexel >> 2).
* max_s: The width, measured in 32-bit units.
*/
switch(bitsPerTexel) {
case 4:
formatSel = 0;
max_s = width >> 3;
break;
case 8:
formatSel = 1;
max_s = width >> 2;
break;
case 16:
formatSel = 2;
max_s = width >> 1;
break;
case 32:
formatSel = 3;
max_s = width;
break;
default:
/* Undefined format, but let's try 16-bit dimensions just in case. */
formatSel = 2;
max_s = width >> 1;
}
if (max_s <= 0) max_s = 1;
if (widthSel > 3) widthSel = 4;
gc->stats.texBytes += (max_s-min_s) * (max_t - t + 1) * 4;
(*((*gc->archDispatchProcs.texDownloadProcs)[formatSel][widthSel]))
(gc, baseAddress, max_s, t, max_t, data);
}
}
/* If this is a small lod level in a texture replacing texels that
* are already loaded then it may be necessary to flush the old
* texels from memory before any other rendering operation using
* this texture is issued. Unconditionally flush these old texels
* just in case rather than being too clever.
*
* The reason that we need to flush here even though we're not
* going through the texture port is because it is perfectly
* legal to source once and download over and over again. (See
* chd for a funny SpecOps story).
*
* NB: The documented nop does not currently work on banshee which
* is why we do the ~texBaseAddr crap along w/ the 2d nop.
*/
GR_TEX_FLUSH_POST(memInfo);
}
all_done:
gc->stats.texDownloads++;
return FXTRUE;
#undef FN_NAME
} /* grTexDownloadMipMapLevelPartialRowExt */

View File

@@ -273,16 +273,9 @@ internal_trisetup(const char* FN_NAME,
{
#ifdef FAST_C_CLIP
AMG_GR_BEGIN_NOFIFOCHECK();
if (!validStateP) GR_FLUSH_STATE();
if (cullP) {
cullVal=_grTriCull(a,b,c);
if(cullVal <= 0) return cullVal;
}
#else /* !FAST_C_CLIP */
#else
GR_BEGIN_NOFIFOCHECK_RET(FN_NAME, 85);
#endif
GDBG_INFO_MORE(gc->myLevel,
"(0x%X, 0x%X, 0x%X)\n",
a, b, c);
@@ -297,7 +290,7 @@ internal_trisetup(const char* FN_NAME,
if (cullVal <= 0) return cullVal;
}
#endif /* !FAST_C_CLIP */
/* Validate parameter coordinates */
#if defined(GLIDE_SANITY_ASSERT)