mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
D3D12: Clean up debug device creation path
This commit is contained in:
@ -423,52 +423,29 @@ HRESULT Create(HWND wnd)
|
|||||||
swap_chain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
swap_chain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
swap_chain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
swap_chain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST) || defined(USE_D3D12_DEBUG_LAYER)
|
||||||
// Creating debug devices can sometimes fail if the user doesn't have the correct
|
// Enabling the debug layer will fail if the Graphics Tools feature is not installed.
|
||||||
// version of the DirectX SDK. If it does, simply fallback to a non-debug device.
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
ID3D12Debug* debug_controller;
|
||||||
|
hr = d3d12_get_debug_interface(IID_PPV_ARGS(&debug_controller));
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
ID3D12Debug* debug_controller;
|
debug_controller->EnableDebugLayer();
|
||||||
hr = d3d12_get_debug_interface(IID_PPV_ARGS(&debug_controller));
|
debug_controller->Release();
|
||||||
if (SUCCEEDED(hr))
|
}
|
||||||
{
|
else
|
||||||
debug_controller->EnableDebugLayer();
|
{
|
||||||
debug_controller->Release();
|
MessageBox(wnd, _T("WARNING: Failed to enable D3D12 debug layer, please ensure the Graphics Tools feature is installed."), _T("Dolphin Direct3D 12 backend"), MB_OK | MB_ICONERROR);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox(wnd, _T("Failed to initialize Direct3D debug layer, please make sure it is installed."), _T("Dolphin Direct3D 12 backend"), MB_OK | MB_ICONERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = d3d12_create_device(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device12));
|
|
||||||
|
|
||||||
s_feat_level = D3D_FEATURE_LEVEL_11_0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr))
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
#ifdef USE_D3D12_DEBUG_LAYER
|
|
||||||
ID3D12Debug* debug_controller;
|
|
||||||
hr = d3d12_get_debug_interface(IID_PPV_ARGS(&debug_controller));
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
debug_controller->EnableDebugLayer();
|
|
||||||
debug_controller->Release();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox(wnd, _T("Failed to initialize Direct3D debug layer."), _T("Dolphin Direct3D 12 backend"), MB_OK | MB_ICONERROR);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
hr = d3d12_create_device(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device12));
|
|
||||||
|
|
||||||
s_feat_level = D3D_FEATURE_LEVEL_11_0;
|
if (SUCCEEDED(hr))
|
||||||
}
|
{
|
||||||
|
hr = d3d12_create_device(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device12));
|
||||||
|
s_feat_level = D3D_FEATURE_LEVEL_11_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
Reference in New Issue
Block a user