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
14 changes: 7 additions & 7 deletions include/gpgmm_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,14 @@ namespace gpgmm::d3d12 {

/** \brief Disables all option flags.
*/
RESIDENCY_FLAG_NONE = 0x0,
RESIDENCY_MANAGER_FLAG_NONE = 0x0,

/** \brief Allow background budget updates from OS notifications.

By default, budget updates will be queried by the residency manager
instead of pushed by OS notifications using a background thread.
*/
RESIDENCY_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES = 0x1,
RESIDENCY_MANAGER_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES = 0x1,

/** \brief Specifies if unified memory architecture (UMA) is always disabled.

Expand All @@ -417,14 +417,14 @@ namespace gpgmm::d3d12 {
Otherwise, the residency manager will have two budgets for local and non-local
memory segments, respectively.
*/
RESIDENCY_FLAG_DISABLE_UNIFIED_MEMORY = 0x2,
RESIDENCY_MANAGER_FLAG_DISABLE_UNIFIED_MEMORY = 0x2,

/** \brief Requires heaps to be in budget or E_OUTOFMEMORY.

With this flag, heaps created for this residency manager will effectively never
specify D3D12_RESIDENCY_FLAG_DENY_OVERBUDGET.
specify D3D12_RESIDENCY_MANAGER_FLAG_DENY_OVERBUDGET.
*/
RESIDENCY_FLAG_ALWAYS_IN_BUDGET = 0x4,
RESIDENCY_MANAGER_FLAG_ALWAYS_IN_BUDGET = 0x4,
};

DEFINE_ENUM_FLAG_OPERATORS(RESIDENCY_MANAGER_FLAGS)
Expand All @@ -435,7 +435,7 @@ namespace gpgmm::d3d12 {
struct RESIDENCY_MANAGER_DESC {
/** \brief Specifies residency options.

Optional parameter. By default, no flags are specified or RESIDENCY_FLAG_NONE.
Optional parameter. By default, no flags are specified or RESIDENCY_MANAGER_FLAG_NONE.
*/
RESIDENCY_MANAGER_FLAGS Flags;

Expand Down Expand Up @@ -765,7 +765,7 @@ namespace gpgmm::d3d12 {

/** \brief Disables all option flags.
*/
ALLOCATOR_FLAG_NONE = 0x0,
RESOURCE_ALLOCATOR_FLAG_NONE = 0x0,

/** \brief Disable re-use of resource heap.

Expand Down
14 changes: 8 additions & 6 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ namespace gpgmm::d3d12 {
caps.reset(ptr);
}

if ((descriptor.Flags & RESIDENCY_FLAG_DISABLE_UNIFIED_MEMORY) && caps->IsAdapterUMA()) {
if ((descriptor.Flags & RESIDENCY_MANAGER_FLAG_DISABLE_UNIFIED_MEMORY) &&
caps->IsAdapterUMA()) {
WarnLog(MessageId::kInvalidArgument, true)
<< "RESIDENCY_FLAG_DISABLE_UNIFIED_MEMORY flag was specified but "
<< "RESIDENCY_MANAGER_FLAG_DISABLE_UNIFIED_MEMORY flag was specified but "
"did not match the architecture of the adapter.";
}

Expand All @@ -88,10 +89,11 @@ namespace gpgmm::d3d12 {
new ResidencyManager(descriptor, pDevice, pAdapter, std::move(caps)));

// Enable automatic video memory budget updates.
if (descriptor.Flags & RESIDENCY_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES) {
if (descriptor.Flags & RESIDENCY_MANAGER_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES) {
if (FAILED(residencyManager->StartBudgetNotificationUpdates())) {
WarnLog(residencyManager.get(), MessageId::kBudgetUpdated)
<< "RESIDENCY_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES was requested but failed to "
<< "RESIDENCY_MANAGER_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES was requested but "
"failed to "
"start.";
}
}
Expand Down Expand Up @@ -169,11 +171,11 @@ namespace gpgmm::d3d12 {
mEvictSizeInBytes(descriptor.EvictSizeInBytes == 0 ? kDefaultEvictSizeInBytes
: descriptor.EvictSizeInBytes),
mIsUMA(caps->IsAdapterUMA() &&
!(descriptor.Flags & RESIDENCY_FLAG_DISABLE_UNIFIED_MEMORY)),
!(descriptor.Flags & RESIDENCY_MANAGER_FLAG_DISABLE_UNIFIED_MEMORY)),
mFlushEventBuffersOnDestruct(descriptor.RecordOptions.EventScope &
RECORD_SCOPE_PER_INSTANCE),
mInitialFenceValue(descriptor.InitialFenceValue),
mIsAlwaysInBudget(descriptor.Flags & RESIDENCY_FLAG_ALWAYS_IN_BUDGET) {
mIsAlwaysInBudget(descriptor.Flags & RESIDENCY_MANAGER_FLAG_ALWAYS_IN_BUDGET) {
GPGMM_TRACE_EVENT_OBJECT_NEW(this);

ASSERT(mDevice != nullptr);
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ namespace gpgmm::d3d12 {
residencyDesc.RecordOptions = allocatorDescriptor.RecordOptions;

if (allocatorDescriptor.Flags & RESOURCE_ALLOCATOR_FLAG_ALWAYS_IN_BUDGET) {
residencyDesc.Flags |= RESIDENCY_FLAG_ALWAYS_IN_BUDGET;
residencyDesc.Flags |= RESIDENCY_MANAGER_FLAG_ALWAYS_IN_BUDGET;
}

GPGMM_RETURN_IF_FAILED(ResidencyManager::CreateResidencyManager(
Expand Down
2 changes: 1 addition & 1 deletion src/tests/end2end/D3D12ResidencyManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudget) {
TEST_F(D3D12ResidencyManagerTests, OverBudgetAsync) {
constexpr uint64_t kBudgetIsDeterminedByOS = 0;
RESIDENCY_MANAGER_DESC residencyDesc = CreateBasicResidencyDesc(kBudgetIsDeterminedByOS);
residencyDesc.Flags |= RESIDENCY_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES;
residencyDesc.Flags |= RESIDENCY_MANAGER_FLAG_ALLOW_BACKGROUND_BUDGET_UPDATES;

ComPtr<IResidencyManager> residencyManager;
ASSERT_SUCCEEDED(
Expand Down