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
19 changes: 6 additions & 13 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ namespace gpgmm::d3d12 {
// mBudgetNotificationUpdateEvent
case (WAIT_OBJECT_0 + 0): {
hr =
mResidencyManager->UpdateMemorySegment(DXGI_MEMORY_SEGMENT_GROUP_LOCAL);
if (FAILED(hr)) {
break;
}

hr = mResidencyManager->UpdateMemorySegment(
DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL);
mResidencyManager->UpdateMemorySegments();
if (FAILED(hr)) {
break;
}
Expand Down Expand Up @@ -189,9 +183,8 @@ namespace gpgmm::d3d12 {
gpgmm::DebugLog() << "OS event based budget updates enabled.";
}

// Set the initial video memory limits per segment.
ReturnIfFailed(residencyManager->UpdateMemorySegment(DXGI_MEMORY_SEGMENT_GROUP_LOCAL));
ReturnIfFailed(residencyManager->UpdateMemorySegment(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL));
// Set the initial video memory limits.
ReturnIfFailed(residencyManager->UpdateMemorySegments());

// D3D12 has non-zero memory usage even before any resources have been created, and this
// value can vary by OS enviroment. By adding this in addition to the artificial budget
Expand Down Expand Up @@ -464,10 +457,10 @@ namespace gpgmm::d3d12 {
return S_OK;
}

HRESULT ResidencyManager::UpdateMemorySegment(
const DXGI_MEMORY_SEGMENT_GROUP& memorySegmentGroup) {
HRESULT ResidencyManager::UpdateMemorySegments() {
std::lock_guard<std::mutex> lock(mMutex);
ReturnIfFailed(UpdateMemorySegmentInternal(memorySegmentGroup));
ReturnIfFailed(UpdateMemorySegmentInternal(DXGI_MEMORY_SEGMENT_GROUP_LOCAL));
ReturnIfFailed(UpdateMemorySegmentInternal(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL));
return S_OK;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/ResidencyManagerD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace gpgmm::d3d12 {
DXGI_MEMORY_SEGMENT_GROUP GetMemorySegmentGroup(D3D12_HEAP_TYPE heapType) const;

friend BudgetUpdateTask;
HRESULT UpdateMemorySegment(const DXGI_MEMORY_SEGMENT_GROUP& memorySegmentGroup);
HRESULT UpdateMemorySegments();

const char* GetTypename() const;

Expand Down