int i;
const char *str;
- int sliaa, numSLI, samplesPerChip, tmuRam, fbRam;
+ int sliaa, numSLI, samplesPerChip;
struct SstCard_St *voodoo;
struct tdfx_glide *Glide;
GLuint redBits, greenBits, blueBits, alphaBits;
GrPixelFormat_t pixFmt;
- GLboolean useBGR;
-
if (TDFX_DEBUG & VERBOSE_DRIVER) {
fprintf(stderr, "fxMesaCreateContext(...)\n");
}
break;
/* XXX ugly hack here for sharing display lists */
case FXMESA_SHARE_CONTEXT:
- {
- const void *vPtr = &attribList[++i];
- GLcontext **ctx = (GLcontext **)vPtr;
- shareCtx = *ctx;
- }
+ shareCtx = (GLcontext *)attribList[++i];
break;
default:
fprintf(stderr, "fxMesaCreateContext: ERROR: wrong parameter (%d) passed\n", attribList[i]);
switch (voodoo->type) {
case GR_SSTTYPE_VOODOO:
case GR_SSTTYPE_Banshee:
- useBGR = GL_TRUE;
+ fxMesa->bgrOrder = GL_TRUE;
fxMesa->snapVertices = GL_TRUE;
break;
case GR_SSTTYPE_Voodoo2:
- useBGR = GL_TRUE;
+ fxMesa->bgrOrder = GL_TRUE;
fxMesa->snapVertices = GL_FALSE;
break;
case GR_SSTTYPE_Voodoo4:
}
case GR_SSTTYPE_Voodoo3:
default:
- useBGR = GL_FALSE;
+ fxMesa->bgrOrder = GL_FALSE;
fxMesa->snapVertices = GL_FALSE;
break;
}
goto errorhandler;
}
- /* Not that it matters, but tmuRam and fbRam change after grSstWinOpen. */
- tmuRam = voodoo->tmuConfig[GR_TMU0].tmuRam;
- fbRam = voodoo->fbRam;
- BEGIN_BOARD_LOCK();
- {
- FxI32 result;
- grGet(GR_MEMORY_TMU, 4, &result);
- tmuRam = result / (1024 * 1024);
- grGet(GR_MEMORY_FB, 4, &result);
- fbRam = result / (1024 * 1024);
- }
- END_BOARD_LOCK();
-
- sprintf(fxMesa->rendererString, "Mesa %s v0.60 %s %dMB FB, %dMB TM, %d TMU, %s",
- grGetString(GR_RENDERER),
- grGetString(GR_HARDWARE),
- fbRam,
- tmuRam * voodoo->nTexelfx,
- voodoo->nTexelfx,
- (voodoo->numChips > 1) ? "SLI" : "NOSLI");
-
- fxMesa->bgrOrder = useBGR;
-
/* screen */
fxMesa->screen_width = FX_grSstScreenWidth();
fxMesa->screen_height = FX_grSstScreenHeight();
fxMesa->clipMaxY = fxMesa->height;
if (fxMesa->verbose) {
- char buf[80];
-
- strcpy(buf, grGetString(GR_VERSION));
- fprintf(stderr, "Voodoo Using Glide %s\n", buf);
- fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst);
- fprintf(stderr, "Voodoo Number of TMUs: %d\n", voodoo->nTexelfx);
- fprintf(stderr, "Voodoo fbRam: %d\n", voodoo->fbRam);
- fprintf(stderr, "Voodoo fbiRev: %d\n", voodoo->fbiRev);
- fprintf(stderr, "Voodoo chips detected: %d\n", voodoo->numChips);
- fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n",
- useBGR ? "BGR" : "RGB",
- fxMesa->snapVertices);
- fprintf(stderr, "Voodoo screen: %dx%d:%d\n",
- fxMesa->screen_width, fxMesa->screen_height, colDepth);
+ FxI32 tmuRam, fbRam;
+
+ /* Not that it matters, but tmuRam and fbRam change after grSstWinOpen. */
+ tmuRam = voodoo->tmuConfig[GR_TMU0].tmuRam;
+ fbRam = voodoo->fbRam;
+ BEGIN_BOARD_LOCK();
+ grGet(GR_MEMORY_TMU, 4, &tmuRam);
+ grGet(GR_MEMORY_FB, 4, &fbRam);
+ END_BOARD_LOCK();
+
+ fprintf(stderr, "Voodoo Using Glide %s\n", grGetString(GR_VERSION));
+ fprintf(stderr, "Voodoo Board: %d/%d, %s, %d GPU\n",
+ fxMesa->board + 1,
+ glbHWConfig.num_sst,
+ grGetString(GR_HARDWARE),
+ voodoo->numChips);
+ fprintf(stderr, "Voodoo Memory: FB = %ld, TM = %d x %ld\n",
+ fbRam,
+ voodoo->nTexelfx,
+ tmuRam);
+ fprintf(stderr, "Voodoo Screen: %dx%d:%d %s, %svertex snapping\n",
+ fxMesa->screen_width,
+ fxMesa->screen_height,
+ colDepth,
+ fxMesa->bgrOrder ? "BGR" : "RGB",
+ fxMesa->snapVertices ? "" : "no ");
}
+ sprintf(fxMesa->rendererString, "Mesa %s v0.60 %s",
+ grGetString(GR_RENDERER),
+ grGetString(GR_HARDWARE));
+
fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */
doubleBuffer,
GL_FALSE, /* stereo */
fxMesa->stats.swapBuffer = 1;
fprintf(stderr, "Textures Stats:\n");
- fprintf(stderr, " Free texture memory on TMU0: %d:\n",
+ fprintf(stderr, " Free texture memory on TMU0: %d\n",
fxMesa->freeTexMem[FX_TMU0]);
if (fxMesa->haveTwoTMUs)
- fprintf(stderr, " Free texture memory on TMU1: %d:\n",
+ fprintf(stderr, " Free texture memory on TMU1: %d\n",
fxMesa->freeTexMem[FX_TMU1]);
fprintf(stderr, " # request to TMM to upload a texture objects: %u\n",
fxMesa->stats.reqTexUpload);
grBufferSwap(fxMesaCurrentCtx->swapInterval);
+#if 0
/*
* Don't allow swap buffer commands to build up!
*/
in order to enable this option) */
/* usleep(10000); */
;
+#endif
fxMesaCurrentCtx->stats.swapBuffer++;
}
fxCloseHardware(void)
{
if (glbGlideInitialized) {
- if (fxMesaCurrentCtx && fxMesaCurrentCtx->verbose) {
+ if (getenv("MESA_FX_INFO")) {
GrSstPerfStats_t st;
FX_grSstPerfStats(&st);
grLfbWriteColorFormat(GR_COLORFORMAT_ABGR);
}
+ if (fxMesa->Glide.grSetNumPendingBuffers != NULL) {
+ fxMesa->Glide.grSetNumPendingBuffers(fxMesa->maxPendingSwapBuffers);
+ }
+
fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN);
/* [koolsmoky] */
{
}
/* core-level extensions */
+#if 0
+ /* not until texel fetchers are right */
+ _mesa_enable_extension(ctx, "GL_SGIS_generate_mipmaps");
+#endif
#if 1
_mesa_enable_extension(ctx, "GL_ARB_vertex_buffer_object");
#endif
_mesa_enable_extension(ctx, "GL_ARB_fragment_program");
_mesa_enable_extension(ctx, "GL_ARB_vertex_program");
#endif
-#if 0
- /* not until texel fetchers are right */
- _mesa_enable_extension(ctx, "GL_SGIS_generate_mipmaps");
-#endif
}
FxBool HaveTexUma; /* TEXUMA */
FxBool HaveTexus2; /* Texus 2 - FXT1 */
struct tdfx_glide Glide;
- char rendererString[100];
+ char rendererString[64];
};
/*
** glide extensions
*/
+void (FX_CALL *real_grSetNumPendingBuffers) (FxI32 NumPendingBuffers);
char * (FX_CALL *real_grGetRegistryOrEnvironmentStringExt) (char *theEntry);
void (FX_CALL *real_grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
void (FX_CALL *real_grChromaRangeModeExt) (GrChromakeyMode_t mode);
#undef FN_NAME
}
-void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers)
-{
-#define FN_NAME "grSetNumPendingBuffers"
- TRAP_LOG("%s(%ld)\n", FN_NAME, NumPendingBuffers);
- grSetNumPendingBuffers(NumPendingBuffers);
-#undef FN_NAME
-}
-
FxBool FX_CALL trap_grSelectContext (GrContext_t context)
{
#define FN_NAME "grSelectContext"
/*
** glide extensions
*/
+void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers)
+{
+#define FN_NAME "grSetNumPendingBuffers"
+ TRAP_LOG("%s(%ld)\n", FN_NAME, NumPendingBuffers);
+ assert(real_grSetNumPendingBuffers);
+ (*real_grSetNumPendingBuffers)(NumPendingBuffers);
+#undef FN_NAME
+}
+
char *FX_CALL trap_grGetRegistryOrEnvironmentStringExt (char *theEntry)
{
#define FN_NAME "grGetRegistryOrEnvironmentStringExt"
#if DEBUG_TRAP
#define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name
#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (real_##name == NULL) real_##name = fake_##name
+#define GET_EXT_NULL(name) GET_EXT_ADDR(name); if (real_##name == NULL) Glide->name = NULL
#else /* DEBUG_TRAP */
#define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name)
#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (Glide->name == NULL) Glide->name = fake_##name
+#define GET_EXT_NULL(name) GET_EXT_ADDR(name)
#endif /* DEBUG_TRAP */
/*
** glide extensions
*/
+ GET_EXT_NULL(grSetNumPendingBuffers);
GET_EXT_FAKE(grGetRegistryOrEnvironmentStringExt);
GET_EXT_ADDR(grGetGammaTableExt);
GET_EXT_ADDR(grChromaRangeModeExt);
/*
** texus
*/
- GET_EXT_ADDR(txImgQuantize);
- GET_EXT_ADDR(txMipQuantize);
- GET_EXT_ADDR(txPalToNcc);
+ GET_EXT_NULL(txImgQuantize);
+ GET_EXT_NULL(txMipQuantize);
+ GET_EXT_NULL(txPalToNcc);
#undef GET_EXT_ADDR
}
void FX_CALL trap_grFlush (void);
GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
FxBool FX_CALL trap_grSstWinClose (GrContext_t context);
-void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers);
FxBool FX_CALL trap_grSelectContext (GrContext_t context);
void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin);
void FX_CALL trap_grSstSelect (int which_sst);
#define grFlush trap_grFlush
#define grSstWinOpen trap_grSstWinOpen
#define grSstWinClose trap_grSstWinClose
-#define grSetNumPendingBuffers trap_grSetNumPendingBuffers
#define grSelectContext trap_grSelectContext
#define grSstOrigin trap_grSstOrigin
#define grSstSelect trap_grSstSelect
/*
** glide extensions
*/
+ void (FX_CALL *grSetNumPendingBuffers) (FxI32 NumPendingBuffers);
char * (FX_CALL *grGetRegistryOrEnvironmentStringExt) (char *theEntry);
void (FX_CALL *grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
void (FX_CALL *grChromaRangeModeExt) (GrChromakeyMode_t mode);
chunk = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT;
if (fxMesa->verbose) {
- fprintf(stderr, "Voodoo %s configuration:\n",
- (tmu == FX_TMU0) ? "TMU0" : "TMU1");
- fprintf(stderr, "Voodoo Lower texture memory address (%u)\n",
- (unsigned int) start);
- fprintf(stderr, "Voodoo Higher texture memory address (%u)\n",
- (unsigned int) end);
- fprintf(stderr, "Voodoo Splitting Texture memory in %luMB blocks:\n", chunk >> 20);
+ fprintf(stderr, "Voodoo TMU%d configuration:\n", tmu);
}
fxMesa->freeTexMem[tmu] = end - start;
blockend = blockstart + chunk;
if (fxMesa->verbose)
- fprintf(stderr, "Voodoo %07u-%07u\n",
+ fprintf(stderr, "Voodoo %08u-%08u\n",
(unsigned int) blockstart, (unsigned int) blockend);
tmn = fxTMNewRangeNode(fxMesa, blockstart, blockend);
{
char *env;
/* always log when debugging, or if user demands */
-#if !FX_DEBUG
- if ((env = getenv("MESA_FX_INFO")) && env[0] == 'r')
-#endif
+ if (TDFX_DEBUG || ((env = getenv("MESA_FX_INFO")) && env[0] == 'r'))
freopen("MESA.LOG", "w", stderr);
}
int i, best = -1, qt_valid_pix;
PIXELFORMATDESCRIPTOR pfd = *ppfd;
-#if 0
- FILE *pix_file;
- pix_file = fopen("pix_log.txt", "a");
- if (pix_file) {
- fprintf(pix_file, "wglChoosePixelFormat\n");
- fprintf(pix_file, "nSize = %d\n",pfd.nSize);
- fprintf(pix_file, "nVersion = %d\n",pfd.nVersion);
- fprintf(pix_file, "dwFlags = %d\n",pfd.dwFlags);
- fprintf(pix_file, "iPixelType = %d\n",pfd.iPixelType);
- fprintf(pix_file, "cColorBits = %d\n",pfd.cColorBits);
- fprintf(pix_file, "cRedBits = %d\n",pfd.cRedBits);
- fprintf(pix_file, "cRedShift = %d\n",pfd.cRedShift);
- fprintf(pix_file, "cGreenBits = %d\n",pfd.cGreenBits);
- fprintf(pix_file, "cGreenShift = %d\n",pfd.cGreenShift);
- fprintf(pix_file, "cBlueBits = %d\n",pfd.cBlueBits);
- fprintf(pix_file, "cBlueShift = %d\n",pfd.cBlueShift);
- fprintf(pix_file, "cAlphaBits = %d\n",pfd.cAlphaBits);
- fprintf(pix_file, "cAlphaShift = %d\n",pfd.cAlphaShift);
- fprintf(pix_file, "cAccumBits = %d\n",pfd.cAccumBits);
- fprintf(pix_file, "cAccumRedBits = %d\n",pfd.cAccumRedBits);
- fprintf(pix_file, "cAccumGreenBits = %d\n",pfd.cAccumGreenBits);
- fprintf(pix_file, "cAccumBlueBits = %d\n",pfd.cAccumBlueBits);
- fprintf(pix_file, "cAccumAlphaBits = %d\n",pfd.cAccumAlphaBits);
- fprintf(pix_file, "cDepthBits = %d\n",pfd.cDepthBits);
- fprintf(pix_file, "cStencilBits = %d\n",pfd.cStencilBits);
- fprintf(pix_file, "cAuxBuffers = %d\n",pfd.cAuxBuffers);
- fprintf(pix_file, "iLayerType = %d\n",pfd.iLayerType);
- fprintf(pix_file, "bReserved = %d\n",pfd.bReserved);
- fprintf(pix_file, "dwLayerMask = %d\n",pfd.dwLayerMask);
- fprintf(pix_file, "dwVisibleMask = %d\n",pfd.dwVisibleMask);
- fprintf(pix_file, "dwDamageMask = %d\n",pfd.dwDamageMask);
- fclose(pix_file);
- }
-#endif
-
qt_valid_pix = pfd_tablen();
#if 1 || QUAKE2 || GORE
/* QUAKE2: 24+32 */
/* GORE : 24+16 */
- if (pfd.cColorBits == 24) {
+ if ((pfd.cColorBits == 24) || (pfd.cColorBits == 32)) {
/* the first 2 entries are 16bit */
pfd.cColorBits = (qt_valid_pix > 2) ? 32 : 16;
}
if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0)
continue; /* need alpha buffer */
-#if 0
- if ((pfd.cColorBits == 32) && (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0))
- continue; /* need stencil */
-#endif
+ if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0)
+ continue; /* need stencil buffer */
if (pfd.iPixelType == pix[i].pfd.iPixelType) {
best = i + 1;
}
if (best == -1) {
+ FILE *err = fopen("MESA.LOG", "w");
+ if (err != NULL) {
+ fprintf(err, "wglChoosePixelFormat failed\n");
+ fprintf(err, "\tnSize = %d\n", ppfd->nSize);
+ fprintf(err, "\tnVersion = %d\n", ppfd->nVersion);
+ fprintf(err, "\tdwFlags = %d\n", ppfd->dwFlags);
+ fprintf(err, "\tiPixelType = %d\n", ppfd->iPixelType);
+ fprintf(err, "\tcColorBits = %d\n", ppfd->cColorBits);
+ fprintf(err, "\tcRedBits = %d\n", ppfd->cRedBits);
+ fprintf(err, "\tcRedShift = %d\n", ppfd->cRedShift);
+ fprintf(err, "\tcGreenBits = %d\n", ppfd->cGreenBits);
+ fprintf(err, "\tcGreenShift = %d\n", ppfd->cGreenShift);
+ fprintf(err, "\tcBlueBits = %d\n", ppfd->cBlueBits);
+ fprintf(err, "\tcBlueShift = %d\n", ppfd->cBlueShift);
+ fprintf(err, "\tcAlphaBits = %d\n", ppfd->cAlphaBits);
+ fprintf(err, "\tcAlphaShift = %d\n", ppfd->cAlphaShift);
+ fprintf(err, "\tcAccumBits = %d\n", ppfd->cAccumBits);
+ fprintf(err, "\tcAccumRedBits = %d\n", ppfd->cAccumRedBits);
+ fprintf(err, "\tcAccumGreenBits = %d\n", ppfd->cAccumGreenBits);
+ fprintf(err, "\tcAccumBlueBits = %d\n", ppfd->cAccumBlueBits);
+ fprintf(err, "\tcAccumAlphaBits = %d\n", ppfd->cAccumAlphaBits);
+ fprintf(err, "\tcDepthBits = %d\n", ppfd->cDepthBits);
+ fprintf(err, "\tcStencilBits = %d\n", ppfd->cStencilBits);
+ fprintf(err, "\tcAuxBuffers = %d\n", ppfd->cAuxBuffers);
+ fprintf(err, "\tiLayerType = %d\n", ppfd->iLayerType);
+ fprintf(err, "\tbReserved = %d\n", ppfd->bReserved);
+ fprintf(err, "\tdwLayerMask = %d\n", ppfd->dwLayerMask);
+ fprintf(err, "\tdwVisibleMask = %d\n", ppfd->dwVisibleMask);
+ fprintf(err, "\tdwDamageMask = %d\n", ppfd->dwDamageMask);
+ fclose(err);
+ }
+
SetLastError(0);
return (0);
}