diff --git a/src/gpgmm/common/GPUInfo.h b/src/gpgmm/common/GPUInfo.h index 22411a8a..331026e1 100644 --- a/src/gpgmm/common/GPUInfo.h +++ b/src/gpgmm/common/GPUInfo.h @@ -15,6 +15,8 @@ #ifndef SRC_GPGMM_COMMON_GPUINFO_H_ #define SRC_GPGMM_COMMON_GPUINFO_H_ +#include + namespace gpgmm { enum class GPUVendor { @@ -24,6 +26,11 @@ namespace gpgmm { kIntel_Vendor = 32902, kNvidia_Vendor = 4318, kQualcomm_Vendor = 20803, + kMicrosoft_Vendor = 0x1414, + }; + + enum class GPUDevice { + kWARP_Device = 0x8c, }; } // namespace gpgmm diff --git a/src/tests/D3D12Test.cpp b/src/tests/D3D12Test.cpp index 3f5b9be9..c13b5d7b 100644 --- a/src/tests/D3D12Test.cpp +++ b/src/tests/D3D12Test.cpp @@ -16,6 +16,7 @@ #include +#include "gpgmm/common/GPUInfo.h" #include "gpgmm/common/SizeClass.h" #include "gpgmm/d3d12/CapsD3D12.h" #include "gpgmm/d3d12/ResidencyManagerD3D12.h" @@ -83,19 +84,18 @@ namespace gpgmm::d3d12 { ASSERT_SUCCEEDED(dxgiFactory4->EnumAdapterByLuid(adapterLUID, IID_PPV_ARGS(&mAdapter))); ASSERT_NE(mAdapter.Get(), nullptr); - DXGI_ADAPTER_DESC adapterDesc; - ASSERT_SUCCEEDED(mAdapter->GetDesc(&adapterDesc)); + ASSERT_SUCCEEDED(mAdapter->GetDesc(&mAdapterDesc)); - DebugLog() << "GPU: " << WCharToUTF8(adapterDesc.Description) - << " (device: " << ToHexStr(adapterDesc.DeviceId) - << ", vendor: " << ToHexStr(adapterDesc.VendorId) << ")"; + DebugLog() << "GPU: " << WCharToUTF8(mAdapterDesc.Description) + << " (device: " << ToHexStr(mAdapterDesc.DeviceId) + << ", vendor: " << ToHexStr(mAdapterDesc.VendorId) << ")"; DebugLog() << "System memory: " - << GPGMM_BYTES_TO_GB(adapterDesc.SharedSystemMemory + - adapterDesc.DedicatedSystemMemory) + << GPGMM_BYTES_TO_GB(mAdapterDesc.SharedSystemMemory + + mAdapterDesc.DedicatedSystemMemory) << " GBs" - << " (" << GPGMM_BYTES_TO_GB(adapterDesc.DedicatedSystemMemory) + << " (" << GPGMM_BYTES_TO_GB(mAdapterDesc.DedicatedSystemMemory) << " dedicated) "; - DebugLog() << "GPU memory: " << GPGMM_BYTES_TO_GB(adapterDesc.DedicatedVideoMemory) + DebugLog() << "GPU memory: " << GPGMM_BYTES_TO_GB(mAdapterDesc.DedicatedVideoMemory) << " GBs."; Caps* capsPtr = nullptr; @@ -124,6 +124,10 @@ namespace gpgmm::d3d12 { void D3D12TestBase::TearDown() { GPGMMTestBase::TearDown(); + + // Check that nothing was leaked from the D3D12 device. + // If the test doesn't fully clean-up itself, this will trip. + EXPECT_REFCOUNT_EQ(mDevice.Get(), 1); } RESOURCE_ALLOCATOR_DESC D3D12TestBase::CreateBasicAllocatorDesc() const { @@ -210,4 +214,9 @@ namespace gpgmm::d3d12 { #endif } + bool D3D12TestBase::IsAdapterMicrosoftWARP() const { + return mAdapterDesc.VendorId == static_cast(GPUVendor::kMicrosoft_Vendor) && + mAdapterDesc.DeviceId == static_cast(GPUDevice::kWARP_Device); + } + } // namespace gpgmm::d3d12 diff --git a/src/tests/D3D12Test.h b/src/tests/D3D12Test.h index ba8aeeb5..fa73613d 100644 --- a/src/tests/D3D12Test.h +++ b/src/tests/D3D12Test.h @@ -67,11 +67,14 @@ namespace gpgmm::d3d12 { D3D12_MESSAGE_SEVERITY GetDefaultLogLevel() const; + bool IsAdapterMicrosoftWARP() const; + protected: ComPtr mAdapter; ComPtr mDevice; std::unique_ptr mCaps; std::string mTraceFile; + DXGI_ADAPTER_DESC mAdapterDesc = {}; }; } // namespace gpgmm::d3d12 diff --git a/src/tests/end2end/D3D12ResidencyManagerTests.cpp b/src/tests/end2end/D3D12ResidencyManagerTests.cpp index d08820fb..1593713e 100644 --- a/src/tests/end2end/D3D12ResidencyManagerTests.cpp +++ b/src/tests/end2end/D3D12ResidencyManagerTests.cpp @@ -907,6 +907,9 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetWithMappedResources) { // swaps the residency status using ExecuteCommandList: first set gets paged-in again, second set // gets paged-out. TEST_F(D3D12ResidencyManagerTests, OverBudgetExecuteCommandList) { + // Disable for WARP because the device always leaks after this test ends. + GPGMM_SKIP_TEST_IF(IsAdapterMicrosoftWARP()); + ComPtr residencyManager; ASSERT_SUCCEEDED(CreateResidencyManager(CreateBasicResidencyDesc(kDefaultBudget), mDevice.Get(), mAdapter.Get(), &residencyManager));