@@ -616,7 +616,8 @@ namespace gpgmm::d3d12 {
616616 EventRecordScope::kPerInstance ),
617617 mUseDetailedTimingEvents(descriptor.RecordOptions.UseDetailedTimingEvents),
618618 mIsCustomHeapsDisabled(descriptor.Flags & ALLOCATOR_FLAG_DISABLE_UNIFIED_MEMORY),
619- mIsAlwaysCreateResident(descriptor.Flags & ALLOCATOR_FLAG_ALWAYS_RESIDENT) {
619+ mIsAlwaysCreateResident(descriptor.Flags & ALLOCATOR_FLAG_ALWAYS_RESIDENT),
620+ mMaxResourceHeapSize(descriptor.MaxResourceHeapSize) {
620621 ASSERT (mDevice != nullptr );
621622
622623 GPGMM_TRACE_EVENT_OBJECT_NEW (this );
@@ -745,12 +746,11 @@ namespace gpgmm::d3d12 {
745746 double memoryGrowthFactor,
746747 bool isPrefetchAllowed,
747748 std::unique_ptr<MemoryAllocator> underlyingAllocator) {
748- const uint64_t maxResourceHeapSize = mCaps ->GetMaxResourceHeapSize ();
749749 switch (algorithm) {
750750 case ALLOCATOR_ALGORITHM_BUDDY_SYSTEM: {
751751 // System and memory size must be aligned at creation-time.
752752 return std::make_unique<BuddyMemoryAllocator>(
753- /* systemSize*/ PrevPowerOfTwo (maxResourceHeapSize ),
753+ /* systemSize*/ PrevPowerOfTwo (mMaxResourceHeapSize ),
754754 /* memorySize*/ NextPowerOfTwo (memorySize),
755755 /* memoryAlignment*/ memoryAlignment,
756756 /* memoryAllocator*/ std::move (underlyingAllocator));
@@ -759,7 +759,7 @@ namespace gpgmm::d3d12 {
759759 // Min slab size is always equal to the memory size because the
760760 // slab allocator aligns the slab size at allocate-time.
761761 return std::make_unique<SlabCacheAllocator>(
762- /* maxSlabSize*/ PrevPowerOfTwo (maxResourceHeapSize ),
762+ /* maxSlabSize*/ PrevPowerOfTwo (mMaxResourceHeapSize ),
763763 /* minSlabSize*/ memorySize,
764764 /* slabAlignment*/ memoryAlignment,
765765 /* slabFragmentationLimit*/ memoryFragmentationLimit,
@@ -975,12 +975,12 @@ namespace gpgmm::d3d12 {
975975 D3D12_RESOURCE_DESC newResourceDesc = resourceDescriptor;
976976 const D3D12_RESOURCE_ALLOCATION_INFO resourceInfo =
977977 GetResourceAllocationInfo (mDevice , newResourceDesc);
978- if (resourceInfo.SizeInBytes > mCaps -> GetMaxResourceSize () ) {
978+ if (resourceInfo.SizeInBytes > mMaxResourceHeapSize ) {
979979 ErrorLog (MessageId::kSizeExceeded )
980980 << " Unable to create resource allocation because the resource size exceeded "
981981 " the capabilities of the device: "
982982 << GPGMM_BYTES_TO_GB (resourceInfo.SizeInBytes ) << " vs "
983- << GPGMM_BYTES_TO_GB (mCaps -> GetMaxResourceSize () ) << " GBs." ;
983+ << GPGMM_BYTES_TO_GB (mMaxResourceHeapSize ) << " GBs." ;
984984 return E_OUTOFMEMORY;
985985 }
986986
@@ -1069,7 +1069,7 @@ namespace gpgmm::d3d12 {
10691069 request.AlwaysPrefetch =
10701070 (allocationDescriptor.Flags & ALLOCATION_FLAG_ALWAYS_PREFETCH_MEMORY);
10711071 request.AlwaysCacheSize = (allocationDescriptor.Flags & ALLOCATION_FLAG_ALWAYS_CACHE_SIZE);
1072- request.AvailableForAllocation = mCaps -> GetMaxResourceHeapSize () ;
1072+ request.AvailableForAllocation = mMaxResourceHeapSize ;
10731073
10741074 // Apply extra padding to the resource heap size, if specified.
10751075 // Padding can only be applied to standalone non-committed resources.
0 commit comments