Move render app init and extraction to separate plugin#22758
Merged
alice-i-cecile merged 11 commits intobevyengine:mainfrom Feb 6, 2026
Merged
Move render app init and extraction to separate plugin#22758alice-i-cecile merged 11 commits intobevyengine:mainfrom
alice-i-cecile merged 11 commits intobevyengine:mainfrom
Conversation
alice-i-cecile
approved these changes
Feb 5, 2026
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
I like separating these, and this appears to have been done correctly.
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
Contributor
Author
|
I disentangled the 2 plugins a bit more, let me know what you think. I haven't worked that much with schedule creation before, and I didn't realize you have to be careful about ordering when doing Now the only render specific things are the |
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
atlv24
reviewed
Feb 6, 2026
Co-authored-by: atlv <email@atlasdostal.com>
atlv24
approved these changes
Feb 6, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 6, 2026
# Objective Fixes #18722, and allows `ExtractComponent` to be used for foreign types. ## Solution * Split the `Out` type from `ExtractComponent` to a `SyncComponent` trait. This allows types to use the synchronization logic without the extraction logic, and allows `SyncComponentPlugin` to correctly identify which components should be removed. * Don't delete the entire entity but only the `Out` components in `SyncComponentPlugin`/`SyncWorldPlugin`, fixing #18722. * Add marker types to `ExtractComponent` and `SyncComponent`, allowing them to be implemented for foreign types outside `bevy_render`. (Example: `DirectionalLight` is defined in `bevy_light` which doesn't depend on `bevy_render`, and used by `bevy_pbr`. Without the marker no crate is allowed to implement the trait.) During some earlier render crate refactors by @atlv24, some uses of `ExtractComponent` was converted to manual implementations. I have not ported these back, that can be done in follow up PRs. As a follow up it might be interesting to make a derive macro for `SyncComponent`, and/or update the `ExtractComponent` macro to be able to customize the behavior around syncing. ## Testing Ran a bunch of the examples. It would be good to test others, especially ones that toggle components. ~~A test case is in #22758. If that one gets merged first this PR should be updated to uncomment the relevant assert.~~ edit: the assert has been added.
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
Currently in
bevy_renderthe renderer initialization (e.g. creating a surface, registering rendering systems) is very intertwined with setting up the extraction logic itself (e.g. how is data moved between the worlds, how are they kept in sync). This makes it harder to understand both things, and also makes it very hard to test the extraction logic, as you don't want to start the renderer in unit test.In the future this functionality might even be useful for the ECS outside
bevy_render, e.g. for custom renderers that want to use a render world, or for multi world setups.Solution
This PR splits out creation of the render subapp plus the extraction logic itself into
ExtractPlugin, and uses the new found flexibility to finally add a test for it.This is the first part in a series of PRs I plan to do to:
Testing
Added a test to show that extraction is working.
I also ran a bunch of examples requiring rendering and they still work.