From 7ee476928ba40ce3b224eca38563b651f9e8c787 Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Tue, 14 Jul 2026 19:47:31 +0200 Subject: [PATCH] Fixes missing window preview on Alt+Tab There was a crash on Alt+Tab in fullscreen for some specific driver: https://code.wildfiregames.com/D1212 It was related only to post processing so it's time to try to enable rendering again (but with provided option to disable it). Also without rendering we might have some bugs in other components. See: https://github.com/libsdl-org/SDL/issues/5033#issuecomment-981819661 The issue is reported here (first one): https://wildfiregames.com/forum/topic/129061-two-vulkan-issues-in-a27-and-unrelated-choppiness-caused-by-control-groups/ --- binaries/data/config/default.cfg | 4 ++++ binaries/data/mods/public/gui/options/options.json | 6 ++++++ source/renderer/Renderer.cpp | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg index d774f86536..78681f4b11 100644 --- a/binaries/data/config/default.cfg +++ b/binaries/data/config/default.cfg @@ -107,6 +107,10 @@ shadowscovermap = false renderer.scale = 1.0 renderer.upscale.technique = "fsr" +; Allows to disable rendering when the game window is out of focus. It might +; save some performance or fix old driver crashes on out of focus. +renderer.renderwhenoutoffocus = "true" + vsync = false particles = true fog = true diff --git a/binaries/data/mods/public/gui/options/options.json b/binaries/data/mods/public/gui/options/options.json index 3f0e02d47f..af21c39ba8 100644 --- a/binaries/data/mods/public/gui/options/options.json +++ b/binaries/data/mods/public/gui/options/options.json @@ -174,6 +174,12 @@ "label": "Mouse grab in window mode", "tooltip": "Constrain mouse in the window mode to the window boundaries.", "config": "window.mousegrabinwindowmode" + }, + { + "type": "boolean", + "label": "Render out of focus", + "tooltip": "To save GPU workload, disable rendering when the game window is out of focus.", + "config": "renderer.renderwhenoutoffocus" } ] }, diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index 7940c7a815..9a3b7190c2 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -508,7 +508,9 @@ void CRenderer::Resize(int width, int height) bool CRenderer::ShouldRender() const { - return !g_app_minimized && (g_app_has_focus || !g_VideoMode.IsInFullscreen()); + const bool shouldRenderWhenOutOfFocus{ + g_ConfigDB.Get("renderer.renderwhenoutoffocus", true)}; + return !g_app_minimized && (g_app_has_focus || shouldRenderWhenOutOfFocus); } void CRenderer::RenderFrame(const bool needsPresent)