bevy/assets/shaders
Mathis Brossier 119eb51f00
Fix game_of_life shader relying on Naga bug (#18951)
# Objective

The game of life example shader relies on a Naga bug
([6397](https://github.com/gfx-rs/wgpu/issues/6397) /
[4536](https://github.com/gfx-rs/wgpu/issues/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](https://github.com/gfx-rs/wgpu/issues/4536#issuecomment-1780113990)).

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`
2025-04-26 21:38:08 +00:00
..
animate_shader.wgsl
array_texture.wgsl
automatic_instancing.wgsl
bindless_material.wgsl
cubemap_unlit.wgsl
custom_clustered_decal.wgsl
custom_gltf_2d.wgsl
custom_material_2d.wgsl
custom_material_import.wgsl
custom_material_screenspace_texture.wgsl
custom_material.frag
custom_material.vert
custom_material.wesl
custom_material.wgsl
custom_phase_item.wgsl
custom_stencil.wgsl
custom_ui_material.wgsl
custom_vertex_attribute.wgsl
extended_material_bindless.wgsl
extended_material.wgsl
fallback_image_test.wgsl
game_of_life.wgsl
gpu_readback.wgsl
instancing.wgsl
irradiance_volume_voxel_visualization.wgsl
line_material.wgsl
post_processing.wgsl
shader_defs.wgsl
show_prepass.wgsl
specialized_mesh_pipeline.wgsl
storage_buffer.wgsl
texture_binding_array.wgsl
tonemapping_test_patterns.wgsl
util.wesl
water_material.wgsl