Add STRICT_WEBGPU_COMPLIANCE instance flag#9586
Conversation
b9aeac7 to
b58c67f
Compare
STRICT_WEBGPU_COMPLIANCE instance flagsSTRICT_WEBGPU_COMPLIANCE instance flag
b58c67f to
3bafe78
Compare
`STRICT_WEBGPU_COMPLIANCE`
`STRICT_WEBGPU_COMPLIANCE`
3bafe78 to
2afbe99
Compare
`STRICT_WEBGPU_COMPLIANCE` is set
2afbe99 to
1c2bb32
Compare
andyleiserson
left a comment
There was a problem hiding this comment.
Nice!
There is another instance flag ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER, which says it "mainly applies to a Vulkan driver's compliance version" (and that is in fact the only place it applies). It might be worth updating the docs for that flag to clarify the difference from STRICT_WEBGPU_COMPLIANCE.
It might be worth a few unit tests (maybe for adapter_allowed) capturing conditions where we don't want to return an adapter. We won't otherwise have much coverage of this logic. An expectation that adapter_allowed exists as a function, is not unused, and has certain properties, provides some protection against breakage.
| /// `adjust_raw_limits` fn. So we only check the remaining properties here. | ||
| /// See <https://gpuweb.github.io/gpuweb/#adapter-capability-guarantees>. | ||
| fn adapter_allowed(&self, raw: &hal::DynExposedAdapter) -> bool { | ||
| // Check "All alignment-class limits must be powers of 2." |
There was a problem hiding this comment.
All alignment-class limits must be powers of 2 is a WebGPU requirement, but this section of the function is applied whether or not the user has asked for strict WebGPU compliance. It would be utter insanity for these not to be a power of two, so it seems fine to reject such devices, but it might be clearer to say something like "Even if the application has not requested strict WebGPU compliance, non-power-of-two alignment limits are nonsensical, so don't attempt to use such a device."
(Side nit: there is a typo in a comment at
wgpu/wgpu-hal/src/dx12/adapter.rs
Line 921 in 523a1cf
Connections
Fixes #3274.
Fixes #9436.
Fixes #3365.
Description
Adds the
STRICT_WEBGPU_COMPLIANCEflag, intended to be used by wgpu-core users that want to strictly limit the behavior ofwgpu-coreto the one defined by the WebGPU spec.Testing
Added some more tests.
Squash or Rebase?
Rebase.
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.