Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naga specific WGSL extensions #4410

Open
teoxoy opened this issue Dec 6, 2022 · 2 comments
Open

Naga specific WGSL extensions #4410

teoxoy opened this issue Dec 6, 2022 · 2 comments
Labels
area: naga back-end Outputs of naga shader conversion area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator

Comments

@teoxoy
Copy link
Member

teoxoy commented Dec 6, 2022

All of these have their own Capabilities therefore the validator is already aware of those non-standard items but I think we should still have our own set of extensions so that it's obvious when a shader uses those items.

Introducing a strict_extensions: bool field for the Parser will limit the extensions to only those defined by the spec (for now only f16).

Relevant errors should be different based on the strict_extensions field. Example: using an f64 type with strict_extensions: true should yield an error that informs the user that there is no such type; on the other hand, if strict_extensions were false, the error should inform the user that the naga_ext_f64 extension is required.

@jimblandy
Copy link
Member

All of these have their own Capabilities therefore the validator is already aware of those non-standard items but I think we should still have our own set of extensions so that it's obvious when a shader uses those items.

So the idea is, to use some extension, you have to add the bit to Capabilities, and then also put enable BLAH; at the top? And the benefit would be that nobody would be writing Naga-specific shaders without them being clearly marked as such?

@teoxoy
Copy link
Member Author

teoxoy commented Jan 17, 2023

Capabilities that are not part of the WebGPU/WGSL specs will be set automatically by wgpu depending on some flag (see #3274).
Users will only have to enable naga_ext_<name>; in their shaders to use a naga specific extension (given they set the "Strict WebGPU compliance mode" to false).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga back-end Outputs of naga shader conversion area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator
Projects
Status: No status
Development

No branches or pull requests

3 participants