]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Remove v_glslgamma cvar (now assumed to be 1) and corresponding code like R_DrawGamma.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 Apr 2018 05:09:08 +0000 (05:09 +0000)
committerRudolf Polzer <divVerent@gmail.com>
Sun, 15 Mar 2020 01:51:47 +0000 (21:51 -0400)
RENDERPATH_GL1* paths no longer support bloom.

Fix a bug in D3D9 renderpath where SHADERPERMUTATION_GAMMARAMPS would crash due to using the wrong variable for the texture unit.

Enable GL_ARB_texture_non_power_of_two on OSX again - the old OSX versions and corresponding hardware that had issues are long gone.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12381 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=477b95bb0bd3ee638ceefd2fc3251a43ff4212d0

cl_screen.c
draw.h
gl_draw.c
gl_rmain.c
vid_shared.c

index e59c6ef0cff0c8fb40a7ffe930fa217320569c58..abde7491d46ee60e730a7c891418a01be47be255 100644 (file)
@@ -112,7 +112,6 @@ cvar_t r_speeds_graph_maxdefault = {CVAR_SAVE, "r_speeds_graph_maxdefault", "100
 
 
 
-extern cvar_t v_glslgamma;
 extern cvar_t sbar_info_pos;
 extern cvar_t r_fog_clear;
 
@@ -2276,8 +2275,6 @@ static void SCR_DrawScreen (void)
 
        DrawQ_Finish();
 
-       R_DrawGamma();
-
        R_Mesh_Finish();
 }
 
@@ -2602,6 +2599,10 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup)
                loadingscreen_lastupdate = t;
        }
 
+       // set up the r_texture_gammaramps texture which we need for rendering the loadingscreenpic
+       VID_UpdateGamma();
+       R_UpdateVariables();
+
        if(!scr_loadingscreen_background.integer)
                clear = true;
        
diff --git a/draw.h b/draw.h
index 316a696dc6c6a14d41a207e1b4ba4335e7f8084a..6ac5c39b139476c5a9fa4a7b66df012505ea4457 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -199,8 +199,6 @@ void DrawQ_RecalcView(void); // use this when changing r_refdef.view.* from e.g.
 
 rtexture_t *Draw_GetPicTexture(cachepic_t *pic);
 
-void R_DrawGamma(void);
-
 extern rtexturepool_t *drawtexturepool; // used by ft2.c
 
 #endif
index 66f6de4f915cea1cdac0538a51d408febcd9d0b4..77c873c3e7832ea41b053b65e13ca7922de1edd5 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -45,8 +45,6 @@ cvar_t r_font_antialias = {CVAR_SAVE, "r_font_antialias", "1", "0 = monochrome,
 cvar_t r_nearest_2d = {CVAR_SAVE, "r_nearest_2d", "0", "use nearest filtering on all 2d textures (including conchars)"};
 cvar_t r_nearest_conchars = {CVAR_SAVE, "r_nearest_conchars", "0", "use nearest filtering on conchars texture"};
 
-extern cvar_t v_glslgamma;
-
 //=============================================================================
 /* Support Routines */
 
@@ -2156,112 +2154,3 @@ void DrawQ_RecalcView(void)
                r_refdef.draw2dstage = -1; // next draw call will set viewport etc. again
 }
 
-static float blendvertex3f[9] = {-5000, -5000, 10, 10000, -5000, 10, -5000, 10000, 10};
-void R_DrawGamma(void)
-{
-       float c[4];
-       switch(vid.renderpath)
-       {
-       case RENDERPATH_GL20:
-       case RENDERPATH_D3D9:
-       case RENDERPATH_D3D10:
-       case RENDERPATH_D3D11:
-       case RENDERPATH_GLES2:
-               if (v_glslgamma.integer)
-                       return;
-               break;
-       case RENDERPATH_GL11:
-       case RENDERPATH_GL13:
-               break;
-       case RENDERPATH_GLES1:
-       case RENDERPATH_SOFT:
-               return;
-       }
-       // all the blends ignore depth
-//     R_Mesh_ResetTextureState();
-       R_SetupShader_Generic_NoTexture(true, true);
-       GL_DepthMask(true);
-       GL_DepthRange(0, 1);
-       GL_PolygonOffset(0, 0);
-       GL_DepthTest(false);
-
-       // interpretation of brightness and contrast:
-       //   color range := brightness .. (brightness + contrast)
-       // i.e. "c *= contrast; c += brightness"
-       // plausible values for brightness thus range from -contrast to 1
-
-       // apply pre-brightness (subtractive brightness, for where contrast was >= 1)
-       if (vid.support.ext_blend_subtract)
-       {
-               if (v_color_enable.integer)
-               {
-                       c[0] = -v_color_black_r.value / v_color_white_r.value;
-                       c[1] = -v_color_black_g.value / v_color_white_g.value;
-                       c[2] = -v_color_black_b.value / v_color_white_b.value;
-               }
-               else
-                       c[0] = c[1] = c[2] = -v_brightness.value / v_contrast.value;
-               if (c[0] >= 0.01f || c[1] >= 0.01f || c[2] >= 0.01f)
-               {
-                       // need SUBTRACTIVE blending to do this!
-                       GL_BlendEquationSubtract(true);
-                       GL_BlendFunc(GL_ONE, GL_ONE);
-                       GL_Color(c[0], c[1], c[2], 1);
-                       R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
-                       R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
-                       GL_BlendEquationSubtract(false);
-               }
-       }
-
-       // apply contrast
-       if (v_color_enable.integer)
-       {
-               c[0] = v_color_white_r.value;
-               c[1] = v_color_white_g.value;
-               c[2] = v_color_white_b.value;
-       }
-       else
-               c[0] = c[1] = c[2] = v_contrast.value;
-       if (c[0] >= 1.003f || c[1] >= 1.003f || c[2] >= 1.003f)
-       {
-               GL_BlendFunc(GL_DST_COLOR, GL_ONE);
-               while (c[0] >= 1.003f || c[1] >= 1.003f || c[2] >= 1.003f)
-               {
-                       float cc[4];
-                       cc[0] = bound(0, c[0] - 1, 1);
-                       cc[1] = bound(0, c[1] - 1, 1);
-                       cc[2] = bound(0, c[2] - 1, 1);
-                       GL_Color(cc[0], cc[1], cc[2], 1);
-                       R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
-                       R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
-                       c[0] /= 1 + cc[0];
-                       c[1] /= 1 + cc[1];
-                       c[2] /= 1 + cc[2];
-               }
-       }
-       if (c[0] <= 0.997f || c[1] <= 0.997f || c[2] <= 0.997f)
-       {
-               GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
-               GL_Color(c[0], c[1], c[2], 1);
-               R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
-               R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
-       }
-
-       // apply post-brightness (additive brightness, for where contrast was <= 1)
-       if (v_color_enable.integer)
-       {
-               c[0] = v_color_black_r.value;
-               c[1] = v_color_black_g.value;
-               c[2] = v_color_black_b.value;
-       }
-       else
-               c[0] = c[1] = c[2] = v_brightness.value;
-       if (c[0] >= 0.01f || c[1] >= 0.01f || c[2] >= 0.01f)
-       {
-               GL_BlendFunc(GL_ONE, GL_ONE);
-               GL_Color(c[0], c[1], c[2], 1);
-               R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
-               R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
-       }
-}
-
index 96a35e764817d444d95f60da8baa544da31e81fb..c5606728264f08f53fd3d3a6913233042927b242 100644 (file)
@@ -268,7 +268,6 @@ cvar_t r_buffermegs[R_BUFFERDATA_COUNT] =
        {CVAR_SAVE, "r_buffermegs_uniform", "0.25", "uniform buffer size for one frame"},
 };
 
-extern cvar_t v_glslgamma;
 extern cvar_t v_glslgamma_2d;
 
 extern qboolean v_flipped_state;
@@ -2034,7 +2033,7 @@ void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemod
                permutation |= SHADERPERMUTATION_GLOW;
        else if (texturemode == GL_DECAL)
                permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
-       if (usegamma && v_glslgamma.integer && v_glslgamma_2d.integer && !vid.sRGB2D && r_texture_gammaramps && !vid_gammatables_trivial)
+       if (usegamma && v_glslgamma_2d.integer && !vid.sRGB2D && r_texture_gammaramps && !vid_gammatables_trivial)
                permutation |= SHADERPERMUTATION_GAMMARAMPS;
        if (suppresstexalpha)
                permutation |= SHADERPERMUTATION_REFLECTCUBE;
@@ -2050,7 +2049,7 @@ void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemod
                R_Mesh_TexBind(GL20TU_FIRST , first );
                R_Mesh_TexBind(GL20TU_SECOND, second);
                if (permutation & SHADERPERMUTATION_GAMMARAMPS)
-                       R_Mesh_TexBind(r_glsl_permutation->tex_Texture_GammaRamps, r_texture_gammaramps);
+                       R_Mesh_TexBind(GL20TU_GAMMARAMPS, r_texture_gammaramps);
 #endif
                break;
        case RENDERPATH_D3D10:
@@ -6226,6 +6225,7 @@ static void R_Bloom_StartFrame(void)
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GLES1:
+               return; // don't bother
        case RENDERPATH_GLES2:
        case RENDERPATH_D3D9:
        case RENDERPATH_D3D10:
@@ -6302,7 +6302,7 @@ static void R_Bloom_StartFrame(void)
                Cvar_SetValueQuick(&r_damageblur, 0);
        }
 
-       if (!((r_glsl_postprocess.integer || r_fxaa.integer) || (!R_Stereo_ColorMasking() && r_glsl_saturation.value != 1) || (v_glslgamma.integer && !vid_gammatables_trivial))
+       if (!((r_glsl_postprocess.integer || r_fxaa.integer) || (!R_Stereo_ColorMasking() && r_glsl_saturation.value != 1) || !vid_gammatables_trivial)
         && !r_bloom.integer
         && (R_Stereo_Active() || (r_motionblur.value <= 0 && r_damageblur.value <= 0))
         && !useviewfbo
@@ -6606,7 +6606,7 @@ static void R_BlendView(int fbo, rtexture_t *depthtexture, rtexture_t *colortext
                permutation =
                          (r_fb.bloomtexture[r_fb.bloomindex] ? SHADERPERMUTATION_BLOOM : 0)
                        | (r_refdef.viewblend[3] > 0 ? SHADERPERMUTATION_VIEWTINT : 0)
-                       | ((v_glslgamma.value && !vid_gammatables_trivial) ? SHADERPERMUTATION_GAMMARAMPS : 0)
+                       | (!vid_gammatables_trivial ? SHADERPERMUTATION_GAMMARAMPS : 0)
                        | (r_glsl_postprocess.integer ? SHADERPERMUTATION_POSTPROCESSING : 0)
                        | ((!R_Stereo_ColorMasking() && r_glsl_saturation.value != 1) ? SHADERPERMUTATION_SATURATION : 0);
 
@@ -6955,7 +6955,7 @@ void R_UpdateVariables(void)
        case RENDERPATH_D3D11:
        case RENDERPATH_SOFT:
        case RENDERPATH_GLES2:
-               if(v_glslgamma.integer && !vid_gammatables_trivial)
+               if(!vid_gammatables_trivial)
                {
                        if(!r_texture_gammaramps || vid_gammatables_serial != r_texture_gammaramps_serial)
                        {
index 7ee5b34f6d3d50fbef0dd0f6defe285d7a662787..26b69ad095cf0dbbf8fde3f40095739d8bd2c271 100644 (file)
@@ -195,8 +195,7 @@ cvar_t v_color_grey_b = {CVAR_SAVE, "v_color_grey_b", "0.5", "desired color of g
 cvar_t v_color_white_r = {CVAR_SAVE, "v_color_white_r", "1", "desired color of white"};
 cvar_t v_color_white_g = {CVAR_SAVE, "v_color_white_g", "1", "desired color of white"};
 cvar_t v_color_white_b = {CVAR_SAVE, "v_color_white_b", "1", "desired color of white"};
-cvar_t v_glslgamma = {CVAR_SAVE, "v_glslgamma", "1", "enables use of GLSL to apply gamma correction ramps"};
-cvar_t v_glslgamma_2d = {CVAR_SAVE, "v_glslgamma_2d", "0", "applies GLSL gamma to 2d pictures (HUD, fonts)"};
+cvar_t v_glslgamma_2d = {CVAR_SAVE, "v_glslgamma_2d", "1", "applies GLSL gamma to 2d pictures (HUD, fonts)"};
 cvar_t v_psycho = {0, "v_psycho", "0", "easter egg - R.I.P. zinx http://obits.al.com/obituaries/birmingham/obituary.aspx?n=christopher-robert-lais&pid=186080667"};
 
 // brand of graphics chip
@@ -1060,10 +1059,7 @@ void VID_CheckExtensions(void)
        vid.support.arb_texture_cube_map = GL_CheckExtension("GL_ARB_texture_cube_map", NULL, "-nocubemap", false);
        vid.support.arb_texture_env_combine = GL_CheckExtension("GL_ARB_texture_env_combine", NULL, "-nocombine", false) || GL_CheckExtension("GL_EXT_texture_env_combine", NULL, "-nocombine", false);
        vid.support.arb_texture_gather = GL_CheckExtension("GL_ARB_texture_gather", NULL, "-notexturegather", false);
-#ifndef __APPLE__
-       // LordHavoc: too many bugs on OSX!
        vid.support.arb_texture_non_power_of_two = GL_CheckExtension("GL_ARB_texture_non_power_of_two", NULL, "-notexturenonpoweroftwo", false);
-#endif
        vid.support.arb_vertex_buffer_object = GL_CheckExtension("GL_ARB_vertex_buffer_object", vbofuncs, "-novbo", false);
        vid.support.arb_uniform_buffer_object = GL_CheckExtension("GL_ARB_uniform_buffer_object", ubofuncs, "-noubo", false);
        vid.support.ati_separate_stencil = GL_CheckExtension("separatestencil", gl2separatestencilfuncs, "-noseparatestencil", true) || GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "-noseparatestencil", false);
@@ -1676,7 +1672,6 @@ void VID_Shared_Init(void)
        Cvar_RegisterVariable(&v_color_white_g);
        Cvar_RegisterVariable(&v_color_white_b);
 
-       Cvar_RegisterVariable(&v_glslgamma);
        Cvar_RegisterVariable(&v_glslgamma_2d);
 
        Cvar_RegisterVariable(&v_psycho);