diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index 9ed6eaa55..3560e13ac 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -382,9 +382,7 @@ namespace gpgmm { namespace d3d12 { uint64_t localSizeToMakeResident = 0; uint64_t nonLocalSizeToMakeResident = 0; - for (size_t i = 0; i < residencySet->mToMakeResident.size(); i++) { - Heap* heap = residencySet->mToMakeResident[i]; - + for (Heap* heap : *residencySet) { // Heaps that are locked resident are not tracked in the LRU cache. if (heap->IsResidencyLocked()) { continue; diff --git a/src/gpgmm/d3d12/ResidencySetD3D12.cpp b/src/gpgmm/d3d12/ResidencySetD3D12.cpp index b66e32d0c..2d859bc21 100644 --- a/src/gpgmm/d3d12/ResidencySetD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencySetD3D12.cpp @@ -19,9 +19,7 @@ namespace gpgmm { namespace d3d12 { if (heap == nullptr) { return E_INVALIDARG; } - const bool inserted = mSet.insert(heap).second; - if (inserted) { - mToMakeResident.push_back(heap); + if (mSet.insert(heap).second) { return S_OK; } return E_FAIL; @@ -29,7 +27,15 @@ namespace gpgmm { namespace d3d12 { HRESULT ResidencySet::Reset() { mSet.clear(); - mToMakeResident.clear(); return S_OK; } + + std::set::iterator ResidencySet::begin() const { + return mSet.begin(); + } + + std::set::iterator ResidencySet::end() const { + return mSet.end(); + } + }} // namespace gpgmm::d3d12 diff --git a/src/gpgmm/d3d12/ResidencySetD3D12.h b/src/gpgmm/d3d12/ResidencySetD3D12.h index f8deac4c2..df2802d7b 100644 --- a/src/gpgmm/d3d12/ResidencySetD3D12.h +++ b/src/gpgmm/d3d12/ResidencySetD3D12.h @@ -19,12 +19,10 @@ #include "include/gpgmm_export.h" #include -#include namespace gpgmm { namespace d3d12 { class Heap; - class ResidencyManager; // Represents a set of heaps which are referenced by a command list. // The set must be updated to ensure each heap is made resident for execution. @@ -35,11 +33,11 @@ namespace gpgmm { namespace d3d12 { HRESULT Insert(Heap* heap); HRESULT Reset(); - private: - friend ResidencyManager; + std::set::iterator begin() const; + std::set::iterator end() const; + private: std::set mSet; - std::vector mToMakeResident; }; }} // namespace gpgmm::d3d12