bevy/assets/shaders
charlotte 40c26f80aa
Gpu readback (#15419)
# Objective

Adds a new `Readback` component to request for readback of a
`Handle<Image>` or `Handle<ShaderStorageBuffer>` to the CPU in a future
frame.

## Solution

We track the `Readback` component and allocate a target buffer to write
the gpu resource into and map it back asynchronously, which then fires a
trigger on the entity in the main world. This proccess is asynchronous,
and generally takes a few frames.

## Showcase

```rust
let mut buffer = ShaderStorageBuffer::from(vec![0u32; 16]);
buffer.buffer_description.usage |= BufferUsages::COPY_SRC;
let buffer = buffers.add(buffer);

commands
    .spawn(Readback::buffer(buffer.clone()))
    .observe(|trigger: Trigger<ReadbackComplete>| {
        info!("Buffer data from previous frame {:?}", trigger.event());
    });
```

---------

Co-authored-by: Kristoffer Søholm <k.soeholm@gmail.com>
Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
2024-09-30 17:28:55 +00:00
..
animate_shader.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
array_texture.wgsl Remove unused mip_bias parameter from apply_normal_mapping (#13752) 2024-06-10 13:00:34 +00:00
cubemap_unlit.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
custom_gltf_2d.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
custom_material.frag Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
custom_material.vert Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
custom_material.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
custom_material_2d.wgsl Fix binding group in custom_material_2d.wgsl (#10841) 2023-12-02 22:21:53 +00:00
custom_material_import.wgsl fix custom shader imports (#10030) 2023-10-06 01:34:57 +00:00
custom_material_screenspace_texture.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
custom_phase_item.wgsl Allow phase items not associated with meshes to be binned. (#14029) 2024-06-27 16:13:03 +00:00
custom_ui_material.wgsl Add a border to the UI material example (#15120) 2024-09-09 16:34:24 +00:00
custom_vertex_attribute.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
extended_material.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
fallback_image_test.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
game_of_life.wgsl Fix example game of life (#12897) 2024-04-08 17:19:07 +00:00
gpu_readback.wgsl Gpu readback (#15419) 2024-09-30 17:28:55 +00:00
instancing.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
irradiance_volume_voxel_visualization.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
line_material.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
post_processing.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
shader_defs.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
show_prepass.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
specialized_mesh_pipeline.wgsl Add example showing how to use SpecializedMeshPipeline (#14370) 2024-07-31 18:24:58 +00:00
storage_buffer.wgsl Adds ShaderStorageBuffer asset (#14663) 2024-09-02 16:46:34 +00:00
texture_binding_array.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
tonemapping_test_patterns.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
water_material.wgsl Implement opt-in sharp screen-space reflections for the deferred renderer, with improved raymarching code. (#13418) 2024-05-27 13:43:40 +00:00