Add WebGPUUseTintIR feature flag to Dawn
Use this to set the default value of the `use_tint_ir` toggle. The
default value will be overridden by Chrome with a Finch study.
Bug: chromium:1489435
Change-Id: Id5be51f5a6de48697a8226f17bb65384ca0046fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/154882
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/include/dawn/platform/DawnPlatform.h b/include/dawn/platform/DawnPlatform.h
index abc9d8f..263510b 100644
--- a/include/dawn/platform/DawnPlatform.h
+++ b/include/dawn/platform/DawnPlatform.h
@@ -77,6 +77,7 @@
// in `namespace features`.
enum class Features {
kWebGPUUseDXC,
+ kWebGPUUseTintIR,
};
class DAWN_PLATFORM_EXPORT Platform {
diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
index 5917d54..6080dc4 100644
--- a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
+++ b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
@@ -18,9 +18,11 @@
#include <string>
#include "dawn/common/GPUInfo.h"
+#include "dawn/native/Instance.h"
#include "dawn/native/Limits.h"
#include "dawn/native/vulkan/BackendVk.h"
#include "dawn/native/vulkan/DeviceVk.h"
+#include "dawn/platform/DawnPlatform.h"
namespace dawn::native::vulkan {
@@ -548,6 +550,10 @@
#if DAWN_PLATFORM_IS(ANDROID)
// Default to the IR backend on Android.
deviceToggles->Default(Toggle::UseTintIR, true);
+#else
+ // All other platforms default to the value corresponding to the feature flag.
+ deviceToggles->Default(Toggle::UseTintIR, GetInstance()->GetPlatform()->IsFeatureEnabled(
+ platform::Features::kWebGPUUseTintIR));
#endif
if (IsAndroidQualcomm()) {
diff --git a/src/dawn/platform/DawnPlatform.cpp b/src/dawn/platform/DawnPlatform.cpp
index 9b2bd00..08e9c42 100644
--- a/src/dawn/platform/DawnPlatform.cpp
+++ b/src/dawn/platform/DawnPlatform.cpp
@@ -87,6 +87,8 @@
#else
return false;
#endif
+ case Features::kWebGPUUseTintIR:
+ return false;
}
return false;
}