diff --git a/src/gpgmm/d3d12/HeapD3D12.cpp b/src/gpgmm/d3d12/HeapD3D12.cpp index d941f0fc7..5edd9b0b0 100644 --- a/src/gpgmm/d3d12/HeapD3D12.cpp +++ b/src/gpgmm/d3d12/HeapD3D12.cpp @@ -47,11 +47,11 @@ namespace gpgmm::d3d12 { HEAP_FLAGS GetHeapFlags(D3D12_HEAP_FLAGS heapFlags, bool isResidencyEnabled) { if (heapFlags & D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT) { - return HEAP_FLAG_NONE; + return HEAP_FLAG_NONE | HEAP_FLAG_ALWAYS_IN_RESIDENCY; } if (isResidencyEnabled) { - return HEAP_FLAG_ALWAYS_IN_BUDGET; + return HEAP_FLAG_ALWAYS_IN_BUDGET | HEAP_FLAG_ALWAYS_IN_RESIDENCY; } return HEAP_FLAG_NONE; @@ -140,8 +140,16 @@ namespace gpgmm::d3d12 { if (descriptor.Flags & HEAP_FLAG_ALWAYS_IN_RESIDENCY) { ReturnIfFailed(residencyManager->LockHeap(heap.get())); ReturnIfFailed(residencyManager->UnlockHeap(heap.get())); + ASSERT(heap->mState == RESIDENCY_STATUS_CURRENT_RESIDENT); } } + } else { + if (descriptor.Flags & HEAP_FLAG_ALWAYS_IN_RESIDENCY) { + gpgmm::WarningLog(MessageId::kInvalidArgument) + << "HEAP_FLAG_ALWAYS_IN_RESIDENCY was specified but had no effect becauase " + "residency management is " + "not being used."; + } } ReturnIfFailed(heap->SetDebugName(descriptor.DebugName));