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.
In wgpu, bools are u32, where false is zero and true is anything else.
Sometimes it can be an optimization to not change the bits, for instance in
passing from 1_f32 which has bit representation 00111111 10000000 00000000 00000000
to the bool true and using afterwards for inplace operations, it's practical to not have to change the bits to 00000000 00000000 00000000 00000001
However, when we explicitly casted bool to something else, we used a kernel that did not know we were using bool, it just knew it had a u32, so it was treated like an integer.
Hence, 1_f32 became true, which in turn became 1065353216 or 1065353216.0 (which is 00111111 10000000 00000000 00000000 as a u32).
The fix is to call a new cast kernel who explicitly knows it must consider its u32 inputs as bools.
Fix #1315
Fix #1388