dawn/node: Add RequestAdapterOptions featureLevel option
Spec PR: https://github.com/webgpu-native/webgpu-headers/pull/399
Bug: 366151404
Change-Id: I4d7ee2d4e2cf7bc73b8ba60f3c1d0652c5711aae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/218535
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
diff --git a/src/dawn/node/binding/GPU.cpp b/src/dawn/node/binding/GPU.cpp
index 6be78fc..cb43ea2 100644
--- a/src/dawn/node/binding/GPU.cpp
+++ b/src/dawn/node/binding/GPU.cpp
@@ -145,6 +145,17 @@
nativeOptions.forceFallbackAdapter = options.forceFallbackAdapter;
nativeOptions.compatibilityMode = options.compatibilityMode;
+ // Convert the feature level.
+ nativeOptions.featureLevel = FeatureLevel::Undefined;
+ if (options.featureLevel == "compatibility") {
+ nativeOptions.featureLevel = FeatureLevel::Compatibility;
+ } else if (options.featureLevel == "core") {
+ nativeOptions.featureLevel = FeatureLevel::Core;
+ } else {
+ promise.Resolve({});
+ return promise;
+ }
+
// Convert the power preference.
nativeOptions.powerPreference = PowerPreference::Undefined;
if (options.powerPreference.has_value()) {