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] - Add upstream bevy_ecs and prepare for custom-shaders merge #2815

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions crates/bevy_ecs/src/schedule/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub struct SystemStage {
uninitialized_parallel: Vec<usize>,
/// Saves the value of the World change_tick during the last tick check
last_tick_check: u32,
apply_buffers: bool,
cart marked this conversation as resolved.
Show resolved Hide resolved
}

impl SystemStage {
Expand All @@ -104,6 +105,7 @@ impl SystemStage {
uninitialized_before_commands: vec![],
uninitialized_at_end: vec![],
last_tick_check: Default::default(),
apply_buffers: true,
}
}

Expand Down Expand Up @@ -203,6 +205,16 @@ impl SystemStage {
}
}

pub fn apply_buffers(&mut self, world: &mut World) {
for container in self.parallel.iter_mut() {
container.system_mut().apply_buffers(world);
}
}

pub fn set_apply_buffers(&mut self, apply_buffers: bool) {
self.apply_buffers = apply_buffers;
}

/// Topologically sorted parallel systems.
///
/// Note that systems won't be fully-formed until the stage has been run at least once.
Expand Down Expand Up @@ -831,9 +843,11 @@ impl Stage for SystemStage {
}

// Apply parallel systems' buffers.
for container in &mut self.parallel {
if container.should_run {
container.system_mut().apply_buffers(world);
if self.apply_buffers {
for container in &mut self.parallel {
if container.should_run {
container.system_mut().apply_buffers(world);
}
}
}

Expand Down