Back to rankings

DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps

microsoftdirectxsimdneoncpp-librarysseavxavx2clangmsvcxboxdirectxmath
Star Growth
Stars
1.8k
Forks
258
Weekly Growth
Issues
15
5001k1.5k
Jan 2023Mar 2024May 2025Jul 2026
README

DirectX Logo

DirectXMath

https://github.com/Microsoft/DirectXMath

Copyright (c) Microsoft Corporation.

June 2026

This package contains the DirectXMath library, an all inline SIMD C++ linear algebra library for use in games and graphics apps.

This code is designed to build with Visual Studio 2019 (16.11), Visual Studio 2022, Visual Studio 2026, or clang/LLVM for Windows. It is recommended that you make use of the latest updates.

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\

    • DirectXMath Files (in the DirectX C++ namespace)

      • DirectXMath.h - Core library
      • DirectXPackedVector.h - Load/Store functions and types for working with various compressed GPU formats
      • DirectXColors.h - .NET-style Color defines in sRGB and linear color space
      • DirectXCollision.h - Bounding volume collision library
  • Extentions\

    • Advanced instruction set variants for guarded codepaths

      • DirectXMathSSE3.h - SSE3
      • DirectXMathBE.h - Supplemental SSE3 (SSSE3)
      • DirectXMathSSE4.h - SSE4.1
      • DirectXMathAVX.h - Advanced Vector Extensions (AVX)
      • DirectXMathAVX2.h - Advanced Vector Extensions 2 (AVX2)
      • DirectXMathF16C.h - Half-precision conversions (F16C)
      • DirectXMathFMA3.h - Fused multiply-accumulate (FMA3)
      • DirectXMathFMA4.h - Fused multiply-accumulate (FMA4)
  • SHMath\

    • Spherical Harmonics math functions

      • DirectXSH.h - Header for SHMath functions
      • DirectXSH.cpp, DirectXSHD3D11.cpp, DirectXSHD3D12.cpp - Implementation
  • XDSP\

    • XDSP.h - Digital Signal Processing helper functions
  • build\

    • Contains miscellaneous build files and scripts.
  • skills\

    • Contains published CoPilot skills for use by developers.

Documentation

Documentation is available on the Microsoft Docs. Additional information can be found on the project wiki.

CoPilot Usage

For CoPilot CLI assistance with using DirectXMath, try:

winget install GitHub.Copilot
winget install GitHub.cli
gh skill install microsoft/directxmath
copilot
/skills list

Compiler support

Officially the library is supported with Microsoft Visual C++ 2019 (16.11) or later, clang/LLVM v12 or later, and GCC 10 or later. It should also compile with the Intel C++, MinGW, and Apple Clang compilers.

When building with clang/LLVM or other GNU C compilers, the _XM_NO_XMVECTOR_OVERLOADS_ control define is set because these compilers do not support creating operator overloads for the XMVECTOR type. You can choose to enable this preprocessor define explicitly to do the same thing with Visual C++ for improved portability.

To build for non-Windows platforms, you need to provide a sal.h header in your include path. You can obtain an open source version from GitHub.

With GCC, the SAL annotation preprocessor symbols can conflict with the GNU implementation of the Standard C++ Library. The workaround is to include the system headers before including DirectXMath:

#include <algorithm>
#include <iterator>
#include <utility>

#include <format> // C++20 header

#include <DirectXMath.h>

Notices

All content and source code for this package are subject to the terms of the MIT License.

For the latest version of DirectXMath, bug reports, etc. please visit the project site on GitHub.

Release Notes

FOR SECURITY ADVISORIES, see GitHub.

For a full change history, see CHANGELOG.md.

  • The directxmath NuGet package is deprecated. The best way to integrate the latest DirectXMath into your C++ project is using vcpkg.

  • The CMake projects require 3.21 or later. VS 2019 users will need to install a standalone version of CMake 3.21 or later and add it to their PATH.

  • The clang/LLVM toolset currently does not respect the float_control pragma for SSE instrinsics. Therefore, the use of /fp:fast is not recommended on clang/LLVM until this issue is fixed. See 55713.

  • AArch32/ARM32 (ARMv7) support is deprecated in Windows 11. Compiler support for ARM32 is deprecated in Visual Studio 2026, and the system libraries are no longer present in the Windows SDK (26100) or later. Therefore, support for ARM32 is deprecated in DirectXMath and will be removed in a future release. Since most codepaths are shared for AArch32 and AArch64, the codepaths will be refactored to assume AArch64 (ARMv8).

Support

For questions, consider using Stack Overflow with the directxmath tag, or the DirectX Discord Server in the dx12-developers or dx9-dx11-developers channel.

For bug reports and feature requests, please use GitHub issues for this project.

Contributing

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.

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.

Tests for new features should also be submitted as a PR to the Test Suite repository.

Code of Conduct

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.

Trademarks

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. 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.

Credits

The xboxmath library was originated by Matt Bronder with contributions from Sakphong Chanbai and David Hefner for the Xbox 360.

The xnamath library for the DirectX SDK and Xbox XDK was the work of Chuck Walbourn and Becky Heineman based on xboxmath, with contributions from Jeremy Gup, Dan Haffner, Matt Lee, Casey Meekhof, Rich Sauer, Jason Strayer, and Xiaoyue Zheng.

The DirectXMath library for the Windows SDK and Xbox One XDK is the work of Chuck Walbourn based on xnamath, with contributions from Darren Anderson, Matt Lee, Aaron Rodriguez Hernandez, Yuichi Ito, Reza Nourai, Rich Sauer, and Jason Strayer.

Thanks to Dave Eberly for his contributions particularly in improving the transcendental functions.

Thanks to Bruce Dawson for his help with the rounding functions.

Thanks to Andrew Farrier and Ruiji-Shi for the fixes to XMVerifyCPUSupport to properly support clang.

Thanks to Scott Matloff for his help in getting the library updated to use Intel SVML for VS 2019.

Thanks to Shawn Hargreaves and Nada Ouf for their continued support for this library.

Related repositories
microsoft/vscode

Visual Studio Code

TypeScriptnpmMIT Licenseeditorelectron
code.visualstudio.com
187.8k41.3k
massgravel/Microsoft-Activation-Scripts

Open-source Windows and Office activator featuring HWID, Ohook, TSforge, and Online KMS activation methods, along with advanced troubleshooting.

BatchfileGNU General Public License v3.0hwidkms38
massgrave.dev
184k17.6k
dotnet/maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.

C#MIT Licensedotnetmaui
dot.net/maui
23.3k2k
thangchung/awesome-dotnet-core

:honeybee: A collection of awesome .NET core libraries, tools, frameworks and software

C#dotnet-coreawesome-list
21.3k3k
qax-os/excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets

GoGo ModulesBSD 3-Clause "New" or "Revised" Licensexlsxexcel
xuri.me/excelize
20.8k1.9k
microsoft/fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.

TypeScriptnpmOtherreactreact-components
react.fluentui.dev
20.2k2.9k
dotnet/corefx

This repo is used for servicing PR's for .NET Core 2.1 and 3.1. Please visit us at https://github.com/dotnet/runtime

corefxcoreclr
docs.microsoft.com/dotnet/core/
17.5k4.8k
ether/etherpad-lite

Etherpad: A modern really-real-time collaborative document editor.

TypeScriptnpmApache License 2.0etherpadcollaboration
docs.etherpad.org
17.2k2.9k
microsoft/LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.

C++MIT Licensegbdtgbm
lightgbm.readthedocs.io/en/latest/
17k3.9k
abraunegg/onedrive

OneDrive Client for Linux

DGNU General Public License v3.0microsoftonedrive
abraunegg.github.io
12.6k913
OdysseusYuan/LKY_OfficeTools

一键自动化 下载、安装、激活 Office 的利器。

C#GNU General Public License v3.0kmsmicrosoft
foxmail.com
12.3k1.2k
microsoft/frontend-bootcamp

Frontend Workshop from HTML/CSS/JS to TypeScript/React/Redux

TypeScriptnpmCreative Commons Attribution 4.0 Internationalreacttypescript
microsoft.github.io/frontend-bootcamp/
10.8k1.2k