]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
fix cl.completed_time math after that last commit
[xonotic/darkplaces.git] / vid_shared.c
index 0ffc36287966bdd97a2042747df1952459a21795..d5f9299675132e4a74ae4045fa471da5701c552c 100644 (file)
@@ -50,8 +50,6 @@ int gl_support_shading_language_100 = false;
 int gl_support_vertex_shader = false;
 // GL_ARB_fragment_shader
 int gl_support_fragment_shader = false;
-// GL_NV_half_float
-int gl_support_half_float = false;
 
 // LordHavoc: if window is hidden, don't update screen
 qboolean vid_hidden = true;
@@ -694,9 +692,6 @@ void VID_CheckExtensions(void)
                if ((gl_support_shading_language_100 = GL_CheckExtension("GL_ARB_shading_language_100", NULL, "-noshadinglanguage100", false)))
                        if ((gl_support_vertex_shader = GL_CheckExtension("GL_ARB_vertex_shader", vertexshaderfuncs, "-novertexshader", false)))
                                gl_support_fragment_shader = GL_CheckExtension("GL_ARB_fragment_shader", NULL, "-nofragmentshader", false);
-
-// COMMANDLINEOPTION: GL: -nohalffloat disables GL_NV_half_float extension
-       gl_support_half_float = GL_CheckExtension("GL_NV_half_float", NULL, "-nohalffloat", false);
 }
 
 void Force_CenterView_f (void)
@@ -748,7 +743,7 @@ void VID_UpdateGamma(qboolean force, int rampsize)
                                vid_gammarampsize = rampsize;
                                if (vid_gammaramps)
                                        Z_Free(vid_gammaramps);
-                               vid_gammaramps = Z_Malloc(6 * vid_gammarampsize * sizeof(unsigned short));
+                               vid_gammaramps = (unsigned short *)Z_Malloc(6 * vid_gammarampsize * sizeof(unsigned short));
                                vid_systemgammaramps = vid_gammaramps + 3 * vid_gammarampsize;
                        }
                        Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_GetGamma(vid_systemgammaramps, vid_gammarampsize));
@@ -773,15 +768,15 @@ void VID_UpdateGamma(qboolean force, int rampsize)
 
                if (cachecolorenable)
                {
-                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[0]), cachewhite[0], cacheblack[0], vid_gammaramps);
-                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[1]), cachewhite[1], cacheblack[1], vid_gammaramps + vid_gammarampsize);
-                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[2]), cachewhite[2], cacheblack[2], vid_gammaramps + vid_gammarampsize*2);
+                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[0]), cachewhite[0], cacheblack[0], vid_gammaramps, rampsize);
+                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[1]), cachewhite[1], cacheblack[1], vid_gammaramps + vid_gammarampsize, rampsize);
+                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[2]), cachewhite[2], cacheblack[2], vid_gammaramps + vid_gammarampsize*2, rampsize);
                }
                else
                {
-                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps);
-                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + vid_gammarampsize);
-                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + vid_gammarampsize*2);
+                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps, rampsize);
+                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + vid_gammarampsize, rampsize);
+                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + vid_gammarampsize*2, rampsize);
                }
 
                // LordHavoc: this code came from Ben Winslow and Zinx Verituse, I have
@@ -820,7 +815,7 @@ void VID_UpdateGamma(qboolean force, int rampsize)
 
                        for (x = 0, ramp = vid_gammaramps;x < 3;x++)
                                for (y = 0, t = n[x] - 0.75f;y < vid_gammarampsize;y++, t += 0.75f * (2.0f / vid_gammarampsize))
-                                       *ramp++ = cos(t*(M_PI*2.0)) * 32767.0f + 32767.0f;
+                                       *ramp++ = (unsigned short)(cos(t*(M_PI*2.0)) * 32767.0f + 32767.0f);
                }
 
                Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_SetGamma(vid_gammaramps, vid_gammarampsize));