bevy/examples/shader
HugoPeters1024 8afb3ceb89
add storage_texture option to as_bind_group macro (#9943)
# Objective

- Add the ability to describe storage texture bindings when deriving
`AsBindGroup`.
- This is especially valuable for the compute story of bevy which
deserves some extra love imo.

## Solution

- This add the ability to annotate struct fields with a
`#[storage_texture(0)]` annotation.
- Instead of adding specific option parsing for all the image formats
and access modes, I simply accept a token stream and defer checking to
see if the option is valid to the compiler. This still results in useful
and friendly errors and is free to maintain and always compatible with
wgpu changes.

---

## Changelog

- The `#[storage_texture(..)]` annotation is now accepted for fields of
`Handle<Image>` in structs that derive `AsBindGroup`.
- The game_of_life compute shader example has been updated to use
`AsBindGroup` together with `[storage_texture(..)]` to obtain the
`BindGroupLayout`.

## Migration Guide
2024-01-21 18:47:13 +00:00
..
animate_shader.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
array_texture.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
compute_shader_game_of_life.rs add storage_texture option to as_bind_group macro (#9943) 2024-01-21 18:47:13 +00:00
custom_vertex_attribute.rs Add consuming builder methods for more ergonomic Mesh creation (#10056) 2023-10-09 19:47:41 +00:00
extended_material.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
fallback_image.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
post_processing.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
shader_defs.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
shader_instancing.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
shader_material.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
shader_material_2d.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
shader_material_glsl.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00
shader_material_screenspace_texture.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
shader_prepass.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
texture_binding_array.rs Use impl Into<A> for Assets::add (#10878) 2024-01-08 22:14:43 +00:00