Replace uses of deprecated dawn_native::BackendType

Bug: dawn:824
Change-Id: I261c3329e53de62df83b4cca10aa9e909dd293df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492456
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@google.com>
Commit-Queue: Stephen White <senorblanco@google.com>
diff --git a/tools/gpu/dawn/DawnTestContext.cpp b/tools/gpu/dawn/DawnTestContext.cpp
index 162deaf..1c990c8 100644
--- a/tools/gpu/dawn/DawnTestContext.cpp
+++ b/tools/gpu/dawn/DawnTestContext.cpp
@@ -84,13 +84,15 @@
 class DawnTestContextImpl : public sk_gpu_test::DawnTestContext {
 public:
     static wgpu::Device createDevice(const dawn_native::Instance& instance,
-                                     dawn_native::BackendType type) {
+                                     wgpu::BackendType type) {
         DawnProcTable backendProcs = dawn_native::GetProcs();
         dawnProcSetProcs(&backendProcs);
 
         std::vector<dawn_native::Adapter> adapters = instance.GetAdapters();
         for (dawn_native::Adapter adapter : adapters) {
-            if (adapter.GetBackendType() == type) {
+            wgpu::AdapterProperties properties;
+            adapter.GetProperties(&properties);
+            if (properties.backendType == type) {
                 return wgpu::Device::Acquire(adapter.CreateDevice());
             }
         }
@@ -103,7 +105,7 @@
         if (sharedContext) {
             device = sharedContext->getDevice();
         } else {
-            dawn_native::BackendType type;
+            wgpu::BackendType type;
 #if USE_OPENGL_BACKEND
             dawn_native::opengl::AdapterDiscoveryOptions adapterOptions;
             adapterOptions.getProc = reinterpret_cast<void*(*)(const char*)>(
@@ -116,15 +118,15 @@
 #endif
             );
             instance->DiscoverAdapters(&adapterOptions);
-            type = dawn_native::BackendType::OpenGL;
+            type = wgpu::BackendType::OpenGL;
 #else
             instance->DiscoverDefaultAdapters();
 #if defined(SK_BUILD_FOR_MAC)
-            type = dawn_native::BackendType::Metal;
+            type = wgpu::BackendType::Metal;
 #elif defined(SK_BUILD_FOR_WIN)
-            type = dawn_native::BackendType::D3D12;
+            type = wgpu::BackendType::D3D12;
 #elif defined(SK_BUILD_FOR_UNIX)
-            type = dawn_native::BackendType::Vulkan;
+            type = wgpu::BackendType::Vulkan;
 #endif
 #endif
             device = createDevice(*instance, type);
diff --git a/tools/sk_app/DawnWindowContext.cpp b/tools/sk_app/DawnWindowContext.cpp
index 134842d..f810923 100644
--- a/tools/sk_app/DawnWindowContext.cpp
+++ b/tools/sk_app/DawnWindowContext.cpp
@@ -106,14 +106,16 @@
     fDisplayParams = params;
 }
 
-wgpu::Device DawnWindowContext::createDevice(dawn_native::BackendType type) {
+wgpu::Device DawnWindowContext::createDevice(wgpu::BackendType type) {
     fInstance->DiscoverDefaultAdapters();
     DawnProcTable backendProcs = dawn_native::GetProcs();
     dawnProcSetProcs(&backendProcs);
 
     std::vector<dawn_native::Adapter> adapters = fInstance->GetAdapters();
     for (dawn_native::Adapter adapter : adapters) {
-        if (adapter.GetBackendType() == type) {
+        wgpu::AdapterProperties properties;
+        adapter.GetProperties(&properties);
+        if (properties.backendType == type) {
             return adapter.CreateDevice();
         }
     }
diff --git a/tools/sk_app/DawnWindowContext.h b/tools/sk_app/DawnWindowContext.h
index ef4b717..a548ca4 100644
--- a/tools/sk_app/DawnWindowContext.h
+++ b/tools/sk_app/DawnWindowContext.h
@@ -32,7 +32,7 @@
 protected:
     bool isGpuContext() override { return true; }
     void initializeContext(int width, int height);
-    wgpu::Device createDevice(dawn_native::BackendType type);
+    wgpu::Device createDevice(wgpu::BackendType type);
     virtual wgpu::Device onInitializeContext() = 0;
     virtual void onDestroyContext() = 0;
     virtual void onSwapBuffers() = 0;
diff --git a/tools/sk_app/mac/DawnMTLWindowContext_mac.mm b/tools/sk_app/mac/DawnMTLWindowContext_mac.mm
index 0fc2d1b..67bec74 100644
--- a/tools/sk_app/mac/DawnMTLWindowContext_mac.mm
+++ b/tools/sk_app/mac/DawnMTLWindowContext_mac.mm
@@ -119,7 +119,7 @@
 }
 
 wgpu::Device DawnMTLWindowContext::onInitializeContext() {
-    wgpu::Device device = this->createDevice(dawn_native::BackendType::Metal);
+    wgpu::Device device = this->createDevice(wgpu::BackendType::Metal);
     if (!device) {
         return nullptr;
     }
diff --git a/tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp b/tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp
index aec034a..f6a5b6f 100644
--- a/tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp
+++ b/tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp
@@ -58,7 +58,7 @@
 }
 
 wgpu::Device DawnVulkanWindowContext_xlib::onInitializeContext() {
-    wgpu::Device device = this->createDevice(dawn_native::BackendType::Vulkan);
+    wgpu::Device device = this->createDevice(wgpu::BackendType::Vulkan);
     if (!device) {
         return nullptr;
     }
diff --git a/tools/sk_app/win/DawnD3D12WindowContext_win.cpp b/tools/sk_app/win/DawnD3D12WindowContext_win.cpp
index 30df981..6ceaf05 100644
--- a/tools/sk_app/win/DawnD3D12WindowContext_win.cpp
+++ b/tools/sk_app/win/DawnD3D12WindowContext_win.cpp
@@ -46,7 +46,7 @@
 }
 
 wgpu::Device DawnD3D12WindowContext::onInitializeContext() {
-    return this->createDevice(dawn_native::BackendType::D3D12);
+    return this->createDevice(wgpu::BackendType::D3D12);
 }
 
 void DawnD3D12WindowContext::onDestroyContext() {