From a8d42e5c190828951771dcd84385f3d9ae69ae7b Mon Sep 17 00:00:00 2001 From: cdozdil Date: Mon, 8 Sep 2025 02:20:46 +0300 Subject: [PATCH] Fix for Dx11 swapchain creation --- OptiScaler/hooks/HooksDx.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/OptiScaler/hooks/HooksDx.cpp b/OptiScaler/hooks/HooksDx.cpp index 1969b5c5..162981b1 100644 --- a/OptiScaler/hooks/HooksDx.cpp +++ b/OptiScaler/hooks/HooksDx.cpp @@ -2530,13 +2530,23 @@ static HRESULT hkD3D11CreateDeviceAndSwapChain(IDXGIAdapter* pAdapter, D3D_DRIVE pSwapChainDesc->BufferCount = 2; } - if (Config::Instance()->OverrideVsync.value_or_default() && pSwapChainDesc != nullptr) + if (pSwapChainDesc != nullptr) { - pSwapChainDesc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; - pSwapChainDesc->Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; + // For vsync override + if (!pSwapChainDesc->Windowed) + { + LOG_INFO("Game is creating fullscreen swapchain, disabled V-Sync overrides"); + Config::Instance()->OverrideVsync.set_volatile_value(false); + } - if (pSwapChainDesc->BufferCount < 2) - pSwapChainDesc->BufferCount = 2; + if (Config::Instance()->OverrideVsync.value_or_default()) + { + pSwapChainDesc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + pSwapChainDesc->Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; + + if (pSwapChainDesc->BufferCount < 2) + pSwapChainDesc->BufferCount = 2; + } } auto result = o_D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels,