Skip to content
Merged
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 src/DX12SwapChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void DX12SwapChain::CreateSwapChain(IDXGIAdapter* adapter, DXGI_SWAP_CHAIN_DESC
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapChainDesc.SwapEffect = a_swapChainDesc.SwapEffect;
swapChainDesc.Flags = a_swapChainDesc.Flags;

ffx::CreateContextDescFrameGenerationSwapChainForHwndDX12 ffxSwapChainDesc{};
Expand Down
24 changes: 22 additions & 2 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ struct IDXGISwapChain_Present
state->Reset();
menu->DrawOverlay();

if (upscaling->d3d12Interop) {
SyncInterval = std::max(1u, SyncInterval);
BOOL fullscreen = FALSE;
((IDXGISwapChain*)This)->GetFullscreenState(&fullscreen, nullptr);
if (fullscreen || SyncInterval) {
Flags &= ~DXGI_PRESENT_ALLOW_TEARING;
} else if (SyncInterval == 0) {
Flags |= DXGI_PRESENT_ALLOW_TEARING;
}

Expand Down Expand Up @@ -288,6 +291,23 @@ HRESULT WINAPI hk_D3D11CreateDeviceAndSwapChain(
pAdapter->GetDesc(&adapterDesc);
globals::state->SetAdapterDescription(adapterDesc.Description);

pSwapChainDesc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;

IDXGIFactory5* dxgiFactory;
DX::ThrowIfFailed(pAdapter->GetParent(IID_PPV_ARGS(&dxgiFactory)));

BOOL allowTearing = FALSE;
DX::ThrowIfFailed(dxgiFactory->CheckFeatureSupport(
DXGI_FEATURE_PRESENT_ALLOW_TEARING,
&allowTearing,
sizeof(allowTearing)));

if (allowTearing) {
pSwapChainDesc->Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
} else {
pSwapChainDesc->Flags &= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
}

auto streamline = globals::streamline;
auto fidelityFX = globals::fidelityFX;
auto upscaling = globals::upscaling;
Expand Down