From bae1396387cfddc2ddea520553429498a8afcfea Mon Sep 17 00:00:00 2001 From: "Bernhart, Bryan" Date: Thu, 30 Mar 2023 16:26:16 -0700 Subject: [PATCH] Apply ALLOCATOR_FLAG_ALWAYS_RESIDENT by default if NOT_RESIDENT is unsupported. --- src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index a95369534..79ccead93 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -537,6 +537,14 @@ namespace gpgmm::d3d12 { newDescriptor.Flags |= ALLOCATOR_FLAG_DISABLE_UNIFIED_MEMORY; } + if (!(allocatorDescriptor.Flags & ALLOCATOR_FLAG_ALWAYS_RESIDENT) && + !caps->IsCreateHeapNotResidentSupported()) { + DebugLog(MessageId::kInvalidArgument) + << "ALLOCATOR_FLAG_ALWAYS_RESIDENT was not requested but enabled " + "anyway because the device did not support creation of non-resident heaps."; + newDescriptor.Flags |= ALLOCATOR_FLAG_ALWAYS_RESIDENT; + } + // Resource heap tier is required but user didn't specify one. if (newDescriptor.ResourceHeapTier == 0) { newDescriptor.ResourceHeapTier = caps->GetMaxResourceHeapTierSupported(); @@ -1617,8 +1625,7 @@ namespace gpgmm::d3d12 { } bool ResourceAllocator::IsCreateHeapNotResident() const { - return IsResidencyEnabled() && mCaps->IsCreateHeapNotResidentSupported() && - !mIsAlwaysCreateResident; + return IsResidencyEnabled() && !mIsAlwaysCreateResident; } bool ResourceAllocator::IsResidencyEnabled() const {