-
Notifications
You must be signed in to change notification settings - Fork 464
Getting Started
This is the Getting Started tutorial for DirectX Tool Kit which introduces the reader to using the DirectX Tool Kit with DirectX 12.
If you are new to DirectX, the place to start is the DirectX Tool Kit for DirectX 11 tutorials. 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.
This tutorial assumes the reader is familiar with the basics of C++ programming using Microsoft Visual C++, including writing code, building applications, and basic debugging. Coding conventions here will make use of C++11 language features such as nullptr, auto, simple lambdas (aka anonymous functions), and the standard smart-pointer std::unique_ptr / std::make_unique<T>(), but will generally be otherwise 'core' C++. Some aspects of the library make use of perfect-forwarding and variadic templates in the implementation, but the client code doesn't need to use these features directly.
The tutorial assumes the reader is already familiar with the DirectX 12 API, and is an expert in graphics programming. If you are already an expert in Direct3D 11 but are new to the DirectX 12 API, then you should start by reviewing the Direct3D 12 Programming Guide on MSDN as well as the official samples on GitHub.
Note that Direct3D 12 and DirectX Tool Kit are not Windows Runtime (aka "WinRT") components, so we do not make use of the C++/CX language extensions or the
/ZWswitch. DirectX Tool Kit is a 'pure' C++ library, which is why it's not directly usable by Visual Basic, C# or HTML+JavaScript applications.
One thing that many C++ developers, particularly game developers, may not be all that familiar with is "C++ Exception Handling". This is distinct from "Structured Exception Handling" (SEH) which some developers have seen in the past, and can leave an unfavorable impression of C++ EH. On both ARM and x64 native platforms, C++ EH is very efficient, although the x86 32-bit implementation does have some quirks. In any case, DirectX Tool Kit uses C++ Exception Handling for most error conditions, just as the Standard Template Library (STL) does and the standard behavior of the operator new.
For debugging exceptions thrown by the DirectX Tool Kit, you should enable the checkbox next to std::exception in the Visual Studio Exception Settings dialog. It's not on by default.
For some more detail on how the Visual Studio debugger deals with exceptions, read this blog post.
These tutorials are written with game development in mind as the target application since games are an excellent fit for the 'immersive DirectX app' model. DirectX 12 can also be used for non-game applications. The reader is assumed to be an expert in Direct3D programming and have a basic understanding of the DirectX 12 API.
For learning purposes, these instructions are going to focus on the following setup:
- Visual Studio 2015 Update 3 or Visual Studio 2017 (15.5 update) Community, Professional, Premium, or Ultimate
- Windows 10 SDK (14393, 15063, or 16299)
- Windows 10
We will be using a Win32 desktop application project template, but all these techniques and APIs apply to Universal Windows Platform (UWP) apps and Xbox One XDK apps as well.
There is no need to install the legacy DirectX SDK to use DirectX Tool Kit. The DirectX SDK is deprecated, and has no DirectX 12 material. Since the DirectX Tool Kit for DirectX 12 projects are built with
_WIN32_WINNTset to0x0A00, DirectX Tool Kit for Audio will make use of XAudio 2.9 which is included with Windows 10 and the Windows 10 SDK.
Be sure to install Visual C++ which requires using the Custom install as it's not part of the Typical install.

You also need to select the "Tools and Windows 10 SDK" feature under "Universal Windows App Development Tools" even if you are just planning to build Win32 desktop apps.

See the Visual C++ Team Blog posts on the toolset and Windows 10 SDK for further details.
When using the new VS 2017 installer be sure to select the appropriate workloads. Here are the recommended options to select:
- Workload: Game development with C++
- Workload: Desktop development with C++
- Workload: Universal Windows Platform development
- Optional component: C++ Tools for UWP
For a quick introduction to DirectX 12 programming, take a look at the Introductory Graphics samples on Xbox-ATG-Samples.
- Basic drawing: SimpleTriangle12
- Basic texturing: SimpleTexture12
- Basic lighting: SimpleLighting12
- DirectCompute: SimpleCompute12
- Tessellation: SimpleBezier12
- Instancing: SimpleInstancing12
- Multisample Antialiasing: SimpleMSAA12
- Sprites and textures
- Drawing text
- Simple rendering
- 3D shapes
- Rendering a model
- Using advanced shaders
- Using HDR rendering
For materials on using DirectX Tool Kit's Input, Math, and Audio support, see the DirectX Tool Kit for DirectX 11 tutorials as all those types and classes are identical.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Xbox One
- Xbox Series X|S
- x86
- x64
- ARM64
- Visual Studio 2026
- Visual Studio 2022 (17.12 or later)
- clang/LLVM v12 - v20
- MinGW 12.2, 13.2
- CMake 3.21