Skip to content

Commit eaa137b

Browse files
committed
Rename the main schedule label
1 parent 8fffc44 commit eaa137b

File tree

51 files changed

+146
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+146
-126
lines changed

crates/bevy_app/src/app.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::{First, Main, MainSchedulePlugin, Plugin, Plugins, Startup, StateTransition, Update};
1+
use crate::{
2+
First, MainSchedulePlugin, Plugin, Plugins, Startup, StateTransition, Update, UpdateFlow,
3+
};
24
pub use bevy_derive::AppLabel;
35
use bevy_ecs::{
46
prelude::*,
@@ -94,7 +96,7 @@ impl Debug for App {
9496
/// # Example
9597
///
9698
/// ```rust
97-
/// # use bevy_app::{App, AppLabel, SubApp, Main};
99+
/// # use bevy_app::{App, AppLabel, SubApp, UpdateFlow};
98100
/// # use bevy_ecs::prelude::*;
99101
/// # use bevy_ecs::schedule::ScheduleLabel;
100102
///
@@ -115,7 +117,7 @@ impl Debug for App {
115117
/// sub_app.insert_resource(Val(100));
116118
///
117119
/// // initialize main schedule
118-
/// sub_app.add_systems(Main, |counter: Res<Val>| {
120+
/// sub_app.add_systems(UpdateFlow, |counter: Res<Val>| {
119121
/// // since we assigned the value from the main world in extract
120122
/// // we see that value instead of 100
121123
/// assert_eq!(counter.0, 10);
@@ -136,7 +138,7 @@ pub struct SubApp {
136138

137139
/// The schedule to run by default.
138140
///
139-
/// This is initially set to [`Main`].
141+
/// This is initially set to [`UpdateFlow`].
140142
pub main_schedule_label: BoxedScheduleLabel,
141143

142144
/// A function that allows access to both the main [`App`] [`World`] and the [`SubApp`]. This is
@@ -154,7 +156,7 @@ impl SubApp {
154156
pub fn new(app: App, extract: impl Fn(&mut World, &mut App) + Send + Sync + 'static) -> Self {
155157
Self {
156158
app,
157-
main_schedule_label: Box::new(Main),
159+
main_schedule_label: Box::new(UpdateFlow),
158160
extract: Box::new(extract),
159161
}
160162
}
@@ -635,7 +637,7 @@ impl App {
635637
/// fn my_runner(mut app: App) {
636638
/// loop {
637639
/// println!("In main loop");
638-
/// app.world.run_schedule(Main);
640+
/// app.world.run_schedule(UpdateFlow);
639641
/// }
640642
/// }
641643
///
@@ -963,8 +965,8 @@ fn run_once(mut app: App) {
963965

964966
{
965967
#[cfg(feature = "trace")]
966-
let _main_schedule_span = info_span!("main schedule", name = ?Main).entered();
967-
app.world.run_schedule(Main);
968+
let _ = info_span!("run top schedule", name = ?UpdateFlow).entered();
969+
app.world.run_schedule(UpdateFlow);
968970
}
969971
app.update_sub_apps();
970972
}

crates/bevy_app/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod prelude {
2525
pub use crate::{
2626
app::App,
2727
main_schedule::{
28-
First, FixedUpdate, Last, Main, PostStartup, PostUpdate, PreStartup, PreUpdate, Render,
28+
First, FixedUpdate, Last, UpdateFlow, PostStartup, PostUpdate, PreStartup, PreUpdate, RenderFlow,
2929
Startup, StateTransition, Update,
3030
},
3131
DynamicPlugin, Plugin, PluginGroup,

crates/bevy_app/src/main_schedule.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use bevy_ecs::{
2424
/// * [`PostUpdate`]
2525
/// * [`Last`]
2626
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
27-
pub struct Main;
27+
pub struct UpdateFlow;
2828

2929
/// The schedule that runs before [`Startup`].
3030
/// This is run by the [`Main`] schedule.
@@ -97,17 +97,17 @@ pub struct Last;
9797

9898
/// The main render schedule.
9999
#[derive(ScheduleLabel, Debug, Hash, PartialEq, Eq, Clone)]
100-
pub struct Render;
100+
pub struct RenderFlow;
101101

102-
/// Defines the schedules to be run for the [`Main`] schedule, including
102+
/// Defines the schedules to be run for the [`UpdateFlow`] schedule, including
103103
/// their order.
104104
#[derive(Resource, Debug)]
105-
pub struct MainScheduleOrder {
106-
/// The labels to run for the [`Main`] schedule (in the order they will be run).
105+
pub struct UpdateFlowOrder {
106+
/// The labels to run for the [`UpdateFlow`] schedule (in the order they will be run).
107107
pub labels: Vec<Box<dyn ScheduleLabel>>,
108108
}
109109

110-
impl Default for MainScheduleOrder {
110+
impl Default for UpdateFlowOrder {
111111
fn default() -> Self {
112112
Self {
113113
labels: vec![
@@ -123,7 +123,7 @@ impl Default for MainScheduleOrder {
123123
}
124124
}
125125

126-
impl MainScheduleOrder {
126+
impl UpdateFlowOrder {
127127
/// Adds the given `schedule` after the `after` schedule
128128
pub fn insert_after(&mut self, after: impl ScheduleLabel, schedule: impl ScheduleLabel) {
129129
let index = self
@@ -135,7 +135,7 @@ impl MainScheduleOrder {
135135
}
136136
}
137137

138-
impl Main {
138+
impl UpdateFlow {
139139
/// A system that runs the "main schedule"
140140
pub fn run_main(world: &mut World, mut run_at_least_once: Local<bool>) {
141141
if !*run_at_least_once {
@@ -145,7 +145,7 @@ impl Main {
145145
*run_at_least_once = true;
146146
}
147147

148-
world.resource_scope(|world, order: Mut<MainScheduleOrder>| {
148+
world.resource_scope(|world, order: Mut<UpdateFlowOrder>| {
149149
for label in &order.labels {
150150
let _ = world.try_run_schedule(&**label);
151151
}
@@ -164,9 +164,9 @@ impl Plugin for MainSchedulePlugin {
164164
let mut fixed_update_loop_schedule = Schedule::new();
165165
fixed_update_loop_schedule.set_executor_kind(ExecutorKind::SingleThreaded);
166166

167-
app.add_schedule(Main, main_schedule)
167+
app.add_schedule(UpdateFlow, main_schedule)
168168
.add_schedule(RunFixedUpdateLoop, fixed_update_loop_schedule)
169-
.init_resource::<MainScheduleOrder>()
170-
.add_systems(Main, Main::run_main);
169+
.init_resource::<UpdateFlowOrder>()
170+
.add_systems(UpdateFlow, UpdateFlow::run_main);
171171
}
172172
}

crates/bevy_app/src/schedule_runner.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
app::{App, AppExit},
33
plugin::Plugin,
4-
Main,
4+
UpdateFlow,
55
};
66
use bevy_ecs::{
77
event::{Events, ManualEventReader},
@@ -64,7 +64,7 @@ impl ScheduleRunnerPlugin {
6464
pub fn run_once() -> Self {
6565
ScheduleRunnerPlugin {
6666
run_mode: RunMode::Once,
67-
main_schedule_label: Box::new(Main),
67+
main_schedule_label: Box::new(UpdateFlow),
6868
}
6969
}
7070

@@ -74,7 +74,7 @@ impl ScheduleRunnerPlugin {
7474
run_mode: RunMode::Loop {
7575
wait: Some(wait_duration),
7676
},
77-
main_schedule_label: Box::new(Main),
77+
main_schedule_label: Box::new(UpdateFlow),
7878
}
7979
}
8080
}
@@ -83,7 +83,7 @@ impl Default for ScheduleRunnerPlugin {
8383
fn default() -> Self {
8484
ScheduleRunnerPlugin {
8585
run_mode: RunMode::Loop { wait: None },
86-
main_schedule_label: Box::new(Main),
86+
main_schedule_label: Box::new(UpdateFlow),
8787
}
8888
}
8989
}

crates/bevy_asset/src/asset_server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ pub fn free_unused_assets_system(asset_server: Res<AssetServer>) {
645645
mod test {
646646
use super::*;
647647
use crate::{loader::LoadedAsset, update_asset_storage_system};
648-
use bevy_app::{App, Main, Update};
648+
use bevy_app::{App, Update, UpdateFlow};
649649
use bevy_ecs::prelude::*;
650650
use bevy_reflect::{TypePath, TypeUuid};
651651
use bevy_utils::BoxedFuture;
@@ -896,19 +896,19 @@ mod test {
896896
// asset is loading
897897
assert_eq!(LoadState::Loading, get_load_state(&handle, &app.world));
898898

899-
app.world.run_schedule(Main);
899+
app.world.run_schedule(UpdateFlow);
900900
// asset should exist and be loaded at this point
901901
assert_eq!(LoadState::Loaded, get_load_state(&handle, &app.world));
902902
assert!(get_asset(&handle, &app.world).is_some());
903903

904904
// after dropping the handle, next call to `tick` will prepare the assets for removal.
905905
drop(handle);
906-
app.world.run_schedule(Main);
906+
app.world.run_schedule(UpdateFlow);
907907
assert_eq!(LoadState::Loaded, get_load_state(&weak_handle, &app.world));
908908
assert!(get_asset(&weak_handle, &app.world).is_some());
909909

910910
// second call to tick will actually remove the asset.
911-
app.world.run_schedule(Main);
911+
app.world.run_schedule(UpdateFlow);
912912
assert_eq!(
913913
LoadState::Unloaded,
914914
get_load_state(&weak_handle, &app.world)
@@ -918,7 +918,7 @@ mod test {
918918
// finally, reload the asset
919919
let handle = load_asset(path.clone(), &app.world).typed();
920920
assert_eq!(LoadState::Loading, get_load_state(&handle, &app.world));
921-
app.world.run_schedule(Main);
921+
app.world.run_schedule(UpdateFlow);
922922
assert_eq!(LoadState::Loaded, get_load_state(&handle, &app.world));
923923
assert!(get_asset(&handle, &app.world).is_some());
924924
}

crates/bevy_asset/src/debug_asset_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! Internal assets (e.g. shaders) are bundled directly into an application and can't be hot
44
//! reloaded using the conventional API.
5-
use bevy_app::{App, Main, Plugin, Update};
5+
use bevy_app::{App, Plugin, Update, UpdateFlow};
66
use bevy_ecs::{prelude::*, system::SystemState};
77
use bevy_tasks::{IoTaskPool, TaskPoolBuilder};
88
use bevy_utils::{Duration, HashMap};
@@ -81,7 +81,7 @@ impl Plugin for DebugAssetServerPlugin {
8181
}
8282

8383
fn run_debug_asset_app(mut debug_asset_app: NonSendMut<DebugAssetApp>) {
84-
debug_asset_app.0.world.run_schedule(Main);
84+
debug_asset_app.0.world.run_schedule(UpdateFlow);
8585
}
8686

8787
pub(crate) fn sync_debug_assets<T: Asset + Clone>(

crates/bevy_asset/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub use loader::*;
4747
pub use path::*;
4848
pub use reflect::*;
4949

50-
use bevy_app::{prelude::*, MainScheduleOrder};
50+
use bevy_app::{prelude::*, UpdateFlowOrder};
5151
use bevy_ecs::schedule::ScheduleLabel;
5252
use bevy_utils::Duration;
5353

@@ -142,7 +142,7 @@ impl Plugin for AssetPlugin {
142142
))]
143143
app.add_systems(LoadAssets, io::filesystem_watcher_system);
144144

145-
let mut order = app.world.resource_mut::<MainScheduleOrder>();
145+
let mut order = app.world.resource_mut::<UpdateFlowOrder>();
146146
order.insert_after(First, LoadAssets);
147147
order.insert_after(PostUpdate, AssetEvents);
148148
}

crates/bevy_core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ mod tests {
203203
TypeRegistrationPlugin::default(),
204204
FrameCountPlugin::default(),
205205
));
206-
app.world.run_schedule(Main);
206+
app.world.run_schedule(UpdateFlow);
207207

208208
let frame_count = app.world.resource::<FrameCount>();
209209
assert_eq!(1, frame_count.0);

crates/bevy_core_pipeline/src/bloom/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
core_2d::{self, CORE_2D},
99
core_3d::{self, CORE_3D},
1010
};
11-
use bevy_app::{App, Plugin, Render};
11+
use bevy_app::{App, Plugin, RenderFlow};
1212
use bevy_asset::{load_internal_asset, HandleUntyped};
1313
use bevy_ecs::{prelude::*, query::QueryItem};
1414
use bevy_math::UVec2;
@@ -66,7 +66,7 @@ impl Plugin for BloomPlugin {
6666
.init_resource::<SpecializedRenderPipelines<BloomDownsamplingPipeline>>()
6767
.init_resource::<SpecializedRenderPipelines<BloomUpsamplingPipeline>>()
6868
.add_systems(
69-
Render,
69+
RenderFlow,
7070
(
7171
prepare_bloom_textures.in_set(RenderSet::Prepare),
7272
prepare_downsampling_pipeline.in_set(RenderSet::Prepare),

crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Plugin for CASPlugin {
119119
};
120120
render_app
121121
.init_resource::<SpecializedRenderPipelines<CASPipeline>>()
122-
.add_systems(Render, prepare_cas_pipelines.in_set(RenderSet::Prepare));
122+
.add_systems(RenderFlow, prepare_cas_pipelines.in_set(RenderSet::Prepare));
123123

124124
{
125125
use core_3d::graph::node::*;

crates/bevy_core_pipeline/src/core_2d/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub const CORE_2D: &str = graph::NAME;
2222
pub use camera_2d::*;
2323
pub use main_pass_2d_node::*;
2424

25-
use bevy_app::{App, Plugin, Render};
25+
use bevy_app::{App, Plugin, RenderFlow};
2626
use bevy_ecs::prelude::*;
2727
use bevy_render::{
2828
camera::Camera,
@@ -56,7 +56,7 @@ impl Plugin for Core2dPlugin {
5656
.init_resource::<DrawFunctions<Transparent2d>>()
5757
.add_systems(ExtractSchedule, extract_core_2d_camera_phases)
5858
.add_systems(
59-
Render,
59+
RenderFlow,
6060
(
6161
sort_phase_system::<Transparent2d>.in_set(RenderSet::PhaseSort),
6262
batch_phase_system::<Transparent2d>

crates/bevy_core_pipeline/src/core_3d/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub use camera_3d::*;
3030
pub use main_opaque_pass_3d_node::*;
3131
pub use main_transparent_pass_3d_node::*;
3232

33-
use bevy_app::{App, Plugin, Render};
33+
use bevy_app::{App, Plugin, RenderFlow};
3434
use bevy_ecs::prelude::*;
3535
use bevy_render::{
3636
camera::{Camera, ExtractedCamera},
@@ -85,7 +85,7 @@ impl Plugin for Core3dPlugin {
8585
.add_systems(ExtractSchedule, extract_core_3d_camera_phases)
8686
.add_systems(ExtractSchedule, extract_camera_prepass_phase)
8787
.add_systems(
88-
Render,
88+
RenderFlow,
8989
(
9090
prepare_core_3d_depth_textures
9191
.in_set(RenderSet::Prepare)

crates/bevy_core_pipeline/src/fxaa/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ impl Plugin for FxaaPlugin {
9595
};
9696
render_app
9797
.init_resource::<SpecializedRenderPipelines<FxaaPipeline>>()
98-
.add_systems(Render, prepare_fxaa_pipelines.in_set(RenderSet::Prepare))
98+
.add_systems(
99+
RenderFlow,
100+
prepare_fxaa_pipelines.in_set(RenderSet::Prepare),
101+
)
99102
.add_render_graph_node::<ViewNodeRunner<FxaaNode>>(CORE_3D, core_3d::graph::node::FXAA)
100103
.add_render_graph_edges(
101104
CORE_3D,

crates/bevy_core_pipeline/src/msaa_writeback.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
core_2d::{self, CORE_2D},
44
core_3d::{self, CORE_3D},
55
};
6-
use bevy_app::{App, Plugin, Render};
6+
use bevy_app::{App, Plugin, RenderFlow};
77
use bevy_ecs::prelude::*;
88
use bevy_render::{
99
camera::ExtractedCamera,
@@ -25,7 +25,7 @@ impl Plugin for MsaaWritebackPlugin {
2525
};
2626

2727
render_app.add_systems(
28-
Render,
28+
RenderFlow,
2929
queue_msaa_writeback_pipelines.in_set(RenderSet::Queue),
3030
);
3131
{

crates/bevy_core_pipeline/src/skybox/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use bevy_app::{App, Plugin, Render};
1+
use bevy_app::{App, Plugin, RenderFlow};
22
use bevy_asset::{load_internal_asset, Handle, HandleUntyped};
33
use bevy_ecs::{
44
prelude::{Component, Entity},
@@ -44,7 +44,7 @@ impl Plugin for SkyboxPlugin {
4444
render_app
4545
.init_resource::<SpecializedRenderPipelines<SkyboxPipeline>>()
4646
.add_systems(
47-
Render,
47+
RenderFlow,
4848
(
4949
prepare_skybox_pipelines.in_set(RenderSet::Prepare),
5050
queue_skybox_bind_groups.in_set(RenderSet::Queue),

crates/bevy_core_pipeline/src/taa/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
prelude::Camera3d,
55
prepass::{DepthPrepass, MotionVectorPrepass, ViewPrepassTextures},
66
};
7-
use bevy_app::{App, Plugin, Render};
7+
use bevy_app::{App, Plugin, RenderFlow};
88
use bevy_asset::{load_internal_asset, HandleUntyped};
99
use bevy_core::FrameCount;
1010
use bevy_ecs::{
@@ -63,7 +63,7 @@ impl Plugin for TemporalAntiAliasPlugin {
6363
.init_resource::<SpecializedRenderPipelines<TAAPipeline>>()
6464
.add_systems(ExtractSchedule, extract_taa_settings)
6565
.add_systems(
66-
Render,
66+
RenderFlow,
6767
(
6868
(prepare_taa_jitter_and_mip_bias, apply_deferred)
6969
.chain()

0 commit comments

Comments
 (0)