From e9ff9b618cfa49541b45ccfa9e07ec4046106f27 Mon Sep 17 00:00:00 2001 From: "Bernhart, Bryan" Date: Mon, 12 Feb 2024 12:00:11 -0800 Subject: [PATCH] Refactor DXGI impl. into separate cpps. In the future, DXGI will be conditionally built for projects that don't require DXGI. Issue: #683 --- src/gpgmm/BUILD.gn | 4 + src/gpgmm/CMakeLists.txt | 4 + src/gpgmm/d3d12/BudgetUpdateD3D12.cpp | 71 ------------------ src/gpgmm/d3d12/BudgetUpdateD3D12.h | 22 ------ src/gpgmm/d3d12/BudgetUpdateDXGI.cpp | 87 ++++++++++++++++++++++ src/gpgmm/d3d12/BudgetUpdateDXGI.h | 47 ++++++++++++ src/gpgmm/d3d12/ResidencyManagerD3D12.cpp | 34 +-------- src/gpgmm/d3d12/ResidencyManagerD3D12.h | 22 ------ src/gpgmm/d3d12/ResidencyManagerDXGI.cpp | 54 ++++++++++++++ src/gpgmm/d3d12/ResidencyManagerDXGI.h | 48 ++++++++++++ src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp | 7 +- 11 files changed, 246 insertions(+), 154 deletions(-) create mode 100644 src/gpgmm/d3d12/BudgetUpdateDXGI.cpp create mode 100644 src/gpgmm/d3d12/BudgetUpdateDXGI.h create mode 100644 src/gpgmm/d3d12/ResidencyManagerDXGI.cpp create mode 100644 src/gpgmm/d3d12/ResidencyManagerDXGI.h diff --git a/src/gpgmm/BUILD.gn b/src/gpgmm/BUILD.gn index 7b8046c1..674daef8 100644 --- a/src/gpgmm/BUILD.gn +++ b/src/gpgmm/BUILD.gn @@ -115,6 +115,8 @@ source_set("gpgmm_sources") { sources += [ "d3d12/BudgetUpdateD3D12.cpp", "d3d12/BudgetUpdateD3D12.h", + "d3d12/BudgetUpdateDXGI.cpp", + "d3d12/BudgetUpdateDXGI.h", "d3d12/BufferAllocatorD3D12.cpp", "d3d12/BufferAllocatorD3D12.h", "d3d12/CapsD3D12.cpp", @@ -136,6 +138,8 @@ source_set("gpgmm_sources") { "d3d12/ResidencyListD3D12.h", "d3d12/ResidencyManagerD3D12.cpp", "d3d12/ResidencyManagerD3D12.h", + "d3d12/ResidencyManagerDXGI.cpp", + "d3d12/ResidencyManagerDXGI.h", "d3d12/ResourceAllocationD3D12.cpp", "d3d12/ResourceAllocationD3D12.h", "d3d12/ResourceAllocationTrackingAllocatorD3D12.cpp", diff --git a/src/gpgmm/CMakeLists.txt b/src/gpgmm/CMakeLists.txt index 8df19dbc..1fff8498 100644 --- a/src/gpgmm/CMakeLists.txt +++ b/src/gpgmm/CMakeLists.txt @@ -55,6 +55,8 @@ endif() if (GPGMM_ENABLE_D3D12) target_sources(gpgmm PRIVATE + "d3d12/BudgetUpdateDXGI.cpp" + "d3d12/BudgetUpdateDXGI.h" "d3d12/BudgetUpdateD3D12.cpp" "d3d12/BudgetUpdateD3D12.h" "d3d12/BufferAllocatorD3D12.cpp" @@ -79,6 +81,8 @@ if (GPGMM_ENABLE_D3D12) "d3d12/ResidencyListD3D12.h" "d3d12/ResidencyManagerD3D12.cpp" "d3d12/ResidencyManagerD3D12.h" + "d3d12/ResidencyManagerDXGI.cpp" + "d3d12/ResidencyManagerDXGI.h" "d3d12/ResourceAllocationD3D12.cpp" "d3d12/ResourceAllocationD3D12.h" "d3d12/ResourceAllocatorD3D12.cpp" diff --git a/src/gpgmm/d3d12/BudgetUpdateD3D12.cpp b/src/gpgmm/d3d12/BudgetUpdateD3D12.cpp index 4d7570d3..bd7bfb6c 100644 --- a/src/gpgmm/d3d12/BudgetUpdateD3D12.cpp +++ b/src/gpgmm/d3d12/BudgetUpdateD3D12.cpp @@ -14,12 +14,6 @@ #include "gpgmm/d3d12/BudgetUpdateD3D12.h" -#include "gpgmm/common/Message.h" -#include "gpgmm/common/TraceEvent.h" -#include "gpgmm/d3d12/ErrorD3D12.h" -#include "gpgmm/d3d12/LogD3D12.h" -#include "gpgmm/d3d12/ResidencyManagerD3D12.h" - namespace gpgmm::d3d12 { // BudgetUpdateTask @@ -38,71 +32,6 @@ namespace gpgmm::d3d12 { mLastError = hr; } - // BudgetUpdateTaskDXGI - - BudgetUpdateTaskDXGI::BudgetUpdateTaskDXGI(ResidencyManagerDXGI* const residencyManager) - : mResidencyManager(residencyManager), - mBudgetNotificationUpdateEvent(CreateEventW(NULL, FALSE, FALSE, NULL)), - mUnregisterAndExitEvent(CreateEventW(NULL, FALSE, FALSE, NULL)) { - ASSERT(mResidencyManager != nullptr); - mLastError = - mResidencyManager->GetAdapter()->RegisterVideoMemoryBudgetChangeNotificationEvent( - mBudgetNotificationUpdateEvent, &mCookie); - } - - BudgetUpdateTaskDXGI::~BudgetUpdateTaskDXGI() { - CloseHandle(mUnregisterAndExitEvent); - CloseHandle(mBudgetNotificationUpdateEvent); - } - - MaybeError BudgetUpdateTaskDXGI::operator()() { - HRESULT hr = GetLastError(); - bool isExiting = false; - while (!isExiting && SUCCEEDED(hr)) { - // Wait on two events: one to unblock for OS budget changes, and another to unblock - // for shutdown. - HANDLE hWaitEvents[2] = {mBudgetNotificationUpdateEvent, mUnregisterAndExitEvent}; - const DWORD waitedEvent = - WaitForMultipleObjects(2, hWaitEvents, /*bWaitAll*/ false, INFINITE); - switch (waitedEvent) { - // mBudgetNotificationUpdateEvent - case (WAIT_OBJECT_0 + 0): { - hr = mResidencyManager->UpdateMemorySegments(); - if (FAILED(hr)) { - break; - } - - DebugLog(MessageId::kBudgetUpdated, mResidencyManager) - << "Updated budget from OS notification."; - break; - } - // mUnregisterAndExitEvent - case (WAIT_OBJECT_0 + 1): { - isExiting = true; - break; - } - default: { - UNREACHABLE(); - break; - } - } - } - - if (FAILED(hr)) { - ErrorLog(ErrorCode::kBudgetInvalid, mResidencyManager) - << "Unable to update budget: " + - GetErrorResultMessage(hr, mResidencyManager->GetDevice()); - } - - SetLastError(hr); - return GetErrorCode(hr); - } - - bool BudgetUpdateTaskDXGI::UnregisterAndExit() { - mResidencyManager->GetAdapter()->UnregisterVideoMemoryBudgetChangeNotification(mCookie); - return SetEvent(mUnregisterAndExitEvent); - } - // BudgetUpdateEvent BudgetUpdateEvent::BudgetUpdateEvent(std::shared_ptr event, diff --git a/src/gpgmm/d3d12/BudgetUpdateD3D12.h b/src/gpgmm/d3d12/BudgetUpdateD3D12.h index 69848956..7bd5cf63 100644 --- a/src/gpgmm/d3d12/BudgetUpdateD3D12.h +++ b/src/gpgmm/d3d12/BudgetUpdateD3D12.h @@ -41,28 +41,6 @@ namespace gpgmm::d3d12 { HRESULT mLastError = S_OK; }; - class ResidencyManagerDXGI; - - class BudgetUpdateTaskDXGI final : public BudgetUpdateTask { - public: - BudgetUpdateTaskDXGI(ResidencyManagerDXGI* const residencyManager); - ~BudgetUpdateTaskDXGI() override; - - // VoidCallback interface - MaybeError operator()() override; - - // BudgetUpdateTask interface - bool UnregisterAndExit() override; - - private: - ResidencyManagerDXGI* const mResidencyManager; - - HANDLE mBudgetNotificationUpdateEvent = INVALID_HANDLE_VALUE; - HANDLE mUnregisterAndExitEvent = INVALID_HANDLE_VALUE; - - DWORD mCookie = 0; // Used to unregister from notifications. - }; - class BudgetUpdateEvent final : public Event { public: BudgetUpdateEvent(std::shared_ptr event, std::shared_ptr task); diff --git a/src/gpgmm/d3d12/BudgetUpdateDXGI.cpp b/src/gpgmm/d3d12/BudgetUpdateDXGI.cpp new file mode 100644 index 00000000..4fe40a8d --- /dev/null +++ b/src/gpgmm/d3d12/BudgetUpdateDXGI.cpp @@ -0,0 +1,87 @@ +// Copyright 2024 The GPGMM Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "gpgmm/d3d12/BudgetUpdateDXGI.h" + +#include "gpgmm/common/Message.h" +#include "gpgmm/d3d12/ErrorD3D12.h" +#include "gpgmm/d3d12/LogD3D12.h" +#include "gpgmm/d3d12/ResidencyManagerDXGI.h" + +namespace gpgmm::d3d12 { + + BudgetUpdateTaskDXGI::BudgetUpdateTaskDXGI(ResidencyManagerDXGI* const residencyManager) + : mResidencyManager(residencyManager), + mBudgetNotificationUpdateEvent(CreateEventW(NULL, FALSE, FALSE, NULL)), + mUnregisterAndExitEvent(CreateEventW(NULL, FALSE, FALSE, NULL)) { + ASSERT(mResidencyManager != nullptr); + mLastError = + mResidencyManager->GetAdapter()->RegisterVideoMemoryBudgetChangeNotificationEvent( + mBudgetNotificationUpdateEvent, &mCookie); + } + + BudgetUpdateTaskDXGI::~BudgetUpdateTaskDXGI() { + CloseHandle(mUnregisterAndExitEvent); + CloseHandle(mBudgetNotificationUpdateEvent); + } + + MaybeError BudgetUpdateTaskDXGI::operator()() { + HRESULT hr = GetLastError(); + bool isExiting = false; + while (!isExiting && SUCCEEDED(hr)) { + // Wait on two events: one to unblock for OS budget changes, and another to unblock + // for shutdown. + HANDLE hWaitEvents[2] = {mBudgetNotificationUpdateEvent, mUnregisterAndExitEvent}; + const DWORD waitedEvent = + WaitForMultipleObjects(2, hWaitEvents, /*bWaitAll*/ false, INFINITE); + switch (waitedEvent) { + // mBudgetNotificationUpdateEvent + case (WAIT_OBJECT_0 + 0): { + hr = mResidencyManager->UpdateMemorySegments(); + if (FAILED(hr)) { + break; + } + + DebugLog(MessageId::kBudgetUpdated, mResidencyManager) + << "Updated budget from OS notification."; + break; + } + // mUnregisterAndExitEvent + case (WAIT_OBJECT_0 + 1): { + isExiting = true; + break; + } + default: { + UNREACHABLE(); + break; + } + } + } + + if (FAILED(hr)) { + ErrorLog(ErrorCode::kBudgetInvalid, mResidencyManager) + << "Unable to update budget: " + + GetErrorResultMessage(hr, mResidencyManager->GetDevice()); + } + + SetLastError(hr); + return GetErrorCode(hr); + } + + bool BudgetUpdateTaskDXGI::UnregisterAndExit() { + mResidencyManager->GetAdapter()->UnregisterVideoMemoryBudgetChangeNotification(mCookie); + return SetEvent(mUnregisterAndExitEvent); + } + +} // namespace gpgmm::d3d12 diff --git a/src/gpgmm/d3d12/BudgetUpdateDXGI.h b/src/gpgmm/d3d12/BudgetUpdateDXGI.h new file mode 100644 index 00000000..4a4eb84c --- /dev/null +++ b/src/gpgmm/d3d12/BudgetUpdateDXGI.h @@ -0,0 +1,47 @@ +// Copyright 2024 The GPGMM Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_GPGMM_D3D12_BUDGETUPDATEDXGI_H_ +#define SRC_GPGMM_D3D12_BUDGETUPDATEDXGI_H_ + +#include "gpgmm/d3d12/BudgetUpdateD3D12.h" + +namespace gpgmm::d3d12 { + + class ResidencyManagerDXGI; + + // Implements a long running task that can continuously receives DXGI budget notifications. + class BudgetUpdateTaskDXGI final : public BudgetUpdateTask { + public: + BudgetUpdateTaskDXGI(ResidencyManagerDXGI* const residencyManager); + ~BudgetUpdateTaskDXGI() override; + + // VoidCallback interface + MaybeError operator()() override; + + // BudgetUpdateTask interface + bool UnregisterAndExit() override; + + private: + ResidencyManagerDXGI* const mResidencyManager; + + HANDLE mBudgetNotificationUpdateEvent = INVALID_HANDLE_VALUE; + HANDLE mUnregisterAndExitEvent = INVALID_HANDLE_VALUE; + + DWORD mCookie = 0; // Used to unregister from notifications. + }; + +} // namespace gpgmm::d3d12 + +#endif // SRC_GPGMM_D3D12_BUDGETUPDATEDXGI_H_ diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index 879e06e7..47e463f0 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -27,6 +27,7 @@ #include "gpgmm/d3d12/LogD3D12.h" #include "gpgmm/d3d12/ResidencyHeapD3D12.h" #include "gpgmm/d3d12/ResidencyListD3D12.h" +#include "gpgmm/d3d12/ResidencyManagerDXGI.h" #include "gpgmm/d3d12/UtilsD3D12.h" #include "gpgmm/utils/Math.h" @@ -923,37 +924,4 @@ namespace gpgmm::d3d12 { return mDevice; } - // ResidencyManagerDXGI - - ResidencyManagerDXGI::ResidencyManagerDXGI(const RESIDENCY_MANAGER_DESC& descriptor, - ID3D12Device* pDevice, - IDXGIAdapter3* pAdapter, - std::unique_ptr caps) - : ResidencyManager(descriptor, pDevice, std::move(caps)), mAdapter(pAdapter) { - ASSERT(mAdapter != nullptr); - } - - ResidencyManagerDXGI::~ResidencyManagerDXGI() = default; - - HRESULT ResidencyManagerDXGI::QueryMemoryInfoImpl(const RESIDENCY_HEAP_SEGMENT& heapSegment, - RESIDENCY_MEMORY_INFO* pMemoryInfoOut) { - // Residency heap segments are 1:1 with DXGI memory segment groups. - DXGI_QUERY_VIDEO_MEMORY_INFO queryVideoMemoryInfoOut; - GPGMM_RETURN_IF_FAILED(mAdapter->QueryVideoMemoryInfo( - 0, static_cast(heapSegment), &queryVideoMemoryInfoOut)); - pMemoryInfoOut->AvailableForReservation = queryVideoMemoryInfoOut.AvailableForReservation; - pMemoryInfoOut->Budget = queryVideoMemoryInfoOut.Budget; - pMemoryInfoOut->CurrentReservation = queryVideoMemoryInfoOut.CurrentReservation; - pMemoryInfoOut->CurrentUsage = queryVideoMemoryInfoOut.CurrentUsage; - return S_OK; - } - - std::shared_ptr ResidencyManagerDXGI::CreateBudgetUpdateTask() { - return std::make_shared(this); - } - - IDXGIAdapter3* ResidencyManagerDXGI::GetAdapter() const { - return mAdapter; - } - } // namespace gpgmm::d3d12 diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.h b/src/gpgmm/d3d12/ResidencyManagerD3D12.h index 7d4eccbf..3d32dd34 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.h +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.h @@ -21,7 +21,6 @@ #include "gpgmm/utils/EnumFlags.h" #include "gpgmm/utils/LinkedList.h" -#include #include #include @@ -159,27 +158,6 @@ namespace gpgmm::d3d12 { std::shared_ptr mBudgetNotificationUpdateEvent; }; - class ResidencyManagerDXGI final : public ResidencyManager { - public: - ResidencyManagerDXGI(const RESIDENCY_MANAGER_DESC& descriptor, - ID3D12Device* pDevice, - IDXGIAdapter3* pAdapter, - std::unique_ptr caps); - - ~ResidencyManagerDXGI() override; - - IDXGIAdapter3* GetAdapter() const; - - private: - // ResidencyManager overloads - HRESULT QueryMemoryInfoImpl(const RESIDENCY_HEAP_SEGMENT& heapSegment, - RESIDENCY_MEMORY_INFO* pMemoryInfoOut) override; - - std::shared_ptr CreateBudgetUpdateTask() override; - - IDXGIAdapter3* mAdapter = nullptr; - }; - } // namespace gpgmm::d3d12 #endif // SRC_GPGMM_D3D12_RESIDENCYMANAGERD3D12_H_ diff --git a/src/gpgmm/d3d12/ResidencyManagerDXGI.cpp b/src/gpgmm/d3d12/ResidencyManagerDXGI.cpp new file mode 100644 index 00000000..55440d6f --- /dev/null +++ b/src/gpgmm/d3d12/ResidencyManagerDXGI.cpp @@ -0,0 +1,54 @@ +// Copyright 2024 The GPGMM Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "gpgmm/d3d12/ResidencyManagerDXGI.h" + +#include "gpgmm/d3d12/BudgetUpdateDXGI.h" +#include "gpgmm/d3d12/CapsD3D12.h" +#include "gpgmm/d3d12/ErrorD3D12.h" + +namespace gpgmm::d3d12 { + + ResidencyManagerDXGI::ResidencyManagerDXGI(const RESIDENCY_MANAGER_DESC& descriptor, + ID3D12Device* pDevice, + IDXGIAdapter3* pAdapter, + std::unique_ptr caps) + : ResidencyManager(descriptor, pDevice, std::move(caps)), mAdapter(pAdapter) { + ASSERT(mAdapter != nullptr); + } + + ResidencyManagerDXGI::~ResidencyManagerDXGI() = default; + + HRESULT ResidencyManagerDXGI::QueryMemoryInfoImpl(const RESIDENCY_HEAP_SEGMENT& heapSegment, + RESIDENCY_MEMORY_INFO* pMemoryInfoOut) { + // Residency heap segments are 1:1 with DXGI memory segment groups. + DXGI_QUERY_VIDEO_MEMORY_INFO queryVideoMemoryInfoOut; + GPGMM_RETURN_IF_FAILED(mAdapter->QueryVideoMemoryInfo( + 0, static_cast(heapSegment), &queryVideoMemoryInfoOut)); + pMemoryInfoOut->AvailableForReservation = queryVideoMemoryInfoOut.AvailableForReservation; + pMemoryInfoOut->Budget = queryVideoMemoryInfoOut.Budget; + pMemoryInfoOut->CurrentReservation = queryVideoMemoryInfoOut.CurrentReservation; + pMemoryInfoOut->CurrentUsage = queryVideoMemoryInfoOut.CurrentUsage; + return S_OK; + } + + std::shared_ptr ResidencyManagerDXGI::CreateBudgetUpdateTask() { + return std::make_shared(this); + } + + IDXGIAdapter3* ResidencyManagerDXGI::GetAdapter() const { + return mAdapter; + } + +} // namespace gpgmm::d3d12 diff --git a/src/gpgmm/d3d12/ResidencyManagerDXGI.h b/src/gpgmm/d3d12/ResidencyManagerDXGI.h new file mode 100644 index 00000000..2cee5348 --- /dev/null +++ b/src/gpgmm/d3d12/ResidencyManagerDXGI.h @@ -0,0 +1,48 @@ +// Copyright 2024 The GPGMM Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_GPGMM_D3D12_RESIDENCYMANAGERDXGI_H_ +#define SRC_GPGMM_D3D12_RESIDENCYMANAGERDXGI_H_ + +#include "gpgmm/d3d12/ResidencyManagerD3D12.h" + +#include + +namespace gpgmm::d3d12 { + + // Implements residency management for DXGI 1.4 and newer adapters. + class ResidencyManagerDXGI final : public ResidencyManager { + public: + ResidencyManagerDXGI(const RESIDENCY_MANAGER_DESC& descriptor, + ID3D12Device* pDevice, + IDXGIAdapter3* pAdapter, + std::unique_ptr caps); + + ~ResidencyManagerDXGI() override; + + IDXGIAdapter3* GetAdapter() const; + + private: + // ResidencyManager overloads + HRESULT QueryMemoryInfoImpl(const RESIDENCY_HEAP_SEGMENT& heapSegment, + RESIDENCY_MEMORY_INFO* pMemoryInfoOut) override; + + std::shared_ptr CreateBudgetUpdateTask() override; + + IDXGIAdapter3* mAdapter = nullptr; + }; + +} // namespace gpgmm::d3d12 + +#endif // SRC_GPGMM_D3D12_RESIDENCYMANAGERDXGI_H_ diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 7d599d85..215d3726 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -414,11 +414,6 @@ namespace gpgmm::d3d12 { ComPtr residencyManager; if (ppResidencyManagerOut != nullptr) { - ComPtr adapter3; - if (pAdapter != nullptr) { - GPGMM_RETURN_IF_FAILED(pAdapter->QueryInterface(IID_PPV_ARGS(&adapter3))); - } - RESIDENCY_MANAGER_DESC residencyDesc = {}; residencyDesc.MinLogLevel = allocatorDescriptor.MinLogLevel; residencyDesc.RecordOptions = allocatorDescriptor.RecordOptions; @@ -428,7 +423,7 @@ namespace gpgmm::d3d12 { } GPGMM_RETURN_IF_FAILED(ResidencyManager::CreateResidencyManager( - residencyDesc, pDevice, adapter3.Get(), &residencyManager)); + residencyDesc, pDevice, pAdapter, &residencyManager)); } ComPtr resourceAllocator;