From 7ddf3558a908f0c405ed24269c2a1c22df9c044e Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Mon, 18 Apr 2022 15:07:57 -0700 Subject: [PATCH 1/2] Move residency defaults closer to where used. In a future change, DefaultsD3D12.h will be fully removed. --- src/gpgmm/d3d12/DefaultsD3D12.h | 3 --- src/gpgmm/d3d12/ResidencyManagerD3D12.cpp | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpgmm/d3d12/DefaultsD3D12.h b/src/gpgmm/d3d12/DefaultsD3D12.h index 4253ffbca..898399859 100644 --- a/src/gpgmm/d3d12/DefaultsD3D12.h +++ b/src/gpgmm/d3d12/DefaultsD3D12.h @@ -20,9 +20,6 @@ namespace gpgmm { namespace d3d12 { static constexpr uint64_t kDefaultPreferredResourceHeapSize = 4ll * 1024ll * 1024ll; // 4MB - static constexpr uint32_t kDefaultVideoMemoryEvictSize = 50ll * 1024ll * 1024ll; // 50MB - static constexpr float kDefaultMaxVideoMemoryBudget = 0.95f; // 95% - }} // namespace gpgmm::d3d12 #endif // GPGMM_D3D12_DEFAULTSD3D12_H_ diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index 3c46cd52b..d9ec987cc 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -28,6 +28,9 @@ namespace gpgmm { namespace d3d12 { + static constexpr uint32_t kDefaultVideoMemoryEvictSize = 50ll * 1024ll * 1024ll; // 50MB + static constexpr float kDefaultMaxVideoMemoryBudget = 0.95f; + // static HRESULT ResidencyManager::CreateResidencyManager(ComPtr device, ComPtr adapter, From 038221222d3df00091d8b4ae82acaa0e4627442c Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Mon, 18 Apr 2022 15:34:14 -0700 Subject: [PATCH 2/2] Depreciate MaxResourceSizeForPooling and GetResidencyManager(). --- src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp | 4 ---- src/gpgmm/d3d12/ResourceAllocatorD3D12.h | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index a01c29257..b8fb96e96 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -951,10 +951,6 @@ namespace gpgmm { namespace d3d12 { return S_OK; } - ResidencyManager* ResourceAllocator::GetResidencyManager() const { - return mResidencyManager.Get(); - } - RESOURCE_ALLOCATOR_INFO ResourceAllocator::GetInfo() const { std::lock_guard lock(mMutex); diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.h b/src/gpgmm/d3d12/ResourceAllocatorD3D12.h index 7d6454b29..d41e0cc05 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.h +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.h @@ -162,15 +162,6 @@ namespace gpgmm { namespace d3d12 { // exceeds the adapter's GPU virtual address range, it will default to the smaller range. uint64_t MaxResourceHeapSize; - // Maximum resource size that can be pool-allocated. - // - // Pool-allocating larger resources consumes more memory then smaller ones but is faster to - // create subsequent resources by using a pool of resource heaps. Apps must periodically - // call Trim() to free unused pool-allocated resource heaps. - // - // Optional parameter. When 0 is specified, the API will automatically disabling pooling. - uint64_t MaxResourceSizeForPooling; - // Maximum video memory available to budget by the allocator, expressed as a // percentage. // @@ -282,11 +273,6 @@ namespace gpgmm { namespace d3d12 { HRESULT CreateResource(ComPtr committedResource, ResourceAllocation** resourceAllocationOut); - // Return the residency manager. The lifetime of the residency manager is fully owned by the - // allocator. CreateResource enables the returned resource allocation to be residency - // managed when non-null. - ResidencyManager* GetResidencyManager() const; - // When pooling is enabled, the allocator will retain resource heaps in order to speed-up // subsequent resource allocation requests. These resource allocations count against the // app's memory usage and in general, will lead to increased memory usage by the overall