Fallback when DirectX debug layer is unavailable

This commit is contained in:
David Svez
2026-08-02 20:45:36 -05:00
committed by Wojtek Figat
parent 236e9c27c7
commit a67ff38ed5
@@ -549,7 +549,19 @@ bool GPUDeviceDX11::Init()
else
#endif
{
VALIDATE_DIRECTX_CALL(D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, flags, &targetFeatureLevel, 1, D3D11_SDK_VERSION, &_device, &createdFeatureLevel, &_imContext));
HRESULT createResult = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, flags, &targetFeatureLevel, 1, D3D11_SDK_VERSION, &_device, &createdFeatureLevel, &_imContext);
#if GPU_ENABLE_DIAGNOSTICS
if (createResult == DXGI_ERROR_SDK_COMPONENT_MISSING)
{
// The Direct3D debug layer is an optional Windows component. Development builds
// should remain usable when it is not installed, just like adapter probing above.
flags &= ~D3D11_CREATE_DEVICE_DEBUG;
createResult = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, flags, &targetFeatureLevel, 1, D3D11_SDK_VERSION, &_device, &createdFeatureLevel, &_imContext);
if (SUCCEEDED(createResult))
LOG(Warning, "Direct3D SDK debug layers were requested, but not available. Continuing without them.");
}
#endif
VALIDATE_DIRECTX_CALL(createResult);
}
if (!_device || !_imContext)
return true;