directxmath-usage
Skill1.8k starsChanged 5 months agoMITView on GitHub
Guide for integrating DirectXMath into new projects and an overview of the API, types, and classes. Use this skill when asked about how to use DirectXMath, integrate it into a project, or for an overview of available functionality.
Trending
Quiet since June.thin dataabout the whole repository
Who's talking about microsoft/DirectXMath
- microsoft/vcpkg“[directxmath] update for June 2026 (3.21b)”GitHub · Jun 13, 2026
- The-White-Box/whitebox“Bump deps/DirectXMath from `0dcbe70` to `e1386d2`”GitHub · Mar 12, 2025
- The-White-Box/whitebox“Bump deps/DirectXMath from `3de6f2b` to `0dcbe70`”GitHub · Mar 4, 2025
- The-White-Box/whitebox“Bump deps/DirectXMath from `6d10b28` to `3de6f2b`”GitHub · Mar 3, 2025
- The-White-Box/whitebox“Bump deps/DirectXMath from `6d10b28` to `c54a937`”GitHub · Feb 4, 2025
The biggest 5 of 13 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 13
Talked about on GitHub (13 times).
On GitHub · 13
- Jun 13, 2026[directxmath] update for June 2026 (3.21b) — microsoft/vcpkg0 reactions
- Mar 12, 2025Bump deps/DirectXMath from `0dcbe70` to `e1386d2` — The-White-Box/whitebox0 reactions · 2 comments
- Mar 4, 2025Bump deps/DirectXMath from `3de6f2b` to `0dcbe70` — The-White-Box/whitebox0 reactions · 2 comments
- Mar 3, 2025Bump deps/DirectXMath from `6d10b28` to `3de6f2b` — The-White-Box/whitebox0 reactions · 1 comment
- Feb 4, 2025Bump deps/DirectXMath from `6d10b28` to `c54a937` — The-White-Box/whitebox0 reactions · 3 comments
8 more on GitHub
- Jan 10, 2025Bump deps/DirectXMath from `1b98a60` to `6d10b28` — The-White-Box/whitebox0 reactions · 2 comments
- Dec 17, 2024Bump deps/DirectXMath from `d2bb6c0` to `1b98a60` — The-White-Box/whitebox0 reactions · 2 comments
- Dec 10, 2024Bump deps/DirectXMath from `78922ff` to `d2bb6c0` — The-White-Box/whitebox0 reactions · 2 comments
- Dec 3, 2024Bump deps/DirectXMath from `68a21b3` to `78922ff` — The-White-Box/whitebox0 reactions · 2 comments
- Feb 7, 2024[directxmath] Build error on x64-windows — microsoft/vcpkg0 reactions · 3 comments
- Apr 29, 2023slerp: investigate accuracy of slerp — kzhsw/keyframe-resample-c0 reactions · 2 comments
- Mar 2, 2022ライブラリ導入 — ttynsmr/potato0 reactions
- Jan 8, 2022`unknown-pragmas` warnings in a header file with GCC on Github Actions CI — Auburn/FastNoise20 reactions
In this repository2 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- Release ProcessSkill
The file
Files
DirectXMath Usage
Overview
DirectXMath is a header-only SIMD C++ linear algebra library for use in games, graphics engines, and other performance-sensitive applications. It provides vector, matrix, and quaternion math optimized for SSE/SSE2 (x86/x64) and ARM-NEON (ARM64) instruction sets.
- Namespace:
DirectX - Minimum C++ Standard: C++11 (with conditional C++14/17/20 features)
- Minimum Compiler: Visual C++ 2017 (
_MSC_VER >= 1910), or equivalent Clang/GCC - Repository: https://github.com/microsoft/DirectXMath
- Documentation: https://github.com/microsoft/DirectXMath/wiki, https://learn.microsoft.com/windows/win32/dxmath/directxmath-portal
- NuGet Packages:
directxmath - vcpkg Port:
directxmath
An optional C++ wrapper, SimpleMath, is available that provides a more user-friendly interface to the DirectXMath API with fewer alignment and usage restrictions. It is part of the DirectX Tool Kit for DirectX 11 and DirectX 12, and is intended to mimic the XNA Game Studio framework math library.
Integration Methods
vcpkg manifest-mode (Recommended)
In your vcpkg.json file, add the following:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"directxmath"
]
}vcpkg (classic)
vcpkg install directxmathThen in your CMakeLists.txt:
find_package(directxmath CONFIG REQUIRED)
target_link_libraries(YourTarget PRIVATE Microsoft::DirectXMath)Features: dx11 (Spherical Harmonics math library for DirectX 11), dx12 (Spherical Harmonics math library for DirectX 12), xdsp (Digital Signal Processing library). Triplets: x64-windows, x64-linux, arm64-windows, etc.
NuGet
Install the directxmath package from nuget.org.
Windows SDK
The Windows SDK ships with DirectXMath, though it may not be the latest version. Include via:
#include <DirectXMath.h>Basic Usage
#include <DirectXMath.h>
using namespace DirectX;
// Load data from storage type to SIMD register
XMFLOAT3 position{ 1.0f, 2.0f, 3.0f };
XMVECTOR v = XMLoadFloat3(&position);
// Perform computation in SIMD
v = XMVector3Normalize(v);
// Store result back to memory
XMFLOAT3 result;
XMStoreFloat3(&result, v);Key Concepts
Load / Compute / Store Pattern
DirectXMath separates storage types (for memory layout) from the computation type (XMVECTOR). Always:
- Load from a storage type (
XMFLOAT3,XMFLOAT4, etc.) intoXMVECTORorXMMATRIXusingXMLoad*functions. - Compute using
XMVector*,XMMatrix*,XMQuaternion*, orXMColor*functions. - Store results back to a storage type using
XMStore*functions.
Calling Conventions
Functions that accept XMVECTOR or XMMATRIX parameters use XM_CALLCONV and the parameter typedefs FXMVECTOR, GXMVECTOR, HXMVECTOR, CXMVECTOR, FXMMATRIX, and CXMMATRIX to maximize register usage across platforms.
Alignment
XMVECTOR and XMMATRIX require 16-byte alignment. Storage types with an A suffix (e.g., XMFLOAT4A) are aligned; the unsuffixed variants (e.g., XMFLOAT4) are unaligned and safe for use in arbitrary data structures.
API Reference
For detailed API signatures and function families, see the reference overview.
The canonical API documentation is on Microsoft Learn. All function signatures can be discovered in the public headers under the Inc/ directory.
Auxiliary Libraries
SHMath (Spherical Harmonics)
The SHMath/ directory provides spherical harmonic math functions for lighting computations. Unlike the core library, SHMath includes .cpp files that must be compiled.
See reference overview - SHMath section for details.
XDSP (Digital Signal Processing)
The XDSP/ directory provides header-only FFT and DSP functions built on DirectXMath.
See reference overview - XDSP section for details.
Platform Support
| Platform | SIMD Backend |
| Windows x86/x64 | SSE/SSE2 (baseline), up to AVX2 |
| Windows ARM64/ARM64EC | ARM-NEON |
| Linux x86_64 | SSE/SSE2 (baseline), up to AVX2 |
| Linux ARM64 | ARM-NEON |
| Any (fallback) | Pure C++ (_XM_NO_INTRINSICS_) |
Additional Resources
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

