Skip to content

Commit 27f790e

Browse files
committed
DirectXMath 3.04
1 parent fd7f304 commit 27f790e

7 files changed

+7427
-1196
lines changed

Inc/DirectXCollision.inl

+13-3
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,12 @@ inline void BoundingOrientedBox::Transform( BoundingOrientedBox& Out, CXMMATRIX
19491949
assert( DirectX::Internal::XMQuaternionIsUnit( vOrientation ) );
19501950

19511951
// Composite the box rotation and the transform rotation.
1952-
XMVECTOR Rotation = XMQuaternionRotationMatrix( M );
1952+
XMMATRIX nM;
1953+
nM.r[0] = XMVector3Normalize( M.r[0] );
1954+
nM.r[1] = XMVector3Normalize( M.r[1] );
1955+
nM.r[2] = XMVector3Normalize( M.r[2] );
1956+
nM.r[3] = g_XMIdentityR3;
1957+
XMVECTOR Rotation = XMQuaternionRotationMatrix( nM );
19531958
vOrientation = XMQuaternionMultiply( vOrientation, Rotation );
19541959

19551960
// Transform the center.
@@ -2820,8 +2825,13 @@ inline void BoundingFrustum::Transform( BoundingFrustum& Out, CXMMATRIX M ) cons
28202825

28212826
assert( DirectX::Internal::XMQuaternionIsUnit( vOrientation ) );
28222827

2823-
// Composite the frustum rotation and the transform rotation.
2824-
XMVECTOR Rotation = XMQuaternionRotationMatrix( M );
2828+
// Composite the frustum rotation and the transform rotation
2829+
XMMATRIX nM;
2830+
nM.r[0] = XMVector3Normalize( M.r[0] );
2831+
nM.r[1] = XMVector3Normalize( M.r[1] );
2832+
nM.r[2] = XMVector3Normalize( M.r[2] );
2833+
nM.r[3] = g_XMIdentityR3;
2834+
XMVECTOR Rotation = XMQuaternionRotationMatrix( nM );
28252835
vOrientation = XMQuaternionMultiply( vOrientation, Rotation );
28262836

28272837
// Transform the center.

Inc/DirectXMath.h

+97-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#error DirectX Math requires C++
1818
#endif
1919

20-
#define DIRECTX_MATH_VERSION 303
20+
#define DIRECTX_MATH_VERSION 304
2121

2222
#if !defined(_XM_BIGENDIAN_) && !defined(_XM_LITTLEENDIAN_)
23-
#if defined(_M_AMD64) || defined(_M_IX86) || defined(_M_ARM)
23+
#if defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM)
2424
#define _XM_LITTLEENDIAN_
2525
#elif defined(_M_PPCBE)
2626
#define _XM_BIGENDIAN_
@@ -32,7 +32,7 @@
3232

3333

3434
#if !defined(_XM_ARM_NEON_INTRINSICS_) && !defined(_XM_SSE_INTRINSICS_) && !defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
35-
#if defined(_M_IX86) || defined(_M_AMD64)
35+
#if defined(_M_IX86) || defined(_M_X64)
3636
#define _XM_SSE_INTRINSICS_
3737
#elif defined(_M_PPCBE)
3838
#define _XM_VMX128_INTRINSICS_
@@ -204,7 +204,7 @@ struct __vector4
204204
#endif // _XM_NO_INTRINSICS_
205205

206206
//------------------------------------------------------------------------------
207-
#if (defined (_M_IX86) || defined(_M_AMD64) || defined(_M_ARM)) && defined(_XM_NO_INTRINSICS_)
207+
#if (defined (_M_IX86) || defined(_M_X64) || defined(_M_ARM)) && defined(_XM_NO_INTRINSICS_)
208208
typedef uint32_t __vector4i[4];
209209
#else
210210
typedef __declspec(align(16)) uint32_t __vector4i[4];
@@ -338,7 +338,7 @@ typedef const XMMATRIX CXMMATRIX;
338338
typedef const XMMATRIX& CXMMATRIX;
339339
#endif
340340

341-
#if (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM)) && defined(_XM_NO_INTRINSICS_)
341+
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM)) && defined(_XM_NO_INTRINSICS_)
342342
struct XMMATRIX
343343
#else
344344
__declspec(align(16)) struct XMMATRIX
@@ -775,16 +775,31 @@ void XMStoreUInt3(_Out_ XMUINT3* pDestination, _In_ FXMVECTOR V);
775775

776776
void XMStoreInt4(_Out_writes_(4) uint32_t* pDestination, _In_ FXMVECTOR V);
777777
void XMStoreInt4A(_Out_writes_(4) uint32_t* pDestination, _In_ FXMVECTOR V);
778+
///begin_xbox360
779+
void XMStoreInt4NC(_Out_writes_(4) uint32_t* pDestination, _In_ FXMVECTOR V);
780+
///end_xbox360
778781
void XMStoreFloat4(_Out_ XMFLOAT4* pDestination, _In_ FXMVECTOR V);
779782
void XMStoreFloat4A(_Out_ XMFLOAT4A* pDestination, _In_ FXMVECTOR V);
783+
///begin_xbox360
784+
void XMStoreFloat4NC(_Out_ XMFLOAT4* pDestination, _In_ FXMVECTOR V);
785+
///end_xbox360
780786
void XMStoreSInt4(_Out_ XMINT4* pDestination, _In_ FXMVECTOR V);
781787
void XMStoreUInt4(_Out_ XMUINT4* pDestination, _In_ FXMVECTOR V);
782788

783789
void XMStoreFloat3x3(_Out_ XMFLOAT3X3* pDestination, _In_ CXMMATRIX M);
790+
///begin_xbox360
791+
void XMStoreFloat3x3NC(_Out_ XMFLOAT3X3* pDestination, _In_ CXMMATRIX M);
792+
///end_xbox360
784793
void XMStoreFloat4x3(_Out_ XMFLOAT4X3* pDestination, _In_ CXMMATRIX M);
785794
void XMStoreFloat4x3A(_Out_ XMFLOAT4X3A* pDestination, _In_ CXMMATRIX M);
795+
///begin_xbox360
796+
void XMStoreFloat4x3NC(_Out_ XMFLOAT4X3* pDestination, _In_ CXMMATRIX M);
797+
///end_xbox360
786798
void XMStoreFloat4x4(_Out_ XMFLOAT4X4* pDestination, _In_ CXMMATRIX M);
787799
void XMStoreFloat4x4A(_Out_ XMFLOAT4X4A* pDestination, _In_ CXMMATRIX M);
800+
///begin_xbox360
801+
void XMStoreFloat4x4NC(_Out_ XMFLOAT4X4* pDestination, _In_ CXMMATRIX M);
802+
///end_xbox360
788803

789804
/****************************************************************************
790805
*
@@ -933,8 +948,21 @@ XMVECTOR XMVectorSqrtEst(FXMVECTOR V);
933948
XMVECTOR XMVectorSqrt(FXMVECTOR V);
934949
XMVECTOR XMVectorReciprocalSqrtEst(FXMVECTOR V);
935950
XMVECTOR XMVectorReciprocalSqrt(FXMVECTOR V);
951+
///begin_xbox360
952+
XMVECTOR XMVectorExpEst(FXMVECTOR V);
953+
///end_xbox360
954+
XMVECTOR XMVectorExp2(FXMVECTOR V);
955+
XMVECTOR XMVectorExpE(FXMVECTOR V);
936956
XMVECTOR XMVectorExp(FXMVECTOR V);
957+
///begin_xbox360
958+
XMVECTOR XMVectorLogEst(FXMVECTOR V);
959+
///end_xbox360
960+
XMVECTOR XMVectorLog2(FXMVECTOR V);
961+
XMVECTOR XMVectorLogE(FXMVECTOR V);
937962
XMVECTOR XMVectorLog(FXMVECTOR V);
963+
///begin_xbox360
964+
XMVECTOR XMVectorPowEst(FXMVECTOR V1, FXMVECTOR V2);
965+
///end_xbox360
938966
XMVECTOR XMVectorPow(FXMVECTOR V1, FXMVECTOR V2);
939967
XMVECTOR XMVectorAbs(FXMVECTOR V);
940968
XMVECTOR XMVectorMod(FXMVECTOR V1, FXMVECTOR V2);
@@ -948,8 +976,17 @@ void XMVectorSinCosEst(_Out_ XMVECTOR* pSin, _Out_ XMVECTOR* pCos, _I
948976
XMVECTOR XMVectorTan(FXMVECTOR V);
949977
XMVECTOR XMVectorTanEst(FXMVECTOR V);
950978
XMVECTOR XMVectorSinH(FXMVECTOR V);
979+
///begin_xbox360
980+
XMVECTOR XMVectorSinHEst(FXMVECTOR V);
981+
///end_xbox360
951982
XMVECTOR XMVectorCosH(FXMVECTOR V);
983+
///begin_xbox360
984+
XMVECTOR XMVectorCosHEst(FXMVECTOR V);
985+
///end_xbox360
952986
XMVECTOR XMVectorTanH(FXMVECTOR V);
987+
///begin_xbox360
988+
XMVECTOR XMVectorTanHEst(FXMVECTOR V);
989+
///end_xbox360
953990
XMVECTOR XMVectorASin(FXMVECTOR V);
954991
XMVECTOR XMVectorASinEst(FXMVECTOR V);
955992
XMVECTOR XMVectorACos(FXMVECTOR V);
@@ -987,6 +1024,9 @@ uint32_t XMVector2GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
9871024
bool XMVector2Less(FXMVECTOR V1, FXMVECTOR V2);
9881025
bool XMVector2LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
9891026
bool XMVector2InBounds(FXMVECTOR V, FXMVECTOR Bounds);
1027+
///begin_xbox360
1028+
uint32_t XMVector2InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
1029+
///end_xbox360
9901030

9911031
bool XMVector2IsNaN(FXMVECTOR V);
9921032
bool XMVector2IsInfinite(FXMVECTOR V);
@@ -1016,6 +1056,12 @@ XMFLOAT4* XMVector2TransformStream(_Out_writes_bytes_(sizeof(XMFLOAT4)+Out
10161056
_In_ size_t OutputStride,
10171057
_In_reads_bytes_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) const XMFLOAT2* pInputStream,
10181058
_In_ size_t InputStride, _In_ size_t VectorCount, _In_ CXMMATRIX M);
1059+
///begin_xbox360
1060+
XMFLOAT4* XMVector2TransformStreamNC(_Out_writes_bytes_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
1061+
_In_ size_t OutputStride,
1062+
_In_reads_bytes_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) const XMFLOAT2* pInputStream,
1063+
_In_ size_t InputStride, _In_ size_t VectorCount, _In_ CXMMATRIX M);
1064+
///end_xbox360
10191065
XMVECTOR XMVector2TransformCoord(FXMVECTOR V, CXMMATRIX M);
10201066
XMFLOAT2* XMVector2TransformCoordStream(_Out_writes_bytes_(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream,
10211067
_In_ size_t OutputStride,
@@ -1047,6 +1093,9 @@ uint32_t XMVector3GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
10471093
bool XMVector3Less(FXMVECTOR V1, FXMVECTOR V2);
10481094
bool XMVector3LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
10491095
bool XMVector3InBounds(FXMVECTOR V, FXMVECTOR Bounds);
1096+
///begin_xbox360
1097+
uint32_t XMVector3InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
1098+
///end_xbox360
10501099

10511100
bool XMVector3IsNaN(FXMVECTOR V);
10521101
bool XMVector3IsInfinite(FXMVECTOR V);
@@ -1078,6 +1127,12 @@ XMFLOAT4* XMVector3TransformStream(_Out_writes_bytes_(sizeof(XMFLOAT4)+Out
10781127
_In_ size_t OutputStride,
10791128
_In_reads_bytes_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) const XMFLOAT3* pInputStream,
10801129
_In_ size_t InputStride, _In_ size_t VectorCount, _In_ CXMMATRIX M);
1130+
///begin_xbox360
1131+
XMFLOAT4* XMVector3TransformStreamNC(_Out_writes_bytes_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
1132+
_In_ size_t OutputStride,
1133+
_In_reads_bytes_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) const XMFLOAT3* pInputStream,
1134+
_In_ size_t InputStride, _In_ size_t VectorCount, _In_ CXMMATRIX M);
1135+
///end_xbox360
10811136
XMVECTOR XMVector3TransformCoord(FXMVECTOR V, CXMMATRIX M);
10821137
XMFLOAT3* XMVector3TransformCoordStream(_Out_writes_bytes_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
10831138
_In_ size_t OutputStride,
@@ -1125,6 +1180,9 @@ uint32_t XMVector4GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
11251180
bool XMVector4Less(FXMVECTOR V1, FXMVECTOR V2);
11261181
bool XMVector4LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
11271182
bool XMVector4InBounds(FXMVECTOR V, FXMVECTOR Bounds);
1183+
///begin_xbox360
1184+
uint32_t XMVector4InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
1185+
///end_xbox360
11281186

11291187
bool XMVector4IsNaN(FXMVECTOR V);
11301188
bool XMVector4IsInfinite(FXMVECTOR V);
@@ -1368,6 +1426,12 @@ template<class T> inline T XMMax(T a, T b) { return (a > b) ? a : b; }
13681426

13691427
#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
13701428

1429+
#if defined(_XM_NO_MOVNT_)
1430+
#define XM_STREAM_PS( p, a ) _mm_store_ps( p, a )
1431+
#else
1432+
#define XM_STREAM_PS( p, a ) _mm_stream_ps( p, a )
1433+
#endif
1434+
13711435
#define XM_PERMUTE_PS( v, c ) _mm_shuffle_ps( v, v, c )
13721436

13731437
// PermuteHelper internal template (SSE only)
@@ -1452,6 +1516,7 @@ template<uint32_t PermuteX, uint32_t PermuteY, uint32_t PermuteZ, uint32_t Permu
14521516
template<> inline XMVECTOR XMVectorPermute<0,1,2,3>(FXMVECTOR V1, FXMVECTOR V2) { (V2); return V1; }
14531517
template<> inline XMVECTOR XMVectorPermute<4,5,6,7>(FXMVECTOR V1, FXMVECTOR V2) { (V1); return V2; }
14541518

1519+
14551520
#if defined(_XM_ARM_NEON_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
14561521

14571522
// If the indices are all in the range 0-3 or 4-7, then use XMVectorSwizzle instead
@@ -1705,6 +1770,24 @@ XMGLOBALCONST XMVECTORI32 g_XMFlipW = {0,0,0,0x80000000};
17051770
XMGLOBALCONST XMVECTORI32 g_XMFlipYZ = {0,0x80000000,0x80000000,0};
17061771
XMGLOBALCONST XMVECTORI32 g_XMFlipZW = {0,0,0x80000000,0x80000000};
17071772
XMGLOBALCONST XMVECTORI32 g_XMFlipYW = {0,0x80000000,0,0x80000000};
1773+
///begin_xbox360
1774+
XMGLOBALCONST XMVECTORI32 g_XMMaskHenD3 = {0x7FF,0x7ff<<11,0x3FF<<22,0};
1775+
XMGLOBALCONST XMVECTORI32 g_XMMaskDHen3 = {0x3FF,0x7ff<<10,0x7FF<<21,0};
1776+
XMGLOBALCONST XMVECTORF32 g_XMAddUHenD3 = {0,0,32768.0f*65536.0f,0};
1777+
XMGLOBALCONST XMVECTORF32 g_XMAddHenD3 = {-1024.0f,-1024.0f*2048.0f,0,0};
1778+
XMGLOBALCONST XMVECTORF32 g_XMAddDHen3 = {-512.0f,-1024.0f*1024.0f,0,0};
1779+
XMGLOBALCONST XMVECTORF32 g_XMMulHenD3 = {1.0f,1.0f/2048.0f,1.0f/(2048.0f*2048.0f),0};
1780+
XMGLOBALCONST XMVECTORF32 g_XMMulDHen3 = {1.0f,1.0f/1024.0f,1.0f/(1024.0f*2048.0f),0};
1781+
XMGLOBALCONST XMVECTORI32 g_XMXorHenD3 = {0x400,0x400<<11,0,0};
1782+
XMGLOBALCONST XMVECTORI32 g_XMXorDHen3 = {0x200,0x400<<10,0,0};
1783+
XMGLOBALCONST XMVECTORI32 g_XMMaskIco4 = {0xFFFFF,0xFFFFF000,0xFFFFF,0xF0000000};
1784+
XMGLOBALCONST XMVECTORI32 g_XMXorXIco4 = {0x80000,0,0x80000,0x80000000};
1785+
XMGLOBALCONST XMVECTORI32 g_XMXorIco4 = {0x80000,0,0x80000,0};
1786+
XMGLOBALCONST XMVECTORF32 g_XMAddXIco4 = {-8.0f*65536.0f,0,-8.0f*65536.0f,32768.0f*65536.0f};
1787+
XMGLOBALCONST XMVECTORF32 g_XMAddUIco4 = {0,32768.0f*65536.0f,0,32768.0f*65536.0f};
1788+
XMGLOBALCONST XMVECTORF32 g_XMAddIco4 = {-8.0f*65536.0f,0,-8.0f*65536.0f,0};
1789+
XMGLOBALCONST XMVECTORF32 g_XMMulIco4 = {1.0f,1.0f/4096.0f,1.0f,1.0f/(4096.0f*65536.0f)};
1790+
///end_xbox360
17081791
XMGLOBALCONST XMVECTORI32 g_XMMaskDec4 = {0x3FF,0x3FF<<10,0x3FF<<20,0x3<<30};
17091792
XMGLOBALCONST XMVECTORI32 g_XMXorDec4 = {0x200,0x200<<10,0x200<<20,0};
17101793
XMGLOBALCONST XMVECTORF32 g_XMAddUDec4 = {0,0,0,32768.0f*65536.0f};
@@ -1720,6 +1803,15 @@ XMGLOBALCONST XMVECTORF32 g_XMUnsignedFix = {32768.0f*65536.0f,32768.0f*65
17201803
XMGLOBALCONST XMVECTORF32 g_XMsrgbScale = { 12.92f, 12.92f, 12.92f, 1.0f };
17211804
XMGLOBALCONST XMVECTORF32 g_XMsrgbA = { 0.055f, 0.055f, 0.055f, 0.0f };
17221805
XMGLOBALCONST XMVECTORF32 g_XMsrgbA1 = { 1.055f, 1.055f, 1.055f, 1.0f };
1806+
XMGLOBALCONST XMVECTORI32 g_XMExponentBias = {127, 127, 127, 127};
1807+
XMGLOBALCONST XMVECTORI32 g_XMSubnormalExponent = {-126, -126, -126, -126};
1808+
XMGLOBALCONST XMVECTORI32 g_XMNumTrailing = {23, 23, 23, 23};
1809+
XMGLOBALCONST XMVECTORI32 g_XMMinNormal = {0x00800000, 0x00800000, 0x00800000, 0x00800000};
1810+
XMGLOBALCONST XMVECTORI32 g_XMNegInfinity = {0xFF800000, 0xFF800000, 0xFF800000, 0xFF800000};
1811+
XMGLOBALCONST XMVECTORI32 g_XMNegQNaN = {0xFFC00000, 0xFFC00000, 0xFFC00000, 0xFFC00000};
1812+
XMGLOBALCONST XMVECTORI32 g_XMBin128 = {0x43000000, 0x43000000, 0x43000000, 0x43000000};
1813+
XMGLOBALCONST XMVECTORI32 g_XMBinNeg150 = {0xC3160000, 0xC3160000, 0xC3160000, 0xC3160000};
1814+
XMGLOBALCONST XMVECTORI32 g_XM253 = {253, 253, 253, 253};
17231815

17241816
/****************************************************************************
17251817
*

0 commit comments

Comments
 (0)