diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 130e5f2c5..8befd26db 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -14,6 +14,7 @@ int sh_shadowframe; //index for msurf->shadowframe int r_framecount; struct texture_s *r_notexture_mip; +qboolean r_blockvidrestart; void R_InitParticleTexture (void); @@ -286,8 +287,8 @@ cvar_t gl_texturemode2d = CVARFC("gl_texturemode2d", "GL_LINEAR", GL_Texturemode2d_Callback); #endif -cvar_t gl_triplebuffer = SCVARF ("gl_triplebuffer", "1", - CVAR_ARCHIVE); +cvar_t vid_triplebuffer = CVARAF ("vid_triplebuffer", "1", + "gl_triplebuffer", CVAR_ARCHIVE); cvar_t r_noportals = SCVAR ("r_noportals", "0"); cvar_t r_noaliasshadows = SCVARF ("r_noaliasshadows", "0", @@ -341,8 +342,6 @@ void GLRenderer_Init(void) Cvar_Register (&vid_gl_context_es2, GLRENDEREROPTIONS); //screen - Cvar_Register (&gl_triplebuffer, GLRENDEREROPTIONS); - Cvar_Register (&vid_preservegamma, GLRENDEREROPTIONS); Cvar_Register (&vid_hardwaregamma, GLRENDEREROPTIONS); Cvar_Register (&vid_desktopgamma, GLRENDEREROPTIONS); @@ -480,6 +479,7 @@ void Renderer_Init(void) currentrendererstate.renderer = NULL; qrenderer = QR_NONE; + r_blockvidrestart = true; Cmd_AddCommand("setrenderer", R_SetRenderer_f); Cmd_AddCommand("vid_restart", R_RestartRenderer_f); @@ -510,6 +510,7 @@ void Renderer_Init(void) Cvar_Register (&vid_conheight, VIDCOMMANDGROUP); Cvar_Register (&vid_conautoscale, VIDCOMMANDGROUP); + Cvar_Register (&vid_triplebuffer, VIDCOMMANDGROUP); Cvar_Register (&vid_width, VIDCOMMANDGROUP); Cvar_Register (&vid_height, VIDCOMMANDGROUP); Cvar_Register (&vid_refreshrate, VIDCOMMANDGROUP); @@ -615,6 +616,7 @@ qboolean Renderer_Started(void) void Renderer_Start(void) { + r_blockvidrestart = false; Cvar_ApplyLatches(CVAR_RENDERERLATCH); //renderer = none && currentrendererstate.bpp == -1 means we've never applied any mode at all @@ -1283,6 +1285,12 @@ void R_RestartRenderer_f (void) int i, j; rendererstate_t oldr; rendererstate_t newr; + if (r_blockvidrestart) + { + Con_Printf("Ignoring vid_restart from config\n"); + return; + } + M_Shutdown(); memset(&newr, 0, sizeof(newr)); @@ -1295,6 +1303,7 @@ TRACE(("dbg: R_RestartRenderer_f\n")); newr.width = vid_width.value; newr.height = vid_height.value; + newr.triplebuffer = vid_triplebuffer.value; newr.multisample = vid_multisample.value; newr.bpp = vid_bpp.value; newr.fullscreen = vid_fullscreen.value; diff --git a/engine/client/vid.h b/engine/client/vid.h index e28537cfb..b3e628d61 100644 --- a/engine/client/vid.h +++ b/engine/client/vid.h @@ -36,6 +36,7 @@ typedef struct { int rate; int wait; //-1 = default, 0 = off, 1 = on, 2 = every other int multisample; //for opengl antialiasing (which requires context stuff) + int triplebuffer; char glrenderer[MAX_QPATH]; struct rendererinfo_s *renderer; } rendererstate_t; diff --git a/engine/d3d/vid_d3d.c b/engine/d3d/vid_d3d.c index 078dfa7d5..0ff196edd 100644 --- a/engine/d3d/vid_d3d.c +++ b/engine/d3d/vid_d3d.c @@ -469,7 +469,7 @@ static qboolean initD3D9Device(HWND hWnd, rendererstate_t *info, unsigned int de d3dpp.BackBufferWidth = info->width; d3dpp.BackBufferHeight = info->height; d3dpp.MultiSampleType = info->multisample; - d3dpp.BackBufferCount = 1; + d3dpp.BackBufferCount = 1 + info->triplebuffer; d3dpp.FullScreen_RefreshRateInHz = info->fullscreen?info->rate:0; //don't pass a rate if not fullscreen, d3d doesn't like it. d3dpp.Windowed = !info->fullscreen; diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index a785eaa63..436de105d 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -33,7 +33,7 @@ void GLSCR_UpdateScreen (void); extern qboolean scr_drawdialog; -extern cvar_t gl_triplebuffer; +extern cvar_t vid_triplebuffer; extern cvar_t scr_fov; extern qboolean scr_initialized; @@ -68,7 +68,7 @@ void GLSCR_UpdateScreen (void) qboolean noworld; RSpeedMark(); - vid.numpages = 2 + gl_triplebuffer.value; + vid.numpages = 2 + vid_triplebuffer.value; if (scr_disabled_for_loading) {