From: havoc Date: Mon, 30 Jan 2006 13:34:01 +0000 (+0000) Subject: disable hardware gamma if XF86VidModeGetGammaRampSize reports a size other than 256... X-Git-Tag: xonotic-v0.1.0preview~4369 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=890d4c00928b263763b460cb6f5b6a828fd4afc7;p=xonotic%2Fdarkplaces.git disable hardware gamma if XF86VidModeGetGammaRampSize reports a size other than 256, for instance 1024 on Quadro git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5927 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_glx.c b/vid_glx.c index 8f477f3e..ebb7f49b 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -591,11 +591,23 @@ void VID_Finish (void) int VID_SetGamma(unsigned short *ramps) { + int rampsize; + // FIXME: it would be good to generate ramps of the size reported by X, + // for instance Quadro cards seem to use 1024 color ramps not 256 + if(!XF86VidModeGetGammaRampSize(vidx11_display, vidx11_screen, &rampsize)) + return 0; + if(rampsize != 256) + return 0; return XF86VidModeSetGammaRamp(vidx11_display, vidx11_screen, 256, ramps, ramps + 256, ramps + 512); } int VID_GetGamma(unsigned short *ramps) { + int rampsize; + if(!XF86VidModeGetGammaRampSize(vidx11_display, vidx11_screen, &rampsize)) + return 0; + if(rampsize != 256) + return 0; return XF86VidModeGetGammaRamp(vidx11_display, vidx11_screen, 256, ramps, ramps + 256, ramps + 512); }