Fall back to creating a Release runtime Direct3D device if Debug device creation fails.

TRAC #22881 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2220 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 132862fa
...@@ -163,14 +163,32 @@ EGLint Renderer11::initialize() ...@@ -163,14 +163,32 @@ EGLint Renderer11::initialize()
D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_10_0,
}; };
HRESULT result = D3D11CreateDevice(NULL, HRESULT result = S_OK;
#ifdef _DEBUG
result = D3D11CreateDevice(NULL,
D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_HARDWARE,
NULL, NULL,
#if defined(_DEBUG)
D3D11_CREATE_DEVICE_DEBUG, D3D11_CREATE_DEVICE_DEBUG,
#else featureLevels,
ArraySize(featureLevels),
D3D11_SDK_VERSION,
&mDevice,
&mFeatureLevel,
&mDeviceContext);
if (!mDevice || FAILED(result))
{
ERR("Failed creating Debug D3D11 device - falling back to release runtime.\n");
}
if (!mDevice || FAILED(result))
#endif
{
result = D3D11CreateDevice(NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
0, 0,
#endif
featureLevels, featureLevels,
ArraySize(featureLevels), ArraySize(featureLevels),
D3D11_SDK_VERSION, D3D11_SDK_VERSION,
...@@ -183,6 +201,7 @@ EGLint Renderer11::initialize() ...@@ -183,6 +201,7 @@ EGLint Renderer11::initialize()
ERR("Could not create D3D11 device - aborting!\n"); ERR("Could not create D3D11 device - aborting!\n");
return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer
} }
}
IDXGIDevice *dxgiDevice = NULL; IDXGIDevice *dxgiDevice = NULL;
result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice); result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment