-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Pass query change ticks to QueryParIter
instead of always using change ticks from World
.
#8029
Pass query change ticks to QueryParIter
instead of always using change ticks from World
.
#8029
Conversation
…e ticks from World.
Whoops, these types got changed by #7905 after my last fetch. Let me rebase and try again. |
002f7e7
to
53de75a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right, but I think a simple regression test would be helpful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding a test!
crates/bevy_ecs/src/query/mod.rs
Outdated
let mut propagate_system = IntoSystem::into_system(propagate_system); | ||
propagate_system.initialize(&mut world); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason that you're manually initializing and calling these systems instead of just adding them to a Schedule
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I just copied that approach from the previous test in that file. Should I replace it with
let mut schedule = Schedule::new();
schedule.add_systems((propagate_system, modify_system).chain());
schedule.run(&mut world);
world.clear_trackers();
schedule.run(&mut world);
world.clear_trackers();
?
(I thought I could put World::clear_trackers
in the schedule, too, but exclusive systems can't actually update last_change_tick
, and without that update the test can't catch the bug.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that looks better.
384fcdf
to
e1cbb5a
Compare
…nge ticks from `World`. (bevyengine#8029) Co-authored-by: Chris Russell <[email protected]> Co-authored-by: James Liu <[email protected]>
…nge ticks from `World`. (bevyengine#8029) Co-authored-by: Chris Russell <[email protected]> Co-authored-by: James Liu <[email protected]>
@alice-i-cecile Not sure you are the right person, but this change has the 0.10.1 milestone label but does not appear to be included in that release. |
@cart was responsible for cherrypicking from the milestone this time. |
@cart Would this change warrant another minor release? |
I prepared the patch for the 0.10.1, and this PR depends on #7905 which is breaking so it couldn't be cherry picked. See #8029 (comment) |
…nge ticks from `World`. (bevyengine#8029) Co-authored-by: Chris Russell <[email protected]> Co-authored-by: James Liu <[email protected]>
I've cherry picked this PR on this branch, in case we are interested in another minor version. It seems like multiple people are affected by this problem so it might be a good idea. |
There are 56 days between today and the tentative Bevy 0.11 release date. That does seem like a reasonably long time for this to be broken. I've created a new 0.10.2 milestone and added this to it. Lets take a couple more days to consider other items for the release and then we can do the cut. |
Objective
Make
Changed<T>
filters work reliably withQuery::par_iter_mut()
.While updating my game to Bevy 0.10, I had a bug where
GlobalTransform
was not being updated. The problem turned out to be that I was changingTransform
in a system that ran after theTransformSystem::TransformPropagate
set. I would have expected that to cause a one frame delay in updates, but instead it was ignoring them completely.When #4777 introduced
QueryParIter
, it consolidated code inQueryState
that usedworld.last_change_tick()
and code inQuery
that usedself.last_change_tick
. The new code always usesworld.last_change_tick()
. This means that any system usingQuery::par_iter_mut()
uses thelast_change_tick
from the end of the previous frame, and won't see any changes made by systems that ran after it did on the previous frame.In particular,
sync_simple_transforms
never sees anyTransform
changes made by systems that run after it.Solution
Pass
last_change_tick
andchange_tick
fromQuery
toQueryParIter
.