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
5 changes: 5 additions & 0 deletions src/gpgmm/d3d12/FenceD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@ namespace gpgmm { namespace d3d12 {
uint64_t Fence::GetCurrentFence() const {
return mCurrentFence;
}

ID3D12Fence* Fence::GetFence() const {
return mFence.Get();
}

}} // namespace gpgmm::d3d12
2 changes: 2 additions & 0 deletions src/gpgmm/d3d12/FenceD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace gpgmm { namespace d3d12 {
uint64_t GetLastSignaledFence() const;
uint64_t GetCurrentFence() const;

ID3D12Fence* GetFence() const;

private:
Fence(ComPtr<ID3D12Fence> fence, uint64_t initialValue);

Expand Down
10 changes: 10 additions & 0 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,16 @@ namespace gpgmm { namespace d3d12 {

ReturnIfFailed(Evict(sizeToMakeResident, memorySegmentGroup, nullptr));

// Decrease the overhead from using MakeResident, a synchronous call, by calling the
// asynchronous MakeResident, called EnqueueMakeResident, instead first. Should
// EnqueueMakeResident fail, fall-back to using synchronous MakeResident since we may be
// able to continue after calling Evict again.
if (mDevice3 != nullptr) {
ReturnIfSucceeded(mDevice3->EnqueueMakeResident(
D3D12_RESIDENCY_FLAG_NONE, numberOfObjectsToMakeResident, allocations,
mFence->GetFence(), mFence->GetLastSignaledFence() + 1));
}

// A MakeResident call can fail if there's not enough available memory. This
// could occur when there's significant fragmentation or if the allocation size
// estimates are incorrect. We may be able to continue execution by evicting some
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ namespace gpgmm { namespace d3d12 {

ComPtr<ID3D12Device> mDevice;
ComPtr<IDXGIAdapter3> mAdapter;
ComPtr<ID3D12Device3> mDevice3;

std::unique_ptr<Fence> mFence;

Expand Down