|
@@ -5911,6 +5911,34 @@ _SOKOL_PRIVATE void _sapp_d3d11_create_device_and_swapchain(void) {
|
|
|
&feature_level, /* pFeatureLevel */
|
|
|
&_sapp.d3d11.device_context); /* ppImmediateContext */
|
|
|
_SOKOL_UNUSED(hr);
|
|
|
+ #if defined(SOKOL_DEBUG)
|
|
|
+ if (!SUCCEEDED(hr)) {
|
|
|
+ // if initialization with D3D11_CREATE_DEVICE_DEBUG failes, this could be because the
|
|
|
+ // 'D3D11 debug layer' stopped working, indicated by the error message:
|
|
|
+ // ===
|
|
|
+ // D3D11CreateDevice: Flags (0x2) were specified which require the D3D11 SDK Layers for Windows 10, but they are not present on the system.
|
|
|
+ // These flags must be removed, or the Windows 10 SDK must be installed.
|
|
|
+ // Flags include: D3D11_CREATE_DEVICE_DEBUG
|
|
|
+ // ===
|
|
|
+ //
|
|
|
+ // ...just retry with the DEBUG flag switched off
|
|
|
+ SOKOL_LOG("sokol_app.h: D3D11CreateDeviceAndSwapChain() with D3D11_CREATE_DEVICE_DEBUG failed, retrying without debug flag.\n");
|
|
|
+ create_flags &= ~D3D11_CREATE_DEVICE_DEBUG;
|
|
|
+ hr = D3D11CreateDeviceAndSwapChain(
|
|
|
+ NULL, /* pAdapter (use default) */
|
|
|
+ D3D_DRIVER_TYPE_HARDWARE, /* DriverType */
|
|
|
+ NULL, /* Software */
|
|
|
+ create_flags, /* Flags */
|
|
|
+ NULL, /* pFeatureLevels */
|
|
|
+ 0, /* FeatureLevels */
|
|
|
+ D3D11_SDK_VERSION, /* SDKVersion */
|
|
|
+ sc_desc, /* pSwapChainDesc */
|
|
|
+ &_sapp.d3d11.swap_chain, /* ppSwapChain */
|
|
|
+ &_sapp.d3d11.device, /* ppDevice */
|
|
|
+ &feature_level, /* pFeatureLevel */
|
|
|
+ &_sapp.d3d11.device_context); /* ppImmediateContext */
|
|
|
+ }
|
|
|
+ #endif
|
|
|
SOKOL_ASSERT(SUCCEEDED(hr) && _sapp.d3d11.swap_chain && _sapp.d3d11.device && _sapp.d3d11.device_context);
|
|
|
|
|
|
// mimimize frame latency, disable Alt-Enter
|