D3D12 -> D3D11 device fallback

This commit is contained in:
Jack Andersen 2016-06-27 12:54:02 -10:00
parent c7df255c24
commit affb4e98d3
1 changed files with 33 additions and 28 deletions

View File

@ -141,9 +141,8 @@ public:
/* Create device */ /* Create device */
HRESULT hr = MyD3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), &m_3dCtx.m_ctx12.m_dev); HRESULT hr = MyD3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), &m_3dCtx.m_ctx12.m_dev);
if (FAILED(hr)) if (!FAILED(hr))
Log.report(logvisor::Fatal, "unable to create D3D12 device"); {
/* Obtain DXGI Factory */ /* Obtain DXGI Factory */
hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx12.m_dxFactory); hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx12.m_dxFactory);
if (FAILED(hr)) if (FAILED(hr))
@ -175,6 +174,12 @@ public:
Log.report(logvisor::Info, "initialized D3D12 renderer"); Log.report(logvisor::Info, "initialized D3D12 renderer");
return; return;
} }
else
{
/* Some Win10 client HW doesn't support D3D12 (despite being supposedly HW-agnostic) */
m_3dCtx.m_ctx12.m_dev.Reset();
}
}
#endif #endif
HMODULE d3d11lib = LoadLibraryW(L"D3D11.dll"); HMODULE d3d11lib = LoadLibraryW(L"D3D11.dll");
if (d3d11lib && !noD3d) if (d3d11lib && !noD3d)