From 8c255acbe403cf20d838a163729d8ff6722e24a4 Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Fri, 10 Jul 2020 22:58:48 +0000 Subject: [PATCH] Add GPU detection for WARP Adds WARP to known vendor/device Ids so tests can detect when MBR is being used. BUG=dawn:463 TEST=dawn_end2end_tests Change-Id: I19f16dfeb4839c5a7c0a993bab94d2b6ca4ca36d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24680 Reviewed-by: Rafael Cintron Reviewed-by: Austin Eng Commit-Queue: Bryan Bernhart --- src/common/GPUInfo.cpp | 3 +++ src/common/GPUInfo.h | 3 +++ src/tests/DawnTest.cpp | 4 ++++ src/tests/DawnTest.h | 1 + src/tests/white_box/D3D12SmallTextureTests.cpp | 2 +- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common/GPUInfo.cpp b/src/common/GPUInfo.cpp index 60076d2830..c3ea9cefb5 100644 --- a/src/common/GPUInfo.cpp +++ b/src/common/GPUInfo.cpp @@ -36,4 +36,7 @@ namespace gpu_info { bool IsSwiftshader(PCIVendorID vendorId, PCIDeviceID deviceId) { return vendorId == kVendorID_Google && deviceId == kDeviceID_Swiftshader; } + bool IsWARP(PCIVendorID vendorId, PCIDeviceID deviceId) { + return vendorId == kVendorID_Microsoft && deviceId == kDeviceID_WARP; + } } // namespace gpu_info diff --git a/src/common/GPUInfo.h b/src/common/GPUInfo.h index d16c89b9b9..87efbbc9df 100644 --- a/src/common/GPUInfo.h +++ b/src/common/GPUInfo.h @@ -29,8 +29,10 @@ namespace gpu_info { static constexpr PCIVendorID kVendorID_Nvidia = 0x10DE; static constexpr PCIVendorID kVendorID_Qualcomm = 0x5143; static constexpr PCIVendorID kVendorID_Google = 0x1AE0; + static constexpr PCIVendorID kVendorID_Microsoft = 0x1414; static constexpr PCIDeviceID kDeviceID_Swiftshader = 0xC0DE; + static constexpr PCIDeviceID kDeviceID_WARP = 0x8c; bool IsAMD(PCIVendorID vendorId); bool IsARM(PCIVendorID vendorId); @@ -39,6 +41,7 @@ namespace gpu_info { bool IsNvidia(PCIVendorID vendorId); bool IsQualcomm(PCIVendorID vendorId); bool IsSwiftshader(PCIVendorID vendorId, PCIDeviceID deviceId); + bool IsWARP(PCIVendorID vendorId, PCIDeviceID deviceId); } // namespace gpu_info #endif // COMMON_GPUINFO_H diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index b71e84f6a3..64e74555d3 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -647,6 +647,10 @@ bool DawnTestBase::IsSwiftshader() const { mParam.adapterProperties.deviceID); } +bool DawnTestBase::IsWARP() const { + return gpu_info::IsWARP(mParam.adapterProperties.vendorID, mParam.adapterProperties.deviceID); +} + bool DawnTestBase::IsWindows() const { #ifdef DAWN_PLATFORM_WINDOWS return true; diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index dddb9ad8ab..7a29bc0e99 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -239,6 +239,7 @@ class DawnTestBase { bool IsNvidia() const; bool IsQualcomm() const; bool IsSwiftshader() const; + bool IsWARP() const; bool IsWindows() const; bool IsLinux() const; diff --git a/src/tests/white_box/D3D12SmallTextureTests.cpp b/src/tests/white_box/D3D12SmallTextureTests.cpp index e3ab8cdad5..5566e158bc 100644 --- a/src/tests/white_box/D3D12SmallTextureTests.cpp +++ b/src/tests/white_box/D3D12SmallTextureTests.cpp @@ -43,7 +43,7 @@ TEST_P(D3D12SmallTextureTests, AlignSmallCompressedTexture) { DAWN_SKIP_TEST_IF(!IsBCFormatSupported()); // TODO(http://crbug.com/dawn/282): Investigate GPU/driver rejections of small alignment. - DAWN_SKIP_TEST_IF(IsIntel() || IsNvidia()); + DAWN_SKIP_TEST_IF(IsIntel() || IsNvidia() || IsWARP()); wgpu::TextureDescriptor descriptor; descriptor.dimension = wgpu::TextureDimension::e2D;