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-in: naga accepts switch statement with different integer types #1777

Closed
jakobhellermann opened this issue Mar 17, 2022 · 2 comments
Closed
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language

Comments

@jakobhellermann
Copy link
Contributor

While implementing support for switch statements in wgsl-analyzer I noticed that naga accepts the following program,

let i: u32 = 0u;
switch (i) {
  case 0: { return 0; }
  default: { return 0; }
}

which should - if I'm reading the spec correctly - be an error.

https://gpuweb.github.io/gpuweb/wgsl/#switch-statement

The case selector values must have the same type as the result of evaluating the selector expression.

@kvark
Copy link
Member

kvark commented Mar 19, 2022

I wonder how literal typing is going to change that. My feeling is that this pattern will be allowed in the end, so should be no rush to fix it.

@teoxoy
Copy link
Member

teoxoy commented Nov 17, 2022

We no longer allow this and opened gfx-rs/wgpu#4400 to track allowing this again.

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language
Projects
None yet
Development

No branches or pull requests

3 participants