-
Notifications
You must be signed in to change notification settings - Fork 931
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 wgsl] Implement local const
declarations
#6156
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 <[email protected]>
Signed-off-by: sagudev <[email protected]>
Signed-off-by: sagudev <[email protected]>
Signed-off-by: sagudev <[email protected]>
Signed-off-by: sagudev <[email protected]>
6e7eddb
to
fba1985
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: sagudev <[email protected]>
|
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
…but this doesn't need to block this PR from getting merged, right? |
Right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Make `cargo doc --document-private-items` work again in Naga. Update some documentation missed by the local const work in gfx-rs#6156.
Make `cargo doc --document-private-items` work again in Naga. Update some documentation missed by the local const work in #6156.
Connections
Fixes #4493
Description
For wgsl-in I handled
const
declarations similarly aslet
by adding expressions to directly to named_expressions (first commit). For wgsl-out I simply check if expr instart_named_expr
call 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::ImplConst
for expressions that are also impl as const in naga, alternatively we could always print them as let statements and provideWriterFlags::CONST
that 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-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.