Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 10 additions & 4 deletions src/gpgmm/d3d12/ResidencySetD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ 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;
}

HRESULT ResidencySet::Reset() {
mSet.clear();
mToMakeResident.clear();
return S_OK;
}

std::set<Heap*>::iterator ResidencySet::begin() const {
return mSet.begin();
}

std::set<Heap*>::iterator ResidencySet::end() const {
return mSet.end();
}

}} // namespace gpgmm::d3d12
8 changes: 3 additions & 5 deletions src/gpgmm/d3d12/ResidencySetD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
#include "include/gpgmm_export.h"

#include <set>
#include <vector>

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.
Expand All @@ -35,11 +33,11 @@ namespace gpgmm { namespace d3d12 {
HRESULT Insert(Heap* heap);
HRESULT Reset();

private:
friend ResidencyManager;
std::set<Heap*>::iterator begin() const;
std::set<Heap*>::iterator end() const;

private:
std::set<Heap*> mSet;
std::vector<Heap*> mToMakeResident;
};

}} // namespace gpgmm::d3d12
Expand Down