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

[Merged by Bors] - Stageless: fix unapplied systems #7446

Closed
Closed
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions crates/bevy_ecs/src/schedule_v3/executor/multi_threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,12 @@ impl SystemExecutor for MultiThreadedExecutor {

// SAFETY: all systems have completed
let world = unsafe { &mut *world.get() };
apply_system_buffers(&mut self.unapplied_systems, systems, world);
apply_system_buffers(&self.unapplied_systems, systems, world);
self.unapplied_systems.clear();
debug_assert!(self.unapplied_systems.is_clear());

debug_assert!(self.ready_systems.is_clear());
debug_assert!(self.running_systems.is_clear());
debug_assert!(self.unapplied_systems.is_clear());
self.active_access.clear();
self.evaluated_sets.clear();
self.skipped_systems.clear();
Expand Down Expand Up @@ -459,11 +460,12 @@ impl MultiThreadedExecutor {
let sender = self.sender.clone();
if is_apply_system_buffers(system) {
// TODO: avoid allocation
let mut unapplied_systems = self.unapplied_systems.clone();
let unapplied_systems = self.unapplied_systems.clone();
self.unapplied_systems.clear();
let task = async move {
#[cfg(feature = "trace")]
let system_guard = system_span.enter();
apply_system_buffers(&mut unapplied_systems, systems, world);
apply_system_buffers(&unapplied_systems, systems, world);
#[cfg(feature = "trace")]
drop(system_guard);
sender
Expand Down Expand Up @@ -545,7 +547,7 @@ impl MultiThreadedExecutor {
}

fn apply_system_buffers(
unapplied_systems: &mut FixedBitSet,
unapplied_systems: &FixedBitSet,
systems: &[SyncUnsafeCell<BoxedSystem>],
world: &mut World,
) {
Expand All @@ -556,8 +558,6 @@ fn apply_system_buffers(
let _apply_buffers_span = info_span!("apply_buffers", name = &*system.name()).entered();
system.apply_buffers(world);
}

unapplied_systems.clear();
}

fn evaluate_and_fold_conditions(conditions: &mut [BoxedCondition], world: &World) -> bool {
Expand Down