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

WGSL: Support the pointer_composite_access language extension #6192

Open
rcoreilly opened this issue Sep 1, 2024 · 5 comments
Open

WGSL: Support the pointer_composite_access language extension #6192

rcoreilly opened this issue Sep 1, 2024 · 5 comments
Assignees
Labels
naga Shader Translator type: enhancement New feature or request

Comments

@rcoreilly
Copy link

Description

The WGSL spec has a requires directive to request language extensions, such as pointer_composite_access https://www.w3.org/TR/WGSL/#language-extensions-sec

When I put that at the top of my .wgsl shader, it barfs:

[wgpu] [Error] Device::create_shader_module error: 
Shader 'squares' parsing error: expected global item ('struct', 'const', 'var', 'alias', ';', 'fn') or the end of the file, found 'requires'
  ┌─ wgsl:2:1
  │
2 │ requires pointer_composite_access;
  │ ^^^^^^^^ expected global item ('struct', 'const', 'var', 'alias', ';', 'fn') or the end of the file

I would particularly be interested in when that specific language extension pointer_composite_access will be included as well -- huge improvement in usability. Also unrestricted_pointer_parameters seems rather important if I understand it properly, which I'm not sure I do..

Repro steps
add that line to the top of any .wgsl code.

Expected vs observed behavior

didn't work.

Platform

Mac OS, latest trunk HEAD 26398ea using naga cli, and v0.19.4.1 of wgpu-native.

@teoxoy teoxoy added type: enhancement New feature or request naga Shader Translator labels Sep 2, 2024
@ErichDonGubler ErichDonGubler changed the title requires directive does not appear to be supported (specifically pointer_composite_access) WGSL: support the pointer_composite_access language extension Oct 22, 2024
@ErichDonGubler ErichDonGubler changed the title WGSL: support the pointer_composite_access language extension WGSL: Support the pointer_composite_access language extension Oct 22, 2024
@ErichDonGubler
Copy link
Member

@rcoreilly: Basic support for parsing requires is now posted in #6437. As the scope of parsing is in #6350, I'll narrow the scope of this issue (and edit the OP) to just the pointer_composite_access extension.

@sagudev
Copy link
Contributor

sagudev commented Dec 23, 2024

I am working on this.

@ErichDonGubler
Copy link
Member

@sagudev: Sweet! I'll plan on reviewing your PRs. It might be next year when I have bandwidth to do so, but I think it's the same for all the Firefox WebGPU/Naga team. 😅

@sagudev
Copy link
Contributor

sagudev commented Dec 23, 2024

It would be nice to get #6814 landed before (holidays).

@sagudev
Copy link
Contributor

sagudev commented Dec 23, 2024

I think we need to remove all usages of Error::Pointer, ex:

return Err(Error::Pointer(

Also I think some types of expressions are already supported, so It would be really interesting to see CTS results with pointer_composite_access reported as supported but otherwise unimpl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
naga Shader Translator type: enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

4 participants