Merged
Conversation
88ae3d0 to
0000a83
Compare
kristoff3r
approved these changes
Sep 25, 2024
Contributor
kristoff3r
left a comment
There was a problem hiding this comment.
Code looks good to me, none of my comments are blockers so I'm just going to approve already. I tested the example on Linux and it works.
Co-authored-by: Kristoffer Søholm <k.soeholm@gmail.com>
BenjaminBrienen
suggested changes
Sep 25, 2024
BenjaminBrienen
approved these changes
Sep 26, 2024
IceSentry
reviewed
Sep 26, 2024
IceSentry
reviewed
Sep 26, 2024
IceSentry
reviewed
Sep 26, 2024
IceSentry
reviewed
Sep 26, 2024
IceSentry
approved these changes
Sep 26, 2024
Contributor
IceSentry
left a comment
There was a problem hiding this comment.
It would be nice if it was able to automatically convert it back to the right type. At least in the case of buffervec but not sure if that's even possible without user input.
I'd like a bit more docs in a few places especially the example but things are already pretty good.
Overall, the implementation is really nice, LGTM
IceSentry
reviewed
Sep 26, 2024
Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
robtfm
pushed a commit
to robtfm/bevy
that referenced
this pull request
Oct 4, 2024
# 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>
Member
|
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1704 if you'd like to help out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Adds a new
Readbackcomponent to request for readback of aHandle<Image>orHandle<ShaderStorageBuffer>to the CPU in a future frame.Solution
We track the
Readbackcomponent 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