From 48ab66214ac0c094951f5b8ca43f51f7c3c1df5b Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sat, 18 Jun 2016 13:31:26 -0700 Subject: [PATCH] DirectXMath 3.09 --- Inc/DirectXCollision.h | 28 +++---- Inc/DirectXCollision.inl | 2 - Inc/DirectXColors.h | 2 - Inc/DirectXMath.h | 123 +++++++++++++++++------------ Inc/DirectXMathConvert.inl | 5 +- Inc/DirectXMathMatrix.inl | 106 +++---------------------- Inc/DirectXMathMisc.inl | 2 - Inc/DirectXMathVector.inl | 2 - Inc/DirectXPackedVector.h | 149 ++++++++++++++++++++---------------- Inc/DirectXPackedVector.inl | 33 +++++++- ReadMe.txt | 12 ++- 11 files changed, 227 insertions(+), 237 deletions(-) diff --git a/Inc/DirectXCollision.h b/Inc/DirectXCollision.h index b56ab02..e509af8 100644 --- a/Inc/DirectXCollision.h +++ b/Inc/DirectXCollision.h @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif #include "DirectXMath.h" @@ -38,6 +36,8 @@ struct BoundingFrustum; #pragma warning(push) #pragma warning(disable:4324 4820) +// C4324: alignment padding warnings +// C4820: Off by default noise //------------------------------------------------------------------------------------- // Bounding sphere @@ -49,8 +49,8 @@ struct BoundingSphere // Creators BoundingSphere() : Center(0,0,0), Radius( 1.f ) {} - BoundingSphere( _In_ const XMFLOAT3& center, _In_ float radius ) - : Center(center), Radius(radius) { assert( radius >= 0.f ); }; + XM_CONSTEXPR BoundingSphere( _In_ const XMFLOAT3& center, _In_ float radius ) + : Center(center), Radius(radius) {} BoundingSphere( _In_ const BoundingSphere& sp ) : Center(sp.Center), Radius(sp.Radius) {} @@ -110,8 +110,8 @@ struct BoundingBox // Creators BoundingBox() : Center(0,0,0), Extents( 1.f, 1.f, 1.f ) {} - BoundingBox( _In_ const XMFLOAT3& center, _In_ const XMFLOAT3& extents ) - : Center(center), Extents(extents) { assert(extents.x >= 0 && extents.y >= 0 && extents.z >= 0); } + XM_CONSTEXPR BoundingBox( _In_ const XMFLOAT3& center, _In_ const XMFLOAT3& extents ) + : Center(center), Extents(extents) {} BoundingBox( _In_ const BoundingBox& box ) : Center(box.Center), Extents(box.Extents) {} // Methods @@ -171,11 +171,8 @@ struct BoundingOrientedBox // Creators BoundingOrientedBox() : Center(0,0,0), Extents( 1.f, 1.f, 1.f ), Orientation(0,0,0, 1.f ) {} - BoundingOrientedBox( _In_ const XMFLOAT3& _Center, _In_ const XMFLOAT3& _Extents, _In_ const XMFLOAT4& _Orientation ) - : Center(_Center), Extents(_Extents), Orientation(_Orientation) - { - assert(_Extents.x >= 0 && _Extents.y >= 0 && _Extents.z >= 0); - } + XM_CONSTEXPR BoundingOrientedBox( _In_ const XMFLOAT3& _Center, _In_ const XMFLOAT3& _Extents, _In_ const XMFLOAT4& _Orientation ) + : Center(_Center), Extents(_Extents), Orientation(_Orientation) {} BoundingOrientedBox( _In_ const BoundingOrientedBox& box ) : Center(box.Center), Extents(box.Extents), Orientation(box.Orientation) {} @@ -239,12 +236,12 @@ struct BoundingFrustum // Creators BoundingFrustum() : Origin(0,0,0), Orientation(0,0,0, 1.f), RightSlope( 1.f ), LeftSlope( -1.f ), TopSlope( 1.f ), BottomSlope( -1.f ), Near(0), Far( 1.f ) {} - BoundingFrustum( _In_ const XMFLOAT3& _Origin, _In_ const XMFLOAT4& _Orientation, + XM_CONSTEXPR BoundingFrustum( _In_ const XMFLOAT3& _Origin, _In_ const XMFLOAT4& _Orientation, _In_ float _RightSlope, _In_ float _LeftSlope, _In_ float _TopSlope, _In_ float _BottomSlope, _In_ float _Near, _In_ float _Far ) : Origin(_Origin), Orientation(_Orientation), RightSlope(_RightSlope), LeftSlope(_LeftSlope), TopSlope(_TopSlope), BottomSlope(_BottomSlope), - Near(_Near), Far(_Far) { assert( _Near <= _Far ); } + Near(_Near), Far(_Far) {} BoundingFrustum( _In_ const BoundingFrustum& fr ) : Origin(fr.Origin), Orientation(fr.Orientation), RightSlope(fr.RightSlope), LeftSlope(fr.LeftSlope), TopSlope(fr.TopSlope), BottomSlope(fr.BottomSlope), Near(fr.Near), Far(fr.Far) {} @@ -325,7 +322,10 @@ namespace TriangleTests ****************************************************************************/ #pragma warning(push) -#pragma warning(disable : 4068 4616 6001) +#pragma warning(disable : 4068 4365 4616 6001) +// C4068/4616: ignore unknown pragmas +// C4365: Off by default noise +// C6001: False positives #pragma prefast(push) #pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes") diff --git a/Inc/DirectXCollision.inl b/Inc/DirectXCollision.inl index a9d7010..5fc2b96 100644 --- a/Inc/DirectXCollision.inl +++ b/Inc/DirectXCollision.inl @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif XMGLOBALCONST XMVECTORF32 g_BoxOffset[8] = { diff --git a/Inc/DirectXColors.h b/Inc/DirectXColors.h index b86314a..1ee7f70 100644 --- a/Inc/DirectXColors.h +++ b/Inc/DirectXColors.h @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif #include "DirectXMath.h" diff --git a/Inc/DirectXMath.h b/Inc/DirectXMath.h index eede57d..b1cf95d 100644 --- a/Inc/DirectXMath.h +++ b/Inc/DirectXMath.h @@ -9,15 +9,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif #ifndef __cplusplus #error DirectX Math requires C++ #endif -#define DIRECTX_MATH_VERSION 308 +#define DIRECTX_MATH_VERSION 309 #if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) && (!_MANAGED) && (!_M_CEE) && (!defined(_M_IX86_FP) || (_M_IX86_FP > 1)) && !defined(_XM_NO_INTRINSICS_) && !defined(_XM_VECTORCALL_) @@ -38,6 +36,16 @@ #define XM_CTOR_DEFAULT =default; #endif +#if defined(_MSC_VER) && (_MSC_VER < 1900) +#define XM_CONSTEXPR +#else +#define XM_CONSTEXPR constexpr +#endif + +#ifndef XM_DEPRECATED +#define XM_DEPRECATED __declspec(deprecated("This is deprecated and will be removed in a future version.")) +#endif + #if !defined(_XM_F16C_INTRINSICS_) && defined(__AVX2__) && !defined(_XM_NO_INTRINSICS_) #define _XM_F16C_INTRINSICS_ #endif @@ -74,7 +82,8 @@ #endif // !_XM_ARM_NEON_INTRINSICS_ && !_XM_SSE_INTRINSICS_ && !_XM_NO_INTRINSICS_ #pragma warning(push) -#pragma warning(disable:4514 4820 4985) +#pragma warning(disable:4514 4820) +// C4514/4820: Off by default noise #include #include #include @@ -90,6 +99,7 @@ #ifndef _XM_NO_INTRINSICS_ #pragma warning(push) #pragma warning(disable : 4987) +// C4987: Off by default noise #include #pragma warning(pop) #ifdef _M_ARM64 @@ -103,6 +113,7 @@ #if defined(_XM_SSE4_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) #pragma warning(push) #pragma warning(disable : 4987) +// C4987: Off by default noise #include #pragma warning(pop) #include @@ -126,6 +137,7 @@ #pragma warning(push) #pragma warning(disable : 4005 4668) +// C4005/4668: Old header issue #include #pragma warning(pop) @@ -253,8 +265,8 @@ const size_t XM_CACHE_LINE_SIZE = 64; // Unit conversion -inline float XMConvertToRadians(float fDegrees) { return fDegrees * (XM_PI / 180.0f); } -inline float XMConvertToDegrees(float fRadians) { return fRadians * (180.0f / XM_PI); } +inline XM_CONSTEXPR float XMConvertToRadians(float fDegrees) { return fDegrees * (XM_PI / 180.0f); } +inline XM_CONSTEXPR float XMConvertToDegrees(float fRadians) { return fRadians * (180.0f / XM_PI); } // Condition register evaluation proceeding a recording (R) comparison @@ -275,14 +287,16 @@ inline bool XMComparisonAnyOutOfBounds(uint32_t CR) { return (((CR) & XM_CRMASK_ #pragma warning(push) #pragma warning(disable:4068 4201 4365 4324 4820) +// C4068: ignore unknown pragmas +// C4201: nonstandard extension used : nameless struct/union +// C4365: Off by default noise +// C4324/4820: padding warnings #pragma prefast(push) #pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes") //------------------------------------------------------------------------------ #if defined(_XM_NO_INTRINSICS_) -// The __vector4 structure is an intrinsic on Xbox but must be separately defined -// for x86/x64 struct __vector4 { union @@ -294,11 +308,7 @@ struct __vector4 #endif // _XM_NO_INTRINSICS_ //------------------------------------------------------------------------------ -#ifdef _XM_NO_INTRINSICS_ -typedef uint32_t __vector4i[4]; -#else -typedef __declspec(align(16)) uint32_t __vector4i[4]; -#endif +typedef uint32_t XM_DEPRECATED __vector4i[4]; //------------------------------------------------------------------------------ // Vector intrinsic: Four 32 bit floating point components aligned on a 16 byte @@ -459,7 +469,11 @@ __declspec(align(16)) struct XMMATRIX #endif XMMATRIX() XM_CTOR_DEFAULT +#if defined(_MSC_VER) && _MSC_VER >= 1900 + constexpr XMMATRIX(FXMVECTOR R0, FXMVECTOR R1, FXMVECTOR R2, CXMVECTOR R3) : r{ R0,R1,R2,R3 } {} +#else XMMATRIX(FXMVECTOR R0, FXMVECTOR R1, FXMVECTOR R2, CXMVECTOR R3) { r[0] = R0; r[1] = R1; r[2] = R2; r[3] = R3; } +#endif XMMATRIX(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, @@ -499,7 +513,7 @@ struct XMFLOAT2 float y; XMFLOAT2() XM_CTOR_DEFAULT - XMFLOAT2(float _x, float _y) : x(_x), y(_y) {} + XM_CONSTEXPR XMFLOAT2(float _x, float _y) : x(_x), y(_y) {} explicit XMFLOAT2(_In_reads_(2) const float *pArray) : x(pArray[0]), y(pArray[1]) {} XMFLOAT2& operator= (const XMFLOAT2& Float2) { x = Float2.x; y = Float2.y; return *this; } @@ -509,7 +523,7 @@ struct XMFLOAT2 __declspec(align(16)) struct XMFLOAT2A : public XMFLOAT2 { XMFLOAT2A() XM_CTOR_DEFAULT - XMFLOAT2A(float _x, float _y) : XMFLOAT2(_x, _y) {} + XM_CONSTEXPR XMFLOAT2A(float _x, float _y) : XMFLOAT2(_x, _y) {} explicit XMFLOAT2A(_In_reads_(2) const float *pArray) : XMFLOAT2(pArray) {} XMFLOAT2A& operator= (const XMFLOAT2A& Float2) { x = Float2.x; y = Float2.y; return *this; } @@ -523,7 +537,7 @@ struct XMINT2 int32_t y; XMINT2() XM_CTOR_DEFAULT - XMINT2(int32_t _x, int32_t _y) : x(_x), y(_y) {} + XM_CONSTEXPR XMINT2(int32_t _x, int32_t _y) : x(_x), y(_y) {} explicit XMINT2(_In_reads_(2) const int32_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMINT2& operator= (const XMINT2& Int2) { x = Int2.x; y = Int2.y; return *this; } @@ -536,7 +550,7 @@ struct XMUINT2 uint32_t y; XMUINT2() XM_CTOR_DEFAULT - XMUINT2(uint32_t _x, uint32_t _y) : x(_x), y(_y) {} + XM_CONSTEXPR XMUINT2(uint32_t _x, uint32_t _y) : x(_x), y(_y) {} explicit XMUINT2(_In_reads_(2) const uint32_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMUINT2& operator= (const XMUINT2& UInt2) { x = UInt2.x; y = UInt2.y; return *this; } @@ -551,7 +565,7 @@ struct XMFLOAT3 float z; XMFLOAT3() XM_CTOR_DEFAULT - XMFLOAT3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} + XM_CONSTEXPR XMFLOAT3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} explicit XMFLOAT3(_In_reads_(3) const float *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {} XMFLOAT3& operator= (const XMFLOAT3& Float3) { x = Float3.x; y = Float3.y; z = Float3.z; return *this; } @@ -561,7 +575,7 @@ struct XMFLOAT3 __declspec(align(16)) struct XMFLOAT3A : public XMFLOAT3 { XMFLOAT3A() XM_CTOR_DEFAULT - XMFLOAT3A(float _x, float _y, float _z) : XMFLOAT3(_x, _y, _z) {} + XM_CONSTEXPR XMFLOAT3A(float _x, float _y, float _z) : XMFLOAT3(_x, _y, _z) {} explicit XMFLOAT3A(_In_reads_(3) const float *pArray) : XMFLOAT3(pArray) {} XMFLOAT3A& operator= (const XMFLOAT3A& Float3) { x = Float3.x; y = Float3.y; z = Float3.z; return *this; } @@ -576,7 +590,7 @@ struct XMINT3 int32_t z; XMINT3() XM_CTOR_DEFAULT - XMINT3(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) {} + XM_CONSTEXPR XMINT3(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) {} explicit XMINT3(_In_reads_(3) const int32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {} XMINT3& operator= (const XMINT3& i3) { x = i3.x; y = i3.y; z = i3.z; return *this; } @@ -590,7 +604,7 @@ struct XMUINT3 uint32_t z; XMUINT3() XM_CTOR_DEFAULT - XMUINT3(uint32_t _x, uint32_t _y, uint32_t _z) : x(_x), y(_y), z(_z) {} + XM_CONSTEXPR XMUINT3(uint32_t _x, uint32_t _y, uint32_t _z) : x(_x), y(_y), z(_z) {} explicit XMUINT3(_In_reads_(3) const uint32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {} XMUINT3& operator= (const XMUINT3& u3) { x = u3.x; y = u3.y; z = u3.z; return *this; } @@ -606,7 +620,7 @@ struct XMFLOAT4 float w; XMFLOAT4() XM_CTOR_DEFAULT - XMFLOAT4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) {} + XM_CONSTEXPR XMFLOAT4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMFLOAT4(_In_reads_(4) const float *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMFLOAT4& operator= (const XMFLOAT4& Float4) { x = Float4.x; y = Float4.y; z = Float4.z; w = Float4.w; return *this; } @@ -616,7 +630,7 @@ struct XMFLOAT4 __declspec(align(16)) struct XMFLOAT4A : public XMFLOAT4 { XMFLOAT4A() XM_CTOR_DEFAULT - XMFLOAT4A(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {} + XM_CONSTEXPR XMFLOAT4A(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {} explicit XMFLOAT4A(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {} XMFLOAT4A& operator= (const XMFLOAT4A& Float4) { x = Float4.x; y = Float4.y; z = Float4.z; w = Float4.w; return *this; } @@ -632,7 +646,7 @@ struct XMINT4 int32_t w; XMINT4() XM_CTOR_DEFAULT - XMINT4(int32_t _x, int32_t _y, int32_t _z, int32_t _w) : x(_x), y(_y), z(_z), w(_w) {} + XM_CONSTEXPR XMINT4(int32_t _x, int32_t _y, int32_t _z, int32_t _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMINT4(_In_reads_(4) const int32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMINT4& operator= (const XMINT4& Int4) { x = Int4.x; y = Int4.y; z = Int4.z; w = Int4.w; return *this; } @@ -647,7 +661,7 @@ struct XMUINT4 uint32_t w; XMUINT4() XM_CTOR_DEFAULT - XMUINT4(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w) : x(_x), y(_y), z(_z), w(_w) {} + XM_CONSTEXPR XMUINT4(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMUINT4(_In_reads_(4) const uint32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMUINT4& operator= (const XMUINT4& UInt4) { x = UInt4.x; y = UInt4.y; z = UInt4.z; w = UInt4.w; return *this; } @@ -669,9 +683,12 @@ struct XMFLOAT3X3 }; XMFLOAT3X3() XM_CTOR_DEFAULT - XMFLOAT3X3(float m00, float m01, float m02, - float m10, float m11, float m12, - float m20, float m21, float m22); + XM_CONSTEXPR XMFLOAT3X3(float m00, float m01, float m02, + float m10, float m11, float m12, + float m20, float m21, float m22) + : _11(m00), _12(m01), _13(m02), + _21(m10), _22(m11), _23(m12), + _31(m20), _32(m21), _33(m22) {} explicit XMFLOAT3X3(_In_reads_(9) const float *pArray); float operator() (size_t Row, size_t Column) const { return m[Row][Column]; } @@ -697,10 +714,14 @@ struct XMFLOAT4X3 }; XMFLOAT4X3() XM_CTOR_DEFAULT - XMFLOAT4X3(float m00, float m01, float m02, - float m10, float m11, float m12, - float m20, float m21, float m22, - float m30, float m31, float m32); + XM_CONSTEXPR XMFLOAT4X3(float m00, float m01, float m02, + float m10, float m11, float m12, + float m20, float m21, float m22, + float m30, float m31, float m32) + : _11(m00), _12(m01), _13(m02), + _21(m10), _22(m11), _23(m12), + _31(m20), _32(m21), _33(m22), + _41(m30), _42(m31), _43(m32) {} explicit XMFLOAT4X3(_In_reads_(12) const float *pArray); float operator() (size_t Row, size_t Column) const { return m[Row][Column]; } @@ -714,10 +735,10 @@ struct XMFLOAT4X3 __declspec(align(16)) struct XMFLOAT4X3A : public XMFLOAT4X3 { XMFLOAT4X3A() XM_CTOR_DEFAULT - XMFLOAT4X3A(float m00, float m01, float m02, - float m10, float m11, float m12, - float m20, float m21, float m22, - float m30, float m31, float m32) : + XM_CONSTEXPR XMFLOAT4X3A(float m00, float m01, float m02, + float m10, float m11, float m12, + float m20, float m21, float m22, + float m30, float m31, float m32) : XMFLOAT4X3(m00,m01,m02,m10,m11,m12,m20,m21,m22,m30,m31,m32) {} explicit XMFLOAT4X3A(_In_reads_(12) const float *pArray) : XMFLOAT4X3(pArray) {} @@ -744,10 +765,14 @@ struct XMFLOAT4X4 }; XMFLOAT4X4() XM_CTOR_DEFAULT - XMFLOAT4X4(float m00, float m01, float m02, float m03, - float m10, float m11, float m12, float m13, - float m20, float m21, float m22, float m23, - float m30, float m31, float m32, float m33); + XM_CONSTEXPR XMFLOAT4X4(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) + : _11(m00), _12(m01), _13(m02), _14(m03), + _21(m10), _22(m11), _23(m12), _24(m13), + _31(m20), _32(m21), _33(m22), _34(m23), + _41(m30), _42(m31), _43(m32), _44(m33) {} explicit XMFLOAT4X4(_In_reads_(16) const float *pArray); float operator() (size_t Row, size_t Column) const { return m[Row][Column]; } @@ -760,10 +785,10 @@ struct XMFLOAT4X4 __declspec(align(16)) struct XMFLOAT4X4A : public XMFLOAT4X4 { XMFLOAT4X4A() XM_CTOR_DEFAULT - XMFLOAT4X4A(float m00, float m01, float m02, float m03, - float m10, float m11, float m12, float m13, - float m20, float m21, float m22, float m23, - float m30, float m31, float m32, float m33) + XM_CONSTEXPR XMFLOAT4X4A(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) : XMFLOAT4X4(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33) {} explicit XMFLOAT4X4A(_In_reads_(16) const float *pArray) : XMFLOAT4X4(pArray) {} @@ -1292,8 +1317,8 @@ XMMATRIX XM_CALLCONV XMMatrixLookToLH(FXMVECTOR EyePosition, FXMVECTOR Ey XMMATRIX XM_CALLCONV XMMatrixLookToRH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection); XMMATRIX XM_CALLCONV XMMatrixPerspectiveLH(float ViewWidth, float ViewHeight, float NearZ, float FarZ); XMMATRIX XM_CALLCONV XMMatrixPerspectiveRH(float ViewWidth, float ViewHeight, float NearZ, float FarZ); -XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH(float FovAngleY, float AspectHByW, float NearZ, float FarZ); -XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH(float FovAngleY, float AspectHByW, float NearZ, float FarZ); +XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH(float FovAngleY, float AspectRatio, float NearZ, float FarZ); +XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH(float FovAngleY, float AspectRatio, float NearZ, float FarZ); XMMATRIX XM_CALLCONV XMMatrixPerspectiveOffCenterLH(float ViewLeft, float ViewRight, float ViewBottom, float ViewTop, float NearZ, float FarZ); XMMATRIX XM_CALLCONV XMMatrixPerspectiveOffCenterRH(float ViewLeft, float ViewRight, float ViewBottom, float ViewTop, float NearZ, float FarZ); XMMATRIX XM_CALLCONV XMMatrixOrthographicLH(float ViewWidth, float ViewHeight, float NearZ, float FarZ); @@ -1859,7 +1884,11 @@ XMGLOBALCONST XMVECTORF32 g_UShortMax = {65535.0f, 65535.0f, 65535.0f, ****************************************************************************/ #pragma warning(push) -#pragma warning(disable:4068 4214 4204 4365 4616 4640 6001) +#pragma warning(disable:4068 4214 4204 4365 4616 4640 6001 6101) +// C4068/4616: ignore unknown pragmas +// C4214/4204: nonstandard extension used +// C4365/4640: Off by default noise +// C6001/6101: False positives #pragma prefast(push) #pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes") diff --git a/Inc/DirectXMathConvert.inl b/Inc/DirectXMathConvert.inl index 1fc7aee..394399c 100644 --- a/Inc/DirectXMathConvert.inl +++ b/Inc/DirectXMathConvert.inl @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif /**************************************************************************** * @@ -22,7 +20,8 @@ //------------------------------------------------------------------------------ #pragma warning(push) -#pragma warning(disable:4701) // Prevent warnings about 'Result' potentially being used without having been initialized +#pragma warning(disable:4701) +// C4701: false positives inline XMVECTOR XM_CALLCONV XMConvertVectorIntToFloat ( diff --git a/Inc/DirectXMathMatrix.inl b/Inc/DirectXMathMatrix.inl index 836e9d9..be2e7f2 100644 --- a/Inc/DirectXMathMatrix.inl +++ b/Inc/DirectXMathMatrix.inl @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif /**************************************************************************** * @@ -2133,14 +2131,14 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveRH inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH ( float FovAngleY, - float AspectHByW, + float AspectRatio, float NearZ, float FarZ ) { assert(NearZ > 0.f && FarZ > 0.f); assert(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f)); - assert(!XMScalarNearEqual(AspectHByW, 0.0f, 0.00001f)); + assert(!XMScalarNearEqual(AspectRatio, 0.0f, 0.00001f)); assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); #if defined(_XM_NO_INTRINSICS_) @@ -2150,7 +2148,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); float Height = CosFov / SinFov; - float Width = Height / AspectHByW; + float Width = Height / AspectRatio; float fRange = FarZ / (FarZ-NearZ); XMMATRIX M; @@ -2182,7 +2180,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH float fRange = FarZ / (FarZ-NearZ); float Height = CosFov / SinFov; - float Width = Height / AspectHByW; + float Width = Height / AspectRatio; const XMVECTOR Zero = vdupq_n_f32(0); XMMATRIX M; @@ -2200,7 +2198,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH // Note: This is recorded on the stack float Height = CosFov / SinFov; XMVECTOR rMem = { - Height / AspectHByW, + Height / AspectRatio, Height, fRange, -fRange * NearZ @@ -2213,7 +2211,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH // CosFov / SinFov,0,0,0 XMMATRIX M; M.r[0] = vTemp; - // 0,Height / AspectHByW,0,0 + // 0,Height / AspectRatio,0,0 vTemp = vValues; vTemp = _mm_and_ps(vTemp,g_XMMaskY); M.r[1] = vTemp; @@ -2235,14 +2233,14 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH ( float FovAngleY, - float AspectHByW, + float AspectRatio, float NearZ, float FarZ ) { assert(NearZ > 0.f && FarZ > 0.f); assert(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f)); - assert(!XMScalarNearEqual(AspectHByW, 0.0f, 0.00001f)); + assert(!XMScalarNearEqual(AspectRatio, 0.0f, 0.00001f)); assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); #if defined(_XM_NO_INTRINSICS_) @@ -2252,7 +2250,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); float Height = CosFov / SinFov; - float Width = Height / AspectHByW; + float Width = Height / AspectRatio; float fRange = FarZ / (NearZ-FarZ); XMMATRIX M; @@ -2283,7 +2281,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); float fRange = FarZ / (NearZ-FarZ); float Height = CosFov / SinFov; - float Width = Height / AspectHByW; + float Width = Height / AspectRatio; const XMVECTOR Zero = vdupq_n_f32(0); XMMATRIX M; @@ -2300,7 +2298,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH // Note: This is recorded on the stack float Height = CosFov / SinFov; XMVECTOR rMem = { - Height / AspectHByW, + Height / AspectRatio, Height, fRange, fRange * NearZ @@ -2313,7 +2311,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH // CosFov / SinFov,0,0,0 XMMATRIX M; M.r[0] = vTemp; - // 0,Height / AspectHByW,0,0 + // 0,Height / AspectRatio,0,0 vTemp = vValues; vTemp = _mm_and_ps(vTemp,g_XMMaskY); M.r[1] = vTemp; @@ -3123,28 +3121,6 @@ inline XMMATRIX XM_CALLCONV operator* * ****************************************************************************/ -//------------------------------------------------------------------------------ - -inline XMFLOAT3X3::XMFLOAT3X3 -( - float m00, float m01, float m02, - float m10, float m11, float m12, - float m20, float m21, float m22 -) -{ - m[0][0] = m00; - m[0][1] = m01; - m[0][2] = m02; - - m[1][0] = m10; - m[1][1] = m11; - m[1][2] = m12; - - m[2][0] = m20; - m[2][1] = m21; - m[2][2] = m22; -} - //------------------------------------------------------------------------------ _Use_decl_annotations_ inline XMFLOAT3X3::XMFLOAT3X3 @@ -3188,33 +3164,6 @@ inline XMFLOAT3X3& XMFLOAT3X3::operator= * ****************************************************************************/ -//------------------------------------------------------------------------------ - -inline XMFLOAT4X3::XMFLOAT4X3 -( - float m00, float m01, float m02, - float m10, float m11, float m12, - float m20, float m21, float m22, - float m30, float m31, float m32 -) -{ - m[0][0] = m00; - m[0][1] = m01; - m[0][2] = m02; - - m[1][0] = m10; - m[1][1] = m11; - m[1][2] = m12; - - m[2][0] = m20; - m[2][1] = m21; - m[2][2] = m22; - - m[3][0] = m30; - m[3][1] = m31; - m[3][2] = m32; -} - //------------------------------------------------------------------------------ _Use_decl_annotations_ inline XMFLOAT4X3::XMFLOAT4X3 @@ -3283,37 +3232,6 @@ inline XMFLOAT4X3A& XMFLOAT4X3A::operator= * ****************************************************************************/ -//------------------------------------------------------------------------------ - -inline XMFLOAT4X4::XMFLOAT4X4 -( - float m00, float m01, float m02, float m03, - float m10, float m11, float m12, float m13, - float m20, float m21, float m22, float m23, - float m30, float m31, float m32, float m33 -) -{ - m[0][0] = m00; - m[0][1] = m01; - m[0][2] = m02; - m[0][3] = m03; - - m[1][0] = m10; - m[1][1] = m11; - m[1][2] = m12; - m[1][3] = m13; - - m[2][0] = m20; - m[2][1] = m21; - m[2][2] = m22; - m[2][3] = m23; - - m[3][0] = m30; - m[3][1] = m31; - m[3][2] = m32; - m[3][3] = m33; -} - //------------------------------------------------------------------------------ _Use_decl_annotations_ inline XMFLOAT4X4::XMFLOAT4X4 diff --git a/Inc/DirectXMathMisc.inl b/Inc/DirectXMathMisc.inl index 47eabdf..210e903 100644 --- a/Inc/DirectXMathMisc.inl +++ b/Inc/DirectXMathMisc.inl @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif /**************************************************************************** * diff --git a/Inc/DirectXMathVector.inl b/Inc/DirectXMathVector.inl index fbdd8d0..e205396 100644 --- a/Inc/DirectXMathVector.inl +++ b/Inc/DirectXMathVector.inl @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif #if defined(_XM_NO_INTRINSICS_) #define XMISNAN(x) ((*(uint32_t*)&(x) & 0x7F800000) == 0x7F800000 && (*(uint32_t*)&(x) & 0x7FFFFF) != 0) diff --git a/Inc/DirectXPackedVector.h b/Inc/DirectXPackedVector.h index 5565190..301f108 100644 --- a/Inc/DirectXPackedVector.h +++ b/Inc/DirectXPackedVector.h @@ -9,9 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif #include "DirectXMath.h" @@ -23,6 +21,9 @@ namespace PackedVector #pragma warning(push) #pragma warning(disable:4201 4365 4324) +// C4201: nonstandard extension used +// C4365: Off by default noise +// C4324: alignment padding warnings //------------------------------------------------------------------------------ // ARGB Color; 8-8-8-8 bit unsigned normalized integer components packed into @@ -46,7 +47,7 @@ struct XMCOLOR }; XMCOLOR() XM_CTOR_DEFAULT - XMCOLOR(uint32_t Color) : c(Color) {} + XM_CONSTEXPR XMCOLOR(uint32_t Color) : c(Color) {} XMCOLOR(float _r, float _g, float _b, float _a); explicit XMCOLOR(_In_reads_(4) const float *pArray); @@ -76,8 +77,8 @@ struct XMHALF2 }; XMHALF2() XM_CTOR_DEFAULT - explicit XMHALF2(uint32_t Packed) : v(Packed) {} - XMHALF2(HALF _x, HALF _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMHALF2(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMHALF2(HALF _x, HALF _y) : x(_x), y(_y) {} explicit XMHALF2(_In_reads_(2) const HALF *pArray) : x(pArray[0]), y(pArray[1]) {} XMHALF2(float _x, float _y); explicit XMHALF2(_In_reads_(2) const float *pArray); @@ -101,8 +102,8 @@ struct XMSHORTN2 }; XMSHORTN2() XM_CTOR_DEFAULT - explicit XMSHORTN2(uint32_t Packed) : v(Packed) {} - XMSHORTN2(int16_t _x, int16_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMSHORTN2(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMSHORTN2(int16_t _x, int16_t _y) : x(_x), y(_y) {} explicit XMSHORTN2(_In_reads_(2) const int16_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMSHORTN2(float _x, float _y); explicit XMSHORTN2(_In_reads_(2) const float *pArray); @@ -125,8 +126,8 @@ struct XMSHORT2 }; XMSHORT2() XM_CTOR_DEFAULT - explicit XMSHORT2(uint32_t Packed) : v(Packed) {} - XMSHORT2(int16_t _x, int16_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMSHORT2(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMSHORT2(int16_t _x, int16_t _y) : x(_x), y(_y) {} explicit XMSHORT2(_In_reads_(2) const int16_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMSHORT2(float _x, float _y); explicit XMSHORT2(_In_reads_(2) const float *pArray); @@ -149,8 +150,8 @@ struct XMUSHORTN2 }; XMUSHORTN2() XM_CTOR_DEFAULT - explicit XMUSHORTN2(uint32_t Packed) : v(Packed) {} - XMUSHORTN2(uint16_t _x, uint16_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMUSHORTN2(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUSHORTN2(uint16_t _x, uint16_t _y) : x(_x), y(_y) {} explicit XMUSHORTN2(_In_reads_(2) const uint16_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMUSHORTN2(float _x, float _y); explicit XMUSHORTN2(_In_reads_(2) const float *pArray); @@ -173,8 +174,8 @@ struct XMUSHORT2 }; XMUSHORT2() XM_CTOR_DEFAULT - explicit XMUSHORT2(uint32_t Packed) : v(Packed) {} - XMUSHORT2(uint16_t _x, uint16_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMUSHORT2(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUSHORT2(uint16_t _x, uint16_t _y) : x(_x), y(_y) {} explicit XMUSHORT2(_In_reads_(2) const uint16_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMUSHORT2(float _x, float _y); explicit XMUSHORT2(_In_reads_(2) const float *pArray); @@ -198,8 +199,8 @@ struct XMBYTEN2 }; XMBYTEN2() XM_CTOR_DEFAULT - explicit XMBYTEN2(uint16_t Packed) : v(Packed) {} - XMBYTEN2(int8_t _x, int8_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMBYTEN2(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMBYTEN2(int8_t _x, int8_t _y) : x(_x), y(_y) {} explicit XMBYTEN2(_In_reads_(2) const int8_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMBYTEN2(float _x, float _y); explicit XMBYTEN2(_In_reads_(2) const float *pArray); @@ -222,8 +223,8 @@ struct XMBYTE2 }; XMBYTE2() XM_CTOR_DEFAULT - explicit XMBYTE2(uint16_t Packed) : v(Packed) {} - XMBYTE2(int8_t _x, int8_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMBYTE2(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMBYTE2(int8_t _x, int8_t _y) : x(_x), y(_y) {} explicit XMBYTE2(_In_reads_(2) const int8_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMBYTE2(float _x, float _y); explicit XMBYTE2(_In_reads_(2) const float *pArray); @@ -246,8 +247,8 @@ struct XMUBYTEN2 }; XMUBYTEN2() XM_CTOR_DEFAULT - explicit XMUBYTEN2(uint16_t Packed) : v(Packed) {} - XMUBYTEN2(uint8_t _x, uint8_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMUBYTEN2(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUBYTEN2(uint8_t _x, uint8_t _y) : x(_x), y(_y) {} explicit XMUBYTEN2(_In_reads_(2) const uint8_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMUBYTEN2(float _x, float _y); explicit XMUBYTEN2(_In_reads_(2) const float *pArray); @@ -270,8 +271,8 @@ struct XMUBYTE2 }; XMUBYTE2() XM_CTOR_DEFAULT - explicit XMUBYTE2(uint16_t Packed) : v(Packed) {} - XMUBYTE2(uint8_t _x, uint8_t _y) : x(_x), y(_y) {} + explicit XM_CONSTEXPR XMUBYTE2(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUBYTE2(uint8_t _x, uint8_t _y) : x(_x), y(_y) {} explicit XMUBYTE2(_In_reads_(2) const uint8_t *pArray) : x(pArray[0]), y(pArray[1]) {} XMUBYTE2(float _x, float _y); explicit XMUBYTE2(_In_reads_(2) const float *pArray); @@ -296,9 +297,9 @@ struct XMU565 }; XMU565() XM_CTOR_DEFAULT - explicit XMU565(uint16_t Packed) : v(Packed) {} - XMU565(uint8_t _x, uint8_t _y, uint8_t _z) : x(_x), y(_y), z(_z) {} - explicit XMU565(_In_reads_(3) const int8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {} + explicit XM_CONSTEXPR XMU565(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMU565(uint8_t _x, uint8_t _y, uint8_t _z) : x(_x), y(_y), z(_z) {} + explicit XMU565(_In_reads_(3) const uint8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {} XMU565(float _x, float _y, float _z); explicit XMU565(_In_reads_(3) const float *pArray); @@ -334,7 +335,7 @@ struct XMFLOAT3PK }; XMFLOAT3PK() XM_CTOR_DEFAULT - explicit XMFLOAT3PK(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMFLOAT3PK(uint32_t Packed) : v(Packed) {} XMFLOAT3PK(float _x, float _y, float _z); explicit XMFLOAT3PK(_In_reads_(3) const float *pArray); @@ -367,7 +368,7 @@ struct XMFLOAT3SE }; XMFLOAT3SE() XM_CTOR_DEFAULT - explicit XMFLOAT3SE(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMFLOAT3SE(uint32_t Packed) : v(Packed) {} XMFLOAT3SE(float _x, float _y, float _z); explicit XMFLOAT3SE(_In_reads_(3) const float *pArray); @@ -394,8 +395,8 @@ struct XMHALF4 }; XMHALF4() XM_CTOR_DEFAULT - explicit XMHALF4(uint64_t Packed) : v(Packed) {} - XMHALF4(HALF _x, HALF _y, HALF _z, HALF _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMHALF4(uint64_t Packed) : v(Packed) {} + XM_CONSTEXPR XMHALF4(HALF _x, HALF _y, HALF _z, HALF _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMHALF4(_In_reads_(4) const HALF *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMHALF4(float _x, float _y, float _z, float _w); explicit XMHALF4(_In_reads_(4) const float *pArray); @@ -421,8 +422,8 @@ struct XMSHORTN4 }; XMSHORTN4() XM_CTOR_DEFAULT - explicit XMSHORTN4(uint64_t Packed) : v(Packed) {} - XMSHORTN4(int16_t _x, int16_t _y, int16_t _z, int16_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMSHORTN4(uint64_t Packed) : v(Packed) {} + XM_CONSTEXPR XMSHORTN4(int16_t _x, int16_t _y, int16_t _z, int16_t _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMSHORTN4(_In_reads_(4) const int16_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMSHORTN4(float _x, float _y, float _z, float _w); explicit XMSHORTN4(_In_reads_(4) const float *pArray); @@ -447,8 +448,8 @@ struct XMSHORT4 }; XMSHORT4() XM_CTOR_DEFAULT - explicit XMSHORT4(uint64_t Packed) : v(Packed) {} - XMSHORT4(int16_t _x, int16_t _y, int16_t _z, int16_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMSHORT4(uint64_t Packed) : v(Packed) {} + XM_CONSTEXPR XMSHORT4(int16_t _x, int16_t _y, int16_t _z, int16_t _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMSHORT4(_In_reads_(4) const int16_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMSHORT4(float _x, float _y, float _z, float _w); explicit XMSHORT4(_In_reads_(4) const float *pArray); @@ -473,8 +474,8 @@ struct XMUSHORTN4 }; XMUSHORTN4() XM_CTOR_DEFAULT - explicit XMUSHORTN4(uint64_t Packed) : v(Packed) {} - XMUSHORTN4(uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMUSHORTN4(uint64_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUSHORTN4(uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMUSHORTN4(_In_reads_(4) const uint16_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMUSHORTN4(float _x, float _y, float _z, float _w); explicit XMUSHORTN4(_In_reads_(4) const float *pArray); @@ -499,8 +500,8 @@ struct XMUSHORT4 }; XMUSHORT4() XM_CTOR_DEFAULT - explicit XMUSHORT4(uint64_t Packed) : v(Packed) {} - XMUSHORT4(uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMUSHORT4(uint64_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUSHORT4(uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _w) : x(_x), y(_y), z(_z), w(_w) {} explicit XMUSHORT4(_In_reads_(4) const uint16_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMUSHORT4(float _x, float _y, float _z, float _w); explicit XMUSHORT4(_In_reads_(4) const float *pArray); @@ -531,7 +532,7 @@ struct XMXDECN4 }; XMXDECN4() XM_CTOR_DEFAULT - explicit XMXDECN4(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMXDECN4(uint32_t Packed) : v(Packed) {} XMXDECN4(float _x, float _y, float _z, float _w); explicit XMXDECN4(_In_reads_(4) const float *pArray); @@ -547,7 +548,7 @@ struct XMXDECN4 // z, y, and x components. The w component is stored in the // most significant bits and the x component in the least significant bits // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] -struct XMXDEC4 +struct XM_DEPRECATED XMXDEC4 { union { @@ -562,7 +563,7 @@ struct XMXDEC4 }; XMXDEC4() XM_CTOR_DEFAULT - explicit XMXDEC4(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMXDEC4(uint32_t Packed) : v(Packed) {} XMXDEC4(float _x, float _y, float _z, float _w); explicit XMXDEC4(_In_reads_(4) const float *pArray); @@ -578,7 +579,7 @@ struct XMXDEC4 // integers for the z, y, and x components. The w component is stored in the // most significant bits and the x component in the least significant bits // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] -struct XMDECN4 +struct XM_DEPRECATED XMDECN4 { union { @@ -593,7 +594,7 @@ struct XMDECN4 }; XMDECN4() XM_CTOR_DEFAULT - explicit XMDECN4(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMDECN4(uint32_t Packed) : v(Packed) {} XMDECN4(float _x, float _y, float _z, float _w); explicit XMDECN4(_In_reads_(4) const float *pArray); @@ -609,7 +610,7 @@ struct XMDECN4 // z, y, and x components. The w component is stored in the // most significant bits and the x component in the least significant bits // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] -struct XMDEC4 +struct XM_DEPRECATED XMDEC4 { union { @@ -624,7 +625,7 @@ struct XMDEC4 }; XMDEC4() XM_CTOR_DEFAULT - explicit XMDEC4(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMDEC4(uint32_t Packed) : v(Packed) {} XMDEC4(float _x, float _y, float _z, float _w); explicit XMDEC4(_In_reads_(4) const float *pArray); @@ -655,7 +656,7 @@ struct XMUDECN4 }; XMUDECN4() XM_CTOR_DEFAULT - explicit XMUDECN4(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMUDECN4(uint32_t Packed) : v(Packed) {} XMUDECN4(float _x, float _y, float _z, float _w); explicit XMUDECN4(_In_reads_(4) const float *pArray); @@ -686,7 +687,7 @@ struct XMUDEC4 }; XMUDEC4() XM_CTOR_DEFAULT - explicit XMUDEC4(uint32_t Packed) : v(Packed) {} + explicit XM_CONSTEXPR XMUDEC4(uint32_t Packed) : v(Packed) {} XMUDEC4(float _x, float _y, float _z, float _w); explicit XMUDEC4(_In_reads_(4) const float *pArray); @@ -713,8 +714,8 @@ struct XMBYTEN4 }; XMBYTEN4() XM_CTOR_DEFAULT - XMBYTEN4(int8_t _x, int8_t _y, int8_t _z, int8_t _w) : x(_x), y(_y), z(_z), w(_w) {} - explicit XMBYTEN4(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMBYTEN4(int8_t _x, int8_t _y, int8_t _z, int8_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMBYTEN4(uint32_t Packed) : v(Packed) {} explicit XMBYTEN4(_In_reads_(4) const int8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMBYTEN4(float _x, float _y, float _z, float _w); explicit XMBYTEN4(_In_reads_(4) const float *pArray); @@ -739,8 +740,8 @@ struct XMBYTE4 }; XMBYTE4() XM_CTOR_DEFAULT - XMBYTE4(int8_t _x, int8_t _y, int8_t _z, int8_t _w) : x(_x), y(_y), z(_z), w(_w) {} - explicit XMBYTE4(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMBYTE4(int8_t _x, int8_t _y, int8_t _z, int8_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMBYTE4(uint32_t Packed) : v(Packed) {} explicit XMBYTE4(_In_reads_(4) const int8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMBYTE4(float _x, float _y, float _z, float _w); explicit XMBYTE4(_In_reads_(4) const float *pArray); @@ -765,8 +766,8 @@ struct XMUBYTEN4 }; XMUBYTEN4() XM_CTOR_DEFAULT - XMUBYTEN4(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w) : x(_x), y(_y), z(_z), w(_w) {} - explicit XMUBYTEN4(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUBYTEN4(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMUBYTEN4(uint32_t Packed) : v(Packed) {} explicit XMUBYTEN4(_In_reads_(4) const uint8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMUBYTEN4(float _x, float _y, float _z, float _w); explicit XMUBYTEN4(_In_reads_(4) const float *pArray); @@ -791,8 +792,8 @@ struct XMUBYTE4 }; XMUBYTE4() XM_CTOR_DEFAULT - XMUBYTE4(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w) : x(_x), y(_y), z(_z), w(_w) {} - explicit XMUBYTE4(uint32_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUBYTE4(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XM_CONSTEXPR XMUBYTE4(uint32_t Packed) : v(Packed) {} explicit XMUBYTE4(_In_reads_(4) const uint8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMUBYTE4(float _x, float _y, float _z, float _w); explicit XMUBYTE4(_In_reads_(4) const float *pArray); @@ -818,9 +819,9 @@ struct XMUNIBBLE4 }; XMUNIBBLE4() XM_CTOR_DEFAULT - explicit XMUNIBBLE4(uint16_t Packed) : v(Packed) {} - XMUNIBBLE4(int8_t _x, int8_t _y, int8_t _z, int8_t _w) : x(_x), y(_y), z(_z), w(_w) {} - explicit XMUNIBBLE4(_In_reads_(4) const int8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} + explicit XM_CONSTEXPR XMUNIBBLE4(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMUNIBBLE4(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w) : x(_x), y(_y), z(_z), w(_w) {} + explicit XMUNIBBLE4(_In_reads_(4) const uint8_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {} XMUNIBBLE4(float _x, float _y, float _z, float _w); explicit XMUNIBBLE4(_In_reads_(4) const float *pArray); @@ -847,9 +848,9 @@ struct XMU555 }; XMU555() XM_CTOR_DEFAULT - explicit XMU555(uint16_t Packed) : v(Packed) {} - XMU555(int8_t _x, int8_t _y, int8_t _z, bool _w) : x(_x), y(_y), z(_z), w(_w ? 0x1 : 0) {} - XMU555(_In_reads_(3) const int8_t *pArray, _In_ bool _w) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(_w ? 0x1 : 0) {} + explicit XM_CONSTEXPR XMU555(uint16_t Packed) : v(Packed) {} + XM_CONSTEXPR XMU555(uint8_t _x, uint8_t _y, uint8_t _z, bool _w) : x(_x), y(_y), z(_z), w(_w ? 0x1 : 0) {} + XMU555(_In_reads_(3) const uint8_t *pArray, _In_ bool _w) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(_w ? 0x1 : 0) {} XMU555(float _x, float _y, float _z, bool _w); XMU555(_In_reads_(3) const float *pArray, _In_ bool _w); @@ -907,9 +908,6 @@ XMVECTOR XM_CALLCONV XMLoadShort4(_In_ const XMSHORT4* pSource); XMVECTOR XM_CALLCONV XMLoadUShortN4(_In_ const XMUSHORTN4* pSource); XMVECTOR XM_CALLCONV XMLoadUShort4(_In_ const XMUSHORT4* pSource); XMVECTOR XM_CALLCONV XMLoadXDecN4(_In_ const XMXDECN4* pSource); -XMVECTOR XM_CALLCONV XMLoadXDec4(_In_ const XMXDEC4* pSource); -XMVECTOR XM_CALLCONV XMLoadDecN4(_In_ const XMDECN4* pSource); -XMVECTOR XM_CALLCONV XMLoadDec4(_In_ const XMDEC4* pSource); XMVECTOR XM_CALLCONV XMLoadUDecN4(_In_ const XMUDECN4* pSource); XMVECTOR XM_CALLCONV XMLoadUDecN4_XR(_In_ const XMUDECN4* pSource); XMVECTOR XM_CALLCONV XMLoadUDec4(_In_ const XMUDEC4* pSource); @@ -920,6 +918,15 @@ XMVECTOR XM_CALLCONV XMLoadUByte4(_In_ const XMUBYTE4* pSource); XMVECTOR XM_CALLCONV XMLoadUNibble4(_In_ const XMUNIBBLE4* pSource); XMVECTOR XM_CALLCONV XMLoadU555(_In_ const XMU555* pSource); +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + +XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDecN4(_In_ const XMDECN4* pSource); +XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDec4(_In_ const XMDEC4* pSource); +XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadXDec4(_In_ const XMXDEC4* pSource); +#pragma warning(pop) + /**************************************************************************** * * Store operations @@ -948,9 +955,6 @@ void XM_CALLCONV XMStoreShort4(_Out_ XMSHORT4* pDestination, _In_ FXMVECT void XM_CALLCONV XMStoreUShortN4(_Out_ XMUSHORTN4* pDestination, _In_ FXMVECTOR V); void XM_CALLCONV XMStoreUShort4(_Out_ XMUSHORT4* pDestination, _In_ FXMVECTOR V); void XM_CALLCONV XMStoreXDecN4(_Out_ XMXDECN4* pDestination, _In_ FXMVECTOR V); -void XM_CALLCONV XMStoreXDec4(_Out_ XMXDEC4* pDestination, _In_ FXMVECTOR V); -void XM_CALLCONV XMStoreDecN4(_Out_ XMDECN4* pDestination, _In_ FXMVECTOR V); -void XM_CALLCONV XMStoreDec4(_Out_ XMDEC4* pDestination, _In_ FXMVECTOR V); void XM_CALLCONV XMStoreUDecN4(_Out_ XMUDECN4* pDestination, _In_ FXMVECTOR V); void XM_CALLCONV XMStoreUDecN4_XR(_Out_ XMUDECN4* pDestination, _In_ FXMVECTOR V); void XM_CALLCONV XMStoreUDec4(_Out_ XMUDEC4* pDestination, _In_ FXMVECTOR V); @@ -961,6 +965,15 @@ void XM_CALLCONV XMStoreUByte4(_Out_ XMUBYTE4* pDestination, _In_ FXMVECT void XM_CALLCONV XMStoreUNibble4(_Out_ XMUNIBBLE4* pDestination, _In_ FXMVECTOR V); void XM_CALLCONV XMStoreU555(_Out_ XMU555* pDestination, _In_ FXMVECTOR V); +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + +void XM_DEPRECATED XM_CALLCONV XMStoreDecN4(_Out_ XMDECN4* pDestination, _In_ FXMVECTOR V); +void XM_DEPRECATED XM_CALLCONV XMStoreDec4(_Out_ XMDEC4* pDestination, _In_ FXMVECTOR V); +void XM_DEPRECATED XM_CALLCONV XMStoreXDec4(_Out_ XMXDEC4* pDestination, _In_ FXMVECTOR V); +#pragma warning(pop) + /**************************************************************************** * * Implementation @@ -968,7 +981,11 @@ void XM_CALLCONV XMStoreU555(_Out_ XMU555* pDestination, _In_ FXMVECTOR V ****************************************************************************/ #pragma warning(push) -#pragma warning(disable:4068 4214 4204 4365 4616 6001) +#pragma warning(disable:4068 4214 4204 4365 4616 6001 6101) +// C4068/4616: ignore unknown pragmas +// C4214/4204: nonstandard extension used +// C4365: Off by default noise +// C6001/6101: False positives #pragma prefast(push) #pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes") diff --git a/Inc/DirectXPackedVector.inl b/Inc/DirectXPackedVector.inl index a50d397..cb03734 100644 --- a/Inc/DirectXPackedVector.inl +++ b/Inc/DirectXPackedVector.inl @@ -9,10 +9,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------------- -#ifdef _MSC_VER #pragma once -#endif - /**************************************************************************** * @@ -1262,6 +1259,10 @@ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadXDecN4 } //------------------------------------------------------------------------------ +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadXDec4 ( @@ -1311,6 +1312,8 @@ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadXDec4 #endif } +#pragma warning(pop) + //------------------------------------------------------------------------------ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadUDecN4 @@ -1455,6 +1458,10 @@ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadUDec4 } //------------------------------------------------------------------------------ +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadDecN4 ( @@ -1554,6 +1561,8 @@ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadDec4 #endif } +#pragma warning(pop) + //------------------------------------------------------------------------------ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV PackedVector::XMLoadUByteN4 @@ -2676,6 +2685,10 @@ inline void XM_CALLCONV PackedVector::XMStoreXDecN4 } //------------------------------------------------------------------------------ +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + _Use_decl_annotations_ inline void XM_CALLCONV PackedVector::XMStoreXDec4 ( @@ -2746,6 +2759,8 @@ inline void XM_CALLCONV PackedVector::XMStoreXDec4 #endif } +#pragma warning(pop) + //------------------------------------------------------------------------------ _Use_decl_annotations_ inline void XM_CALLCONV PackedVector::XMStoreUDecN4 @@ -2961,6 +2976,10 @@ inline void XM_CALLCONV PackedVector::XMStoreUDec4 } //------------------------------------------------------------------------------ +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + _Use_decl_annotations_ inline void XM_CALLCONV PackedVector::XMStoreDecN4 ( @@ -3084,6 +3103,8 @@ inline void XM_CALLCONV PackedVector::XMStoreDec4 #endif } +#pragma warning(pop) + //------------------------------------------------------------------------------ _Use_decl_annotations_ inline void XM_CALLCONV PackedVector::XMStoreUByteN4 @@ -3954,6 +3975,10 @@ inline PackedVector::XMXDECN4::XMXDECN4 * ****************************************************************************/ +#pragma warning(push) +#pragma warning(disable : 4996) +// C4996: ignore deprecation warning + //------------------------------------------------------------------------------ inline PackedVector::XMXDEC4::XMXDEC4 @@ -4035,6 +4060,8 @@ inline PackedVector::XMDEC4::XMDEC4 XMStoreDec4(this, XMLoadFloat4(reinterpret_cast(pArray))); } +#pragma warning(pop) + /**************************************************************************** * * XMUDECN4 operators diff --git a/ReadMe.txt b/ReadMe.txt index 4743685..a4b33de 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -4,13 +4,13 @@ DirectXMath Copyright (c) Microsoft Corporation. All rights reserved. -May 23, 2016 +June 2016 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 2012, 2013 or 2015. It is recommended that you +This code is designed to build with Visual Studio 2013 or 2015. It is recommended that you make use of VS 2013 Update 5 or VS 2015 Update 2. These components are designed to work without requiring any content from the DirectX SDK. For details, @@ -55,6 +55,14 @@ For the latest version of DirectXMath, bug reports, etc. please visit the projec RELEASE HISTORY --------------- +June 2016 (3.09) + Includes support for additional optimizations when built with /arch:AVX or /arch:AVX2 + Added use of constexpr for type constructors, XMConvertToRadians, and XMConvertToDegrees + Marked __vector4i, XMXDEC4, XMDECN4, XMDEC4, and associated Load & Store functions as deprecated. + These are vestiges of Xbox 360 support and will be removed in a future release + Renamed parameter in XMMatrixPerspectiveFov* to reduce user confusion when relying on IntelliSense + XMU565, XMUNIBBLE4 constructors take uint8_t instead of int8_t + May 2016 DirectXMath 3.08 released under the MIT license