This interface is part of the Direct3D 12 Debug Layer.
The ID3D12Debug interface inherits from the IUnknown interface.
The ID3D12Debug interface has these methods.
Enables the Direct3D 12 debug layer. The debug layer performs runtime validation of Direct3D 12 API calls and provides detailed error reporting.
void EnableDebugLayer()
This method has no parameters.
This method does not return a value.
You must call EnableDebugLayer before creating your first Direct3D 12 device object. Calling it after device creation may result in undefined behavior or a crash. The debug layer adds overhead, so it should only be used during development and debugging. For release builds, you should omit this call.
On Windows 10, version 1607 or later, the debug layer is enabled by default if the Graphics Tools feature is installed and not explicitly disabled by the application. However, it's still good practice to call EnableDebugLayer explicitly for maximum compatibility and control.
#include <windows.h>
#include <d3d12.h>
#include <dxgidebug.h>
// ...
// Enable the D3D12 debug layer
if (SUCCEEDED(dxguuid::D3D12GetDebugInterface(__uuidof(ID3D12Debug), (void**)&pDebugInterface)))
{
pDebugInterface->EnableDebugLayer();
pDebugInterface->Release(); // Release the debug interface after enabling
}
// Now create your D3D12 device
// ...
| Minimum supported client | Windows 10 |
| Minimum supported server | Windows Server 2016 |
| Header file | d3d12.h |
| Library | D3D12.lib |
| DLL | D3D12.dll |