diff --git a/DirectXTex/d3dx12.h b/DirectXTex/d3dx12.h index d0e9464..06171d8 100644 --- a/DirectXTex/d3dx12.h +++ b/DirectXTex/d3dx12.h @@ -123,10 +123,10 @@ struct CD3DX12_BOX : public D3D12_BOX LONG Left, LONG Right ) { - left = Left; + left = static_cast(Left); top = 0; front = 0; - right = Right; + right = static_cast(Right); bottom = 1; back = 1; } @@ -136,11 +136,11 @@ struct CD3DX12_BOX : public D3D12_BOX LONG Right, LONG Bottom ) { - left = Left; - top = Top; + left = static_cast(Left); + top = static_cast(Top); front = 0; - right = Right; - bottom = Bottom; + right = static_cast(Right); + bottom = static_cast(Bottom); back = 1; } explicit CD3DX12_BOX( @@ -151,12 +151,12 @@ struct CD3DX12_BOX : public D3D12_BOX LONG Bottom, LONG Back ) { - left = Left; - top = Top; - front = Front; - right = Right; - bottom = Bottom; - back = Back; + left = static_cast(Left); + top = static_cast(Top); + front = static_cast(Front); + right = static_cast(Right); + bottom = static_cast(Bottom); + back = static_cast(Back); } }; inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r ) @@ -1582,12 +1582,12 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE } CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) { - ptr += INT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); + ptr += SIZE_T(offsetInDescriptors) * SIZE_T(descriptorIncrementSize); return *this; } CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) { - ptr += offsetScaledByIncrementSize; + ptr += SIZE_T(offsetScaledByIncrementSize); return *this; } bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) const @@ -1616,12 +1616,12 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) { - handle.ptr = base.ptr + offsetScaledByIncrementSize; + handle.ptr = base.ptr + SIZE_T(offsetScaledByIncrementSize); } static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) { - handle.ptr = static_cast(base.ptr + INT64(offsetInDescriptors) * UINT64(descriptorIncrementSize)); + handle.ptr = base.ptr + SIZE_T(offsetInDescriptors) * SIZE_T(descriptorIncrementSize); } }; @@ -1643,12 +1643,12 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE } CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) { - ptr += INT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); + ptr += UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); return *this; } CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) { - ptr += offsetScaledByIncrementSize; + ptr += UINT64(offsetScaledByIncrementSize); return *this; } inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) const @@ -1677,12 +1677,12 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) { - handle.ptr = base.ptr + offsetScaledByIncrementSize; + handle.ptr = base.ptr + UINT64(offsetScaledByIncrementSize); } static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) { - handle.ptr = static_cast(base.ptr + INT64(offsetInDescriptors) * UINT64(descriptorIncrementSize)); + handle.ptr = base.ptr + UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); } }; @@ -1890,7 +1890,7 @@ inline UINT64 GetRequiredIntermediateSize( UINT64 RequiredSize = 0; ID3D12Device* pDevice = nullptr; - pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast(&pDevice)); pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize); pDevice->Release(); @@ -1983,7 +1983,7 @@ inline UINT64 UpdateSubresources( auto Desc = pDestinationResource->GetDesc(); ID3D12Device* pDevice = nullptr; - pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast(&pDevice)); pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize); pDevice->Release(); @@ -2011,7 +2011,7 @@ inline UINT64 UpdateSubresources( auto Desc = pDestinationResource->GetDesc(); ID3D12Device* pDevice = nullptr; - pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast(&pDevice)); pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize); pDevice->Release(); @@ -2192,8 +2192,10 @@ public: CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT() noexcept : _Type(Type), _Inner(DefaultArg()) {} CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT(InnerStructType const& i) : _Type(Type), _Inner(i) {} CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT& operator=(InnerStructType const& i) { _Inner = i; return *this; } - operator InnerStructType() const { return _Inner; } + operator InnerStructType const&() const { return _Inner; } operator InnerStructType&() { return _Inner; } + InnerStructType* operator&() { return &_Inner; } + InnerStructType const* operator&() const { return &_Inner; } }; #pragma warning(pop) typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PIPELINE_STATE_FLAGS, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS> CD3DX12_PIPELINE_STATE_STREAM_FLAGS; @@ -2903,8 +2905,8 @@ private: class SUBOBJECT_HELPER_BASE { public: - SUBOBJECT_HELPER_BASE() { Init(); }; - virtual ~SUBOBJECT_HELPER_BASE() {}; + SUBOBJECT_HELPER_BASE() { Init(); } + virtual ~SUBOBJECT_HELPER_BASE() {} virtual D3D12_STATE_SUBOBJECT_TYPE Type() const = 0; void AddToStateObject(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject) { @@ -3464,6 +3466,3 @@ private: #endif // defined( __cplusplus ) #endif //__D3DX12_H__ - - -