Bugfix - creating swap chain twice in d3d11

Not sure what I was thinking when writing this

dd60b5d576 (commitcomment-31801518)
This commit is contained in:
krzys-h 2018-12-29 11:38:06 +01:00
parent bddcd2d5e5
commit 1cb1ea55b1
2 changed files with 33 additions and 9 deletions

View File

@ -23,6 +23,39 @@
#if defined(HAVE_DYNAMIC) && !defined(__WINRT__)
#include <dynamic/dylib.h>
HRESULT WINAPI D3D11CreateDevice(
IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
CONST D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
ID3D11Device** ppDevice,
D3D_FEATURE_LEVEL* pFeatureLevel,
ID3D11DeviceContext** ppImmediateContext)
{
static dylib_t d3d11_dll;
static PFN_D3D11_CREATE_DEVICE fp;
if (!d3d11_dll)
d3d11_dll = dylib_load("d3d11.dll");
if (!d3d11_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D11_CREATE_DEVICE)dylib_proc(
d3d11_dll, "D3D11CreateDevice");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(
pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion,
ppDevice, pFeatureLevel, ppImmediateContext);
}
HRESULT WINAPI D3D11CreateDeviceAndSwapChain(
IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,

View File

@ -687,20 +687,11 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
}
else
{
#if defined(__WINRT__)
if (FAILED(D3D11CreateDevice(
NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags,
requested_feature_levels, number_feature_levels,
D3D11_SDK_VERSION, &d3d11->device,
&d3d11->supportedFeatureLevel, &d3d11->context)))
#else
if (FAILED(D3D11CreateDeviceAndSwapChain(
NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags,
requested_feature_levels, number_feature_levels,
D3D11_SDK_VERSION, &desc,
(IDXGISwapChain**)&d3d11->swapChain, &d3d11->device,
&d3d11->supportedFeatureLevel, &d3d11->context)))
#endif
goto error;
}