[naga wgsl] Implement local const declarations#6156
Merged
teoxoy merged 6 commits intogfx-rs:trunkfrom Aug 30, 2024
Merged
Conversation
const declerationsconst declerations
8580b6f to
19f03dc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
d5205d0 to
6abd2ad
Compare
3b4d18c to
6e7eddb
Compare
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
6e7eddb to
fba1985
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Collaborator
Author
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
const declerationsconst declarations
Member
…but this doesn't need to block this PR from getting merged, right? |
Collaborator
Author
Right. |
3 tasks
jimblandy
added a commit
to jimblandy/wgpu
that referenced
this pull request
Sep 5, 2024
Make `cargo doc --document-private-items` work again in Naga. Update some documentation missed by the local const work in gfx-rs#6156.
teoxoy
pushed a commit
that referenced
this pull request
Sep 5, 2024
Make `cargo doc --document-private-items` work again in Naga. Update some documentation missed by the local const work in #6156.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections
Fixes #4493
Description
For wgsl-in I handled
constdeclarations similarly asletby adding expressions to directly to named_expressions (first commit). For wgsl-out I simply check if expr instart_named_exprcall is constant expr or not and based on that writeconst/let(see second commit), this exposed some problems as naga report some expr as constant although they are not actually impl as const, workaround is in third commit by introducingExpressionKind::ImplConstfor expressions that are also impl as const in naga, alternatively we could always print them as let statements and provideWriterFlags::CONSTthat will constify all wgsl const expr.Testing
Some new manually written tests and I plan to also test this against CTS via servo.
Checklist
cargo fmt.cargo clippy. If applicable, add:--target wasm32-unknown-unknown--target wasm32-unknown-emscriptencargo xtask testto run tests.CHANGELOG.md. See simple instructions inside file.