DirectX Graphics Documentation

ID3D12Debug Interface

This interface is part of the Direct3D 12 Debug Layer.

Interface Members

The ID3D12Debug interface inherits from the IUnknown interface.

The ID3D12Debug interface has these methods.

Methods

EnableDebugLayer

Enables the Direct3D 12 debug layer. The debug layer performs runtime validation of Direct3D 12 API calls and provides detailed error reporting.

void EnableDebugLayer()
Parameters

This method has no parameters.

Return Value

This method does not return a value.

Remarks

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.

Example Code


#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
// ...
        

Requirements

Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Header file d3d12.h
Library D3D12.lib
DLL D3D12.dll

See Also