Skip to content

Commit 557408e

Browse files
committed
Adjust schedules to add systems
1 parent fe794a8 commit 557408e

File tree

24 files changed

+50
-52
lines changed

24 files changed

+50
-52
lines changed

crates/bevy_asset/src/debug_asset_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl Plugin for DebugAssetServerPlugin {
7676
watch_for_changes: ChangeWatcher::with_delay(Duration::from_millis(200)),
7777
});
7878
app.insert_non_send_resource(DebugAssetApp(debug_asset_app));
79-
app.add_systems(Update, run_debug_asset_app);
79+
app.add_systems(FrameReady, run_debug_asset_app);
8080
}
8181
}
8282

crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T: Asset> Default for AssetCountDiagnosticsPlugin<T> {
2121
impl<T: Asset> Plugin for AssetCountDiagnosticsPlugin<T> {
2222
fn build(&self, app: &mut App) {
2323
app.add_systems(Startup, Self::setup_system)
24-
.add_systems(Update, Self::diagnostic_system);
24+
.add_systems(FrameReady, Self::diagnostic_system);
2525
}
2626
}
2727

crates/bevy_asset/src/lib.rs

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

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

5454
/// Asset storages are updated.
@@ -132,7 +132,6 @@ impl Plugin for AssetPlugin {
132132
app.register_type::<HandleId>();
133133
app.register_type::<AssetPath>();
134134

135-
app.add_systems(PreUpdate, asset_server::free_unused_assets_system);
136135
app.init_schedule(LoadAssets);
137136
app.init_schedule(AssetEvents);
138137

@@ -141,9 +140,10 @@ impl Plugin for AssetPlugin {
141140
all(not(target_arch = "wasm32"), not(target_os = "android"))
142141
))]
143142
app.add_systems(LoadAssets, io::filesystem_watcher_system);
144-
145-
let mut order = app.world.resource_mut::<UpdateFlowOrder>();
146-
order.insert_after(First, LoadAssets);
147-
order.insert_after(PostUpdate, AssetEvents);
143+
app.add_systems(LoadAssets, asset_server::free_unused_assets_system);
144+
app.add_systems(FrameReady, |world: &mut World| {
145+
world.run_schedule(LoadAssets);
146+
world.run_schedule(AssetEvents);
147+
});
148148
}
149149
}

crates/bevy_audio/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Plugin for AudioPlugin {
6464
.add_asset::<SpatialAudioSink>()
6565
.init_resource::<Audio<AudioSource>>()
6666
.insert_resource(self.global_volume)
67-
.add_systems(PostUpdate, play_queued_audio_system::<AudioSource>);
67+
.add_systems(FrameReady, play_queued_audio_system::<AudioSource>);
6868

6969
#[cfg(any(feature = "mp3", feature = "flac", feature = "wav", feature = "vorbis"))]
7070
app.init_asset_loader::<AudioLoader>();
@@ -80,6 +80,6 @@ impl AddAudioSource for App {
8080
self.add_asset::<T>()
8181
.init_resource::<Audio<T>>()
8282
.init_resource::<AudioOutput<T>>()
83-
.add_systems(PostUpdate, play_queued_audio_system::<T>)
83+
.add_systems(FrameReady, play_queued_audio_system::<T>)
8484
}
8585
}

crates/bevy_core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl Plugin for TaskPoolPlugin {
114114
self.task_pool_options.create_default_pools();
115115

116116
#[cfg(not(target_arch = "wasm32"))]
117-
_app.add_systems(Last, tick_global_task_pools);
117+
_app.add_systems(FrameReady, tick_global_task_pools);
118118
}
119119
}
120120
/// A dummy type that is [`!Send`](Send), to force systems to run on the main thread.

crates/bevy_diagnostic/src/entity_count_diagnostics_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct EntityCountDiagnosticsPlugin;
1010
impl Plugin for EntityCountDiagnosticsPlugin {
1111
fn build(&self, app: &mut App) {
1212
app.register_diagnostic(Diagnostic::new(Self::ENTITY_COUNT, "entity_count", 20))
13-
.add_systems(Update, Self::diagnostic_system);
13+
.add_systems(FrameReady, Self::diagnostic_system);
1414
}
1515
}
1616

crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Plugin for FrameTimeDiagnosticsPlugin {
1717
.register_diagnostic(
1818
Diagnostic::new(Self::FRAME_COUNT, "frame_count", 1).with_smoothing_factor(0.0),
1919
)
20-
.add_systems(Update, Self::diagnostic_system);
20+
.add_systems(FrameReady, Self::diagnostic_system);
2121
}
2222
}
2323

crates/bevy_diagnostic/src/log_diagnostics_plugin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ impl Plugin for LogDiagnosticsPlugin {
3737
});
3838

3939
if self.debug {
40-
app.add_systems(PostUpdate, Self::log_diagnostics_debug_system);
40+
app.add_systems(FrameReady, Self::log_diagnostics_debug_system);
4141
} else {
42-
app.add_systems(PostUpdate, Self::log_diagnostics_system);
42+
app.add_systems(FrameReady, Self::log_diagnostics_system);
4343
}
4444
}
4545
}

crates/bevy_diagnostic/src/system_information_diagnostics_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct SystemInformationDiagnosticsPlugin;
1515
impl Plugin for SystemInformationDiagnosticsPlugin {
1616
fn build(&self, app: &mut App) {
1717
app.add_systems(Startup, internal::setup_system)
18-
.add_systems(Update, internal::diagnostic_system);
18+
.add_systems(FrameReady, internal::diagnostic_system);
1919
}
2020
}
2121

crates/bevy_gilrs/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod converter;
44
mod gilrs_system;
55
mod rumble;
66

7-
use bevy_app::{App, Plugin, PostUpdate, PreStartup, PreUpdate};
7+
use bevy_app::{App, Control, FrameReady, Plugin, PreStartup};
88
use bevy_ecs::prelude::*;
99
use bevy_input::InputSystem;
1010
use bevy_utils::tracing::error;
@@ -30,8 +30,8 @@ impl Plugin for GilrsPlugin {
3030
app.insert_non_send_resource(gilrs)
3131
.init_non_send_resource::<RunningRumbleEffects>()
3232
.add_systems(PreStartup, gilrs_event_startup_system)
33-
.add_systems(PreUpdate, gilrs_event_system.before(InputSystem))
34-
.add_systems(PostUpdate, play_gilrs_rumble.in_set(RumbleSystem));
33+
.add_systems(Control, gilrs_event_system.before(InputSystem))
34+
.add_systems(FrameReady, play_gilrs_rumble.in_set(RumbleSystem));
3535
}
3636
Err(err) => error!("Failed to start Gilrs. {}", err),
3737
}

crates/bevy_gizmos/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
use std::mem;
2020

21-
use bevy_app::{Last, Plugin, RenderFlow, Update};
21+
use bevy_app::{FrameReady, Plugin, RenderFlow};
2222
use bevy_asset::{load_internal_asset, AddAsset, Assets, Handle, HandleUntyped};
2323
use bevy_core::cast_slice;
2424
use bevy_ecs::{
@@ -84,12 +84,12 @@ impl Plugin for GizmoPlugin {
8484
.init_resource::<LineGizmoHandles>()
8585
.init_resource::<GizmoConfig>()
8686
.init_resource::<GizmoStorage>()
87-
.add_systems(Last, update_gizmo_meshes)
8887
.add_systems(
89-
Update,
88+
FrameReady,
9089
(
9190
draw_aabbs,
9291
draw_all_aabbs.run_if(|config: Res<GizmoConfig>| config.aabb.draw_all),
92+
update_gizmo_meshes,
9393
),
9494
);
9595

crates/bevy_input/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ impl Plugin for InputPlugin {
6262
.add_event::<KeyboardInput>()
6363
.init_resource::<Input<KeyCode>>()
6464
.init_resource::<Input<ScanCode>>()
65-
.add_systems(PreUpdate, keyboard_input_system.in_set(InputSystem))
65+
.add_systems(Control, keyboard_input_system.in_set(InputSystem))
6666
// mouse
6767
.add_event::<MouseButtonInput>()
6868
.add_event::<MouseMotion>()
6969
.add_event::<MouseWheel>()
7070
.init_resource::<Input<MouseButton>>()
71-
.add_systems(PreUpdate, mouse_button_input_system.in_set(InputSystem))
71+
.add_systems(Control, mouse_button_input_system.in_set(InputSystem))
7272
.add_event::<TouchpadMagnify>()
7373
.add_event::<TouchpadRotate>()
7474
// gamepad
@@ -99,7 +99,7 @@ impl Plugin for InputPlugin {
9999
// touch
100100
.add_event::<TouchInput>()
101101
.init_resource::<Touches>()
102-
.add_systems(PreUpdate, touch_screen_input_system.in_set(InputSystem));
102+
.add_systems(Control, touch_screen_input_system.in_set(InputSystem));
103103

104104
// Register common types
105105
app.register_type::<ButtonState>();

crates/bevy_render/src/mesh/morph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
render_resource::{Extent3d, TextureDimension, TextureFormat},
44
texture::Image,
55
};
6-
use bevy_app::{Plugin, PostUpdate};
6+
use bevy_app::{FrameReady, Plugin};
77
use bevy_asset::Handle;
88
use bevy_ecs::prelude::*;
99
use bevy_hierarchy::Children;
@@ -28,7 +28,7 @@ impl Plugin for MorphPlugin {
2828
fn build(&self, app: &mut bevy_app::App) {
2929
app.register_type::<MorphWeights>()
3030
.register_type::<MeshMorphWeights>()
31-
.add_systems(PostUpdate, inherit_weights);
31+
.add_systems(FrameReady, inherit_weights);
3232
}
3333
}
3434

crates/bevy_render/src/render_resource/texture.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub struct TextureView {
5858
value: ErasedTextureView,
5959
}
6060

61+
#[derive(Debug)]
6162
pub struct SurfaceTexture {
6263
value: ErasedSurfaceTexture,
6364
}

crates/bevy_render/src/renderer/render_device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::render_resource::resource_macros::*;
1212
render_resource_wrapper!(ErasedRenderDevice, wgpu::Device);
1313

1414
/// This GPU device is responsible for the creation of most rendering and compute resources.
15-
#[derive(Resource, Clone)]
15+
#[derive(Debug, Resource, Clone)]
1616
pub struct RenderDevice {
1717
device: ErasedRenderDevice,
1818
}

crates/bevy_render/src/view/visibility/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod render_layers;
22

33
pub use render_layers::*;
44

5-
use bevy_app::{Plugin, PostUpdate};
5+
use bevy_app::{FrameReady, Plugin};
66
use bevy_asset::{Assets, Handle};
77
use bevy_ecs::prelude::*;
88
use bevy_hierarchy::{Children, Parent};
@@ -213,10 +213,10 @@ impl Plugin for VisibilityPlugin {
213213

214214
app
215215
// We add an AABB component in CalculateBounds, which must be ready on the same frame.
216-
.add_systems(PostUpdate, apply_deferred.in_set(CalculateBoundsFlush))
217-
.configure_set(PostUpdate, CalculateBoundsFlush.after(CalculateBounds))
216+
.add_systems(FrameReady, apply_deferred.in_set(CalculateBoundsFlush))
217+
.configure_set(FrameReady, CalculateBoundsFlush.after(CalculateBounds))
218218
.add_systems(
219-
PostUpdate,
219+
FrameReady,
220220
(
221221
calculate_bounds.in_set(CalculateBounds),
222222
update_frusta::<OrthographicProjection>

crates/bevy_render/src/view/window/screenshot.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ impl SpecializedRenderPipeline for ScreenshotToScreenPipeline {
254254
}
255255
}
256256

257+
#[derive(Debug)]
257258
pub struct ScreenshotPreparedState {
258259
pub texture: Texture,
259260
pub buffer: Buffer,

crates/bevy_time/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl Plugin for TimePlugin {
4545
.register_type::<Time>()
4646
.register_type::<Stopwatch>()
4747
.init_resource::<FixedTime>()
48-
.add_systems(First, time_system.in_set(TimeSystem))
48+
.add_systems(Control, time_system.in_set(TimeSystem))
4949
.add_systems(RunFixedUpdateLoop, run_fixed_update_schedule);
5050

5151
#[cfg(feature = "bevy_ci_testing")]

crates/bevy_ui/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl Plugin for UiPlugin {
145145
);
146146
#[cfg(feature = "bevy_text")]
147147
app.add_plugins(accessibility::AccessibilityPlugin);
148-
app.add_systems(PostUpdate, {
148+
app.add_systems(FrameReady, {
149149
let system = widget::update_image_content_size_system.before(UiSystem::Layout);
150150
// Potential conflicts: `Assets<Image>`
151151
// They run independently since `widget::image_node_system` will only ever observe

crates/bevy_window/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ impl Plugin for WindowPlugin {
9595

9696
match self.exit_condition {
9797
ExitCondition::OnPrimaryClosed => {
98-
app.add_systems(PostUpdate, exit_on_primary_closed);
98+
app.add_systems(Control, exit_on_primary_closed);
9999
}
100100
ExitCondition::OnAllClosed => {
101-
app.add_systems(PostUpdate, exit_on_all_closed);
101+
app.add_systems(Control, exit_on_all_closed);
102102
}
103103
ExitCondition::DontExit => {}
104104
}
105105

106106
if self.close_when_requested {
107107
// Need to run before `exit_on_*` systems
108-
app.add_systems(PostUpdate, close_when_requested);
108+
app.add_systems(Control, close_when_requested);
109109
}
110110

111111
// Register event types

crates/bevy_winit/src/accessibility.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use bevy_a11y::{
1111
accesskit::{ActionHandler, ActionRequest, NodeBuilder, NodeClassSet, Role, TreeUpdate},
1212
AccessKitEntityExt, AccessibilityNode, AccessibilityRequested, Focus,
1313
};
14-
use bevy_app::{App, Plugin, PostUpdate};
14+
use bevy_app::{App, Control, FrameReady, Plugin};
1515
use bevy_derive::{Deref, DerefMut};
1616
use bevy_ecs::{
1717
prelude::{DetectChanges, Entity, EventReader, EventWriter},
@@ -170,13 +170,9 @@ impl Plugin for AccessibilityPlugin {
170170
.init_resource::<WinitActionHandlers>()
171171
.add_event::<ActionRequestWrapper>()
172172
.add_systems(
173-
PostUpdate,
174-
(
175-
handle_window_focus,
176-
window_closed,
177-
poll_receivers,
178-
update_accessibility_nodes,
179-
),
180-
);
173+
Control,
174+
(handle_window_focus, window_closed, poll_receivers),
175+
)
176+
.add_systems(FrameReady, update_accessibility_nodes);
181177
}
182178
}

crates/bevy_winit/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub use winit_config::*;
2929
pub use winit_handler::*;
3030
pub use winit_windows::*;
3131

32-
use bevy_app::{App, AppExit, Last, Plugin};
32+
use bevy_app::{App, AppExit, Control, Plugin};
3333
use bevy_ecs::event::ManualEventReader;
3434
use bevy_ecs::prelude::*;
3535
use bevy_input::{
@@ -108,7 +108,7 @@ impl Plugin for WinitPlugin {
108108
// exit_on_all_closed only uses the query to determine if the query is empty,
109109
// and so doesn't care about ordering relative to changed_window
110110
.add_systems(
111-
Last,
111+
Control,
112112
(
113113
changed_window.ambiguous_with(exit_on_all_closed),
114114
// Update the state of the window before attempting to despawn to ensure consistent event ordering

crates/bevy_winit/src/web_resize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::WinitWindows;
2-
use bevy_app::{App, Plugin, Update};
2+
use bevy_app::{App, Plugin};
33
use bevy_ecs::prelude::*;
44
use crossbeam_channel::{Receiver, Sender};
55
use wasm_bindgen::JsCast;
@@ -10,7 +10,7 @@ pub(crate) struct CanvasParentResizePlugin;
1010
impl Plugin for CanvasParentResizePlugin {
1111
fn build(&self, app: &mut App) {
1212
app.init_resource::<CanvasParentResizeEventChannel>()
13-
.add_systems(Update, canvas_parent_resize_event_handler);
13+
.add_systems(Control, canvas_parent_resize_event_handler);
1414
}
1515
}
1616

crates/bevy_winit/src/winit_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl WinitHandler {
8484
}
8585

8686
/// Requests frame redraw.
87-
///
87+
///
8888
/// If called during redrawing, the next redraw is reserved.
8989
pub fn redraw(&mut self) {
9090
if let Err(e) = self.proxy.get().send_event(HandleEvent::RequestRedraw) {

0 commit comments

Comments
 (0)