Skip to content

Commit fea9eab

Browse files
committed
DirectXMath 3.08
1 parent 51802de commit fea9eab

7 files changed

+860
-274
lines changed

Inc/DirectXCollision.inl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1965,8 +1965,8 @@ inline void XM_CALLCONV BoundingOrientedBox::Transform( BoundingOrientedBox& Out
19651965
XMVECTOR dY = XMVector3Length( M.r[1] );
19661966
XMVECTOR dZ = XMVector3Length( M.r[2] );
19671967

1968-
XMVECTOR VectorScale = XMVectorSelect( dX, dY, g_XMSelect1000 );
1969-
VectorScale = XMVectorSelect( VectorScale, dZ, g_XMSelect1100 );
1968+
XMVECTOR VectorScale = XMVectorSelect( dY, dX, g_XMSelect1000 );
1969+
VectorScale = XMVectorSelect( dZ, VectorScale, g_XMSelect1100 );
19701970
vExtents = vExtents * VectorScale;
19711971

19721972
// Store the box.

Inc/DirectXMath.h

+34-19
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#error DirectX Math requires C++
1818
#endif
1919

20-
#define DIRECTX_MATH_VERSION 307
20+
#define DIRECTX_MATH_VERSION 308
2121

2222

2323
#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_)
@@ -32,6 +32,12 @@
3232
#define XM_CALLCONV __fastcall
3333
#endif
3434

35+
#if defined(_MSC_VER) && (_MSC_VER < 1800)
36+
#define XM_CTOR_DEFAULT {}
37+
#else
38+
#define XM_CTOR_DEFAULT =default;
39+
#endif
40+
3541

3642

3743
#if !defined(_XM_ARM_NEON_INTRINSICS_) && !defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
@@ -117,8 +123,10 @@
117123

118124
#if defined(_XM_NO_MOVNT_)
119125
#define XM_STREAM_PS( p, a ) _mm_store_ps( p, a )
126+
#define XM_SFENCE()
120127
#else
121128
#define XM_STREAM_PS( p, a ) _mm_stream_ps( p, a )
129+
#define XM_SFENCE() _mm_sfence()
122130
#endif
123131

124132
#define XM_PERMUTE_PS( v, c ) _mm_shuffle_ps( v, v, c )
@@ -413,7 +421,7 @@ __declspec(align(16)) struct XMMATRIX
413421
XMVECTOR r[4];
414422
#endif
415423

416-
XMMATRIX() {}
424+
XMMATRIX() XM_CTOR_DEFAULT
417425
XMMATRIX(FXMVECTOR R0, FXMVECTOR R1, FXMVECTOR R2, CXMVECTOR R3) { r[0] = R0; r[1] = R1; r[2] = R2; r[3] = R3; }
418426
XMMATRIX(float m00, float m01, float m02, float m03,
419427
float m10, float m11, float m12, float m13,
@@ -453,7 +461,7 @@ struct XMFLOAT2
453461
float x;
454462
float y;
455463

456-
XMFLOAT2() {}
464+
XMFLOAT2() XM_CTOR_DEFAULT
457465
XMFLOAT2(float _x, float _y) : x(_x), y(_y) {}
458466
explicit XMFLOAT2(_In_reads_(2) const float *pArray) : x(pArray[0]), y(pArray[1]) {}
459467

@@ -463,7 +471,7 @@ struct XMFLOAT2
463471
// 2D Vector; 32 bit floating point components aligned on a 16 byte boundary
464472
__declspec(align(16)) struct XMFLOAT2A : public XMFLOAT2
465473
{
466-
XMFLOAT2A() : XMFLOAT2() {}
474+
XMFLOAT2A() XM_CTOR_DEFAULT
467475
XMFLOAT2A(float _x, float _y) : XMFLOAT2(_x, _y) {}
468476
explicit XMFLOAT2A(_In_reads_(2) const float *pArray) : XMFLOAT2(pArray) {}
469477

@@ -477,7 +485,7 @@ struct XMINT2
477485
int32_t x;
478486
int32_t y;
479487

480-
XMINT2() {}
488+
XMINT2() XM_CTOR_DEFAULT
481489
XMINT2(int32_t _x, int32_t _y) : x(_x), y(_y) {}
482490
explicit XMINT2(_In_reads_(2) const int32_t *pArray) : x(pArray[0]), y(pArray[1]) {}
483491

@@ -490,7 +498,7 @@ struct XMUINT2
490498
uint32_t x;
491499
uint32_t y;
492500

493-
XMUINT2() {}
501+
XMUINT2() XM_CTOR_DEFAULT
494502
XMUINT2(uint32_t _x, uint32_t _y) : x(_x), y(_y) {}
495503
explicit XMUINT2(_In_reads_(2) const uint32_t *pArray) : x(pArray[0]), y(pArray[1]) {}
496504

@@ -505,7 +513,7 @@ struct XMFLOAT3
505513
float y;
506514
float z;
507515

508-
XMFLOAT3() {}
516+
XMFLOAT3() XM_CTOR_DEFAULT
509517
XMFLOAT3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}
510518
explicit XMFLOAT3(_In_reads_(3) const float *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {}
511519

@@ -515,7 +523,7 @@ struct XMFLOAT3
515523
// 3D Vector; 32 bit floating point components aligned on a 16 byte boundary
516524
__declspec(align(16)) struct XMFLOAT3A : public XMFLOAT3
517525
{
518-
XMFLOAT3A() : XMFLOAT3() {}
526+
XMFLOAT3A() XM_CTOR_DEFAULT
519527
XMFLOAT3A(float _x, float _y, float _z) : XMFLOAT3(_x, _y, _z) {}
520528
explicit XMFLOAT3A(_In_reads_(3) const float *pArray) : XMFLOAT3(pArray) {}
521529

@@ -530,7 +538,7 @@ struct XMINT3
530538
int32_t y;
531539
int32_t z;
532540

533-
XMINT3() {}
541+
XMINT3() XM_CTOR_DEFAULT
534542
XMINT3(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) {}
535543
explicit XMINT3(_In_reads_(3) const int32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {}
536544

@@ -544,7 +552,7 @@ struct XMUINT3
544552
uint32_t y;
545553
uint32_t z;
546554

547-
XMUINT3() {}
555+
XMUINT3() XM_CTOR_DEFAULT
548556
XMUINT3(uint32_t _x, uint32_t _y, uint32_t _z) : x(_x), y(_y), z(_z) {}
549557
explicit XMUINT3(_In_reads_(3) const uint32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {}
550558

@@ -560,7 +568,7 @@ struct XMFLOAT4
560568
float z;
561569
float w;
562570

563-
XMFLOAT4() {}
571+
XMFLOAT4() XM_CTOR_DEFAULT
564572
XMFLOAT4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) {}
565573
explicit XMFLOAT4(_In_reads_(4) const float *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {}
566574

@@ -570,7 +578,7 @@ struct XMFLOAT4
570578
// 4D Vector; 32 bit floating point components aligned on a 16 byte boundary
571579
__declspec(align(16)) struct XMFLOAT4A : public XMFLOAT4
572580
{
573-
XMFLOAT4A() : XMFLOAT4() {}
581+
XMFLOAT4A() XM_CTOR_DEFAULT
574582
XMFLOAT4A(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {}
575583
explicit XMFLOAT4A(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
576584

@@ -586,7 +594,7 @@ struct XMINT4
586594
int32_t z;
587595
int32_t w;
588596

589-
XMINT4() {}
597+
XMINT4() XM_CTOR_DEFAULT
590598
XMINT4(int32_t _x, int32_t _y, int32_t _z, int32_t _w) : x(_x), y(_y), z(_z), w(_w) {}
591599
explicit XMINT4(_In_reads_(4) const int32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {}
592600

@@ -601,7 +609,7 @@ struct XMUINT4
601609
uint32_t z;
602610
uint32_t w;
603611

604-
XMUINT4() {}
612+
XMUINT4() XM_CTOR_DEFAULT
605613
XMUINT4(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w) : x(_x), y(_y), z(_z), w(_w) {}
606614
explicit XMUINT4(_In_reads_(4) const uint32_t *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {}
607615

@@ -623,7 +631,7 @@ struct XMFLOAT3X3
623631
float m[3][3];
624632
};
625633

626-
XMFLOAT3X3() {}
634+
XMFLOAT3X3() XM_CTOR_DEFAULT
627635
XMFLOAT3X3(float m00, float m01, float m02,
628636
float m10, float m11, float m12,
629637
float m20, float m21, float m22);
@@ -651,7 +659,7 @@ struct XMFLOAT4X3
651659
float m[4][3];
652660
};
653661

654-
XMFLOAT4X3() {}
662+
XMFLOAT4X3() XM_CTOR_DEFAULT
655663
XMFLOAT4X3(float m00, float m01, float m02,
656664
float m10, float m11, float m12,
657665
float m20, float m21, float m22,
@@ -668,7 +676,7 @@ struct XMFLOAT4X3
668676
// 4x3 Matrix: 32 bit floating point components aligned on a 16 byte boundary
669677
__declspec(align(16)) struct XMFLOAT4X3A : public XMFLOAT4X3
670678
{
671-
XMFLOAT4X3A() : XMFLOAT4X3() {}
679+
XMFLOAT4X3A() XM_CTOR_DEFAULT
672680
XMFLOAT4X3A(float m00, float m01, float m02,
673681
float m10, float m11, float m12,
674682
float m20, float m21, float m22,
@@ -698,7 +706,7 @@ struct XMFLOAT4X4
698706
float m[4][4];
699707
};
700708

701-
XMFLOAT4X4() {}
709+
XMFLOAT4X4() XM_CTOR_DEFAULT
702710
XMFLOAT4X4(float m00, float m01, float m02, float m03,
703711
float m10, float m11, float m12, float m13,
704712
float m20, float m21, float m22, float m23,
@@ -714,7 +722,7 @@ struct XMFLOAT4X4
714722
// 4x4 Matrix: 32 bit floating point components aligned on a 16 byte boundary
715723
__declspec(align(16)) struct XMFLOAT4X4A : public XMFLOAT4X4
716724
{
717-
XMFLOAT4X4A() : XMFLOAT4X4() {}
725+
XMFLOAT4X4A() XM_CTOR_DEFAULT
718726
XMFLOAT4X4A(float m00, float m01, float m02, float m03,
719727
float m10, float m11, float m12, float m13,
720728
float m20, float m21, float m22, float m23,
@@ -1672,6 +1680,7 @@ XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR2 = {0.0f, 0.0f,-1.0f, 0.0f};
16721680
XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR3 = {0.0f, 0.0f, 0.0f,-1.0f};
16731681
XMGLOBALCONST XMVECTORU32 g_XMNegativeZero = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
16741682
XMGLOBALCONST XMVECTORU32 g_XMNegate3 = {0x80000000, 0x80000000, 0x80000000, 0x00000000};
1683+
XMGLOBALCONST XMVECTORU32 g_XMMaskXY = {0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000};
16751684
XMGLOBALCONST XMVECTORU32 g_XMMask3 = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000};
16761685
XMGLOBALCONST XMVECTORU32 g_XMMaskX = {0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000};
16771686
XMGLOBALCONST XMVECTORU32 g_XMMaskY = {0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000};
@@ -1779,6 +1788,12 @@ XMGLOBALCONST XMVECTORF32 g_XMLogEst6 = {+0.057148f, +0.057148f, +0.05
17791788
XMGLOBALCONST XMVECTORF32 g_XMLogEst7 = {-0.010578f, -0.010578f, -0.010578f, -0.010578f};
17801789
XMGLOBALCONST XMVECTORF32 g_XMLgE = {+1.442695f, +1.442695f, +1.442695f, +1.442695f};
17811790
XMGLOBALCONST XMVECTORF32 g_XMInvLgE = {+6.93147182e-1f, +6.93147182e-1f, +6.93147182e-1f, +6.93147182e-1f};
1791+
XMGLOBALCONST XMVECTORF32 g_UByteMax = {255.0f, 255.0f, 255.0f, 255.0f};
1792+
XMGLOBALCONST XMVECTORF32 g_ByteMin = {-127.0f, -127.0f, -127.0f, -127.0f};
1793+
XMGLOBALCONST XMVECTORF32 g_ByteMax = {127.0f, 127.0f, 127.0f, 127.0f};
1794+
XMGLOBALCONST XMVECTORF32 g_ShortMin = {-32767.0f, -32767.0f, -32767.0f, -32767.0f};
1795+
XMGLOBALCONST XMVECTORF32 g_ShortMax = {32767.0f, 32767.0f, 32767.0f, 32767.0f};
1796+
XMGLOBALCONST XMVECTORF32 g_UShortMax = {65535.0f, 65535.0f, 65535.0f, 65535.0f};
17821797

17831798
/****************************************************************************
17841799
*

Inc/DirectXMathMatrix.inl

+6
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveLH
19621962
float FarZ
19631963
)
19641964
{
1965+
assert(NearZ > 0.f && FarZ > 0.f);
19651966
assert(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f));
19661967
assert(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f));
19671968
assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f));
@@ -2049,6 +2050,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveRH
20492050
float FarZ
20502051
)
20512052
{
2053+
assert(NearZ > 0.f && FarZ > 0.f);
20522054
assert(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f));
20532055
assert(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f));
20542056
assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f));
@@ -2136,6 +2138,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH
21362138
float FarZ
21372139
)
21382140
{
2141+
assert(NearZ > 0.f && FarZ > 0.f);
21392142
assert(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f));
21402143
assert(!XMScalarNearEqual(AspectHByW, 0.0f, 0.00001f));
21412144
assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f));
@@ -2237,6 +2240,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH
22372240
float FarZ
22382241
)
22392242
{
2243+
assert(NearZ > 0.f && FarZ > 0.f);
22402244
assert(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f));
22412245
assert(!XMScalarNearEqual(AspectHByW, 0.0f, 0.00001f));
22422246
assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f));
@@ -2338,6 +2342,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveOffCenterLH
23382342
float FarZ
23392343
)
23402344
{
2345+
assert(NearZ > 0.f && FarZ > 0.f);
23412346
assert(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f));
23422347
assert(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f));
23432348
assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f));
@@ -2435,6 +2440,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveOffCenterRH
24352440
float FarZ
24362441
)
24372442
{
2443+
assert(NearZ > 0.f && FarZ > 0.f);
24382444
assert(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f));
24392445
assert(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f));
24402446
assert(!XMScalarNearEqual(FarZ, NearZ, 0.00001f));

Inc/DirectXMathMisc.inl

+1-2
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ inline XMVECTOR XM_CALLCONV XMQuaternionSlerpV
399399
#elif defined(_XM_SSE_INTRINSICS_)
400400
static const XMVECTORF32 OneMinusEpsilon = {1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f};
401401
static const XMVECTORU32 SignMask2 = {0x80000000,0x00000000,0x00000000,0x00000000};
402-
static const XMVECTORU32 MaskXY = {0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000};
403402

404403
XMVECTOR CosOmega = XMQuaternionDot(Q0, Q1);
405404

@@ -418,7 +417,7 @@ inline XMVECTOR XM_CALLCONV XMQuaternionSlerpV
418417
XMVECTOR Omega = XMVectorATan2(SinOmega, CosOmega);
419418

420419
XMVECTOR V01 = XM_PERMUTE_PS(T,_MM_SHUFFLE(2,3,0,1));
421-
V01 = _mm_and_ps(V01,MaskXY);
420+
V01 = _mm_and_ps(V01,g_XMMaskXY);
422421
V01 = _mm_xor_ps(V01,SignMask2);
423422
V01 = _mm_add_ps(g_XMIdentityR0, V01);
424423

Inc/DirectXMathVector.inl

+18
Original file line numberDiff line numberDiff line change
@@ -7655,6 +7655,8 @@ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream
76557655
}
76567656
}
76577657

7658+
XM_SFENCE();
7659+
76587660
return pOutputStream;
76597661
#endif
76607662
}
@@ -8022,6 +8024,8 @@ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStream
80228024
}
80238025
}
80248026

8027+
XM_SFENCE();
8028+
80258029
return pOutputStream;
80268030
#endif
80278031
}
@@ -8327,6 +8331,8 @@ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStream
83278331
}
83288332
}
83298333

8334+
XM_SFENCE();
8335+
83308336
return pOutputStream;
83318337
#endif
83328338
}
@@ -10052,6 +10058,8 @@ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream
1005210058
}
1005310059
}
1005410060

10061+
XM_SFENCE();
10062+
1005510063
return pOutputStream;
1005610064
#endif
1005710065
}
@@ -10550,6 +10558,8 @@ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStream
1055010558
pOutputVector += OutputStride;
1055110559
}
1055210560

10561+
XM_SFENCE();
10562+
1055310563
return pOutputStream;
1055410564
#endif
1055510565
}
@@ -10974,6 +10984,8 @@ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStream
1097410984
pOutputVector += OutputStride;
1097510985
}
1097610986

10987+
XM_SFENCE();
10988+
1097710989
return pOutputStream;
1097810990
#endif
1097910991
}
@@ -11542,6 +11554,8 @@ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream
1154211554
pOutputVector += OutputStride;
1154311555
}
1154411556

11557+
XM_SFENCE();
11558+
1154511559
return pOutputStream;
1154611560
#endif
1154711561
}
@@ -12129,6 +12143,8 @@ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream
1212912143
pOutputVector += OutputStride;
1213012144
}
1213112145

12146+
XM_SFENCE();
12147+
1213212148
return pOutputStream;
1213312149
#endif
1213412150
}
@@ -13843,6 +13859,8 @@ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream
1384313859
}
1384413860
}
1384513861

13862+
XM_SFENCE();
13863+
1384613864
return pOutputStream;
1384713865
#endif
1384813866
}

0 commit comments

Comments
 (0)