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,25 +163,44 @@ EGLint Renderer11::initialize() ...@@ -163,25 +163,44 @@ EGLint Renderer11::initialize()
D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_10_0,
}; };
HRESULT result = D3D11CreateDevice(NULL, HRESULT result = S_OK;
D3D_DRIVER_TYPE_HARDWARE,
NULL, #ifdef _DEBUG
#if defined(_DEBUG) result = D3D11CreateDevice(NULL,
D3D11_CREATE_DEVICE_DEBUG, D3D_DRIVER_TYPE_HARDWARE,
#else NULL,
0, D3D11_CREATE_DEVICE_DEBUG,
#endif featureLevels,
featureLevels, ArraySize(featureLevels),
ArraySize(featureLevels), D3D11_SDK_VERSION,
D3D11_SDK_VERSION, &mDevice,
&mDevice, &mFeatureLevel,
&mFeatureLevel, &mDeviceContext);
&mDeviceContext);
if (!mDevice || FAILED(result))
{
ERR("Failed creating Debug D3D11 device - falling back to release runtime.\n");
}
if (!mDevice || FAILED(result)) if (!mDevice || FAILED(result))
#endif
{ {
ERR("Could not create D3D11 device - aborting!\n"); result = D3D11CreateDevice(NULL,
return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer D3D_DRIVER_TYPE_HARDWARE,
NULL,
0,
featureLevels,
ArraySize(featureLevels),
D3D11_SDK_VERSION,
&mDevice,
&mFeatureLevel,
&mDeviceContext);
if (!mDevice || FAILED(result))
{
ERR("Could not create D3D11 device - aborting!\n");
return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer
}
} }
IDXGIDevice *dxgiDevice = NULL; IDXGIDevice *dxgiDevice = NULL;
......
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