Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling v-sync in D3D11/D3D12 backend #635

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void SwapChainD3D11Impl::Present(Uint32 SyncInterval)
// https://docs.microsoft.com/en-us/windows/uwp/gaming/reduce-latency-with-dxgi-1-3-swap-chains#step-4-wait-before-rendering-each-frame
WaitForFrame();

m_pSwapChain->Present(SyncInterval, 0);
m_pSwapChain->Present(SyncInterval, SyncInterval == 0 ? DXGI_PRESENT_ALLOW_TEARING : 0);
}

void SwapChainD3D11Impl::UpdateSwapChain(bool CreateNew)
Expand Down
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void SwapChainD3D12Impl::Present(Uint32 SyncInterval)
// https://docs.microsoft.com/en-us/windows/uwp/gaming/reduce-latency-with-dxgi-1-3-swap-chains#step-4-wait-before-rendering-each-frame
WaitForFrame();

auto hr = m_pSwapChain->Present(SyncInterval, 0);
auto hr = m_pSwapChain->Present(SyncInterval, SyncInterval == 0 ? DXGI_PRESENT_ALLOW_TEARING : 0);
VERIFY(SUCCEEDED(hr), "Present failed");

if (m_SwapChainDesc.IsPrimary)
Expand Down
2 changes: 2 additions & 0 deletions Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class SwapChainD3DBase : public SwapChainBase<BaseInterface>
// mode (or monitor resolution) will be changed to match the dimensions of the application window.
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

// https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/variable-refresh-rate-displays#variable-refresh-rate-displaysvsync-off
swapChainDesc.Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;

CComPtr<IDXGIFactory2> pDXGIFactory;

Expand Down
Loading