Remove deprecated DawnNative Adapter getters.

Bug: dawn:824
Change-Id: I4e73598ccd8eb5ce85c8a0ed86629daef4b575c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75584
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/Adapter.cpp b/src/dawn_native/Adapter.cpp
index d435526..f8a5d91 100644
--- a/src/dawn_native/Adapter.cpp
+++ b/src/dawn_native/Adapter.cpp
@@ -33,14 +33,12 @@
             InitializeSupportedFeaturesImpl(),
             "gathering supported features for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
             "backend=%s type=%s)",
-            mPCIInfo.name, mDriverDescription, mPCIInfo.vendorId, mPCIInfo.deviceId, mBackend,
-            mAdapterType);
+            mName, mDriverDescription, mVendorId, mDeviceId, mBackend, mAdapterType);
         DAWN_TRY_CONTEXT(
             InitializeSupportedLimitsImpl(&mLimits),
             "gathering supported limits for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
             "backend=%s type=%s)",
-            mPCIInfo.name, mDriverDescription, mPCIInfo.vendorId, mPCIInfo.deviceId, mBackend,
-            mAdapterType);
+            mName, mDriverDescription, mVendorId, mDeviceId, mBackend, mAdapterType);
 
         // Enforce internal Dawn constants.
         mLimits.v1.maxVertexBufferArrayStride =
@@ -77,9 +75,9 @@
     }
 
     void AdapterBase::APIGetProperties(AdapterProperties* properties) const {
-        properties->vendorID = mPCIInfo.vendorId;
-        properties->deviceID = mPCIInfo.deviceId;
-        properties->name = mPCIInfo.name.c_str();
+        properties->vendorID = mVendorId;
+        properties->deviceID = mDeviceId;
+        properties->name = mName.c_str();
         properties->driverDescription = mDriverDescription.c_str();
         properties->adapterType = mAdapterType;
         properties->backendType = mBackend;
@@ -125,22 +123,18 @@
         callback(status, ToAPI(device.Detach()), nullptr, userdata);
     }
 
+    uint32_t AdapterBase::GetVendorId() const {
+        return mVendorId;
+    }
+
+    uint32_t AdapterBase::GetDeviceId() const {
+        return mDeviceId;
+    }
+
     wgpu::BackendType AdapterBase::GetBackendType() const {
         return mBackend;
     }
 
-    wgpu::AdapterType AdapterBase::GetAdapterType() const {
-        return mAdapterType;
-    }
-
-    const std::string& AdapterBase::GetDriverDescription() const {
-        return mDriverDescription;
-    }
-
-    const PCIInfo& AdapterBase::GetPCIInfo() const {
-        return mPCIInfo;
-    }
-
     InstanceBase* AdapterBase::GetInstance() const {
         return mInstance;
     }
@@ -161,8 +155,8 @@
 
     WGPUDeviceProperties AdapterBase::GetAdapterProperties() const {
         WGPUDeviceProperties adapterProperties = {};
-        adapterProperties.deviceID = mPCIInfo.deviceId;
-        adapterProperties.vendorID = mPCIInfo.vendorId;
+        adapterProperties.deviceID = mDeviceId;
+        adapterProperties.vendorID = mVendorId;
         adapterProperties.adapterType = static_cast<WGPUAdapterType>(mAdapterType);
 
         mSupportedFeatures.InitializeDeviceProperties(&adapterProperties);
diff --git a/src/dawn_native/Adapter.h b/src/dawn_native/Adapter.h
index 12de0aa..3636bfc 100644
--- a/src/dawn_native/Adapter.h
+++ b/src/dawn_native/Adapter.h
@@ -47,10 +47,9 @@
                               void* userdata);
         DeviceBase* APICreateDevice(const DeviceDescriptor* descriptor = nullptr);
 
+        uint32_t GetVendorId() const;
+        uint32_t GetDeviceId() const;
         wgpu::BackendType GetBackendType() const;
-        wgpu::AdapterType GetAdapterType() const;
-        const std::string& GetDriverDescription() const;
-        const PCIInfo& GetPCIInfo() const;
         InstanceBase* GetInstance() const;
 
         void ResetInternalDeviceForTesting();
@@ -67,7 +66,9 @@
         virtual bool SupportsExternalImages() const = 0;
 
       protected:
-        PCIInfo mPCIInfo = {};
+        uint32_t mVendorId = 0xFFFFFFFF;
+        uint32_t mDeviceId = 0xFFFFFFFF;
+        std::string mName;
         wgpu::AdapterType mAdapterType = wgpu::AdapterType::Unknown;
         std::string mDriverDescription;
         FeaturesSet mSupportedFeatures;
diff --git a/src/dawn_native/DawnNative.cpp b/src/dawn_native/DawnNative.cpp
index 80772f0..3736dc1 100644
--- a/src/dawn_native/DawnNative.cpp
+++ b/src/dawn_native/DawnNative.cpp
@@ -86,56 +86,11 @@
     Adapter& Adapter::operator=(const Adapter& other) = default;
 
     void Adapter::GetProperties(wgpu::AdapterProperties* properties) const {
-        properties->backendType = mImpl->GetBackendType();
-        properties->adapterType = mImpl->GetAdapterType();
-        properties->driverDescription = mImpl->GetDriverDescription().c_str();
-        properties->deviceID = mImpl->GetPCIInfo().deviceId;
-        properties->vendorID = mImpl->GetPCIInfo().vendorId;
-        properties->name = mImpl->GetPCIInfo().name.c_str();
+        GetProperties(reinterpret_cast<WGPUAdapterProperties*>(properties));
     }
 
     void Adapter::GetProperties(WGPUAdapterProperties* properties) const {
-        GetProperties(reinterpret_cast<wgpu::AdapterProperties*>(properties));
-    }
-
-    BackendType Adapter::GetBackendType() const {
-        switch (mImpl->GetBackendType()) {
-            case wgpu::BackendType::D3D12:
-                return BackendType::D3D12;
-            case wgpu::BackendType::Metal:
-                return BackendType::Metal;
-            case wgpu::BackendType::Null:
-                return BackendType::Null;
-            case wgpu::BackendType::OpenGL:
-                return BackendType::OpenGL;
-            case wgpu::BackendType::Vulkan:
-                return BackendType::Vulkan;
-            case wgpu::BackendType::OpenGLES:
-                return BackendType::OpenGLES;
-
-            case wgpu::BackendType::D3D11:
-            case wgpu::BackendType::WebGPU:
-                break;
-        }
-        UNREACHABLE();
-    }
-
-    DeviceType Adapter::GetDeviceType() const {
-        switch (mImpl->GetAdapterType()) {
-            case wgpu::AdapterType::DiscreteGPU:
-                return DeviceType::DiscreteGPU;
-            case wgpu::AdapterType::IntegratedGPU:
-                return DeviceType::IntegratedGPU;
-            case wgpu::AdapterType::CPU:
-                return DeviceType::CPU;
-            case wgpu::AdapterType::Unknown:
-                return DeviceType::Unknown;
-        }
-        UNREACHABLE();
-    }
-
-    const PCIInfo& Adapter::GetPCIInfo() const {
-        return mImpl->GetPCIInfo();
+        mImpl->APIGetProperties(FromAPI(properties));
     }
 
     WGPUAdapter Adapter::Get() const {
diff --git a/src/dawn_native/d3d12/AdapterD3D12.cpp b/src/dawn_native/d3d12/AdapterD3D12.cpp
index e2182e7..1f17979 100644
--- a/src/dawn_native/d3d12/AdapterD3D12.cpp
+++ b/src/dawn_native/d3d12/AdapterD3D12.cpp
@@ -76,9 +76,9 @@
         DXGI_ADAPTER_DESC1 adapterDesc;
         mHardwareAdapter->GetDesc1(&adapterDesc);
 
-        mPCIInfo.deviceId = adapterDesc.DeviceId;
-        mPCIInfo.vendorId = adapterDesc.VendorId;
-        mPCIInfo.name = WCharToUTF8(adapterDesc.Description);
+        mDeviceId = adapterDesc.DeviceId;
+        mVendorId = adapterDesc.VendorId;
+        mName = WCharToUTF8(adapterDesc.Description);
 
         DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this));
 
diff --git a/src/dawn_native/d3d12/D3D12Info.cpp b/src/dawn_native/d3d12/D3D12Info.cpp
index 3f10b11..ab68487 100644
--- a/src/dawn_native/d3d12/D3D12Info.cpp
+++ b/src/dawn_native/d3d12/D3D12Info.cpp
@@ -54,7 +54,7 @@
             // with RENDER_PASS_TIER_1 available, so fall back to a software emulated render
             // pass on these platforms.
             if (featureOptions5.RenderPassesTier < D3D12_RENDER_PASS_TIER_1 ||
-                !gpu_info::IsIntel(adapter.GetPCIInfo().vendorId)) {
+                !gpu_info::IsIntel(adapter.GetVendorId())) {
                 info.supportsRenderPass = true;
             }
         }
diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp
index 54c2a71..d0d06c1 100644
--- a/src/dawn_native/d3d12/DeviceD3D12.cpp
+++ b/src/dawn_native/d3d12/DeviceD3D12.cpp
@@ -584,15 +584,16 @@
         // By default use the maximum shader-visible heap size allowed.
         SetToggle(Toggle::UseD3D12SmallShaderVisibleHeapForTesting, false);
 
-        PCIInfo pciInfo = GetAdapter()->GetPCIInfo();
+        uint32_t deviceId = GetAdapter()->GetDeviceId();
+        uint32_t vendorId = GetAdapter()->GetVendorId();
 
         // Currently this workaround is only needed on Intel Gen9 and Gen9.5 GPUs.
         // See http://crbug.com/1161355 for more information.
-        if (gpu_info::IsIntel(pciInfo.vendorId) &&
-            (gpu_info::IsSkylake(pciInfo.deviceId) || gpu_info::IsKabylake(pciInfo.deviceId) ||
-             gpu_info::IsCoffeelake(pciInfo.deviceId))) {
+        if (gpu_info::IsIntel(vendorId) &&
+            (gpu_info::IsSkylake(deviceId) || gpu_info::IsKabylake(deviceId) ||
+             gpu_info::IsCoffeelake(deviceId))) {
             constexpr gpu_info::D3DDriverVersion kFirstDriverVersionWithFix = {30, 0, 100, 9864};
-            if (gpu_info::CompareD3DDriverVersion(pciInfo.vendorId,
+            if (gpu_info::CompareD3DDriverVersion(vendorId,
                                                   ToBackend(GetAdapter())->GetDriverVersion(),
                                                   kFirstDriverVersionWithFix) < 0) {
                 SetToggle(
diff --git a/src/dawn_native/metal/BackendMTL.mm b/src/dawn_native/metal/BackendMTL.mm
index f6034b5..fd5e507 100644
--- a/src/dawn_native/metal/BackendMTL.mm
+++ b/src/dawn_native/metal/BackendMTL.mm
@@ -243,12 +243,12 @@
       public:
         Adapter(InstanceBase* instance, id<MTLDevice> device)
             : AdapterBase(instance, wgpu::BackendType::Metal), mDevice(device) {
-            mPCIInfo.name = std::string([[*mDevice name] UTF8String]);
+            mName = std::string([[*mDevice name] UTF8String]);
 
             PCIIDs ids;
             if (!instance->ConsumedError(GetDevicePCIInfo(device, &ids))) {
-                mPCIInfo.vendorId = ids.vendorId;
-                mPCIInfo.deviceId = ids.deviceId;
+                mVendorId = ids.vendorId;
+                mDeviceId = ids.deviceId;
             }
 
 #if defined(DAWN_PLATFORM_IOS)
@@ -311,7 +311,7 @@
                     // fails to call without any copy commands on MTLBlitCommandEncoder. This issue
                     // has been fixed on macOS 11.0. See crbug.com/dawn/545
                     enableTimestampQuery &=
-                        !(gpu_info::IsAMD(GetPCIInfo().vendorId) && IsMacOSVersionAtLeast(11));
+                        !(gpu_info::IsAMD(mVendorId) && IsMacOSVersionAtLeast(11));
 #endif
 
                     if (enableTimestampQuery) {
diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm
index ccba9d1..978b2f6 100644
--- a/src/dawn_native/metal/DeviceMTL.mm
+++ b/src/dawn_native/metal/DeviceMTL.mm
@@ -137,8 +137,7 @@
         if (IsFeatureEnabled(Feature::TimestampQuery)) {
             // Make a best guess of timestamp period based on device vendor info, and converge it to
             // an accurate value by the following calculations.
-            mTimestampPeriod =
-                gpu_info::IsIntel(GetAdapter()->GetPCIInfo().vendorId) ? 83.333f : 1.0f;
+            mTimestampPeriod = gpu_info::IsIntel(GetAdapter()->GetVendorId()) ? 83.333f : 1.0f;
 
             // Initialize kalman filter parameters
             mKalmanInfo = std::make_unique<KalmanInfo>();
@@ -199,27 +198,28 @@
         // TODO(crbug.com/dawn/846): tighten this workaround when the driver bug is fixed.
         SetToggle(Toggle::AlwaysResolveIntoZeroLevelAndLayer, true);
 
-        const PCIInfo& pciInfo = GetAdapter()->GetPCIInfo();
+        uint32_t deviceId = GetAdapter()->GetDeviceId();
+        uint32_t vendorId = GetAdapter()->GetVendorId();
 
         // TODO(crbug.com/dawn/847): Use MTLStorageModeShared instead of MTLStorageModePrivate when
         // creating MTLCounterSampleBuffer in QuerySet on Intel platforms, otherwise it fails to
         // create the buffer. Change to use MTLStorageModePrivate when the bug is fixed.
         if (@available(macOS 10.15, iOS 14.0, *)) {
-            bool useSharedMode = gpu_info::IsIntel(pciInfo.vendorId);
+            bool useSharedMode = gpu_info::IsIntel(vendorId);
             SetToggle(Toggle::MetalUseSharedModeForCounterSampleBuffer, useSharedMode);
         }
 
         // TODO(crbug.com/dawn/1071): r8unorm and rg8unorm textures with multiple mip levels don't
         // clear properly on Intel Macs.
-        if (gpu_info::IsIntel(pciInfo.vendorId)) {
+        if (gpu_info::IsIntel(vendorId)) {
             SetToggle(Toggle::DisableR8RG8Mipmaps, true);
         }
 
         // On some Intel GPU vertex only render pipeline get wrong depth result if no fragment
         // shader provided. Create a dummy fragment shader module to work around this issue.
-        if (gpu_info::IsIntel(this->GetAdapter()->GetPCIInfo().vendorId)) {
+        if (gpu_info::IsIntel(vendorId)) {
             bool useDummyFragmentShader = true;
-            if (gpu_info::IsSkylake(this->GetAdapter()->GetPCIInfo().deviceId)) {
+            if (gpu_info::IsSkylake(deviceId)) {
                 useDummyFragmentShader = false;
             }
             SetToggle(Toggle::UseDummyFragmentInVertexOnlyPipeline, useDummyFragmentShader);
diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp
index dad3afa..548426c 100644
--- a/src/dawn_native/null/DeviceNull.cpp
+++ b/src/dawn_native/null/DeviceNull.cpp
@@ -25,7 +25,9 @@
     // Implementation of pre-Device objects: the null adapter, null backend connection and Connect()
 
     Adapter::Adapter(InstanceBase* instance) : AdapterBase(instance, wgpu::BackendType::Null) {
-        mPCIInfo.name = "Null backend";
+        mVendorId = 0;
+        mDeviceId = 0;
+        mName = "Null backend";
         mAdapterType = wgpu::AdapterType::CPU;
         MaybeError err = Initialize();
         ASSERT(err.IsSuccess());
diff --git a/src/dawn_native/opengl/BackendGL.cpp b/src/dawn_native/opengl/BackendGL.cpp
index 0c2ee0b..7726ed2 100644
--- a/src/dawn_native/opengl/BackendGL.cpp
+++ b/src/dawn_native/opengl/BackendGL.cpp
@@ -186,16 +186,16 @@
             }
             mFunctions.Enable(GL_SAMPLE_MASK);
 
-            mPCIInfo.name = reinterpret_cast<const char*>(mFunctions.GetString(GL_RENDERER));
+            mName = reinterpret_cast<const char*>(mFunctions.GetString(GL_RENDERER));
 
             // Workaroud to find vendor id from vendor name
             const char* vendor = reinterpret_cast<const char*>(mFunctions.GetString(GL_VENDOR));
-            mPCIInfo.vendorId = GetVendorIdFromVendors(vendor);
+            mVendorId = GetVendorIdFromVendors(vendor);
 
             mDriverDescription = std::string("OpenGL version ") +
                                  reinterpret_cast<const char*>(mFunctions.GetString(GL_VERSION));
 
-            if (mPCIInfo.name.find("SwiftShader") != std::string::npos) {
+            if (mName.find("SwiftShader") != std::string::npos) {
                 mAdapterType = wgpu::AdapterType::CPU;
             }
 
diff --git a/src/dawn_native/vulkan/AdapterVk.cpp b/src/dawn_native/vulkan/AdapterVk.cpp
index 4b81ba0..9ac789e 100644
--- a/src/dawn_native/vulkan/AdapterVk.cpp
+++ b/src/dawn_native/vulkan/AdapterVk.cpp
@@ -65,9 +65,9 @@
                 "Vulkan driver version: " + std::to_string(mDeviceInfo.properties.driverVersion);
         }
 
-        mPCIInfo.deviceId = mDeviceInfo.properties.deviceID;
-        mPCIInfo.vendorId = mDeviceInfo.properties.vendorID;
-        mPCIInfo.name = mDeviceInfo.properties.deviceName;
+        mDeviceId = mDeviceInfo.properties.deviceID;
+        mVendorId = mDeviceInfo.properties.vendorID;
+        mName = mDeviceInfo.properties.deviceName;
 
         switch (mDeviceInfo.properties.deviceType) {
             case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
diff --git a/src/include/dawn_native/DawnNative.h b/src/include/dawn_native/DawnNative.h
index 2ca2c48..82df688 100644
--- a/src/include/dawn_native/DawnNative.h
+++ b/src/include/dawn_native/DawnNative.h
@@ -33,31 +33,6 @@
 
 namespace dawn_native {
 
-    // DEPRECATED: use WGPUAdapterProperties instead.
-    struct PCIInfo {
-        uint32_t deviceId = 0;
-        uint32_t vendorId = 0;
-        std::string name;
-    };
-
-    // DEPRECATED: use WGPUBackendType instead.
-    enum class BackendType {
-        D3D12,
-        Metal,
-        Null,
-        OpenGL,
-        OpenGLES,
-        Vulkan,
-    };
-
-    // DEPRECATED: use WGPUAdapterType instead.
-    enum class DeviceType {
-        DiscreteGPU,
-        IntegratedGPU,
-        CPU,
-        Unknown,
-    };
-
     class InstanceBase;
     class AdapterBase;
 
@@ -100,11 +75,6 @@
         Adapter(const Adapter& other);
         Adapter& operator=(const Adapter& other);
 
-        // DEPRECATED: use GetProperties instead.
-        BackendType GetBackendType() const;
-        DeviceType GetDeviceType() const;
-        const PCIInfo& GetPCIInfo() const;
-
         // Essentially webgpu.h's wgpuAdapterGetProperties while we don't have WGPUAdapter in
         // dawn.json
         void GetProperties(wgpu::AdapterProperties* properties) const;
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 189fa3c..4102c0f 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -323,11 +323,11 @@
                 std::string type;
                 while (std::getline(ss, type, ',')) {
                     if (strcmp(type.c_str(), "discrete") == 0) {
-                        mDevicePreferences.push_back(dawn_native::DeviceType::DiscreteGPU);
+                        mDevicePreferences.push_back(wgpu::AdapterType::DiscreteGPU);
                     } else if (strcmp(type.c_str(), "integrated") == 0) {
-                        mDevicePreferences.push_back(dawn_native::DeviceType::IntegratedGPU);
+                        mDevicePreferences.push_back(wgpu::AdapterType::IntegratedGPU);
                     } else if (strcmp(type.c_str(), "cpu") == 0) {
-                        mDevicePreferences.push_back(dawn_native::DeviceType::CPU);
+                        mDevicePreferences.push_back(wgpu::AdapterType::CPU);
                     } else {
                         dawn::ErrorLog() << "Invalid device type preference: " << type;
                         UNREACHABLE();
@@ -474,14 +474,14 @@
 
 void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::Instance* instance) {
     // Get the first available preferred device type.
-    dawn_native::DeviceType preferredDeviceType = static_cast<dawn_native::DeviceType>(-1);
+    wgpu::AdapterType preferredDeviceType = static_cast<wgpu::AdapterType>(-1);
     bool hasDevicePreference = false;
-    for (dawn_native::DeviceType devicePreference : mDevicePreferences) {
+    for (wgpu::AdapterType devicePreference : mDevicePreferences) {
         for (const dawn_native::Adapter& adapter : instance->GetAdapters()) {
             wgpu::AdapterProperties properties;
             adapter.GetProperties(&properties);
 
-            if (adapter.GetDeviceType() == devicePreference) {
+            if (properties.adapterType == devicePreference) {
                 preferredDeviceType = devicePreference;
                 hasDevicePreference = true;
                 break;
@@ -517,12 +517,12 @@
             selected &=
                 // The device type doesn't match the first available preferred type for that
                 // backend, if present.
-                (adapter.GetDeviceType() == preferredDeviceType) ||
+                (properties.adapterType == preferredDeviceType) ||
                 // Always select Unknown OpenGL adapters if we don't want a CPU adapter.
                 // OpenGL will usually be unknown because we can't query the device type.
                 // If we ever have Swiftshader GL (unlikely), we could set the DeviceType properly.
-                (preferredDeviceType != dawn_native::DeviceType::CPU &&
-                 adapter.GetDeviceType() == dawn_native::DeviceType::Unknown &&
+                (preferredDeviceType != wgpu::AdapterType::CPU &&
+                 properties.adapterType == wgpu::AdapterType::Unknown &&
                  (properties.backendType == wgpu::BackendType::OpenGL ||
                   properties.backendType == wgpu::BackendType::OpenGLES)) ||
                 // Always select the Null backend. There are few tests on this backend, and they run
diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h
index cbc8fe9..5496bb7 100644
--- a/src/tests/DawnTest.h
+++ b/src/tests/DawnTest.h
@@ -261,7 +261,7 @@
 
     ToggleParser mToggleParser;
 
-    std::vector<dawn_native::DeviceType> mDevicePreferences;
+    std::vector<wgpu::AdapterType> mDevicePreferences;
     std::vector<TestAdapterProperties> mAdapterProperties;
 
     std::unique_ptr<utils::PlatformDebugLogger> mPlatformDebugLogger;