]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
disable hardware gamma if XF86VidModeGetGammaRampSize reports a size other than 256...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Jan 2006 13:34:01 +0000 (13:34 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Jan 2006 13:34:01 +0000 (13:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5927 d7cf8633-e32d-0410-b094-e92efae38249

vid_glx.c

index 8f477f3e5151e60fdc2882924858869d461bbed0..ebb7f49b8dfd79c26c05dae5a6d328817b02c627 100644 (file)
--- 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);
 }