microsoft/DirectXTK12
C++
Captured source
source ↗microsoft/DirectXTK12
Description: The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
Language: C++
License: MIT
Stars: 1725
Forks: 464
Open issues: 14
Created: 2016-06-17T00:54:50Z
Pushed: 2026-06-08T17:42:14Z
Default branch: main
Fork: no
Archived: no
README: !DirectX Logo
DirectX Tool Kit for DirectX 12
https://go.microsoft.com/fwlink/?LinkID=615561
Copyright (c) Microsoft Corporation.
May 7, 2026
This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 12 C++ code for Win32 desktop applications for Windows 11 and Windows 10, game titles for Xbox Series X\|S and Xbox One, and Universal Windows Platform (UWP) apps for Windows 11 and Windows 10.
This code is designed to build with Visual Studio 2022, Visual Studio 2026, clang for Windows v12 or later, or MinGW 12.2. Use of the Windows 10 May 2020 Update SDK (19041) or later is required for Visual Studio.
These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see Where is the DirectX SDK?.
Directory Layout
Inc\
- Public Header Files (in the DirectX C++ namespace):
- Audio.h - low-level audio API using XAudio2 (DirectXTK for Audio public header)
- BufferHelpers.h - C++ helpers for creating D3D resources from CPU data
- CommonStates.h - common D3D state combinations
- DDSTextureLoader.h - light-weight DDS file texture loader
- DescriptorHeap.h - helper for managing DX12 descriptor heaps
- DirectXHelpers.h - misc C++ helpers for D3D programming
- EffectPipelineStateDescription.h - helper for creating PSOs
- Effects.h - set of built-in shaders for common rendering tasks
- GamePad.h - gamepad controller helper using Windows.Gaming.Input or GameInput
- GeometricPrimitive.h - draws basic shapes such as cubes and spheres
- GraphicsMemory.h - helper for managing dynamic graphics memory allocation
- Keyboard.h - keyboard state tracking helper
- Model.h - draws meshes loaded from .CMO, .SDKMESH, or .VBO files
- Mouse.h - mouse helper
- PostProcess.h - set of built-in shaders for common post-processing operations
- PrimitiveBatch.h - simple and efficient way to draw user primitives
- RenderTargetState.h - helper for communicating render target requirements when creating PSOs
- ResourceUploadBatch.h - helper for managing texture resource upload to the GPU
- ScreenGrab.h - light-weight screen shot saver
- SimpleMath.h - simplified C++ wrapper for DirectXMath
- SpriteBatch.h - simple & efficient 2D sprite rendering
- SpriteFont.h - bitmap based text rendering
- VertexTypes.h - structures for commonly used vertex data formats
- WICTextureLoader.h - WIC-based image file texture loader
- XboxDDSTextureLoader.h - Xbox exclusive apps variant of DDSTextureLoader
Src\
- DirectXTK12 source files and internal implementation headers
Audio\
- DirectXTK12 for Audio source files and internal implementation headers
build\
- Contains miscellaneous build files and scripts.
skills\
- Contains published CoPilot skills for use by developers.
> MakeSpriteFont and XWBTool can be found in the DirectX Tool Kit for DirectX 11. Audio, GamePad, Keyboard, Mouse, and SimpleMath are identical between both versions of the toolkit.
Documentation
Documentation is available on the GitHub wiki.
CoPilot Usage
For CoPilot CLI assistance with using DirectX Tool Kit, try:
winget install GitHub.Copilot winget install GitHub.cli gh skill install microsoft/directxtk12 copilot /skills list
Notices
All content and source code for this package are subject to the terms of the MIT License.
For the latest version of DirectXTK12, bug reports, etc. please visit the project site on GitHub.
Comparisons to DirectX 11 Version
- No support for Visual Studio Directed Graph Shader Language (DGSL) effect shaders (i.e. _DGSLEffect_). CMO files are loaded using BasicEffect or SkinnedEffect materials.
- VertexTypes does not include VertexPositionNormalTangentColorTexture or VertexPositionNormalTangentColorTextureSkinning which were intended for use with the DGSL pipeline.
- DirectX Tool Kit for DirectX 11 supports Feature Level 9.x, while DirectX 12 requires Direct3D Feature Level 11.0. There are no expected DirectX 12 drivers for any lower feature level devices.
- The library assumes it is building for Windows 10 (aka `
_WIN32_WINNT=0x0A00`) so it makes use of XAudio 2.9 and WIC2 as well as DirectX 12.
- DirectX Tool Kit for Audio, GamePad, Keyboard, Mouse, and SimpleMath are identical to the DirectX 11 version.
Release Notes
FOR SECURITY ADVISORIES, see GitHub.
For a full change history, see CHANGELOG.md.
- The CMake projects require 3.21 or later.
- In the June 2024 release, the defaulted parameter
initialStatefor the `CreateUploadBufferfunction in _BufferHelpers_ was removed. Per the DirectX 12 validation layer, the only valid initial state for an upload buffer isD3D12_RESOURCE_STATE_GENERIC_READ`.
- Starting with the February 2023 release, the Mouse class implementation of relative mouse movement was updated to accumulate changes between calls to `
GetState. By default, each time you callGetStatethe deltas are reset which works for scenarios where you use relative movement but only call the method once per frame. If you call it more than once per frame, then add an explicit call toEndOfInputFrame` to use an explicit reset model instead.
- As of the September 2022 release, the library makes use of C++11 inline namespaces for differing types that have the same names in the DirectX 11 and DirectX 12 version of the _DirectX Tool Kit_. This provides a link-unique name such as `
DirectX::DX12::SpriteBatchthat will appear in linker output messages. In most use cases, however, there is no need to add explicitDX12` namespace resolution in client code.
- Starting with the June 2021 release, this library builds the HLSL shaders…
Excerpt shown — open the source for the full document.