Getting Started with Direct3D 12

The first thing to do is get up to speed on Direct3D 11 (see Getting Started with Direct3D 11), especially if you are coming from a background of knowing Direct3D 9. Jumping feet-first into Direct3D 12 without a solid grounding in what a Direct3D feature level means, DXGI device-and-swapchain creation, the modern HLSL compiler story, the fate of the legacy DirectX SDK, and the Direct3D 10/Direct3D 11 state model and graphics pipeline design is a recipe for confusion and frustration.

DirectX 12 is an expert API which builds on knowing the ins & outs of DirectX 11. DirectX 12 is an extremely low-level API designed for graphic experts who have a solid understanding of the architecture of modern GPU hardware, and can essentially write the DirectX 11 Runtime from scratch. Both DirectX 11 and DirectX 12 provide access to the same hardware features on Windows 10, but drive the hardware in different ways which can allow a well-optimized DirectX 12 engine to achieve much lower CPU overhead than in DirectX 11.

With that preamble out of the way, you should familiarize yourself with the documentation on MSDN. Then install Visual Studio 2015 or Visual Studio 2017 with the latest Windows 10 SDK.

Samples: The official samples are on GitHub. For introductory samples, take a look at D3D12HelloWorld (PC desktop and UWP), as well as the Xbox ATG Graphics Introductory Graphics samples. DirectX Tool Kit for DirectX 12 includes some tutorials as well.

Presentations: There've been a number of public presentations on Direct3D 12.

DirectX: Evolving Microsoft's Graphics Platform (GDC 2014): link

Direct3D 12 API Preview (BUILD 2014): link

Better Power, Better Performance: Your Game on DirectX12 (GDC 2015): link

Advanced DirectX12 Graphics and Performance (GDC 2015/BUILD 2015): link

Direct3D Update: (GDC 2016): link

AMD, Intel, and NVidia also have additional materials available online.

Videos: There is a series of YouTube videos on various aspects of Direct3D 12 you should take a look at as well.

Debugging: The debug device (aka the Developer Runtime) on Windows 10 is not installed by any SDK. It is enabled as a Windows Optional Feature called "Graphics Tools". See this post for details. You should also familiarize yourself with DXGI debugging features. Note that the WARP12 device is only available when the "Graphics Tools" feature is enabled.

Drivers: Keep in mind that not all video hardware have DirectX 12 capable (WDDM 2.0) drivers available. You should make sure you have the latest drivers installed and verify that your video card supports DirectX 12. Otherwise, you'll have to limit yourself to using the WARP12 software device.

Utilities: The various Direct3D 12 templates make use of a simple header-only helper D3DX12. This does not have nearly the scope of the deprecated D3DX libraries, but is useful in taking care of many of the more mundane aspects of creating the required structures. For support in loading textures, rendering fonts & sprites, loading models, etc. see DirectX Tool Kit for DirectX 12. For graphics math, see DirectXMath. You should use DirectXTex, DirectXMesh, and UVAtlas for content processing as well.

Multi-GPU: See this blog post.

Books: So far the only book I'm aware of that's been published is Frank Luna's Introduction to 3D Game Programming with DirectX 12 (2016).

Related: Anatomy of Direct3D 12 Create Device, Direct3D Game Visual Studio templates (Redux), Windows 10 Anniversary Update SDK

Comments (8)

  1. Martin Fleisz says:

    I don’t know if this is the right place to post this question but maybe you can still help me out:
    Do you know where I can find documentation about the DirectX12 DDI (the user-mode DDI)? I was able to find documentation about the WDDM 2 kernel-mode DDI but I couldn’t find any information on the user-mode part. Thanks for any help!

  2. This link seems to be the only mention of it.

  3. Martin Fleisz says:

    Thanks Chuck but I had hoped for a documentation of the the DDI functions that are more or less defined in the d3d12umddi.h header file from the WDK. I could not find any documentation about it and without it’s kind of hard (or even impossible) to develop a D3D 12 display driver.

  4. Simon says:

    For my current project, I decided since I’m willing to target only Windows 10 users to take the plunge and learn Direct3D 12, having had some exposure in the past with both 9 and 11. I really really really like the D3D12 API a lot better than 11, which feels like a hideous pig of an API in comparison. I don’t want to go back.

    Much to my disappointment, it turns out that Windows 10 targets are not necessarily *guaranteed* to support D3D12 in their display driver. Basically my project is stopped one month in, and I have to restart the plumbing all over again and use D3D11. Kind of wish I had thought to check and confirm whether a lack of D3D12 driver under Windows 10 were actually a possibility. All of the hoopla about it being a “Windows 10 only” API had me make a stupid assumption that all win 10 users will be able to run it. D’oh. D3D11 sucks. BOOO!

    1. You can use the D3D12 API always on Windows 10. It’s the feature levels that change. If a card is on level 11 you can’t use advanced D3D12 features but that doesn’t mean the entire D3D12 API is unusable.

      1. Simon is correct here, Wessam. To successfully create a Direct3D 12 device, the system must have a WDDM 2.0 driver for the video device. While it is technically possible to write a WDDM 2.0 compliant driver for older video cards, no hardware vendor to date has provided a WDDM 2.0 driver for cards older than Direct3D hardware level 11.0.

        That said, if you look at PC gamers the majority of them have Direct3D 12 capable video cards (although not all of those are yet on Windows 10). Unlikely the Direct3D 10 era, it didn’t require that everyone buy new hardware, they just had to have ‘recent’ hardware. It really depends on your target audience.

        If you are going for a ‘breadth’ title, then DirectX 11 is probably a better choice. If you are writing a ‘core gamer’ title, and want to really push the hardware to it’s limits, then DirectX 12 only is a viable option which also happens to be supported by Xbox One.

  5. I’m curious to know about the resource creation paradigm in D3D12 (i.e. copying data to upload heaps then scheduling the GPU to pull from them). Was this what drivers did for us generally behind the scenes in D3D11? Or were they able to support somehow direct writes from the CPU to VRAM?


    1. DirectX 12 lays bare all the things that used to happen ‘by magic’ coordinated by the DirectX 11 runtime. In DirectX 12, the application is basically responsible for 90% of what the Runtime used to do.

      Exactly when to upload data to the GPU most optimally depends on the application. For some, a bulk one-time upload “as fast as possible” is the right choice. For other streaming-based games, being able to load a minimal set of assets and then upload on-demand without interrupting the main render loop is essential for a glitch-free experience.

Skip to main content