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] Permit override expressions as LocalVariable initializers. #5495

Merged

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Apr 4, 2024

Allow LocalVariable::init to be an override expression.

Note that this is unrelated to WGSL compliance. The WGSL front end already accepts any sort of expression as an initializer for LocalVariables, but initialization by an override expression was handled in the same way as initialization by a runtime expression, via an explicit Store statement.

This commit merely lets us skip the Store when the initializer is an override expression, producing slightly cleaner output in some cases.

Resolves #5439.

@jimblandy jimblandy added naga Shader Translator area: naga front-end lang: WGSL WebGPU Shading Language labels Apr 4, 2024
@jimblandy jimblandy self-assigned this Apr 4, 2024
@jimblandy jimblandy requested a review from a team as a code owner April 4, 2024 20:00
@jimblandy jimblandy force-pushed the localvariable-init-override branch from faa15de to e546125 Compare April 4, 2024 20:46
Allow `LocalVariable::init` to be an override expression.

Note that this is unrelated to WGSL compliance. The WGSL front end
already accepts any sort of expression as an initializer for
`LocalVariable`s, but initialization by an override expression was
handled in the same way as initialization by a runtime expression, via
an explicit `Store` statement.

This commit merely lets us skip the `Store` when the initializer is an
override expression, producing slightly cleaner output in some cases.
@jimblandy jimblandy force-pushed the localvariable-init-override branch from d7f8d0c to 417a380 Compare April 5, 2024 14:48
@jimblandy jimblandy merged commit c104f08 into gfx-rs:pipeline-constants Apr 5, 2024
21 checks passed
@teoxoy teoxoy mentioned this pull request Apr 5, 2024
@jimblandy jimblandy deleted the localvariable-init-override branch April 5, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants