WebGPU Backend: Bypass force setting any non device stage toggle For any explicitly set Instance/Adapter stage toggle, we do not want to override them when creating the inner device of the webgpu backend. (e.g. Toggle::ExposeWGSLExperimentalFeatures) As a result, remove Toggle::AllowUnsafeAPI (which is a Instance stage toggle) from the kOuterToggles. Bug: 477593005 Change-Id: I39a2ca033f09322a935205d7e0ac0bce81d1fc15 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/289895 Reviewed-by: Gregg Tavares <gman@chromium.org> Auto-Submit: Shrek Shao <shrekshao@google.com> Commit-Queue: Gregg Tavares <gman@chromium.org>
diff --git a/src/dawn/native/webgpu/DeviceWGPU.cpp b/src/dawn/native/webgpu/DeviceWGPU.cpp index 251703b..1525e54 100644 --- a/src/dawn/native/webgpu/DeviceWGPU.cpp +++ b/src/dawn/native/webgpu/DeviceWGPU.cpp
@@ -71,14 +71,13 @@ namespace { -// Toggles in this list are the only ones enabled in webgpu::Device. -// Other toggles are passed down to the inner device. +// Toggles in this list are the only ones with ToggleStage::Device that enabled in webgpu::Device. +// Other toggles are only passed down to the inner device. constexpr Toggle kOuterToggles[] = { // Toggles webgpu::Device needs Toggle::SkipValidation, Toggle::DisableBaseVertex, Toggle::DisableBindGroupLayoutEntryArraySize, - Toggle::AllowUnsafeAPIs, Toggle::EnableImmediateErrorHandling, // Toggles enabled by default for all backend, do not force set them to avoid warnings. @@ -102,9 +101,15 @@ // TogglesState deviceToggles already has them resolved. // For outer (this webgpu::Device), we want to disable everything else. - std::vector<Toggle> togglesToDisable; for (size_t i : deviceToggles.GetEnabledToggles()) { Toggle t = static_cast<Toggle>(i); + const ToggleInfo* info = TogglesInfo::GetToggleInfo(t); + + if (info->stage != ToggleStage::Device) { + // Bypass any force settings if not a device stage toggle. + continue; + } + bool isOuter = false; for (Toggle outer : kOuterToggles) { if (t == outer) {