Corrected the order of oldSwapChain assign

This commit is contained in:
cdozdil committed 2026-10-18 23:38:42 +03:00
1 parent ab439cc771
commit 4eab52aff6
3 files changed
+4 -54

No files matched your search

-26
View File
@@ -797,19 +797,6 @@ bool FSRFG_Dx12::CreateSwapchain(IDXGIFactory* factory, ID3D12CommandQueue* cmdQ
{
LOG_INFO("Releasing old swapchain");
ReleaseSwapchain(_hwnd);
// Not sure why but XeFG sometimes doesn't release the swapchain properly
// maybe needed for FSR-FG too, so added it here
// so we force release it here to be able to recreate swapchain for same hwnd
if (State::Instance().currentRealSwapchain != nullptr)
{
UINT release = 0;
do
{
release = State::Instance().currentRealSwapchain->Release();
LOG_DEBUG("Releasing swapchain, ref count: {}", release);
} while (release > 0);
}
}
else
{
@@ -877,19 +864,6 @@ bool FSRFG_Dx12::CreateSwapchain1(IDXGIFactory* factory, ID3D12CommandQueue* cmd
{
LOG_INFO("Releasing old swapchain");
ReleaseSwapchain(_hwnd);
// Not sure why but XeFG sometimes doesn't release the swapchain properly
// maybe needed for FSR-FG too, so added it here
// so we force release it here to be able to recreate swapchain for same hwnd
if (State::Instance().currentRealSwapchain != nullptr)
{
UINT release = 0;
do
{
release = State::Instance().currentRealSwapchain->Release();
LOG_DEBUG("Releasing swapchain, ref count: {}", release);
} while (release > 0);
}
}
else
{
-24
View File
@@ -238,18 +238,6 @@ bool XeFG_Dx12::CreateSwapchain(IDXGIFactory* factory, ID3D12CommandQueue* cmdQu
{
LOG_INFO("Releasing old swapchain");
ReleaseSwapchain(_hwnd);
// Not sure why but XeFG sometimes doesn't release the swapchain properly
// so we force release it here to be able to recreate swapchain for same hwnd
if (State::Instance().currentRealSwapchain != nullptr)
{
UINT release = 0;
do
{
release = State::Instance().currentRealSwapchain->Release();
LOG_DEBUG("Releasing swapchain, ref count: {}", release);
} while (release > 0);
}
}
else
{
@@ -435,18 +423,6 @@ bool XeFG_Dx12::CreateSwapchain1(IDXGIFactory* factory, ID3D12CommandQueue* cmdQ
{
LOG_INFO("Releasing old swapchain");
ReleaseSwapchain(_hwnd);
// Not sure why but XeFG sometimes doesn't release the swapchain properly
// so we force release it here to be able to recreate swapchain for same hwnd
if (State::Instance().currentRealSwapchain != nullptr)
{
UINT release = 0;
do
{
release = State::Instance().currentRealSwapchain->Release();
LOG_DEBUG("Releasing swapchain, ref count: {}", release);
} while (release > 0);
}
}
else
{
+4 -4
View File
@@ -152,6 +152,8 @@ HRESULT FGHooks::CreateSwapChain(IDXGIFactory* pFactory, IUnknown* pDevice, DXGI
pDesc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
}
scResult = fg->CreateSwapchain(pFactory, cq, pDesc, ppSwapChain, true);
// Looks like game is creating new swapchain,
// without releasing old one, be sure gpu is in idle state
if (!Config::Instance()->FGPreserveSwapChain.value_or_default() &&
@@ -163,8 +165,6 @@ HRESULT FGHooks::CreateSwapChain(IDXGIFactory* pFactory, IUnknown* pDevice, DXGI
oldSwapChain = State::Instance().currentFGSwapchain;
}
scResult = fg->CreateSwapchain(pFactory, cq, pDesc, ppSwapChain, true);
if (Config::Instance()->FGDontUseSwapchainBuffers.value_or_default())
State::Instance().skipHeapCapture = false;
}
@@ -261,6 +261,8 @@ HRESULT FGHooks::CreateSwapChainForHwnd(IDXGIFactory* pFactory, IUnknown* pDevic
pDesc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
}
scResult = fg->CreateSwapchain1(pFactory, cq, hWnd, pDesc, pFullscreenDesc, ppSwapChain, true);
// Looks like game is creating new swapchain,
// without releasing old one, be sure gpu is in idle state
if (!Config::Instance()->FGPreserveSwapChain.value_or_default() &&
@@ -272,8 +274,6 @@ HRESULT FGHooks::CreateSwapChainForHwnd(IDXGIFactory* pFactory, IUnknown* pDevic
oldSwapChain = State::Instance().currentFGSwapchain;
}
scResult = fg->CreateSwapchain1(pFactory, cq, hWnd, pDesc, pFullscreenDesc, ppSwapChain, true);
if (Config::Instance()->FGDontUseSwapchainBuffers.value_or_default())
State::Instance().skipHeapCapture = false;
}