Repository navigation
Commit 119eb51
authored
Fix game_of_life shader relying on Naga bug (#18951)
# Objective
The game of life example shader relies on a Naga bug
([6397](gfx-rs/wgpu#6397) /
[4536](gfx-rs/wgpu#4536)). In WGSL certain
arithmetic operations must be explicitly parenthesized
([reference](https://www.w3.org/TR/WGSL/#operator-precedence-associativity)).
Naga doesn't enforce that (and also the precedence order is [messed
up](gfx-rs/wgpu#4536 (comment))).
So this example may break soon. This is the only sample shader having
this issue.
## Solution
added parentheses
## Testing
ran the example before and after the fix with `cargo run --example
compute_shader_game_of_life`1 parent 78d9f05 commit 119eb51
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments