Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions release-content/0.15/release-notes/15419_Gpu_readback.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<!-- Gpu readback -->
<!-- https://github.com/bevyengine/bevy/pull/15419 -->
The new `Readback` component simplifies the tricky process of getting data back from the GPU to the CPU using an observer based API.

<!-- TODO -->
```rust
commands.spawn(Readback::buffer(buffer.clone())).observe(
|trigger: Trigger<ReadbackComplete>| {
let data = trigger.event().to_shader_type();
// ...
},
);
```

Normally, manually retrieving data from the GPU involves a lot of boilerplate and careful management of GPU resources. You have to deal with synchronization, ensure the GPU has finished processing, and handle copying data between memory spaces—which isn’t straightforward!

The new `Readback` component streamlines this process. When spawned into the main world, `Readback` will queue a `Handle<Image>` or `Handle<ShaderStorageBuffer>` to be asynchronously read and copied back from the GPU to CPU in a future frame where it will trigger a `ReadbackComplete` event containing the raw bytes of the resource.

This is especially useful for debugging, saving GPU-generated data, or performing CPU-side computations with results from the GPU. It’s perfect for scenarios where you need to analyze simulation data, capture rendered frames, or process large datasets on the GPU and retrieve the results for further use on the CPU.