From 794d40a04c86628d556f3f62fc244c6e0baaacc5 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Wed, 3 Jul 2024 23:13:24 +0200 Subject: [PATCH] Add CVar r_vidRestartAlwaysFull disables partial vid_restarts, hopefully works around issues like https://github.com/dhewm/dhewm3/issues/587#issuecomment-2206937752 Note that resizing the window by dragging it does *not* call vid_restart at all, so if you're having issues that are fixed by a full vid_restart you should also set `r_windowResizable 0` --- neo/renderer/RenderSystem_init.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 3a5fd169a..4e7562e34 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -237,6 +237,7 @@ idCVar r_screenshotJpgQuality("r_screenshotJpgQuality", "75", CVAR_RENDERER | CV idCVar r_screenshotPngCompression("r_screenshotPngCompression", "3", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "Compression level when using PNG screenshots (0-9). Higher levels generate smaller files, but take noticeably longer"); // DG: allow freely resizing the window idCVar r_windowResizable("r_windowResizable", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "Allow resizing (and maximizing) the window (needs SDL2; with 2.0.5 or newer it's applied immediately)" ); +idCVar r_vidRestartAlwaysFull( "r_vidRestartAlwaysFull", 0, CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "Always do a full vid_restart (ignore 'partial' argument), e.g. when changing window size" ); // define qgl functions #define QGLPROC(name, rettype, args) rettype (APIENTRYP q##name) args; @@ -1989,6 +1990,13 @@ void R_VidRestart_f( const idCmdArgs &args ) { } } + // DG: allow enforcing full vid restarts (when vid_restart is called from the menu or whatever) + // to let users work around driver bugs or whatever, like + // https://github.com/dhewm/dhewm3/issues/587#issuecomment-2206937752 + if ( r_vidRestartAlwaysFull.GetBool() ) { + full = true; + } + // DG: in partial mode, try to just resize the window (and make it fullscreen or windowed) // instead of doing a full vid_restart. Still falls back to a full vid_restart // in case this doesn't work (for example because MSAA settings have changed)