Skip to content

Add ReadbackOnce component to help one-shot readbacks.#23845

Open
tychedelia wants to merge 6 commits into
bevyengine:mainfrom
tychedelia:readback-once
Open

Add ReadbackOnce component to help one-shot readbacks.#23845
tychedelia wants to merge 6 commits into
bevyengine:mainfrom
tychedelia:readback-once

Conversation

@tychedelia
Copy link
Copy Markdown
Member

Users are sometimes confused about the fact that the Readback component will fire multiple observers (once per every frame it exists in the main world). This new ReadbackOnce component helps a bit with the ux of spawning a readback that only fires once.

@tychedelia tychedelia added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 17, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Apr 17, 2026
Comment thread crates/bevy_render/src/gpu_readback.rs Outdated
}

fn cleanup_readback_once(
event: On<ReadbackComplete>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will that work correctly if the readback happens a few frames later? Wouldn't that trigger multiple readback operations until this is cleared?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be a system that runs in first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was my thought too. I guess it might break if someone spawns it in First and doesn't order it but that can be handled with good docs. That or tracking the frame it was added and making sure it's the next one before deleting but I think doing it in First unconditionally is good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants