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: 4 additions & 1 deletion src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,10 @@ namespace gpgmm::d3d12 {
if (ppResidencyManagerOut != nullptr) {
RESIDENCY_DESC residencyDesc = {};
residencyDesc.Device = allocatorDescriptor.Device;
ReturnIfFailed(allocatorDescriptor.Adapter.As(&residencyDesc.Adapter));

if (allocatorDescriptor.Adapter != nullptr) {
ReturnIfFailed(allocatorDescriptor.Adapter.As(&residencyDesc.Adapter));
}

std::unique_ptr<Caps> caps;
{
Expand Down
6 changes: 4 additions & 2 deletions src/mvi/gpgmm_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,15 @@ namespace gpgmm::d3d12 {
RESIDENCY_DESC residencyDesc = {};
residencyDesc.Device = allocatorDescriptor.Device;

if (allocatorDescriptor.Adapter != nullptr) {
ReturnIfFailed(allocatorDescriptor.Adapter.As(&residencyDesc.Adapter));
}

D3D12_FEATURE_DATA_ARCHITECTURE arch = {};
ReturnIfFailed(residencyDesc.Device->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE,
&arch, sizeof(arch)));
residencyDesc.IsUMA = arch.UMA;

ReturnIfFailed(allocatorDescriptor.Adapter.As(&residencyDesc.Adapter));

ReturnIfFailed(
ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager));
}
Expand Down
11 changes: 11 additions & 0 deletions src/tests/end2end/D3D12ResidencyManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,17 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManager) {
EXPECT_NE(residencyManager, nullptr);
}

// Create allocator with residency, seperately, but no adapter should fail.
{
ALLOCATOR_DESC allocatorDesc = CreateBasicAllocatorDesc();
allocatorDesc.Adapter = nullptr;

ComPtr<IResidencyManager> residencyManager;
ComPtr<IResourceAllocator> resourceAllocator;
ASSERT_FAILED(
CreateResourceAllocator(allocatorDesc, &resourceAllocator, &residencyManager));
}

// Create allocator with residency, seperately.
{
ComPtr<IResidencyManager> residencyManager;
Expand Down