diff --git a/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp index bd0b4e13..270039c3 100644 --- a/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocationD3D12.cpp @@ -69,6 +69,17 @@ namespace gpgmm::d3d12 { "call Unmap the same number of times as Map before releasing the resource " "allocation."; } + + // If the developer forgots to unlock the heap, do so now so the heap can be made eligable + // for eviction. + if (mResidencyManager != nullptr) { + mResidencyManager->UnlockHeap(GetMemory()); + WarnLog(MessageId::kPerformanceWarning, this) + << "Destroying a locked resource allocation is allowed but discouraged. Please " + "call UnlockHeap the same number of times as LockHeap before releasing the " + "resource " + "allocation."; + } } void ResourceAllocation::DeleteThis() {