Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule-First: the new and improved add_systems #8079

Merged
merged 41 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0e55a0a
Update is a Schedule, add_systems_to, remove base sets
cart Mar 13, 2023
5188f3b
add_systems accepts single systems. nested tuples and nested chains
cart Mar 13, 2023
f7bd7f3
Migrate to add_systems_to
cart Mar 13, 2023
2db892b
add_system -> add_systems
cart Mar 13, 2023
567641d
add_systems -> add_systems_to(Update,
cart Mar 13, 2023
3ebb9b1
Rename add_systems_to to add_systems
cart Mar 13, 2023
3a5771c
Deprecate add_startup_system(s) in favor of add_systems
cart Mar 13, 2023
dd2f077
Fix stragglers
cart Mar 13, 2023
af3d759
configure_set takes a schedule, Render schedule, remove default_sched…
cart Mar 13, 2023
f31e49d
clippy
cart Mar 13, 2023
43ead10
Fix docs
cart Mar 13, 2023
b199fc4
Improve deprecation warnings
cart Mar 13, 2023
ae52018
Cleanup
cart Mar 13, 2023
bad7bc3
Update ecs_guide
cart Mar 13, 2023
8d16e6e
Move Main schedule types to their own module
cart Mar 13, 2023
ea05f97
Merge remote-tracking branch 'upstream/main' into schedules-first
cart Mar 14, 2023
5ae350f
Migrate deprecations added from merge
cart Mar 14, 2023
ad8c662
Fix doc and bench issues
cart Mar 14, 2023
5a98e04
Fix web_resize build error
cart Mar 14, 2023
995eebc
Improve per-schedule docs and add MainSchedulePlugin
cart Mar 16, 2023
e9ec53c
AddSystemsInnerResult
cart Mar 16, 2023
0814ce5
Consolidate and standardize RenderApp creation
cart Mar 16, 2023
f9a0294
Single thread some schedules
cart Mar 16, 2023
49682dc
Resolve comments
cart Mar 16, 2023
716f41c
move comment
cart Mar 16, 2023
21eaff6
Update examples/stress_tests/many_lights.rs
cart Mar 16, 2023
0fc3f8a
Fix RunFixedUpdateLoop link
cart Mar 16, 2023
d945858
15->20 system
cart Mar 16, 2023
9dbca7d
Merge remote-tracking branch 'upstream/main' into schedules-first
cart Mar 16, 2023
23fcb92
Merge remote-tracking branch 'upstream/main' into schedules-first
cart Mar 16, 2023
02d6f00
fix many_lights import
cart Mar 16, 2023
fc2381d
Fix another doc link
cart Mar 16, 2023
396a92f
Remove broken link
cart Mar 16, 2023
6e60185
Add nested chaining test and fix densely chained calculation
cart Mar 17, 2023
2309c81
Merge remote-tracking branch 'upstream/main' into schedules-first
cart Mar 17, 2023
7c3e356
Remove unused field
cart Mar 17, 2023
cd7605e
Apply suggestions from code review
cart Mar 17, 2023
4d0b1e8
Use lazy schedule init for built in schedules. Lazy init config_set(s…
cart Mar 17, 2023
ffe601a
Clippy and import fix
cart Mar 17, 2023
646f26d
Add deprecated shims for on_startup and in_schedule to ease migration
cart Mar 17, 2023
d67cd2c
Use add_systems impl for deprecated add_system
cart Mar 17, 2023
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
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/components/archetype_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn setup(system_count: usize) -> (World, Schedule) {
fn empty() {}
let mut schedule = Schedule::new();
for _ in 0..system_count {
schedule.add_system(empty);
schedule.add_systems(empty);
}
schedule.run(&mut world);
(world, schedule)
Expand Down
6 changes: 3 additions & 3 deletions benches/benches/bevy_ecs/empty_archetypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn empty_archetypes(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("empty_archetypes");
for archetype_count in [10, 100, 500, 1000, 2000, 5000, 10000] {
let (mut world, mut schedule) = setup(true, |schedule| {
schedule.add_system(iter);
schedule.add_systems(iter);
});
add_archetypes(&mut world, archetype_count);
world.clear_entities();
Expand Down Expand Up @@ -185,7 +185,7 @@ fn empty_archetypes(criterion: &mut Criterion) {
}
for archetype_count in [10, 100, 500, 1000, 2000, 5000, 10000] {
let (mut world, mut schedule) = setup(true, |schedule| {
schedule.add_system(for_each);
schedule.add_systems(for_each);
});
add_archetypes(&mut world, archetype_count);
world.clear_entities();
Expand Down Expand Up @@ -216,7 +216,7 @@ fn empty_archetypes(criterion: &mut Criterion) {
}
for archetype_count in [10, 100, 500, 1000, 2000, 5000, 10000] {
let (mut world, mut schedule) = setup(true, |schedule| {
schedule.add_system(par_for_each);
schedule.add_systems(par_for_each);
});
add_archetypes(&mut world, archetype_count);
world.clear_entities();
Expand Down
8 changes: 4 additions & 4 deletions benches/benches/bevy_ecs/scheduling/run_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn run_condition_yes(criterion: &mut Criterion) {
fn empty() {}
for amount in 0..21 {
let mut schedule = Schedule::new();
schedule.add_system(empty.run_if(yes));
schedule.add_systems(empty.run_if(yes));
for _ in 0..amount {
schedule.add_systems((empty, empty, empty, empty, empty).distributive_run_if(yes));
}
Expand All @@ -42,7 +42,7 @@ pub fn run_condition_no(criterion: &mut Criterion) {
fn empty() {}
for amount in 0..21 {
let mut schedule = Schedule::new();
schedule.add_system(empty.run_if(no));
schedule.add_systems(empty.run_if(no));
for _ in 0..amount {
schedule.add_systems((empty, empty, empty, empty, empty).distributive_run_if(no));
}
Expand Down Expand Up @@ -72,7 +72,7 @@ pub fn run_condition_yes_with_query(criterion: &mut Criterion) {
}
for amount in 0..21 {
let mut schedule = Schedule::new();
schedule.add_system(empty.run_if(yes_with_query));
schedule.add_systems(empty.run_if(yes_with_query));
for _ in 0..amount {
schedule.add_systems(
(empty, empty, empty, empty, empty).distributive_run_if(yes_with_query),
Expand Down Expand Up @@ -101,7 +101,7 @@ pub fn run_condition_yes_with_resource(criterion: &mut Criterion) {
}
for amount in 0..21 {
let mut schedule = Schedule::new();
schedule.add_system(empty.run_if(yes_with_resource));
schedule.add_systems(empty.run_if(yes_with_resource));
for _ in 0..amount {
schedule.add_systems(
(empty, empty, empty, empty, empty).distributive_run_if(yes_with_resource),
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/scheduling/running_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn empty_systems(criterion: &mut Criterion) {
for amount in 0..5 {
let mut schedule = Schedule::new();
for _ in 0..amount {
schedule.add_system(empty);
schedule.add_systems(empty);
}
schedule.run(&mut world);
group.bench_function(&format!("{:03}_systems", amount), |bencher| {
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/scheduling/schedule.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_app::App;
use bevy_app::{App, Update};
use bevy_ecs::prelude::*;
use criterion::Criterion;

Expand Down Expand Up @@ -72,7 +72,7 @@ pub fn build_schedule(criterion: &mut Criterion) {
group.measurement_time(std::time::Duration::from_secs(15));

// Method: generate a set of `graph_size` systems which have a One True Ordering.
// Add system to the schedule with full constraints. Hopefully this should be maximimally
// Add system to the schedule with full constraints. Hopefully this should be maximally
// difficult for bevy to figure out.
let labels: Vec<_> = (0..1000).map(|i| NumSet(i)).collect();

Expand All @@ -83,7 +83,7 @@ pub fn build_schedule(criterion: &mut Criterion) {
bencher.iter(|| {
let mut app = App::new();
for _ in 0..graph_size {
app.add_system(empty_system);
app.add_systems(Update, empty_system);
}
app.update();
});
Expand All @@ -93,7 +93,7 @@ pub fn build_schedule(criterion: &mut Criterion) {
group.bench_function(format!("{graph_size}_schedule"), |bencher| {
bencher.iter(|| {
let mut app = App::new();
app.add_system(empty_system.in_set(DummySet));
app.add_systems(Update, empty_system.in_set(DummySet));

// Build a fully-connected dependency graph describing the One True Ordering.
// Not particularly realistic but this can be refined later.
Expand All @@ -105,7 +105,7 @@ pub fn build_schedule(criterion: &mut Criterion) {
for label in &labels[i + 1..graph_size] {
sys = sys.before(*label);
}
app.add_system(sys);
app.add_systems(Update, sys);
}
// Run the app for a single frame.
// This is necessary since dependency resolution does not occur until the game runs.
Expand Down
9 changes: 4 additions & 5 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::ops::Deref;
use std::time::Duration;

use bevy_app::{App, CoreSet, Plugin};
use bevy_app::{App, Plugin, PostUpdate};
use bevy_asset::{AddAsset, Assets, Handle};
use bevy_core::Name;
use bevy_ecs::prelude::*;
Expand Down Expand Up @@ -550,10 +550,9 @@ impl Plugin for AnimationPlugin {
app.add_asset::<AnimationClip>()
.register_asset_reflect::<AnimationClip>()
.register_type::<AnimationPlayer>()
.add_system(
animation_player
.in_base_set(CoreSet::PostUpdate)
.before(TransformSystem::TransformPropagate),
.add_systems(
PostUpdate,
animation_player.before(TransformSystem::TransformPropagate),
);
}
}
Loading