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

Taking the address of a vector component should not be allowed #7271

Closed
andyleiserson opened this issue Mar 6, 2025 · 0 comments · Fixed by #7284
Closed

Taking the address of a vector component should not be allowed #7271

andyleiserson opened this issue Mar 6, 2025 · 0 comments · Fixed by #7284
Assignees
Labels
area: naga middle-end Intermediate representation area: validation Issues related to validation, diagnostics, and error handling naga Shader Translator type: bug Something isn't working

Comments

@andyleiserson
Copy link
Contributor

andyleiserson commented Mar 6, 2025

The spec states (https://gpuweb.github.io/gpuweb/wgsl/#address-of-expr):

It is a shader-creation error if r is a reference to a vector component.

In naga#2451, which was a (never merged) fix for #4541, the concern was raised that passing pointers to vector components doesn't work in Metal and might need to be emulated. But if I am understanding the spec correctly, it should not be supported at all.

I would assume that the same treatment should apply to matrices. Tint appears to do so, but I don't see it stated explicitly in the spec. Edit: I must have messed something up or misinterpreted when I tested Tint's treatment of matrices before. Taking the address of a matrix column is allowed. Taking the address of a matrix element is disallowed, but that's implied by the vector component restriction.

The test case in #4541 is about pointers to array elements, that issue remains.

@andyleiserson andyleiserson self-assigned this Mar 6, 2025
@cwfitzgerald cwfitzgerald added type: bug Something isn't working area: validation Issues related to validation, diagnostics, and error handling naga Shader Translator area: naga middle-end Intermediate representation labels Mar 6, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this issue Mar 6, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this issue Mar 6, 2025
@andyleiserson andyleiserson moved this from Todo to In Progress in WebGPU for Firefox Mar 21, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this issue Mar 26, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in WebGPU for Firefox Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga middle-end Intermediate representation area: validation Issues related to validation, diagnostics, and error handling naga Shader Translator type: bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants