bevy/examples/shader
JMS55 70b0eacc3b
Keep track of when a texture is first cleared (#10325)
# Objective
- Custom render passes, or future passes in the engine (such as
https://github.com/bevyengine/bevy/pull/10164) need a better way to know
and indicate to the core passes whether the view color/depth/prepass
attachments have been cleared or not yet this frame, to know if they
should clear it themselves or load it.

## Solution

- For all render targets (depth textures, shadow textures, prepass
textures, main textures) use an atomic bool to track whether or not each
texture has been cleared this frame. Abstracted away in the new
ColorAttachment and DepthAttachment wrappers.

---

## Changelog
- Changed `ViewTarget::get_color_attachment()`, removed arguments.
- Changed `ViewTarget::get_unsampled_color_attachment()`, removed
arguments.
- Removed `Camera3d::clear_color`.
- Removed `Camera2d::clear_color`.
- Added `Camera::clear_color`.
- Added `ExtractedCamera::clear_color`.
- Added `ColorAttachment` and `DepthAttachment` wrappers.
- Moved `ClearColor` and `ClearColorConfig` from
`bevy::core_pipeline::clear_color` to `bevy::render::camera`.
- Core render passes now track when a texture is first bound as an
attachment in order to decide whether to clear or load it.

## Migration Guide
- Remove arguments to `ViewTarget::get_color_attachment()` and
`ViewTarget::get_unsampled_color_attachment()`.
- Configure clear color on `Camera` instead of on `Camera3d` and
`Camera2d`.
- Moved `ClearColor` and `ClearColorConfig` from
`bevy::core_pipeline::clear_color` to `bevy::render::camera`.
- `ViewDepthTexture` must now be created via the `new()` method

---------

Co-authored-by: vero <email@atlasdostal.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2023-12-31 00:37:37 +00:00
..
animate_shader.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
array_texture.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
compute_shader_game_of_life.rs Bind group layout entries (#10224) 2023-11-28 04:00:49 +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 Ensure ExtendedMaterial works with reflection (to enable bevy_egui_inspector integration) (#10548) 2023-11-15 12:48:36 +00:00
fallback_image.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
post_processing.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
shader_defs.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
shader_instancing.rs Rename WorldQueryData & WorldQueryFilter to QueryData & QueryFilter (#10779) 2023-12-12 19:45:50 +00:00
shader_material.rs Improve shader_material example (#10547) 2023-11-20 10:24:02 +00:00
shader_material_2d.rs Add shader_material_2d example (#10542) 2023-11-14 02:18:25 +00:00
shader_material_glsl.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
shader_material_screenspace_texture.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
shader_prepass.rs Rename Input to ButtonInput (#10859) 2023-12-06 20:32:34 +00:00
texture_binding_array.rs Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00