From 01c6d943f5af91d1932fa64b1ec9be3f69cc5ee6 Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Wed, 6 Jul 2022 17:38:34 -0700 Subject: [PATCH] Fix ResourceAllocation offset type mismatch for MSVC. --- src/gpgmm/d3d12/ResourceAllocationD3D12.cpp | 7 ++++--- src/gpgmm/d3d12/ResourceAllocationD3D12.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp index 67f3e0711..f0471e8c6 100644 --- a/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp @@ -113,7 +113,7 @@ namespace gpgmm::d3d12 { const D3D12_RANGE* newReadRangePtr = readRange; if (newReadRangePtr != nullptr && mOffsetFromResource > 0) { ASSERT(subresource == 0); - newReadRange = GetResourceRange(readRange, mOffsetFromResource); + newReadRange = GetResourceRange(readRange, static_cast(mOffsetFromResource)); newReadRangePtr = &newReadRange; } @@ -140,7 +140,8 @@ namespace gpgmm::d3d12 { const D3D12_RANGE* newWrittenRangePtr = writtenRange; if (newWrittenRangePtr != nullptr && mOffsetFromResource > 0) { ASSERT(subresource == 0); - newWrittenRange = GetResourceRange(newWrittenRangePtr, mOffsetFromResource); + newWrittenRange = + GetResourceRange(newWrittenRangePtr, static_cast(mOffsetFromResource)); newWrittenRangePtr = &newWrittenRange; } @@ -162,7 +163,7 @@ namespace gpgmm::d3d12 { return mResource->GetGPUVirtualAddress() + mOffsetFromResource; } - size_t ResourceAllocation::GetOffsetFromResource() const { + uint64_t ResourceAllocation::GetOffsetFromResource() const { return mOffsetFromResource; } diff --git a/src/gpgmm/d3d12/ResourceAllocationD3D12.h b/src/gpgmm/d3d12/ResourceAllocationD3D12.h index 6e6ff140a..c9f057745 100644 --- a/src/gpgmm/d3d12/ResourceAllocationD3D12.h +++ b/src/gpgmm/d3d12/ResourceAllocationD3D12.h @@ -49,7 +49,7 @@ namespace gpgmm::d3d12 { Always zero when the resource is placed in a heap or created with it's own heap. */ - size_t OffsetFromResource; + uint64_t OffsetFromResource; /** \brief Method to describe how the allocation was created. @@ -177,7 +177,7 @@ namespace gpgmm::d3d12 { \return A offset, in bytes, of the start of this allocation in the resource. */ - size_t GetOffsetFromResource() const; + uint64_t GetOffsetFromResource() const; /** \brief Returns information about this resource allocation. @@ -215,7 +215,7 @@ namespace gpgmm::d3d12 { ResidencyManager* const mResidencyManager; ComPtr mResource; - const size_t mOffsetFromResource; + const uint64_t mOffsetFromResource; }; } // namespace gpgmm::d3d12