mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 20:18:47 +02:00
Examples: DX12: Enable breaking on any warning/error when debug interface is enabled. (#3462, #3472) + misc comments & minor fixes.
This commit is contained in:
@ -241,19 +241,32 @@ bool CreateDeviceD3D(HWND hWnd)
|
||||
sd.Stereo = FALSE;
|
||||
}
|
||||
|
||||
// [DEBUG] Enable debug interface
|
||||
#ifdef DX12_ENABLE_DEBUG_LAYER
|
||||
ID3D12Debug* pdx12Debug = NULL;
|
||||
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&pdx12Debug))))
|
||||
{
|
||||
pdx12Debug->EnableDebugLayer();
|
||||
pdx12Debug->Release();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create device
|
||||
D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0;
|
||||
if (D3D12CreateDevice(NULL, featureLevel, IID_PPV_ARGS(&g_pd3dDevice)) != S_OK)
|
||||
return false;
|
||||
|
||||
// [DEBUG] Setup debug interface to break on any warnings/errors
|
||||
#ifdef DX12_ENABLE_DEBUG_LAYER
|
||||
if (pdx12Debug != NULL)
|
||||
{
|
||||
ID3D12InfoQueue* pInfoQueue = NULL;
|
||||
g_pd3dDevice->QueryInterface(IID_PPV_ARGS(&pInfoQueue));
|
||||
pInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true);
|
||||
pInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true);
|
||||
pInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, true);
|
||||
pInfoQueue->Release();
|
||||
pdx12Debug->Release();
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
|
||||
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
|
||||
|
Reference in New Issue
Block a user