From 71c1b4e0c4bcfb272a83e767b2b9688972d4d06d Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 7 Mar 2022 08:38:38 +0900 Subject: [PATCH] [gl] Clean up some triple buffer and multi-texture cvar mess Excess declarations for gl_multitexture_f, and move gl_triplebuffer into a callback. --- include/QF/GL/qf_rmain.h | 6 ++++-- libs/video/renderer/gl/gl_lightmap.c | 3 --- libs/video/renderer/gl/gl_screen.c | 4 ---- libs/video/renderer/gl/vid_common_gl.c | 11 ++++++++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/QF/GL/qf_rmain.h b/include/QF/GL/qf_rmain.h index 63735a926..4625b94dc 100644 --- a/include/QF/GL/qf_rmain.h +++ b/include/QF/GL/qf_rmain.h @@ -29,7 +29,9 @@ #define __QF_GL_rmain_h #include "QF/qtypes.h" -#include "QF/cvar.h" + +struct cvar_s; +struct entity_s; extern qboolean gl_envmap; extern int c_brush_polys, c_alias_polys; @@ -38,7 +40,7 @@ extern float r_world_matrix[16]; extern float gl_modelalpha; //extern vec3_t shadecolor; -extern void gl_multitexture_f (cvar_t *var); +extern void gl_multitexture_f (struct cvar_s *var); void glrmain_init (void); void R_RotateForEntity (struct entity_s *e); diff --git a/libs/video/renderer/gl/gl_lightmap.c b/libs/video/renderer/gl/gl_lightmap.c index f601e2755..52cbb00b8 100644 --- a/libs/video/renderer/gl/gl_lightmap.c +++ b/libs/video/renderer/gl/gl_lightmap.c @@ -80,9 +80,6 @@ static int lmshift = 7; void (*gl_R_BuildLightMap) (const transform_t *transform, mod_brush_t *brush, msurface_t *surf); -extern void gl_multitexture_f (cvar_t *var); - - void gl_lightmap_init (void) { diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index 32cf78848..8e03bc5f9 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -211,8 +211,6 @@ gl_R_RenderFrame (SCR_Func *scr_funcs) begun = 0; } - vid.numpages = 2 + gl_triplebuffer->int_val; - //FIXME forces the status bar to redraw. needed because it does not fully //update in sw modes but must in gl mode vr_data.scr_copyeverything = 1; @@ -223,8 +221,6 @@ gl_R_RenderFrame (SCR_Func *scr_funcs) if (r_speeds->int_val) { time1 = Sys_DoubleTime (); - gl_c_brush_polys = 0; - gl_c_alias_polys = 0; } // do 3D refresh drawing, and then update the screen diff --git a/libs/video/renderer/gl/vid_common_gl.c b/libs/video/renderer/gl/vid_common_gl.c index 7b8c213e7..ce8a5e3d6 100644 --- a/libs/video/renderer/gl/vid_common_gl.c +++ b/libs/video/renderer/gl/vid_common_gl.c @@ -48,6 +48,7 @@ #include "QF/GL/defines.h" #include "QF/GL/extensions.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_rmain.h" #include "QF/GL/qf_vid.h" #include "compat.h" @@ -150,8 +151,11 @@ cvar_t *gl_texsort; cvar_t *gl_triplebuffer; static cvar_t *vid_use8bit; -void gl_multitexture_f (cvar_t *var); - +static void +gl_triplebuffer_f (cvar_t *var) +{ + vid.numpages = var->int_val ? 3 : 2; +} static void gl_max_size_f (cvar_t *var) @@ -401,7 +405,8 @@ GL_Common_Init_Cvars (void) "controls whether the skydome is single or " "double pass"); gl_texsort = Cvar_Get ("gl_texsort", "1", CVAR_NONE, NULL, "None"); - gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, NULL, + gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, + gl_triplebuffer_f, "Set to 1 by default. Fixes status bar " "flicker on some hardware"); }