summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/glide
diff options
context:
space:
mode:
authorDaniel Borca <[email protected]>2003-12-19 11:26:46 +0000
committerDaniel Borca <[email protected]>2003-12-19 11:26:46 +0000
commite9e98405e720845f06f7a375585491e938f4dacd (patch)
treeae25ec98796f3456f2a5a17ce0a3d02d7838fd33 /src/mesa/drivers/glide
parenteee77bf82fda5b9f3cf34e96e7d0010bf18db748 (diff)
DMesa: removed MGA2064W driver
DMesa: added capability to query visuals fxMesa: WGL_3DFX_gamma_control fxMesa: minor fixes to interface (fxQueryHardware vs fxMesaSelect...)
Diffstat (limited to 'src/mesa/drivers/glide')
-rw-r--r--src/mesa/drivers/glide/fxapi.c68
-rw-r--r--src/mesa/drivers/glide/fxg.c3
-rw-r--r--src/mesa/drivers/glide/fxopengl.def1
-rw-r--r--src/mesa/drivers/glide/fxwgl.c23
4 files changed, 59 insertions, 36 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
index e928b156eb5..12b919b2e60 100644
--- a/src/mesa/drivers/glide/fxapi.c
+++ b/src/mesa/drivers/glide/fxapi.c
@@ -102,19 +102,46 @@ cleangraphics_handler(int s)
/*
+ * Query 3Dfx hardware presence/kind
+ */
+static GLboolean GLAPIENTRY fxQueryHardware (void)
+{
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxQueryHardware()\n");
+ }
+
+ if (!glbGlideInitialized) {
+ grGlideInit();
+ glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
+
+ glbGlideInitialized = 1;
+
+#if defined(__WIN32__)
+ _onexit((_onexit_t) cleangraphics);
+#elif defined(__linux__)
+ /* Only register handler if environment variable is not defined. */
+ if (!getenv("MESA_FX_NO_SIGNALS")) {
+ atexit(cleangraphics);
+ }
+#endif
+ }
+
+ return glb3DfxPresent;
+}
+
+
+/*
* Select the Voodoo board to use when creating
* a new context.
*/
-GLboolean GLAPIENTRY fxMesaSelectCurrentBoard (int n)
+GLint GLAPIENTRY fxMesaSelectCurrentBoard (int n)
{
fxQueryHardware();
if ((n < 0) || (n >= glbHWConfig.num_sst))
- return GL_FALSE;
-
- glbCurrentBoard = n;
+ return -1;
- return GL_TRUE;
+ return glbHWConfig.SSTs[glbCurrentBoard = n].type;
}
@@ -415,7 +442,7 @@ fxMesaCreateContext(GLuint win,
redBits = 5;
greenBits = 5;
blueBits = 5;
- alphaBits = 1;
+ alphaBits = depthSize ? 1 : 8;
switch(fxMesa->fsaa) {
case 8:
pixFmt = GR_PIXFMT_AA_8_ARGB_1555;
@@ -852,35 +879,6 @@ fxMesaSwapBuffers(void)
/*
- * Query 3Dfx hardware presence/kind
- */
-GLboolean GLAPIENTRY fxQueryHardware (void)
-{
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxQueryHardware()\n");
- }
-
- if (!glbGlideInitialized) {
- grGlideInit();
- glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
-
- glbGlideInitialized = 1;
-
-#if defined(__WIN32__)
- _onexit((_onexit_t) cleangraphics);
-#elif defined(__linux__)
- /* Only register handler if environment variable is not defined. */
- if (!getenv("MESA_FX_NO_SIGNALS")) {
- atexit(cleangraphics);
- }
-#endif
- }
-
- return glb3DfxPresent;
-}
-
-
-/*
* Shutdown Glide library
*/
void GLAPIENTRY
diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c
index 6a06ee1461c..7f75f1292c2 100644
--- a/src/mesa/drivers/glide/fxg.c
+++ b/src/mesa/drivers/glide/fxg.c
@@ -2212,6 +2212,7 @@ void FX_CALL fake_grTexDownloadTableExt (GrChipID_t tmu,
GrTexTable_t type,
void *data)
{
+ (void)tmu;
grTexDownloadTable(type, data);
}
@@ -2221,12 +2222,14 @@ void FX_CALL fake_grTexDownloadTablePartialExt (GrChipID_t tmu,
int start,
int end)
{
+ (void)tmu;
grTexDownloadTablePartial(type, data, start, end);
}
void FX_CALL fake_grTexNCCTableExt (GrChipID_t tmu,
GrNCCTable_t table)
{
+ (void)tmu;
grTexNCCTable(table);
}
diff --git a/src/mesa/drivers/glide/fxopengl.def b/src/mesa/drivers/glide/fxopengl.def
index 03ca66444ef..84614923bae 100644
--- a/src/mesa/drivers/glide/fxopengl.def
+++ b/src/mesa/drivers/glide/fxopengl.def
@@ -907,7 +907,6 @@ EXPORTS
;fxMesaSetNearFar
fxMesaSwapBuffers
fxMesaUpdateScreenSize
- fxQueryHardware
wglChoosePixelFormat
wglCopyContext
wglCreateContext
diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c
index 72a8c561b42..41960209e93 100644
--- a/src/mesa/drivers/glide/fxwgl.c
+++ b/src/mesa/drivers/glide/fxwgl.c
@@ -77,6 +77,7 @@ struct __pixelformat__
};
WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
+static GLushort gammaTable[3*256];
struct __pixelformat__ pix[] = {
/* 16bit RGB565 single buffer with depth */
@@ -426,12 +427,34 @@ wglGetSwapIntervalEXT (void)
GLAPI BOOL GLAPIENTRY
wglGetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
{
+ /* gammaTable should be per-context */
+ memcpy(arrays, gammaTable, 3*256*sizeof(GLushort));
return TRUE;
}
GLAPI BOOL GLAPIENTRY
wglSetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
{
+ GLint i, tableSize, inc, index;
+ GLushort *red, *green, *blue;
+ FxU32 gammaTableR[256], gammaTableG[256], gammaTableB[256];
+
+ /* gammaTable should be per-context */
+ memcpy(gammaTable, arrays, 3*256*sizeof(GLushort));
+
+ tableSize = FX_grGetInteger(GR_GAMMA_TABLE_ENTRIES);
+ inc = 256 / tableSize;
+ red = (GLushort *)arrays;
+ green = (GLushort *)arrays + 256;
+ blue = (GLushort *)arrays + 512;
+ for (i = 0, index = 0; i < tableSize; i++, index += inc) {
+ gammaTableR[i] = red[index] >> 8;
+ gammaTableG[i] = green[index] >> 8;
+ gammaTableB[i] = blue[index] >> 8;
+ }
+
+ grLoadGammaTable(tableSize, gammaTableR, gammaTableG, gammaTableB);
+
return TRUE;
}