summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/glide/fxwgl.c
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/fxwgl.c
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/fxwgl.c')
-rw-r--r--src/mesa/drivers/glide/fxwgl.c23
1 files changed, 23 insertions, 0 deletions
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;
}