Skip to content

Naga should give better diagnostics when unrestricted_pointer_parameters is needed #7645

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

Open
jimblandy opened this issue Apr 28, 2025 · 0 comments
Labels
kind: diagnostics Error message should be better naga Shader Translator

Comments

@jimblandy
Copy link
Member

Naga should detect cases where it rejects a function definition that it would accept if it implemented the unrestricted_pointer_parameters language extension, and produce a diagnostic suggesting that users mark their shaders as requiring it.

A WGSL requires-directive merely documents the shader's use of a feature; it doesn't enable it. Implementations are free to simply start supporting the functionality they represent, without gating its availability on the presence of a requires-directive. Because Chrome implements unrestricted_pointer_parameters, we do see shaders taking advantage of it. We do not see any widespread use of the requires-directive that users are encouraged to place at the top of their source code.

At the moment, Naga rejects WGSL user-defined functions that accept pointers other than those supported in the unextended language, without informing the user that their shader might be accepted if unrestricted_pointer_parameters was supported. It seems likely that people take advantage of the extension without being aware that they're doing so, so Naga's behavior leaves users in the dark as to why their shader works in Chrome but not Firefox.

Obviously, if we simply implement the extension (#5158), then this point becomes moot.

@jimblandy jimblandy added kind: diagnostics Error message should be better naga Shader Translator labels Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: diagnostics Error message should be better naga Shader Translator
Projects
Status: Todo
Development

No branches or pull requests

1 participant