gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
11.5k stars 857 forks source link

Strict WebGPU compliance mode #3274

Open teoxoy opened 1 year ago

teoxoy commented 1 year ago

We seem to only issue a warning if we end up with a downlevel adapter/device.

https://github.com/gfx-rs/wgpu/blob/3d33ace8d7f4c410894a6d63092870c7eab0388d/wgpu-core/src/instance.rs#L303-L313

We need a mechanism that errors in such an event. I was thinking a feature flag.

cwfitzgerald commented 1 year ago

What's the use case of this? You can view the downlevel flags on the adapter and error out if you only want compliant adapters.

teoxoy commented 1 year ago

You can view the downlevel flags on the adapter and error out if you only want compliant adapters.

That's indeed a possibility but I think we'll need this distinction anyway to support the proposed strict_extensions field on the WGSL Parser (see https://github.com/gfx-rs/wgpu/issues/4410).

cwfitzgerald commented 1 year ago

Couldn't we automatically set that if all the native-only extensions are false on the device?

cwfitzgerald commented 1 year ago

Hmm, I guess the error messages change - "feature X not enabled" vs "unknown feature X"

teoxoy commented 1 year ago

We should also use this mechanism to avoid exposing features that are not implemented in naga.

For example, SHADER_F16 is currently exposed due to it being available through spir-v passthrough (but not via WGSL).

teoxoy commented 7 months ago

This can now be added to InstanceFlags.