Dawn: always report valid subgroups limits if adapter supported
This CL make Dawn always report valid min/max subgroup size if required
and the adapter support subgroups feature, instead of requiring unsafe
APIs allowed. This change allow the OT webpages query these limits
without starting Chrome with toggle enable-unsafe-webgpu.
Bug: 349125474
Change-Id: Ie3ac0af2ad28dce735e64266b888501652fe7c63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/198634
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp
index 7492f07..bb0232c 100644
--- a/src/dawn/native/Adapter.cpp
+++ b/src/dawn/native/Adapter.cpp
@@ -108,12 +108,13 @@
// TODO(349125474): Deprecate DawnExperimentalSubgroupLimits.
if (auto* subgroupLimits = unpacked.Get<DawnExperimentalSubgroupLimits>()) {
- if (!mTogglesState.IsEnabled(Toggle::AllowUnsafeAPIs)) {
- // If AllowUnsafeAPIs is not enabled, return the default-initialized
+ if (!mSupportedFeatures.IsEnabled(wgpu::FeatureName::Subgroups)) {
+ // If subgroups features are not supported, return the default-initialized
// DawnExperimentalSubgroupLimits object, where minSubgroupSize and
// maxSubgroupSize are WGPU_LIMIT_U32_UNDEFINED.
*subgroupLimits = DawnExperimentalSubgroupLimits{};
} else {
+ // If adapter supports subgroups features, always return the valid subgroup limits.
*subgroupLimits = mPhysicalDevice->GetLimits().experimentalSubgroupLimits;
}
}