You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DirectXMath library is included in the Windows SDK starting with version 8.0. Therefore it is included with Visual C++ 2012, 2013, and 2015. For a full list versions, see releases.
Instruction set
For x86/x64, DirectXMath makes use of SSE/SSE2 intrinsics. All x64 native CPUs are required to support SSE and SSE2. Windows 8.0 (32-bit) or later will not install without SSE/SSE2 support.
For ARM, DirectXMath makes use of ARMv7 ARM-NEON intrinsics. For ARM64, DirectXMath makes use of ARMv8 ARM-NEON intrinsics. All Windows on ARM devices support ARM-NEON.
If you build with /arch:AVX so that your binary requires Intel Advanced Vector Extensions, DirectXMath 3.09 or later will make use of SSE3, SSE4.1, and AVX instructions.
The primary benefit of building with /arch:AVX is the use of the VEX prefix in all generated SSE instructions.
If you build with /arch:AVX2 so that your binary requires Intel Advanced Vector Extensions 2, DirectXMath 3.09 or later will make use of SSE3, SSE4.1, AVX, and F16C instructions.
The compiler should make use of FMA3 as appropriate when building with /arch:AVX2 even without explicit use of the _mm_f*add_ps intrinsic. In DirectXMath 3.10 or later, XMVerifyCPUSupport will check for AVX2 and FMA3 instruction support when building with ``/arch:AVX2`.
Windows XP
The DirectXMath library is all inline and uses only Visual C++ intrinsics. Therefore, it is compatible with all version of Windows supported by Visual C++. There's no standard configuration that will put DirectXMath in the include path when using the v1x0_xp Platform Toolset, but you can add it manually. Keep in mind there are a number of other differences when doing DirectX development for Windows XP support. See this post.
Be sure to read the MSDN details on the calling convention types which are designed to deal with the various architectures and vector calling conventions. The best way to ensure you have them correct is to attempt to build your code with x86, x64, and ARM.
If writing client code that is intended to build with both DirectXMath 3.06+ (Windows 8.1 SDK / VS 2013) and DirectXMath 3.03 (Windows 8 XDK / VS 2012), the following adapter code can be used:
DirectXMath is written using standard Intel-style intrinsics, which should be portable to other compilers. The ARM codepaths use ARM-style intrinsics (earlier versions of the library used Visual C++ specific __n64 and __n128), so these should also be portable.
The DirectXMath library make use of two commonly implemented extensions to Standard C++:
anonymous structs, which are widely supported and are part of the C11 standard. Note that the library also uses anonymous unions, but these are part of the C++ and C99 standard.
#pragma once rather than old-style #define based guards, but are widely supported
Because of these, DirectXMath is not compatible with Visual C++'s /Za switch which enforces ISO C89 / C++11.
#Additional content
Extensions - Advanced instruction set variants for DirectXMath SHMath - Spherical Harmonics math XDSP - Digital Signal Processing helper functions
See the DirectX Tool Kit's SimpleMath wrapper for DirectXMath.
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.
Special thanks to Andy Glaister and Shawn Hargreaves for their on-going support and sponsorship.