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
24 changes: 23 additions & 1 deletion src/DX12SwapChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,29 @@

void DX12SwapChain::CreateD3D12Device(IDXGIAdapter* a_adapter)
{
DX::ThrowIfFailed(D3D12CreateDevice(a_adapter, D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&d3d12Device)));
// Define feature levels in descending order (highest to lowest)
D3D_FEATURE_LEVEL featureLevels[] = {
D3D_FEATURE_LEVEL_12_2,
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0
};

// Store the supported feature level
D3D_FEATURE_LEVEL supportedFeatureLevel;

// Try to create the device with the highest feature level
for (const auto& level : featureLevels) {
HRESULT hr = D3D12CreateDevice(a_adapter, level, IID_PPV_ARGS(&d3d12Device));
if (SUCCEEDED(hr)) {
supportedFeatureLevel = level;
break;
}
}

// Ensure we actually created a device
if (!d3d12Device) {
throw std::runtime_error("[Frame Generation] Failed to create Direct3D 12 device");
}

D3D12_COMMAND_QUEUE_DESC queueDesc = {};
queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
Expand Down
12 changes: 12 additions & 0 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ HRESULT WINAPI hk_D3D11CreateDeviceAndSwapChain(
streamline->PostDevice();
streamline->InstallHooks(*ppImmediateContext);

IDXGIFactory* factory = nullptr;
if (SUCCEEDED((*ppSwapChain)->GetParent(IID_PPV_ARGS(&factory)))) {
factory->MakeWindowAssociation(pSwapChainDesc->OutputWindow, DXGI_MWA_NO_WINDOW_CHANGES);
factory->Release();
}

return ret;

} else {
Expand Down Expand Up @@ -409,6 +415,12 @@ HRESULT WINAPI hk_D3D11CreateDeviceAndSwapChain(
streamline->PostDevice();
}

IDXGIFactory* factory = nullptr;
if (SUCCEEDED((*ppSwapChain)->GetParent(IID_PPV_ARGS(&factory)))) {
factory->MakeWindowAssociation(pSwapChainDesc->OutputWindow, DXGI_MWA_NO_WINDOW_CHANGES);
factory->Release();
}

return S_OK;
} else {
logger::warn("[Frame Generation] amd_fidelityfx_dx12.dll is not loaded, skipping proxy");
Expand Down