diff --git a/UnleashedRecomp/cfg/config.h b/UnleashedRecomp/cfg/config.h index 83686050..9422a86c 100644 --- a/UnleashedRecomp/cfg/config.h +++ b/UnleashedRecomp/cfg/config.h @@ -51,7 +51,7 @@ public: }); CONFIG_DEFINE_LOCALISED("Video", bool, VSync, true); - CONFIG_DEFINE_LOCALISED("Video", bool, TripleBuffering, true); + CONFIG_DEFINE_ENUM("Video", ETripleBuffering, TripleBuffering, ETripleBuffering::Auto); CONFIG_DEFINE_LOCALISED("Video", int32_t, FPS, 60); CONFIG_DEFINE_LOCALISED("Video", float, Brightness, 0.5f); CONFIG_DEFINE_ENUM_LOCALISED("Video", EAntiAliasing, AntiAliasing, EAntiAliasing::MSAA4x); diff --git a/UnleashedRecomp/cfg/config_detail.h b/UnleashedRecomp/cfg/config_detail.h index 98f4be1e..b213120f 100644 --- a/UnleashedRecomp/cfg/config_detail.h +++ b/UnleashedRecomp/cfg/config_detail.h @@ -122,6 +122,20 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EAspectRatio) { "16:9", EAspectRatio::Widescreen } }; +enum class ETripleBuffering : uint32_t +{ + Auto, + On, + Off +}; + +CONFIG_DEFINE_ENUM_TEMPLATE(ETripleBuffering) +{ + { "Auto", ETripleBuffering::Auto }, + { "On", ETripleBuffering::On }, + { "Off", ETripleBuffering::Off } +}; + enum class EAntiAliasing : uint32_t { None = 0, diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index eafddbeb..103160b6 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -1149,7 +1149,22 @@ static void CreateHostDevice() g_copyCommandList = g_device->createCommandList(RenderCommandListType::COPY); g_copyCommandFence = g_device->createCommandFence(); - g_swapChain = g_queue->createSwapChain(Window::s_handle, Config::TripleBuffering ? 3 : 2, BACKBUFFER_FORMAT); + uint32_t bufferCount = 2; + + switch (Config::TripleBuffering) + { + case ETripleBuffering::Auto: + bufferCount = g_vulkan ? 2 : 3; // Defaulting to 3 is fine on D3D12 thanks to flip discard model. + break; + case ETripleBuffering::On: + bufferCount = 3; + break; + case ETripleBuffering::Off: + bufferCount = 2; + break; + } + + g_swapChain = g_queue->createSwapChain(Window::s_handle, bufferCount, BACKBUFFER_FORMAT); g_swapChain->setVsyncEnabled(Config::VSync); g_swapChainValid = !g_swapChain->needsResize(); diff --git a/UnleashedRecomp/locale/config_locale.h b/UnleashedRecomp/locale/config_locale.h index 95aa5db3..aa0c3b72 100644 --- a/UnleashedRecomp/locale/config_locale.h +++ b/UnleashedRecomp/locale/config_locale.h @@ -222,11 +222,6 @@ CONFIG_DEFINE_LOCALE(VSync) { ELanguage::English, { "V-Sync", "[PLACEHOLDER]" } } }; -CONFIG_DEFINE_LOCALE(TripleBuffering) -{ - { ELanguage::English, { "Triple Buffering", "[PLACEHOLDER]" } } -}; - CONFIG_DEFINE_LOCALE(FPS) { { ELanguage::English, { "FPS", "[PLACEHOLDER]" } } diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index c3cf4113..16fa6cc4 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -877,7 +877,6 @@ static void DrawConfigOptions() DrawConfigOption(rowCount++, yOffset, &Config::ResolutionScale, true, nullptr, 0.25f, 1.0f, 2.0f); DrawConfigOption(rowCount++, yOffset, &Config::Fullscreen, true); DrawConfigOption(rowCount++, yOffset, &Config::VSync, true); - DrawConfigOption(rowCount++, yOffset, &Config::TripleBuffering, true); DrawConfigOption(rowCount++, yOffset, &Config::FPS, true, nullptr, 15, 120, 240); DrawConfigOption(rowCount++, yOffset, &Config::Brightness, true); DrawConfigOption(rowCount++, yOffset, &Config::AntiAliasing, true);