Share via


Direct3D 12 Debugging

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Describes the methods available to assist with graphics debugging and diagnostics of Direct3D 12 apps.

Debug layer

The debug layer provides extensive additional parameter and consistency validation (such as validating shader linkage and resource binding, validating parameter consistency, and reporting error descriptions).

To create a device that supports the debug layer, you must add the D3D12SDKLayers.h to your project, and link to the D3D12SDKLayers.dll.

When the debug layer lists memory leaks, it outputs a list of object interface pointers along with their friendly names. The default friendly name is "<unnamed>". You can set the friendly name by using the ID3D12Object::SetName method. Typically, you should compile these calls out of your production version.

We recommend that you use the debug layer to debug your apps to ensure that they are clean of errors and warnings. The debug layer helps you write Direct3D 12 code. In addition, your productivity can increase when you use the debug layer because you can immediately see the causes of obscure rendering errors or even black screens at their source. The debug layer provides warnings for many issues. For example:

  • Forgot to set a texture but read from it in your pixel shader.
  • Output depth but have no depth-stencil state bound.
  • Texture creation failed with INVALIDARG.

Counters and Queries

Performance Measurement