From e9e98405e720845f06f7a375585491e938f4dacd Mon Sep 17 00:00:00 2001 From: Daniel Borca Date: Fri, 19 Dec 2003 11:26:46 +0000 Subject: DMesa: removed MGA2064W driver DMesa: added capability to query visuals fxMesa: WGL_3DFX_gamma_control fxMesa: minor fixes to interface (fxQueryHardware vs fxMesaSelect...) --- src/mesa/drivers/glide/fxwgl.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/mesa/drivers/glide/fxwgl.c') diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index 72a8c561b4..41960209e9 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; } -- cgit v1.2.3