diff --git a/D3DX_DXGIFormatConvert.inl b/D3DX_DXGIFormatConvert.inl index a9409fe..1aa6d17 100644 --- a/D3DX_DXGIFormatConvert.inl +++ b/D3DX_DXGIFormatConvert.inl @@ -229,55 +229,33 @@ typedef uint4 XMUINT4; #error C++ compilation required #endif -#include -#include +#ifndef D3DX11INLINE +#define D3DX11INLINE inline +#endif + +#include + +#include +#include +#include #define hlsl_precise -D3DX11INLINE FLOAT D3DX_Saturate_FLOAT(FLOAT _V) +namespace DirectX { - return min(max(_V, 0), 1); -} -D3DX11INLINE bool D3DX_IsNan(FLOAT _V) + +D3DX11INLINE float D3DX_Saturate_FLOAT(float _V) { - return _V != _V; + return std::min(std::max(_V, 0), 1); } -D3DX11INLINE FLOAT D3DX_Truncate_FLOAT(FLOAT _V) +D3DX11INLINE bool D3DX_IsNan(float _V) { - return _V >= 0 ? floor(_V) : ceil(_V); + return isnan(_V); } - -// 2D Vector; 32 bit signed integer components -typedef struct _XMINT2 -{ - INT x; - INT y; -} XMINT2; - -// 2D Vector; 32 bit unsigned integer components -typedef struct _XMUINT2 +D3DX11INLINE float D3DX_Truncate_FLOAT(float _V) { - UINT x; - UINT y; -} XMUINT2; - -// 4D Vector; 32 bit signed integer components -typedef struct _XMINT4 -{ - INT x; - INT y; - INT z; - INT w; -} XMINT4; - -// 4D Vector; 32 bit unsigned integer components -typedef struct _XMUINT4 -{ - UINT x; - UINT y; - UINT z; - UINT w; -} XMUINT4; + return _V >= 0 ? floorf(_V) : ceilf(_V); +} #endif // HLSL_VERSION > 0 @@ -337,7 +315,7 @@ D3DX11INLINE FLOAT D3DX_SRGB_to_FLOAT(UINT val) #if HLSL_VERSION > 0 return asfloat(D3DX_SRGBTable[val]); #else - return *(FLOAT*)&D3DX_SRGBTable[val]; + return *reinterpret_cast(&D3DX_SRGBTable[val]); #endif } @@ -800,4 +778,9 @@ D3DX11INLINE UINT D3DX_INT2_to_R16G16_SINT(XMINT2 unpackedInput) return packedOutput; } -#endif // __D3DX_DXGI_FORMAT_CONVERT_INL___ +#if HLSL_VERSION > 0 +#else +} // namespace DirectX; +#endif + +#endif // __D3DX_DXGI_FORMAT_CONVERT_INL___ \ No newline at end of file diff --git a/README.md b/README.md index 03d4694..75ff258 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,9 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope ## 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](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). 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. + +# Version History + +April 2021 - Updated to use DirectXMath in the Windows SDK instead of legacy XNAMath from the DirectX SDK for C++ support + +June 2010 - Release in legacy DirectX SDK