Ensure that ALLOW_TEARING is applied on swapchain resize with DLSSG

Slopped. FIxes a crash in BeamNG with DLSSG Dx12 output on resize
This commit is contained in:
FakeMichau committed 2026-10-20 01:59:57 +02:00
1 parent 18d4d2e483
commit b48fcb0dc3
1 file changed
+14
+14
View File
@@ -661,6 +661,13 @@ HRESULT FGHooks::hkResizeBuffers(IDXGISwapChain* This, UINT BufferCount, UINT Wi
}
}
// DLSSG creates its swapchain with ALLOW_TEARING and DXGI rejects resizes that add or remove it
if (State::Instance().activeFgOutput == FGOutput::DLSSG && !(SwapChainFlags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING))
{
LOG_DEBUG("Keeping DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING for DLSSG");
SwapChainFlags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
}
LOG_DEBUG("BufferCount: {}, Width: {}, Height: {}, NewFormat:{}, SwapChainFlags: {:X}", BufferCount, Width, Height,
(UINT) NewFormat, SwapChainFlags);
@@ -902,6 +909,13 @@ HRESULT FGHooks::hkResizeBuffers1(IDXGISwapChain3* This, UINT BufferCount, UINT
}
}
// DLSSG creates its swapchain with ALLOW_TEARING and DXGI rejects resizes that add or remove it
if (State::Instance().activeFgOutput == FGOutput::DLSSG && !(SwapChainFlags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING))
{
LOG_DEBUG("Keeping DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING for DLSSG");
SwapChainFlags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
}
LOG_DEBUG("BufferCount: {}, Width: {}, Height: {}, NewFormat:{}, SwapChainFlags: {:X}, Caller: {}", BufferCount,
Width, Height, (UINT) Format, SwapChainFlags, Util::WhoIsTheCaller(_ReturnAddress()));