From 68e15e8505bd85e67feaf7223804cfd41397d780 Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Fri, 22 Apr 2022 19:04:07 -0700 Subject: [PATCH] Log resource heap misalignments. --- src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp index 97aae71d5..9be57d766 100644 --- a/src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp @@ -57,6 +57,12 @@ namespace gpgmm { namespace d3d12 { // |alignment| to avoid wasting bytes. // https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_HEAP_INFO const uint64_t heapSize = AlignTo(size, alignment); + if (heapSize > size) { + DebugEvent("ResourceHeapAllocator.TryAllocateMemory", + ALLOCATOR_MESSAGE_ID_ALIGNMENT_MISMATCH) + << "Resource heap size is larger then the requested size (" + + std::to_string(heapSize) + " vs " + std::to_string(size) + " bytes)."; + } const DXGI_MEMORY_SEGMENT_GROUP memorySegmentGroup = GetPreferredMemorySegmentGroup(mDevice, mIsUMA, mHeapType);