Skip to content

Extract extract to bevy_extract - #22852

Open
Zeophlite wants to merge 15 commits into
bevyengine:mainfrom
Zeophlite:extract-extract
Open

Extract extract to bevy_extract#22852
Zeophlite wants to merge 15 commits into
bevyengine:mainfrom
Zeophlite:extract-extract

Conversation

@Zeophlite

@Zeophlite Zeophlite commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

Objective

Solution

  • Create bevy_extract crate, containing "extract/sync" stuff from bevy_render

Please review commit-by-commit:

  • 779f73e756 - Create bevy_extract crate skeleton
  • 4accfeef81 - Move sync/extract files from bevy_render to bevy_extract
  • b9cbb446e9 - Move ExtractComponent , ExtractResource derive macros
  • 79745aa880 - Migrate code to be compatible (fix imports, remove L = RenderApp default, add compat types in bevy_render, etc.)
  • c491f11e35 - Fix docs so links work
  • 333fead16d - Rework docs to remove most of render from bevy_extract
  • eec1fd4dcf - CI fixes

Simplified by #23377

Testing

  • CI
  • cargo run --example animated_mesh

@Zeophlite
Zeophlite requested a review from atlv24 February 7, 2026 12:46
@IQuick143 IQuick143 added the A-Rendering Drawing game state to the screen label Feb 7, 2026
@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

You added a new feature but didn't update the readme. Please run cargo run -p build-templated-pages -- update features to update it, and commit the file change.

Comment thread crates/bevy_extract/src/lib.rs Outdated

@atlv24 atlv24 left a comment

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.

This is skipping a few steps but its roughly the goal. We need a few preparatory steps, each of these should be its own PR:

  • The resource marker change to allow orphan rule circumvention on resource impls
  • Making ExtractPlugin take the app label (RenderApp) as generic parameter instead of hardcode
  • Making ExtractPlugin take a schedule to run and having its own internal extract schedule which handles the pre and post actions, running the user provided systemset/schedule in the middle
  • improving the macro situation to hide existing complexity of implementations
  • collapse manual implementations of extract into derive macro call or whatever
  • Introducing an AppLabel marker to Extract impls to specify that they are RenderApp extract impls and tuck it away neatly into the macro
  • Rename test terminology in extract_plugin.rs to not reference rendering
  • finally, this PR

Comment thread crates/bevy_extract/README.md
Comment thread crates/bevy_extract/README.md Outdated
Comment thread crates/bevy_extract/src/extract_component.rs Outdated
Comment thread crates/bevy_extract/src/lib.rs Outdated
Comment thread crates/bevy_extract/src/lib.rs Outdated
@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change X-Contentious There are nontrivial implications that should be thought through S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Feb 8, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Feb 9, 2026
# Objective

- Followup to #22766
- Step towards #22852

## Solution

- Add marker to `ExtractResouce`
- Pass marker to `SyncComponent`

## Testing

- `cargo run --example animated_mesh`
@cart cart added this to Rendering Feb 12, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Feb 12, 2026
@Zeophlite

Zeophlite commented Feb 21, 2026

Copy link
Copy Markdown
Contributor Author

New version, extending https://github.com/atlv24/bevy/tree/ad/extract-label ( #22855 )

cargo run --example animated_mesh works now, but at reduced DX (Need to pass RenderApp around a bunch still)

Comment thread crates/bevy_anti_alias/src/contrast_adaptive_sharpening/mod.rs Outdated
Comment thread crates/bevy_extract/src/extract_base_component.rs Outdated
@Zeophlite Zeophlite added S-Needs-Guidance This PR would benefit from mentorship to refine the quality or completeness of the work. and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Feb 21, 2026
@Zeophlite
Zeophlite requested a review from atlv24 February 21, 2026 17:56
@Zeophlite
Zeophlite marked this pull request as ready for review February 22, 2026 16:32
Comment thread crates/bevy_render/src/lib.rs Outdated
Comment thread crates/bevy_render/src/lib.rs Outdated
Comment thread crates/bevy_extract/src/extract_instances.rs Outdated
Comment thread crates/bevy_extract/src/extract_param.rs Outdated
Placeholder

More skeleton

Rm extract placeholders

squash skeleton

squash skeleton

squash skeleton

cargo

Merge migration guides
squash migrate fixes

squash migrate fixes

Fix

Fix

Fix
@Zeophlite Zeophlite added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Blocked This cannot move forward until something else changes labels Aug 5, 2026
@Zeophlite
Zeophlite requested a review from kfc35 August 5, 2026 10:15

@Based-A Based-A left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall the documentation substitutions are good, there's just a couple of points I have around using "processing" as a substitute for "rendering". "Processing" feels too much like a black box, and even though you don't want to nail it down to a specific use case or example, it can still be confusing as to what "processing" actually means for the whole thing. Although some uses of it are fine, especially when the thing being talked about is detailed as a defined part of the "processor"/"processing".

Comment thread crates/bevy_extract/src/extract_component.rs Outdated
Comment thread crates/bevy_extract/src/extract_param.rs Outdated
Comment thread crates/bevy_extract/src/extract_plugin.rs
@Zeophlite

Copy link
Copy Markdown
Contributor Author

@Based-A I've updated based on your feedback, please have another look

@Based-A

Based-A commented Aug 8, 2026

Copy link
Copy Markdown
Member

Much better, comments look good from my perspective.

@kfc35 kfc35 left a comment

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.

my comments are mostly to do with documentation

i can approve after theyre addressed

Comment thread Cargo.toml Outdated
Comment thread crates/bevy_extract/Cargo.toml Outdated
Comment thread crates/bevy_extract/Cargo.toml Outdated
Comment thread crates/bevy_extract/src/sync_world.rs Outdated
Comment thread crates/bevy_extract/src/sync_world.rs Outdated
Comment thread crates/bevy_extract/macros/src/lib.rs Outdated
Comment thread crates/bevy_extract/src/extract_param.rs Outdated
Comment thread crates/bevy_extract/src/extract_plugin.rs Outdated
Comment thread crates/bevy_extract/src/lib.rs Outdated
Comment thread crates/bevy_extract/src/lib.rs Outdated
)]
#![expect(unsafe_code, reason = "Unsafe code is used to improve performance.")]

//! This crate is about everything concerning extract.

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.

This probably needs to be fleshed out a little bit more

Suggested change
//! This crate is about everything concerning extract.
//! This crate provides a way to extract component information from
//! an app’s main world into a sub world.

I think at least mentioning that the ExtractPlugin is how you mainly set it up, and maybe that extract/sync components to specify exactly how component data may be transformed from the main world to the sub world would also be helpful.

Just mentioning this documentation comment in general since it seems the extract infrastructure isn’t used uniformly by all bevy rendering devs and a little documentation can go a long way to getting this adopted more widely across the rendering codebase

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay I've had a go at some crate docs, please have a look

Zeophlite and others added 3 commits August 13, 2026 22:56
@kfc35

kfc35 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Nice job! Hope it gets merged without a hitch 👍

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 13, 2026
@kfc35

kfc35 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

I think the only additional docs I might add at the top level are about the difference between the terms extract and sync and some basics on how to use the sync tools but that can be a quick followup if desired

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-Code-Quality A section of code that is hard to understand or change M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Contentious There are nontrivial implications that should be thought through

Projects

Status: Needs SME Triage
Status: No status

Development

Successfully merging this pull request may close these issues.

8 participants