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 wgsl-in] Apply automatic conversions to values being assigned. #6822

Conversation

jimblandy
Copy link
Member

Apply automatic conversions to the right-hand sides of assignment and
compound assignment statements.

Fix try_automatic_conversion_for_leaf_scalar to handle arrays,
not just scalars, vectors, and matrices. Previously this was only used
for converting the right-hand sides of bit shift operators to u32,
and bit shift operators don't support arrays. But now we're using
try_automatic_conversion_for_leaf_scalar for ordinary assignments,
and you can assign arrays.

Update a test of propagating source code spans through compaction.
This test needs validation to report an error, but this commit's fix
causes the error in the test to be detected in the front end, which is
too early to exercise compaction. Use a new error that the front end
still won't notice.

Fill out a few more cases for variable type inference and automatic
conversions of initializers.
Apply automatic conversions to the right-hand sides of assignment and
compound assignment statements.

Fix `try_automatic_conversion_for_leaf_scalar` to handle arrays,
not just scalars, vectors, and matrices. Previously this was only used
for converting the right-hand sides of bit shift operators to `u32`,
and bit shift operators don't support arrays. But now we're using
`try_automatic_conversion_for_leaf_scalar` for ordinary assignments,
and you can assign arrays.

Update a test of propagating source code spans through compaction.
This test needs validation to report an error, but this commit's fix
causes the error in the test to be detected in the front end, which is
too early to exercise compaction. Use a new error that the front end
still won't notice.
Add tests for automatic conversions of the right-hand sides of
assignment expressions.
@jimblandy jimblandy force-pushed the naga-wgsl-in-assignment-automatic-conversions branch from ecebbb0 to 4c1b402 Compare December 25, 2024 17:30
@teoxoy teoxoy self-assigned this Jan 6, 2025
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

@ErichDonGubler ErichDonGubler merged commit a84b6ca into gfx-rs:trunk Jan 6, 2025
27 checks passed
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.

3 participants