microsoft/directxmath/directxmath-usage
Claude Code and agent skill by microsoft/directxmath
- vendor
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install microsoft/directxmath/directxmath-usageSKILL.md
The same SKILL.md was published earlier as microsoft/directxmath/directxmath-usage.
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:
vcpkg (classic)
Then in your CMakeLists.txt:
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:
Basic Usage
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
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 16 Aug 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/directxmath-usage/SKILL.md
Popularity
- Repository stars
- 1,785
- Repository forks
- 261
- 7-day trend score
- 37
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/directxmath/directxmath-usage)