D3DX12.H updates with minor fixes

This commit is contained in:
Chuck Walbourn 2019-07-04 23:26:40 -07:00
parent e17b6193ee
commit 34dd61fc7e

View File

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