Dawn: Promote DisallowUnsafeAPIs as instance toggle

This CL add Instance and Adapter toggle stage, and promote
DisallowUnsafeAPIs as an instance toggle, and can be required using
DawnTogglesDescriptor chained in instance descriptor when creating
instance. The instance's toggles state will get inherited to adapters
and devices it create. Related tests are implemented and updated.

Toggles inheritance can be overriden if not forced, so requiring
DisallowUnsafeAPIs when creating device is still available and working
like before.

Note that currently we don't have toggle of adapter stage, and can not
require toggles when creating adapter, until follow up CLs implement it.
Currently the toggles state of a adapter is simply inherited from
instance.

Bug: dawn:1495
Change-Id: I6bf7aa0f950a99451afcc2cab5322c924b7d9520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122021
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Zhaoming Jiang
2023-03-07 02:03:54 +00:00
committed by Dawn LUCI CQ
parent e5ca66806f
commit c2657b21d5
38 changed files with 696 additions and 230 deletions

View File

@@ -51,9 +51,7 @@ struct DAWN_NATIVE_EXPORT DawnDeviceDescriptor {
// Each toggle is assigned with a TogglesStage, indicating the validation and earliest usage
// time of the toggle.
// TODO(dawn:1495): Currently all toggles are device toggles, i.e. of Device toggle stage. Add
// instance and adapter stages after instance and adapter toggles implemented.
enum class ToggleStage { Device };
enum class ToggleStage { Instance, Adapter, Device };
// A struct to record the information of a toggle. A toggle is a code path in Dawn device that
// can be manually configured to run or not outside Dawn, including workarounds, special