Removed registry path from GETENV.

Removed FX_GLIDE_AA_PIXELCENTER, FX_GLIDE_AA_JITTERDISP, FX_GLIDE_AA_GRIDROTATION, and FX_GLIDE_FORCE_SST0.
Removed FX_GL_LFBLOCK_HACK and FX_GLIDE_USE_HWC_AA_FOR_LFB_READ.
Moved _grSstDetectResources into _GlideInitEnvironment so that it will not be called everytime _grGlideInit is called.
This commit is contained in:
koolsmoky
2004-04-28 17:40:52 +00:00
parent b965f50702
commit 2de9805027
9 changed files with 468 additions and 659 deletions

View File

@@ -360,29 +360,7 @@ GR_DIENTRY(grGlideInit, void, (void))
GDBG_INIT();
GDBG_INFO(80,"grGlideInit()\n");
/* dBorca - play safe */
grErrorSetCallback(_grErrorDefaultCallback);
/* KoolSmoky - let's detect glide devices *before* GETENV is called
** need to know where the devices are first if we want multimonitor
** capabilities.
*/
if ( !_grSstDetectResources() ) {
/* Hack alert:
* dBorca - Linux/DRI failed the above call, so bypass the next one
*/
#ifndef DRI_BUILD
#ifdef GLIDE_INIT_HWC
GrErrorCallback( hwcGetErrorString(), FXTRUE );
#endif
#endif
}
/* XXX [koolsmoky] if we have multiple sst devices, they will all
* use the same environment values. Win32 will use device0's registry.
*/
_GlideInitEnvironment(0); /* the main init code */
_GlideInitEnvironment(); /* the main init code */
FXUNUSED(*glideIdent);
#if GDBG_INFO_ON

View File

@@ -199,7 +199,10 @@ GR_DIENTRY(grSstSelect, void, ( int which ))
{
GR_DCL_GC;
if (gc) {
if (gc->windowed) return;
if (gc->windowed) {
_GlideRoot.current_sst = which; // ZZZ
return;
}
}
}
#endif

View File

@@ -2698,9 +2698,8 @@ GR_DIENTRY(grEnable, void , (GrEnableMode_t mode) )
/* EnableOpenGL - Win_Mode.c
** Allow minihwc to know about OpenGL
*/
/* KoolSmoky - the registry path should already be enumerated by now. */
void EnableOpenGL ( char *regpath );
EnableOpenGL( gc->bInfo->RegPath );
/*void EnableOpenGL ();
EnableOpenGL();*/
/* setup env to determine whether we are an OGL app */
_GlideRoot.environment.is_opengl=FXTRUE;
#endif
@@ -2764,7 +2763,7 @@ GR_DIENTRY(grDisable, void , (GrEnableMode_t mode) )
gc->tmuMemInfo[1].tramOffset = gc->tmuMemInfo[0].tramOffset + gc->tmuMemInfo[0].tramSize;
gc->tmuMemInfo[1].tramSize = (gc->bInfo->tramSize >> 1);
gc->tmu_state[1].total_mem = gc->tmuMemInfo[1].tramSize;
}
}
break;
case GR_COMBINEEXT_MODE:
gc->state.grEnableArgs.combine_ext_mode = GR_MODE_DISABLE;

View File

@@ -621,8 +621,6 @@ _grErrorCallback(const char* const procName,
const char* const format,
va_list args)
{
GR_DCL_GC;
static FxBool inProcP = FXFALSE;
if (!inProcP) {
@@ -633,7 +631,7 @@ _grErrorCallback(const char* const procName,
extern void (*GrErrorCallback)( const char *string, FxBool fatal );
vsprintf(errMsgBuf, format, args);
(*GrErrorCallback)(errMsgBuf, (GETENV("FX_ERROR_FAIL", gc->bInfo->RegPath) != NULL));
(*GrErrorCallback)(errMsgBuf, (GETENV("FX_ERROR_FAIL") != NULL));
}
inProcP = FXFALSE;
}

View File

@@ -240,7 +240,7 @@ main (int argc, char **argv)
OFFSET (gr,p6Fencer,"p6Fencer\t");
OFFSET (gr,current_sst,"current_sst\t");
OFFSET (gr,CPUType,"CPUType\t\t");
OFFSET (gr,tlsOffset,"tlsOffset\t\t");
OFFSET (gr,tlsOffset,"tlsOffset\t\t");
OFFSET (gr, pool.f255,"pool_f255");
OFFSET (gr, pool.f1,"pool_f1");
SIZEOF (gr.GCs[0].state,"GrState\t");

View File

@@ -600,11 +600,7 @@ const void *fxSplashPlug (FxU32* w, FxU32* h,
Code Macros
----------------------------------------------------------------------- */
#undef GETENV
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX) || defined(__DJGPP__)
#define GETENV(a, b) hwcGetenv(a)
#else
#define GETENV(a, b) hwcGetenvEx(a, b)
#endif
#define GETENV(a) hwcGetenv(a)
/* -----------------------------------------------------------------------
Internal Enumerated Types
@@ -2115,9 +2111,6 @@ struct _GlideRoot_s {
FxI32 fenceLimit;
FxBool texSubLodDither; /* always do subsample mipmap dithering */
FxBool aaClip; /* clean out AA garbage */
float aaPixelOffset; /* AA jitter pixel offset */
float aaJitterDisp; /* AA jitter dispersity */
double aaGridRotation; /* AA grid rotation */
FxBool forceAutoBump; /* force Auto bump? */
#if CHECK_SLAVE_SWAPCMD
@@ -2127,9 +2120,7 @@ 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 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 */
} environment;
GrHwConfiguration hwConfig;
@@ -2850,7 +2841,7 @@ void
_grDisplayStats(void);
void
_GlideInitEnvironment(int which);
_GlideInitEnvironment(void);
void FX_CSTYLE
_grColorCombineDelta0Mode(FxBool delta0Mode);

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.7.4.17 2003/10/14 15:04:07 dborca
** fixed minihwc; conditioned context checking; added Texus2 to Glide3
**
** Revision 1.7.4.16 2003/08/21 08:49:55 dborca
** Texture fixes by Koolsmoky
**
@@ -1571,26 +1574,16 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
GR_RETURN(FXFALSE);
}
#if !DRI_BUILD /* fix me! */
/* Read using HWC if we want dithering and using FSAA or 16 bpp mode */
wantHwc = ((_GlideRoot.environment.useHwcAAforLfbRead & 2) && /* using HWC and */
_GlideRoot.environment.ditherHwcAA && /* want dithering and */
((gc->bInfo->h3pixelSample > 1) || (gc->bInfo->h3pixelSize == 2))); /* using FSAA or 16 bit mode */
#endif
/* 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) && /* using forced 32 bpp mode or using HWC and */
(!_GlideRoot.environment.is_opengl || _GlideRoot.environment.oglLfbLockHack) && /* not OpenGL or using OpenGL lock hacks and */
(buffer == GR_BUFFER_FRONTBUFFER || buffer == GR_BUFFER_BACKBUFFER)) /* is front or back buffer */
{
if (gc->state.forced32BPP && /* using forced 32 bpp mode or using HWC and */
(buffer == GR_BUFFER_FRONTBUFFER || buffer == GR_BUFFER_BACKBUFFER)) /* is front or back buffer */
{
if (_GlideRoot.environment.is_opengl && type == GR_LFB_WRITE_ONLY && (gc->lockPtrs[GR_LFB_READ_ONLY] == (FxU32)buffer))
{
const FxU32 lockCount = gc->cmdTransportInfo.lfbLockCount;
{
GDBG_INFO_MORE(82,"OpenGL Locking forced 32bit->16bit hack(%d, %d)\n", _type, buffer);
/* check if the buffer exists */
if(!forced_32bpp_lock_buffer) GR_RETURN(FXFALSE);
@@ -1602,9 +1595,9 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
info->writeMode = GR_LFBWRITEMODE_565;
info->strideInBytes = gc->state.screen_width * 2;
info->origin = origin;
gc->cmdTransportInfo.lfbLockCount = lockCount + 1;
gc->cmdTransportInfo.lfbLockCount++;
GDBG_INFO_MORE(82,"OpenGL Locked forced hack (%d, %d)\n", _type, buffer);
GR_RETURN(FXFALSE);
@@ -1615,21 +1608,11 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
/* Force origin */
/* origin = GR_ORIGIN_UPPER_LEFT; */
/* Just play with the useHwcAAforLfbRead setting to tell the ReadRegion */
/* function what we want to do */
FxU32 old_useHwcAAforLfbRead = _GlideRoot.environment.useHwcAAforLfbRead;
if (wantHwc) _GlideRoot.environment.useHwcAAforLfbRead |= 1;
else _GlideRoot.environment.useHwcAAforLfbRead = 0;
GDBG_INFO_MORE(82,"Locking forced (%d, %d)\n", _type, buffer);
forced_32bpp_lock_buffer = malloc (gc->state.screen_width * gc->state.screen_height * 2);
rv = grLfbReadRegionOrigin(buffer, origin, 0, 0, gc->state.screen_width, gc->state.screen_height, gc->state.screen_width*2, forced_32bpp_lock_buffer);
/* Reset the useHwcAAforLfbRead setting */
_GlideRoot.environment.useHwcAAforLfbRead = old_useHwcAAforLfbRead;
/* Failed to read */
if (!rv)
{
@@ -1646,7 +1629,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t _type, GrBuffer_t buffer,
info->writeMode = GR_LFBWRITEMODE_565;
info->strideInBytes = gc->state.screen_width * 2;
info->origin = origin;
gc->cmdTransportInfo.lfbLockCount = lockCount + 1;
GDBG_INFO_MORE(82,"Locked forced (%d, %d)\n", _type, buffer);
@@ -1810,18 +1793,10 @@ GR_ENTRY(grLfbUnlock, FxBool, (GrLock_t _type, GrBuffer_t buffer))
buffer != GR_BUFFER_AUXBUFFER,
"Bad buffer");
#if !DRI_BUILD /* fix me! */
/* Read using HWC if we want dithering and using FSAA or 16 bpp mode */
wantHwc = ((_GlideRoot.environment.useHwcAAforLfbRead & 2) && /* using HWC and */
_GlideRoot.environment.ditherHwcAA && /* want dithering and */
((gc->bInfo->h3pixelSample > 1) || (gc->bInfo->h3pixelSize == 2))); /* using FSAA or 16 bit mode */
#endif
/* 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) &&
(!_GlideRoot.environment.is_opengl || _GlideRoot.environment.oglLfbLockHack) &&
if (gc->state.forced32BPP &&
(buffer == GR_BUFFER_FRONTBUFFER || buffer == GR_BUFFER_BACKBUFFER))
{
if (_GlideRoot.environment.is_opengl && type == GR_LFB_WRITE_ONLY && (gc->lockPtrs[GR_LFB_READ_ONLY] == (FxU32)buffer))
@@ -2235,61 +2210,6 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
info.size = sizeof(info);
rv=FXFALSE;
#if !DRI_BUILD /* fixme */
/* Read using HWC if we want dithering and using FSAA or 16 bpp mode */
wantHwc = ((_GlideRoot.environment.useHwcAAforLfbRead & 2) && /* using HWC and */
_GlideRoot.environment.ditherHwcAA && /* want dithering and */
((gc->bInfo->h3pixelSample > 1) || (gc->bInfo->h3pixelSize == 2))); /* using FSAA or 16 bit mode */
/* 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;
}
#endif
if (_grLfbLock(GR_LFB_READ_ONLY,
src_buffer,
GR_LFBWRITEMODE_ANY,

File diff suppressed because it is too large Load Diff

View File

@@ -1995,11 +1995,11 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
}
} else {
gc->sampleOffsetIndex = gc->grPixelSample-1 + ((gc->grSamplesPerChip == 1) ? 1 : 0);
if (!GETENV("FX_GLIDE_AA_SAMPLE", gc->bInfo->RegPath) && gc->sampleOffsetIndex)
if (!GETENV("FX_GLIDE_AA_SAMPLE") && gc->sampleOffsetIndex)
gc->sampleOffsetIndex+=3;
}
#else
if (!GETENV("FX_GLIDE_AA_SAMPLE", gc->bInfo->RegPath) && gc->sampleOffsetIndex)
if (!GETENV("FX_GLIDE_AA_SAMPLE") && gc->sampleOffsetIndex)
gc->sampleOffsetIndex+=3;
#endif
@@ -2428,7 +2428,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
GDBG_INFO(1, "autoBump: 0x%x\n", _GlideRoot.environment.autoBump);
/* The logic for this is hosed for PowerPC, where we disable auto-bump even
on PCI. */
if (gc->cmdTransportInfo.autoBump = _GlideRoot.environment.autoBump) {
if ((gc->cmdTransportInfo.autoBump = _GlideRoot.environment.autoBump)) {
if (!hwcInitFifo( bInfo, gc->cmdTransportInfo.autoBump)) {
hwcRestoreVideo(bInfo);
GrErrorCallback(hwcGetErrorString(), FXFALSE);