1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-06 04:24:14 +01:00

[d3d11] D3D11CreateDeviceAndSwapChain: Ignore swap chain if null

Fixes some issue with ReShade.
This commit is contained in:
Philip Rebohle 2018-12-02 13:43:55 +01:00
parent cf21111401
commit e4b91057ac

View File

@ -187,6 +187,9 @@ extern "C" {
Com<ID3D11Device> d3d11Device; Com<ID3D11Device> d3d11Device;
Com<ID3D11DeviceContext> d3d11Context; Com<ID3D11DeviceContext> d3d11Context;
if (ppSwapChain && !pSwapChainDesc)
return E_INVALIDARG;
// Try to create a device first. // Try to create a device first.
HRESULT status = D3D11CreateDevice(pAdapter, DriverType, HRESULT status = D3D11CreateDevice(pAdapter, DriverType,
Software, Flags, pFeatureLevels, FeatureLevels, Software, Flags, pFeatureLevels, FeatureLevels,
@ -197,9 +200,7 @@ extern "C" {
// Again, the documentation does not exactly tell us what we // Again, the documentation does not exactly tell us what we
// need to do in case one of the arguments is a null pointer. // need to do in case one of the arguments is a null pointer.
if (pSwapChainDesc == nullptr) if (ppSwapChain) {
return E_INVALIDARG;
Com<IDXGIDevice> dxgiDevice = nullptr; Com<IDXGIDevice> dxgiDevice = nullptr;
Com<IDXGIAdapter> dxgiAdapter = nullptr; Com<IDXGIAdapter> dxgiAdapter = nullptr;
Com<IDXGIFactory> dxgiFactory = nullptr; Com<IDXGIFactory> dxgiFactory = nullptr;
@ -224,6 +225,7 @@ extern "C" {
Logger::err("D3D11CreateDeviceAndSwapChain: Failed to create swap chain"); Logger::err("D3D11CreateDeviceAndSwapChain: Failed to create swap chain");
return E_FAIL; return E_FAIL;
} }
}
if (ppDevice != nullptr) if (ppDevice != nullptr)
*ppDevice = d3d11Device.ref(); *ppDevice = d3d11Device.ref();