From bd4338be427bdc646e4421bf902e777be9d77bd6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 24 Sep 2018 15:26:33 +0200 Subject: [PATCH] [d3d10] Add option to enable or disable D3D10 support --- src/d3d10/d3d10_main.cpp | 13 +++++++++++-- src/dxgi/dxgi_adapter.cpp | 10 +++++++--- src/dxgi/dxgi_options.cpp | 2 ++ src/dxgi/dxgi_options.h | 3 +++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/d3d10/d3d10_main.cpp b/src/d3d10/d3d10_main.cpp index 576c9dab..c8ffe588 100644 --- a/src/d3d10/d3d10_main.cpp +++ b/src/d3d10/d3d10_main.cpp @@ -30,8 +30,17 @@ extern "C" { ID3D10Device** ppDevice) { Com d3d11Device; - HRESULT hr = D3D11CoreCreateDevice(pFactory, - pAdapter, Flags, &FeatureLevel, 1, &d3d11Device); + if (ppDevice != nullptr) + *ppDevice = nullptr; + + HRESULT hr = pAdapter->CheckInterfaceSupport( + __uuidof(ID3D10Device), nullptr); + + if (FAILED(hr)) + return hr; + + hr = D3D11CoreCreateDevice(pFactory, pAdapter, + Flags, &FeatureLevel, 1, &d3d11Device); if (FAILED(hr)) return hr; diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index 63ff001b..8e399181 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -57,12 +57,16 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE DxgiAdapter::CheckInterfaceSupport( REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion) { + const DxgiOptions* options = m_factory->GetOptions(); + if (pUMDVersion != nullptr) *pUMDVersion = LARGE_INTEGER(); - if (InterfaceName == __uuidof(ID3D10Device) - || InterfaceName == __uuidof(ID3D10Device1)) - return S_OK; + if (options->d3d10Enable) { + if (InterfaceName == __uuidof(ID3D10Device) + || InterfaceName == __uuidof(ID3D10Device1)) + return S_OK; + } Logger::err("DXGI: CheckInterfaceSupport: Unsupported interface"); Logger::err(str::format(InterfaceName)); diff --git a/src/dxgi/dxgi_options.cpp b/src/dxgi/dxgi_options.cpp index ca412fdd..c1ebbca5 100644 --- a/src/dxgi/dxgi_options.cpp +++ b/src/dxgi/dxgi_options.cpp @@ -41,6 +41,8 @@ namespace dxvk { this->numBackBuffers = config.getOption("dxgi.numBackBuffers", 0); this->syncInterval = config.getOption("dxgi.syncInterval", -1); + + this->d3d10Enable = config.getOption("d3d10.enable", true); } } \ No newline at end of file diff --git a/src/dxgi/dxgi_options.h b/src/dxgi/dxgi_options.h index d4b9f67c..d7a32e6a 100644 --- a/src/dxgi/dxgi_options.h +++ b/src/dxgi/dxgi_options.h @@ -45,6 +45,9 @@ namespace dxvk { /// Sync interval. Overrides the value /// passed to IDXGISwapChain::Present. int32_t syncInterval; + + /// Enables D3D10 support + bool d3d10Enable; }; }