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] Generate no code for trivial vector/matrix construction. #2576

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

jimblandy
Copy link
Member

Do not emit an Expression::As conversion for WGSL like vec3(v) where v is already a vec3. This doesn't fix any bugs, but it makes it clearer to the reader of Lowerer::construct that no conversion can actually take place in this case.

@jimblandy jimblandy requested a review from a team as a code owner October 21, 2023 19:26
Do not emit an `Expression::As` conversion for WGSL like `vec3(v)`
where `v` is already a `vec3`, or `mat2x3(m)` where `m` is already a
2x3 matrix. This doesn't fix any bugs, but it makes it clearer to the
reader of `Lowerer::construct` that no conversion can actually take
place in this case.

Some snapshots are affected because `As` expressions whose `width` is
`None` are bitcast expressions, which the constant evaluator does not
yet support. When this commit removes those `As` expressions, the
constant evaluator can reduce the expression to a `Literal` or
`ZeroValue`, which is then concealed by #2539.
@jimblandy jimblandy force-pushed the wgsl-in-trivial-vector-conversion branch from 350f8f1 to 04e435f Compare October 22, 2023 23:22
@jimblandy jimblandy changed the title [wgsl-in] Generate no code for trivial vector construction. [wgsl-in] Generate no code for trivial vector/matrix construction. Oct 22, 2023
@teoxoy teoxoy merged commit 509ea4c into gfx-rs:master Oct 23, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants