webgpu.h: Add WGPUFeatureLevel

Spec PR: https://github.com/webgpu-native/webgpu-headers/pull/399

Bug: 366151404

Change-Id: I3b684f1e4f72245b9adcf25d567b9d49c3ae27a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/218514
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 9dc83ba..a68c1f9 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -2435,6 +2435,14 @@
             {"name": "shared event", "type": "void *"}
         ]
     },
+    "feature level": {
+        "category": "enum",
+        "values": [
+            {"value": 0, "name": "undefined", "jsrepr": "undefined"},
+            {"value": 1, "name": "compatibility"},
+            {"value": 2, "name": "core"}
+        ]
+    },
     "feature name": {
         "category": "enum",
         "values": [
diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp
index 39a4408..6fbe51f 100644
--- a/src/dawn/native/Adapter.cpp
+++ b/src/dawn/native/Adapter.cpp
@@ -49,7 +49,7 @@
 
 AdapterBase::AdapterBase(InstanceBase* instance,
                          Ref<PhysicalDeviceBase> physicalDevice,
-                         FeatureLevel featureLevel,
+                         wgpu::FeatureLevel featureLevel,
                          const TogglesState& requiredAdapterToggles,
                          wgpu::PowerPreference powerPreference)
     : mInstance(instance),
@@ -227,7 +227,7 @@
     info->adapterType = mPhysicalDevice->GetAdapterType();
     info->vendorID = mPhysicalDevice->GetVendorId();
     info->deviceID = mPhysicalDevice->GetDeviceId();
-    info->compatibilityMode = mFeatureLevel == FeatureLevel::Compatibility;
+    info->compatibilityMode = mFeatureLevel == wgpu::FeatureLevel::Compatibility;
 
     return wgpu::Status::Success;
 }
@@ -476,7 +476,7 @@
     return mTogglesState;
 }
 
-FeatureLevel AdapterBase::GetFeatureLevel() const {
+wgpu::FeatureLevel AdapterBase::GetFeatureLevel() const {
     return mFeatureLevel;
 }
 
diff --git a/src/dawn/native/Adapter.h b/src/dawn/native/Adapter.h
index 3110d6e..8a6796f 100644
--- a/src/dawn/native/Adapter.h
+++ b/src/dawn/native/Adapter.h
@@ -50,7 +50,7 @@
   public:
     AdapterBase(InstanceBase* instance,
                 Ref<PhysicalDeviceBase> physicalDevice,
-                FeatureLevel featureLevel,
+                wgpu::FeatureLevel featureLevel,
                 const TogglesState& requiredAdapterToggles,
                 wgpu::PowerPreference powerPreference);
     ~AdapterBase() override;
@@ -85,7 +85,7 @@
     // Get the actual toggles state of the adapter.
     const TogglesState& GetTogglesState() const;
 
-    FeatureLevel GetFeatureLevel() const;
+    wgpu::FeatureLevel GetFeatureLevel() const;
 
     // Get a human readable label for the adapter (in practice, the physical device name)
     const std::string& GetName() const;
@@ -98,7 +98,7 @@
 
     Ref<InstanceBase> mInstance;
     Ref<PhysicalDeviceBase> mPhysicalDevice;
-    FeatureLevel mFeatureLevel;
+    wgpu::FeatureLevel mFeatureLevel;
     bool mUseTieredLimits = false;
 
     // Supported features under adapter toggles.
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index 3918eaa..2d7d31e 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -408,7 +408,7 @@
 }
 
 DeviceBase::DeviceBase() : mState(State::Alive), mToggles(ToggleStage::Device) {
-    GetDefaultLimits(&mLimits.v1, FeatureLevel::Core);
+    GetDefaultLimits(&mLimits.v1, wgpu::FeatureLevel::Core);
     mFormatTable = BuildFormatTable(this);
 
     DeviceDescriptor desc = {};
@@ -1768,7 +1768,7 @@
 }
 
 bool DeviceBase::IsCompatibilityMode() const {
-    return mAdapter != nullptr && mAdapter->GetFeatureLevel() == FeatureLevel::Compatibility;
+    return mAdapter != nullptr && mAdapter->GetFeatureLevel() == wgpu::FeatureLevel::Compatibility;
 }
 
 bool DeviceBase::IsImmediateErrorHandlingEnabled() const {
diff --git a/src/dawn/native/Features.h b/src/dawn/native/Features.h
index fed32c0..4869100 100644
--- a/src/dawn/native/Features.h
+++ b/src/dawn/native/Features.h
@@ -38,8 +38,6 @@
 
 namespace dawn::native {
 
-enum class FeatureLevel { Compatibility, Core };
-
 extern const ityp::array<Feature, FeatureInfo, kEnumCount<Feature>> kFeatureNameAndInfoList;
 
 wgpu::FeatureName ToAPI(Feature feature);
diff --git a/src/dawn/native/Instance.cpp b/src/dawn/native/Instance.cpp
index 5eadadf..8422716 100644
--- a/src/dawn/native/Instance.cpp
+++ b/src/dawn/native/Instance.cpp
@@ -334,7 +334,7 @@
 }
 
 Ref<AdapterBase> InstanceBase::CreateAdapter(Ref<PhysicalDeviceBase> physicalDevice,
-                                             FeatureLevel featureLevel,
+                                             wgpu::FeatureLevel featureLevel,
                                              const DawnTogglesDescriptor* requiredAdapterToggles,
                                              wgpu::PowerPreference powerPreference) {
     // Set up toggles state for default adapter from given toggles descriptor and inherit from
@@ -373,9 +373,9 @@
     UnpackedPtr<RequestAdapterOptions> unpacked = Unpack(options);
     auto* togglesDesc = unpacked.Get<DawnTogglesDescriptor>();
 
-    FeatureLevel featureLevel = (options->compatibilityMode && !options->forceFallbackAdapter)
-                                    ? FeatureLevel::Compatibility
-                                    : FeatureLevel::Core;
+    wgpu::FeatureLevel featureLevel = (options->compatibilityMode && !options->forceFallbackAdapter)
+                                          ? wgpu::FeatureLevel::Compatibility
+                                          : wgpu::FeatureLevel::Core;
     std::vector<Ref<AdapterBase>> adapters;
     for (const auto& physicalDevice : EnumeratePhysicalDevices(unpacked)) {
         DAWN_ASSERT(physicalDevice->SupportsFeatureLevel(featureLevel));
diff --git a/src/dawn/native/Instance.h b/src/dawn/native/Instance.h
index edd1518..01e4099 100644
--- a/src/dawn/native/Instance.h
+++ b/src/dawn/native/Instance.h
@@ -182,7 +182,7 @@
     // Helper function that create adapter on given physical device handling required adapter
     // toggles descriptor.
     Ref<AdapterBase> CreateAdapter(Ref<PhysicalDeviceBase> physicalDevice,
-                                   FeatureLevel featureLevel,
+                                   wgpu::FeatureLevel featureLevel,
                                    const DawnTogglesDescriptor* requiredAdapterToggles,
                                    wgpu::PowerPreference powerPreference);
 
diff --git a/src/dawn/native/Limits.cpp b/src/dawn/native/Limits.cpp
index d53d219..f109bdc 100644
--- a/src/dawn/native/Limits.cpp
+++ b/src/dawn/native/Limits.cpp
@@ -221,20 +221,20 @@
 
 }  // namespace
 
-void GetDefaultLimits(Limits* limits, FeatureLevel featureLevel) {
+void GetDefaultLimits(Limits* limits, wgpu::FeatureLevel featureLevel) {
     DAWN_ASSERT(limits != nullptr);
 #define X(Better, limitName, compat, base, ...) \
-    limits->limitName = featureLevel == FeatureLevel::Compatibility ? compat : base;
+    limits->limitName = featureLevel == wgpu::FeatureLevel::Compatibility ? compat : base;
     LIMITS(X)
 #undef X
 }
 
-Limits ReifyDefaultLimits(const Limits& limits, FeatureLevel featureLevel) {
+Limits ReifyDefaultLimits(const Limits& limits, wgpu::FeatureLevel featureLevel) {
     Limits out;
 #define X(Class, limitName, compat, base, ...)                                         \
     {                                                                                  \
         const auto defaultLimit = static_cast<decltype(limits.limitName)>(             \
-            featureLevel == FeatureLevel::Compatibility ? compat : base);              \
+            featureLevel == wgpu::FeatureLevel::Compatibility ? compat : base);        \
         if (IsLimitUndefined(limits.limitName) ||                                      \
             CheckLimit<LimitClass::Class>::IsBetter(defaultLimit, limits.limitName)) { \
             /* If the limit is undefined or the default is better, use the default */  \
diff --git a/src/dawn/native/Limits.h b/src/dawn/native/Limits.h
index f6d895e..51a31c4 100644
--- a/src/dawn/native/Limits.h
+++ b/src/dawn/native/Limits.h
@@ -43,12 +43,12 @@
 };
 
 // Populate |limits| with the default limits.
-void GetDefaultLimits(Limits* limits, FeatureLevel featureLevel);
+void GetDefaultLimits(Limits* limits, wgpu::FeatureLevel featureLevel);
 
 // Returns a copy of |limits| where all undefined values are replaced
 // with their defaults. Also clamps to the defaults if the provided limits
 // are worse.
-Limits ReifyDefaultLimits(const Limits& limits, FeatureLevel featureLevel);
+Limits ReifyDefaultLimits(const Limits& limits, wgpu::FeatureLevel featureLevel);
 
 // Validate that |requiredLimits| are no better than |supportedLimits|.
 MaybeError ValidateLimits(const Limits& supportedLimits, const Limits& requiredLimits);
diff --git a/src/dawn/native/PhysicalDevice.cpp b/src/dawn/native/PhysicalDevice.cpp
index c769be4..ce9022a 100644
--- a/src/dawn/native/PhysicalDevice.cpp
+++ b/src/dawn/native/PhysicalDevice.cpp
@@ -125,9 +125,9 @@
 
 void PhysicalDeviceBase::GetDefaultLimitsForSupportedFeatureLevel(Limits* limits) const {
     // If the physical device does not support core then the defaults are compat defaults.
-    GetDefaultLimits(limits, SupportsFeatureLevel(FeatureLevel::Core)
-                                 ? FeatureLevel::Core
-                                 : FeatureLevel::Compatibility);
+    GetDefaultLimits(limits, SupportsFeatureLevel(wgpu::FeatureLevel::Core)
+                                 ? wgpu::FeatureLevel::Core
+                                 : wgpu::FeatureLevel::Compatibility);
 }
 
 FeaturesSet PhysicalDeviceBase::GetSupportedFeatures(const TogglesState& toggles) const {
diff --git a/src/dawn/native/PhysicalDevice.h b/src/dawn/native/PhysicalDevice.h
index cfd2ea1..3579ff5 100644
--- a/src/dawn/native/PhysicalDevice.h
+++ b/src/dawn/native/PhysicalDevice.h
@@ -102,7 +102,7 @@
 
     virtual bool SupportsExternalImages() const = 0;
 
-    virtual bool SupportsFeatureLevel(FeatureLevel featureLevel) const = 0;
+    virtual bool SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const = 0;
 
     // Backend-specific force-setting and defaulting device toggles
     virtual void SetupBackendAdapterToggles(dawn::platform::Platform* platform,
diff --git a/src/dawn/native/d3d/BackendD3D.cpp b/src/dawn/native/d3d/BackendD3D.cpp
index a492c03..414db4b 100644
--- a/src/dawn/native/d3d/BackendD3D.cpp
+++ b/src/dawn/native/d3d/BackendD3D.cpp
@@ -136,8 +136,8 @@
         return {};
     }
 
-    FeatureLevel featureLevel =
-        options->compatibilityMode ? FeatureLevel::Compatibility : FeatureLevel::Core;
+    wgpu::FeatureLevel featureLevel =
+        options->compatibilityMode ? wgpu::FeatureLevel::Compatibility : wgpu::FeatureLevel::Core;
 
     // Get or create just the physical device matching the dxgi adapter.
     if (auto* luidOptions = options.Get<RequestAdapterOptionsLUID>()) {
diff --git a/src/dawn/native/d3d11/BackendD3D11.cpp b/src/dawn/native/d3d11/BackendD3D11.cpp
index ec2fad6..fd89937 100644
--- a/src/dawn/native/d3d11/BackendD3D11.cpp
+++ b/src/dawn/native/d3d11/BackendD3D11.cpp
@@ -103,8 +103,8 @@
         return {};
     }
 
-    FeatureLevel featureLevel =
-        options->compatibilityMode ? FeatureLevel::Compatibility : FeatureLevel::Core;
+    wgpu::FeatureLevel featureLevel =
+        options->compatibilityMode ? wgpu::FeatureLevel::Compatibility : wgpu::FeatureLevel::Core;
 
     ComPtr<IDXGIAdapter> dxgiAdapter;
     ComPtr<ID3D11Device> d3d11Device;
diff --git a/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp b/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp
index b39631d..05acae9 100644
--- a/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp
+++ b/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp
@@ -56,16 +56,19 @@
     return true;
 }
 
-bool PhysicalDevice::SupportsFeatureLevel(FeatureLevel featureLevel) const {
+bool PhysicalDevice::SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const {
     // TODO(dawn:1820): compare D3D11 feature levels with Dawn feature levels.
     switch (featureLevel) {
-        case FeatureLevel::Core: {
+        case wgpu::FeatureLevel::Core: {
             return mFeatureLevel >= D3D_FEATURE_LEVEL_11_1;
         }
-        case FeatureLevel::Compatibility: {
+        case wgpu::FeatureLevel::Compatibility: {
             return true;
         }
+        case wgpu::FeatureLevel::Undefined:
+            break;
     }
+    DAWN_UNREACHABLE();
 }
 
 const DeviceInfo& PhysicalDevice::GetDeviceInfo() const {
diff --git a/src/dawn/native/d3d11/PhysicalDeviceD3D11.h b/src/dawn/native/d3d11/PhysicalDeviceD3D11.h
index 34efdc9..9a44bd9 100644
--- a/src/dawn/native/d3d11/PhysicalDeviceD3D11.h
+++ b/src/dawn/native/d3d11/PhysicalDeviceD3D11.h
@@ -47,7 +47,7 @@
     // PhysicalDeviceBase Implementation
     bool SupportsExternalImages() const override;
 
-    bool SupportsFeatureLevel(FeatureLevel featureLevel) const override;
+    bool SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const override;
 
     const DeviceInfo& GetDeviceInfo() const;
     ResultOrError<ComPtr<ID3D11Device>> CreateD3D11Device(bool enableDebugLayer);
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
index 5f6ea1a..10b6e0a 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
@@ -57,7 +57,7 @@
     return true;
 }
 
-bool PhysicalDevice::SupportsFeatureLevel(FeatureLevel) const {
+bool PhysicalDevice::SupportsFeatureLevel(wgpu::FeatureLevel) const {
     return true;
 }
 
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.h b/src/dawn/native/d3d12/PhysicalDeviceD3D12.h
index 78a3e41..f85ad77 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.h
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.h
@@ -45,7 +45,7 @@
 
     // PhysicalDeviceBase Implementation
     bool SupportsExternalImages() const override;
-    bool SupportsFeatureLevel(FeatureLevel featureLevel) const override;
+    bool SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const override;
 
     // Get the applied shader model version under the given adapter or device toggle state, which
     // may be lower than the shader model reported in mDeviceInfo.
diff --git a/src/dawn/native/metal/PhysicalDeviceMTL.h b/src/dawn/native/metal/PhysicalDeviceMTL.h
index 179808a..fc49769 100644
--- a/src/dawn/native/metal/PhysicalDeviceMTL.h
+++ b/src/dawn/native/metal/PhysicalDeviceMTL.h
@@ -46,7 +46,7 @@
 
     // PhysicalDeviceBase Implementation
     bool SupportsExternalImages() const override;
-    bool SupportsFeatureLevel(FeatureLevel) const override;
+    bool SupportsFeatureLevel(wgpu::FeatureLevel) const override;
     ResultOrError<PhysicalDeviceSurfaceCapabilities> GetSurfaceCapabilities(
         InstanceBase* instance,
         const Surface*) const override;
diff --git a/src/dawn/native/metal/PhysicalDeviceMTL.mm b/src/dawn/native/metal/PhysicalDeviceMTL.mm
index b3cc059..8550549 100644
--- a/src/dawn/native/metal/PhysicalDeviceMTL.mm
+++ b/src/dawn/native/metal/PhysicalDeviceMTL.mm
@@ -356,7 +356,7 @@
     return false;
 }
 
-bool PhysicalDevice::SupportsFeatureLevel(FeatureLevel) const {
+bool PhysicalDevice::SupportsFeatureLevel(wgpu::FeatureLevel) const {
     return true;
 }
 
diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp
index c5173c6..a9a66ef 100644
--- a/src/dawn/native/null/DeviceNull.cpp
+++ b/src/dawn/native/null/DeviceNull.cpp
@@ -61,7 +61,7 @@
     return false;
 }
 
-bool PhysicalDevice::SupportsFeatureLevel(FeatureLevel) const {
+bool PhysicalDevice::SupportsFeatureLevel(wgpu::FeatureLevel) const {
     return true;
 }
 
diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h
index 0de189a..e8040b6 100644
--- a/src/dawn/native/null/DeviceNull.h
+++ b/src/dawn/native/null/DeviceNull.h
@@ -189,7 +189,7 @@
     // PhysicalDeviceBase Implementation
     bool SupportsExternalImages() const override;
 
-    bool SupportsFeatureLevel(FeatureLevel featureLevel) const override;
+    bool SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const override;
 
     ResultOrError<PhysicalDeviceSurfaceCapabilities> GetSurfaceCapabilities(
         InstanceBase* instance,
diff --git a/src/dawn/native/opengl/PhysicalDeviceGL.cpp b/src/dawn/native/opengl/PhysicalDeviceGL.cpp
index f9df651..8ee4e74 100644
--- a/src/dawn/native/opengl/PhysicalDeviceGL.cpp
+++ b/src/dawn/native/opengl/PhysicalDeviceGL.cpp
@@ -454,8 +454,8 @@
                           std::move(lostEvent));
 }
 
-bool PhysicalDevice::SupportsFeatureLevel(FeatureLevel featureLevel) const {
-    return featureLevel == FeatureLevel::Compatibility;
+bool PhysicalDevice::SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const {
+    return featureLevel == wgpu::FeatureLevel::Compatibility;
 }
 
 ResultOrError<PhysicalDeviceSurfaceCapabilities> PhysicalDevice::GetSurfaceCapabilities(
diff --git a/src/dawn/native/opengl/PhysicalDeviceGL.h b/src/dawn/native/opengl/PhysicalDeviceGL.h
index c6768ab..84c0f93 100644
--- a/src/dawn/native/opengl/PhysicalDeviceGL.h
+++ b/src/dawn/native/opengl/PhysicalDeviceGL.h
@@ -49,7 +49,7 @@
 
     // PhysicalDeviceBase Implementation
     bool SupportsExternalImages() const override;
-    bool SupportsFeatureLevel(FeatureLevel featureLevel) const override;
+    bool SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const override;
     ResultOrError<PhysicalDeviceSurfaceCapabilities> GetSurfaceCapabilities(
         InstanceBase* instance,
         const Surface* surface) const override;
diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
index 8470900..771eb30 100644
--- a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
+++ b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
@@ -655,7 +655,7 @@
                                                      mVulkanInstance->GetFunctions());
 }
 
-bool PhysicalDevice::SupportsFeatureLevel(FeatureLevel) const {
+bool PhysicalDevice::SupportsFeatureLevel(wgpu::FeatureLevel) const {
     return true;
 }
 
diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.h b/src/dawn/native/vulkan/PhysicalDeviceVk.h
index d1065b6..1b26d5d 100644
--- a/src/dawn/native/vulkan/PhysicalDeviceVk.h
+++ b/src/dawn/native/vulkan/PhysicalDeviceVk.h
@@ -50,7 +50,7 @@
 
     // PhysicalDeviceBase Implementation
     bool SupportsExternalImages() const override;
-    bool SupportsFeatureLevel(FeatureLevel featureLevel) const override;
+    bool SupportsFeatureLevel(wgpu::FeatureLevel featureLevel) const override;
 
     const VulkanDeviceInfo& GetDeviceInfo() const;
     VkPhysicalDevice GetVkPhysicalDevice() const;
diff --git a/src/dawn/tests/unittests/FeatureTests.cpp b/src/dawn/tests/unittests/FeatureTests.cpp
index e7d8472..ac1e04e 100644
--- a/src/dawn/tests/unittests/FeatureTests.cpp
+++ b/src/dawn/tests/unittests/FeatureTests.cpp
@@ -46,12 +46,12 @@
           mUnsafePhysicalDevice(),
           mAdapterBase(mInstanceBase.Get(),
                        &mPhysicalDevice,
-                       native::FeatureLevel::Core,
+                       wgpu::FeatureLevel::Core,
                        native::TogglesState(native::ToggleStage::Adapter),
                        wgpu::PowerPreference::Undefined),
           mUnsafeAdapterBase(mInstanceBase.Get(),
                              &mUnsafePhysicalDevice,
-                             native::FeatureLevel::Core,
+                             wgpu::FeatureLevel::Core,
                              native::TogglesState(native::ToggleStage::Adapter)
                                  .SetForTesting(native::Toggle::AllowUnsafeAPIs, true, true),
                              wgpu::PowerPreference::Undefined) {}
diff --git a/src/dawn/tests/unittests/GetProcAddressTests.cpp b/src/dawn/tests/unittests/GetProcAddressTests.cpp
index 9a173cd..1ad6967 100644
--- a/src/dawn/tests/unittests/GetProcAddressTests.cpp
+++ b/src/dawn/tests/unittests/GetProcAddressTests.cpp
@@ -72,7 +72,7 @@
           mNativeInstance(native::APICreateInstance(nullptr)),
           mAdapterBase(mNativeInstance.Get(),
                        AcquireRef(new native::null::PhysicalDevice()),
-                       native::FeatureLevel::Core,
+                       wgpu::FeatureLevel::Core,
                        native::TogglesState(native::ToggleStage::Adapter),
                        wgpu::PowerPreference::Undefined) {}
 
diff --git a/src/dawn/tests/unittests/PerThreadProcTests.cpp b/src/dawn/tests/unittests/PerThreadProcTests.cpp
index f53b8e3..cc404fe 100644
--- a/src/dawn/tests/unittests/PerThreadProcTests.cpp
+++ b/src/dawn/tests/unittests/PerThreadProcTests.cpp
@@ -45,7 +45,7 @@
         : mNativeInstance(native::APICreateInstance(nullptr)),
           mAdapterBase(mNativeInstance.Get(),
                        AcquireRef(new native::null::PhysicalDevice()),
-                       native::FeatureLevel::Core,
+                       wgpu::FeatureLevel::Core,
                        native::TogglesState(native::ToggleStage::Adapter),
                        wgpu::PowerPreference::Undefined) {}
     ~PerThreadProcTests() override = default;
diff --git a/src/dawn/tests/unittests/ToggleTests.cpp b/src/dawn/tests/unittests/ToggleTests.cpp
index 4026f10..250ba3c 100644
--- a/src/dawn/tests/unittests/ToggleTests.cpp
+++ b/src/dawn/tests/unittests/ToggleTests.cpp
@@ -430,7 +430,7 @@
     Ref<native::AdapterBase> adapter = native::FromAPI(nullAdapter.Get());
 
     native::PhysicalDeviceBase* nullPhysicalDevice = adapter->GetPhysicalDevice();
-    native::FeatureLevel featureLevel = adapter->GetFeatureLevel();
+    wgpu::FeatureLevel featureLevel = adapter->GetFeatureLevel();
 
     // Create null adapters with the AllowUnsafeAPIs toggle set/forced to enabled/disabled, using
     // the same physical device and feature level as the known null adapter.
@@ -554,7 +554,7 @@
     ASSERT_FALSE(adapter->GetTogglesState().IsSet(native::Toggle::UseDXC));
 
     native::PhysicalDeviceBase* nullPhysicalDevice = adapter->GetPhysicalDevice();
-    native::FeatureLevel featureLevel = adapter->GetFeatureLevel();
+    wgpu::FeatureLevel featureLevel = adapter->GetFeatureLevel();
 
     // Create null adapters with the UseDXC toggle set/forced to enabled/disabled, using the same
     // physical device and feature level as the known null adapter.
diff --git a/src/dawn/tests/unittests/native/LimitsTests.cpp b/src/dawn/tests/unittests/native/LimitsTests.cpp
index 04b61c3..24d720c 100644
--- a/src/dawn/tests/unittests/native/LimitsTests.cpp
+++ b/src/dawn/tests/unittests/native/LimitsTests.cpp
@@ -38,7 +38,7 @@
     Limits limits = {};
     EXPECT_NE(limits.maxBindGroups, 4u);
 
-    GetDefaultLimits(&limits, FeatureLevel::Core);
+    GetDefaultLimits(&limits, wgpu::FeatureLevel::Core);
 
     EXPECT_EQ(limits.maxBindGroups, 4u);
 }
@@ -49,31 +49,31 @@
     Limits limits = {};
     EXPECT_NE(limits.maxColorAttachments, 4u);
 
-    GetDefaultLimits(&limits, FeatureLevel::Compatibility);
+    GetDefaultLimits(&limits, wgpu::FeatureLevel::Compatibility);
 
     EXPECT_EQ(limits.maxColorAttachments, 4u);
 }
 
-// Test |ReifyDefaultLimits| populates the default for FeatureLevel::Core
+// Test |ReifyDefaultLimits| populates the default for wgpu::FeatureLevel::Core
 // if values are undefined.
 TEST(Limits, ReifyDefaultLimits_PopulatesDefault) {
     Limits limits;
     limits.maxComputeWorkgroupStorageSize = wgpu::kLimitU32Undefined;
     limits.maxStorageBufferBindingSize = wgpu::kLimitU64Undefined;
 
-    Limits reified = ReifyDefaultLimits(limits, FeatureLevel::Core);
+    Limits reified = ReifyDefaultLimits(limits, wgpu::FeatureLevel::Core);
     EXPECT_EQ(reified.maxComputeWorkgroupStorageSize, 16384u);
     EXPECT_EQ(reified.maxStorageBufferBindingSize, 134217728ul);
 }
 
-// Test |ReifyDefaultLimits| populates the default for FeatureLevel::Compatibility
+// Test |ReifyDefaultLimits| populates the default for wgpu::FeatureLevel::Compatibility
 // if values are undefined. Compatibility default limits are lower than Core.
 TEST(Limits, ReifyDefaultLimits_PopulatesDefault_Compat) {
     Limits limits;
     limits.maxTextureDimension1D = wgpu::kLimitU32Undefined;
     limits.maxStorageBufferBindingSize = wgpu::kLimitU64Undefined;
 
-    Limits reified = ReifyDefaultLimits(limits, FeatureLevel::Compatibility);
+    Limits reified = ReifyDefaultLimits(limits, wgpu::FeatureLevel::Compatibility);
     EXPECT_EQ(reified.maxTextureDimension1D, 4096u);
     EXPECT_EQ(reified.maxStorageBufferBindingSize, 134217728ul);
 }
@@ -85,7 +85,7 @@
     limits.maxStorageBuffersPerShaderStage = 4;
     limits.minUniformBufferOffsetAlignment = 512;
 
-    Limits reified = ReifyDefaultLimits(limits, FeatureLevel::Core);
+    Limits reified = ReifyDefaultLimits(limits, wgpu::FeatureLevel::Core);
     EXPECT_EQ(reified.maxStorageBuffersPerShaderStage, 8u);
     EXPECT_EQ(reified.minUniformBufferOffsetAlignment, 256u);
 }
@@ -95,7 +95,7 @@
 TEST(Limits, ValidateLimits) {
     // Start with the default for supported.
     Limits defaults;
-    GetDefaultLimits(&defaults, FeatureLevel::Core);
+    GetDefaultLimits(&defaults, wgpu::FeatureLevel::Core);
 
     // Test supported == required is valid.
     {
@@ -170,7 +170,7 @@
         limits->maxBufferSize = 2147483648;
     };
     Limits limitsStorageBufferBindingSizeTier2;
-    GetDefaultLimits(&limitsStorageBufferBindingSizeTier2, FeatureLevel::Core);
+    GetDefaultLimits(&limitsStorageBufferBindingSizeTier2, wgpu::FeatureLevel::Core);
     SetLimitsStorageBufferBindingSizeTier2(&limitsStorageBufferBindingSizeTier2);
 
     auto SetLimitsStorageBufferBindingSizeTier3 = [](Limits* limits) {
@@ -181,21 +181,21 @@
         limits->maxBufferSize = 2147483648;
     };
     Limits limitsStorageBufferBindingSizeTier3;
-    GetDefaultLimits(&limitsStorageBufferBindingSizeTier3, FeatureLevel::Core);
+    GetDefaultLimits(&limitsStorageBufferBindingSizeTier3, wgpu::FeatureLevel::Core);
     SetLimitsStorageBufferBindingSizeTier3(&limitsStorageBufferBindingSizeTier3);
 
     auto SetLimitsComputeWorkgroupStorageSizeTier1 = [](Limits* limits) {
         limits->maxComputeWorkgroupStorageSize = 16384;
     };
     Limits limitsComputeWorkgroupStorageSizeTier1;
-    GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier1, FeatureLevel::Core);
+    GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier1, wgpu::FeatureLevel::Core);
     SetLimitsComputeWorkgroupStorageSizeTier1(&limitsComputeWorkgroupStorageSizeTier1);
 
     auto SetLimitsComputeWorkgroupStorageSizeTier3 = [](Limits* limits) {
         limits->maxComputeWorkgroupStorageSize = 65536;
     };
     Limits limitsComputeWorkgroupStorageSizeTier3;
-    GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier3, FeatureLevel::Core);
+    GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier3, wgpu::FeatureLevel::Core);
     SetLimitsComputeWorkgroupStorageSizeTier3(&limitsComputeWorkgroupStorageSizeTier3);
 
     // Test that applying tiers to limits that are exactly
@@ -239,7 +239,7 @@
     // Test that limits may be simultaneously degraded in two tiers independently.
     {
         Limits limits;
-        GetDefaultLimits(&limits, FeatureLevel::Core);
+        GetDefaultLimits(&limits, wgpu::FeatureLevel::Core);
         SetLimitsComputeWorkgroupStorageSizeTier3(&limits);
         SetLimitsStorageBufferBindingSizeTier3(&limits);
         limits.maxComputeWorkgroupStorageSize =
@@ -261,7 +261,7 @@
 TEST(Limits, TieredMaxStorageBufferBindingSizeNoLargerThanMaxBufferSize) {
     // Start with the default for supported.
     Limits defaults;
-    GetDefaultLimits(&defaults, FeatureLevel::Core);
+    GetDefaultLimits(&defaults, wgpu::FeatureLevel::Core);
 
     // Test reported maxStorageBufferBindingSize around 128MB, 1GB, 2GB-4 and 4GB-4.
     constexpr uint64_t storageSizeTier1 = 134217728ull;   // 128MB
@@ -303,7 +303,7 @@
 TEST(Limits, TieredMaxUniformBufferBindingSizeNoLargerThanMaxBufferSize) {
     // Start with the default for supported.
     Limits defaults;
-    GetDefaultLimits(&defaults, FeatureLevel::Core);
+    GetDefaultLimits(&defaults, wgpu::FeatureLevel::Core);
 
     // Test reported maxStorageBufferBindingSize around 64KB, and a large 1GB.
     constexpr uint64_t uniformSizeTier1 = 65536ull;       // 64KB
@@ -340,7 +340,7 @@
 TEST(Limits, NormalizeLimits) {
     // Start with the default for supported.
     Limits defaults;
-    GetDefaultLimits(&defaults, FeatureLevel::Core);
+    GetDefaultLimits(&defaults, wgpu::FeatureLevel::Core);
 
     // Test specific limit values are clamped to internal Dawn constants.
     {
diff --git a/tools/android/BUILD.gn b/tools/android/BUILD.gn
index b773570..0e7abd8 100644
--- a/tools/android/BUILD.gn
+++ b/tools/android/BUILD.gn
@@ -118,6 +118,7 @@
     "java/android/dawn/ErrorFilter.kt",
     "java/android/dawn/ErrorType.kt",
     "java/android/dawn/Extent3D.kt",
+    "java/android/dawn/FeatureLevel.kt",
     "java/android/dawn/FeatureName.kt",
     "java/android/dawn/FilterMode.kt",
     "java/android/dawn/FragmentState.kt",
diff --git a/tools/android/webgpu/src/test/java/android/dawn/MappedNamedConstantsTest.kt b/tools/android/webgpu/src/test/java/android/dawn/MappedNamedConstantsTest.kt
index dd7c388..be7a490 100644
--- a/tools/android/webgpu/src/test/java/android/dawn/MappedNamedConstantsTest.kt
+++ b/tools/android/webgpu/src/test/java/android/dawn/MappedNamedConstantsTest.kt
@@ -35,6 +35,7 @@
         DeviceLostReason::class,
         ErrorFilter::class,
         ErrorType::class,
+        FeatureLevel::class,
         FeatureName::class,
         FilterMode::class,
         FrontFace::class,