Skip to content
Back to search

directxtk12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/microsoft--directxtk12/badge.svg)](/listings/microsoft--directxtk12)

HTML

<a href="/listings/microsoft--directxtk12"><img src="/api/listings/microsoft--directxtk12/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 186 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. ![DirectX Logo](https://raw.githubusercontent.com/wiki/Microsoft/DirectXTK12/X_jpg.jpg)
  2. # DirectX Tool Kit for DirectX 12
  3. https://go.microsoft.com/fwlink/?LinkID=615561
  4. Copyright (c) Microsoft Corporation.
  5. ## May 7, 2026
  6. 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.
  7. This code is designed to build with Visual Studio 2022, Visual Studio 2026, clang for Windows v12 or later, or MinGW. Use of the Windows 11 SDK ([22000](https://walbourn.github.io/windows-sdk-for-windows-11/)) or later is required for Visual Studio.
  8. These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see [Where is the DirectX SDK?](https://aka.ms/dxsdk).
  9. ## Directory Layout
  10. * ``Inc\``
  11. * Public Header Files (in the DirectX C++ namespace):
  12. * Audio.h - low-level audio API using XAudio2 (DirectXTK for Audio public header)
  13. * BufferHelpers.h - C++ helpers for creating D3D resources from CPU data
  14. * CommonStates.h - common D3D state combinations
  15. * DDSTextureLoader.h - light-weight DDS file texture loader
  16. * DescriptorHeap.h - helper for managing DX12 descriptor heaps
  17. * DirectXHelpers.h - misc C++ helpers for D3D programming
  18. * EffectPipelineStateDescription.h - helper for creating PSOs
  19. * Effects.h - set of built-in shaders for common rendering tasks
  20. * GamePad.h - gamepad controller helper using Windows.Gaming.Input or GameInput
  21. * GeometricPrimitive.h - draws basic shapes such as cubes and spheres
  22. * GraphicsMemory.h - helper for managing dynamic graphics memory allocation
  23. * Keyboard.h - keyboard state tracking helper
  24. * Model.h - draws meshes loaded from .CMO, .SDKMESH, or .VBO files
  25. * Mouse.h - mouse helper
  26. * PostProcess.h - set of built-in shaders for common post-processing operations
  27. * PrimitiveBatch.h - simple and efficient way to draw user primitives
  28. * RenderTargetState.h - helper for communicating render target requirements when creating PSOs
  29. * ResourceUploadBatch.h - helper for managing texture resource upload to the GPU
  30. * ScreenGrab.h - light-weight screen shot saver
  31. * SimpleMath.h - simplified C++ wrapper for DirectXMath
  32. * SpriteBatch.h - simple & efficient 2D sprite rendering
  33. * SpriteFont.h - bitmap based text rendering
  34. * VertexTypes.h - structures for commonly used vertex data formats
  35. * WICTextureLoader.h - WIC-based image file texture loader
  36. * XboxDDSTextureLoader.h - Xbox exclusive apps variant of DDSTextureLoader
  37. * ``Src\``
  38. * DirectXTK12 source files and internal implementation headers
  39. * ``Audio\``
  40. * DirectXTK12 for Audio source files and internal implementation headers
  41. * ``build\``
  42. * Contains miscellaneous build files and scripts.
  43. * ``skills\``
  44. * Contains published CoPilot skills for use by developers.
  45. > MakeSpriteFont and XWBTool can be found in the [DirectX Tool Kit for DirectX 11](https://github.com/microsoft/DirectXTK). Audio, GamePad, Keyboard, Mouse, and SimpleMath are identical between both versions of the toolkit.
  46. ## Documentation
  47. Documentation is available on the [GitHub wiki](https://github.com/Microsoft/DirectXTK12/wiki).
  48. ## CoPilot Usage
  49. For CoPilot CLI assistance with using DirectX Tool Kit, try:
  50. ```bash
  51. winget install GitHub.Copilot
  52. winget install GitHub.cli
  53. gh skill install microsoft/directxtk12
  54. copilot
  55. /skills list
  56. ```
  57. ## Notices
  58. All content and source code for this package are subject to the terms of the [MIT License](https://github.com/microsoft/DirectXTK12/blob/main/LICENSE).
  59. For the latest version of DirectXTK12, bug reports, etc. please visit the project site on [GitHub](https://github.com/microsoft/DirectXTK12).
  60. ## Comparisons to DirectX 11 Version
  61. * No support for Visual Studio Directed Graph Shader Language (DGSL) effect shaders (i.e. _DGSLEffect_). CMO files are loaded using BasicEffect or SkinnedEffect materials.
  62. * VertexTypes does not include VertexPositionNormalTangentColorTexture or VertexPositionNormalTangentColorTextureSkinning which were intended for use with the DGSL pipeline.
  63. * 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.
  64. * 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.
  65. * DirectX Tool Kit for Audio, GamePad, Keyboard, Mouse, and SimpleMath are identical to the DirectX 11 version.
  66. ## Release Notes
  67. FOR SECURITY ADVISORIES, see [GitHub](https://github.com/microsoft/DirectXTK12/security/advisories).
  68. For a full change history, see [CHANGELOG.md](https://github.com/microsoft/DirectXTK12/blob/main/CHANGELOG.md).
  69. * clang-format use for this project must match the version use by GitHub Super-Linter to pass the validation. VS 2022 and VS 2026 come with different versions, so to match use:
  70. ```cmd
  71. winget install --id=LLVM.LLVM --version 22.1.3
  72. powershell -File build/Format.ps1 -LLVM
  73. ```
  74. * The _directxtk12_desktop_win10_ and _directxtk12_uwp_ NuGet packages are deprecated. The best way to integrate the latest DirectX Tool Kit into your C++ project is using [vcpkg](https://github.com/microsoft/vcpkg/tree/master/ports/directxtk12).
  75. * The CMake projects require 3.21 or later.
  76. * In the June 2024 release, the defaulted parameter `initialState` for the ``CreateUploadBuffer`` function in _BufferHelpers_ was removed. Per the DirectX 12 validation layer, the only valid initial state for an upload buffer is ``D3D12_RESOURCE_STATE_GENERIC_READ``.
  77. * 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 call ``GetState`` the 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 to ``EndOfInputFrame`` to use an explicit reset model instead.
  78. * 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::SpriteBatch`` that will appear in linker output messages. In most use cases, however, there is no need to add explicit ``DX12`` namespace resolution in client code.
  79. * Starting with the June 2021 release, this library builds the HLSL shaders with Shader Model 6 via DXC. See [this wiki page](https://github.com/microsoft/DirectXTK12/wiki/Shader-Model-6) for more information. The Microsoft GDK projects have always used Shader Model 6.
  80. * Starting with the June 2020 release, this library makes use of [typed enum bitmask flags](https://walbourn.github.io/modern-c++-bitmask-types/) per the recommendation of the _C++ Standard_ section _17.5.2.1.3 Bitmask types_. This may have _breaking change impacts to client code:
  81. * You cannot pass the ``0`` literal as your flags value. Instead you must make use of the appropriate default enum value: ``AudioEngine_Default``, ``SoundEffectInstance_Default``, ``ModelLoader_Clockwise``, ``DDS_LOADER_DEFAULT``, or ``WIC_LOADER_DEFAULT``.
  82. * Use the enum type instead of ``DWORD`` if building up flags values locally with bitmask operations. For example, ```WIC_LOADER_FLAGS flags = WIC_LOADER_DEFAULT; if (...) flags |= WIC_LOADER_FORCE_SRGB;```
  83. * The UWP projects and the Win10 classic desktop project include configurations for the ARM64 platform. Building these requires installing the ARM64 toolset.
  84. * When using clang/LLVM for the ARM64/AArch64 platform, the Windows 11 SDK ([22000](https://walbourn.github.io/windows-sdk-for-windows-11/)) or later is required.
  85. * The ``CompileShaders.cmd`` script must have Windows-style (CRLF) line-endings. If it is changed to Linux-style (LF) line-endings, it can fail to build all the required shaders.
  86. * Support for targeting Xbox One using the legacy Xbox One XDK was retired in March 2023. See the February 2023 or earlier releases of _DirectX Tool Kit_ for the required MSBuild project files. It can also be built using the current CMake projects from an _Xbox One XDK Developer Command Prompt_ with the addition of CMake 3.21 or later to the path via the `x64-Debug-Durango` or `x64-Release-Durango` CMake preset.
  87. ## Support
  88. For questions, consider using [Stack Overflow](https://stackoverflow.com/questions/tagged/directxtk) with the _directxtk_ tag, or the [DirectX Discord Server](https://discord.gg/directx) in the _dx12-developers_ or _input-and-audio_ channels.
  89. For bug reports and feature requests, please use GitHub [issues](https://github.com/microsoft/DirectXTK12/issues) for this project.
  90. ## Contributing
  91. This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
  92. When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
  93. Tests for new features should also be submitted as a PR to the [Test Suite](https://github.com/walbourn/directxtk12test/wiki) repository.
  94. Information on coding-style can be found on [GitHub](https://github.com/microsoft/DirectXTK12/wiki/Implementation).
  95. ## Code of Conduct
  96. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more informatsion see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
  97. ## Trademarks
  98. This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
  99. ## Credits
  100. The _DirectX Tool Kit for DirectX 11_ is the work of Shawn Hargreaves and Chuck Walbourn, with contributions from Aaron Rodriguez Hernandez and Dani Roman.
  101. The _DirectX Tool Kit for DirectX 12_ is the work of Pete Lewis, Justin Saunders, and Chuck Walbourn based heavily on the DirectX Tool Kit for DirectX 11.
  102. Thanks to Shanon Drone for the SDKMESH file format.
  103. Thanks to Adrian Tsai for the geodesic sphere implementation.
  104. Thanks to Garrett Serack for his help in creating the NuGet packages for DirectX Tool Kit.
  105. Thanks to Pete Lewis and Justin Saunders for the normal-mapped and PBR shaders implementation.
  106. Thanks for Travis Johnson for the mGPU support.
  107. Thanks to Roberto Sonnino for his help with the CMO format and the VS Starter Kit animation.
  108. Thanks to Richie Meyer for their contribution of Xbox PIX custom memory and type allocation tracking events support.
  109. Thanks to Andrew Farrier, Jon Martin, and Scott Matloff for their help with code reviews.
  110. Thanks to Shawn Hargreaves and Nada Ouf for their continued support for this library.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.