1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-27 17:10:57 +01:00

Examples: DX12: Using IDXGIDebug1::ReportLiveObjects() when DX12_ENABLE_DEBUG_LAYER is enabled.

This commit is contained in:
omar 2019-10-18 18:20:53 +02:00
parent 4de32cc87e
commit eedc8f993f
2 changed files with 22 additions and 8 deletions

View File

@ -53,6 +53,7 @@ Other Changes:
- Docs: Improved and moved FAQ to docs/FAQ.md so it can be readable on the web. [@ButternCream, @ocornut]
- Docs: Added permanent redirect from https://www.dearimgui.org/faq to FAQ page.
- Demo: Added simple item reordering demo in Widgets -> Drag and Drop section. (#2823, #143) [@rokups]
- Examples: DX12: Using IDXGIDebug1::ReportLiveObjects() when DX12_ENABLE_DEBUG_LAYER is enabled.
- Backends: OSX: Fix using Backspace key. (#2578, #2817, #2818) [@DiligentGraphics]
- Backends: GLFW: Previously installed user callbacks are now restored on shutdown. (#2836) [@malte-v]

View File

@ -9,7 +9,12 @@
#include <dxgi1_4.h>
#include <tchar.h>
#define DX12_ENABLE_DEBUG_LAYER 0
//#define DX12_ENABLE_DEBUG_LAYER
#ifdef DX12_ENABLE_DEBUG_LAYER
#include <dxgidebug.h>
#pragma comment(lib, "dxguid.lib")
#endif
struct FrameContext
{
@ -233,15 +238,14 @@ bool CreateDeviceD3D(HWND hWnd)
sd.Stereo = FALSE;
}
if (DX12_ENABLE_DEBUG_LAYER)
#ifdef DX12_ENABLE_DEBUG_LAYER
ID3D12Debug* pdx12Debug = NULL;
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&pdx12Debug))))
{
ID3D12Debug* dx12Debug = NULL;
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&dx12Debug))))
{
dx12Debug->EnableDebugLayer();
dx12Debug->Release();
}
pdx12Debug->EnableDebugLayer();
pdx12Debug->Release();
}
#endif
D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0;
if (D3D12CreateDevice(NULL, featureLevel, IID_PPV_ARGS(&g_pd3dDevice)) != S_OK)
@ -329,6 +333,15 @@ void CleanupDeviceD3D()
if (g_fence) { g_fence->Release(); g_fence = NULL; }
if (g_fenceEvent) { CloseHandle(g_fenceEvent); g_fenceEvent = NULL; }
if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
#ifdef DX12_ENABLE_DEBUG_LAYER
IDXGIDebug1* pDebug = NULL;
if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&pDebug))))
{
pDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_SUMMARY);
pDebug->Release();
}
#endif
}
void CreateRenderTarget()