Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] - Parallelized transform propagation #4775
[Merged by Bors] - Parallelized transform propagation #4775
Changes from 4 commits
4e5ae27
ff0f0bc
925c360
80b2a33
8f28b3d
40c9a4e
fd483d0
73fee07
73ec563
efbbae2
4cec581
691f99a
e032f9d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I'm skeptical that change detection actually helps here. Branching and checking only saves us a very simple operation, while introducing the potential for weird behavior.
Avoids false positives on change detection for GlobalTransform, but IMO we should consider just opting out of change detection for that anyways.
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.
Removing change detection bumps me from 180k to 190k birds at 60FPS on BevyMark. So, a modest improvement when everything is changed. Probably worth doing then, as in most scenes the overwhelming majority of things with transforms are static.
This PR seems to help that benchmark significantly in general, even comparing to latest main I'm getting +20k birbs.
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 isn't a problem with this PR, but it's an interesting conundrum:
Currently, if the
GlobalTransform
has been erroneously changed by users to something other than the correct transform, that will remain until something higher up in the hierarchy or theTransform
changes. Do we want this behaviour, or do we want to fix this (or warn?)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.
Simple solution: make
GlobalTransform
read-only the same way #4197 does with the hierarchy itself. Makes this footgun a lot harder to come across.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.
Why does this query need those filters? I guess completeness of recording requirements to limit possible collisions?
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 should allow this system to run in parallel with
sync_simple_transforms
.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.
I wonder if we should rename this to something like
unsafe_transform_query
here (and above). The requirements for this to be safely accessed are quite subtle - evenQuery::get
is probably UB.This seems like the kind of code which would be blindly copied for user's custom hierarchy, so we can at least nudge the gun away from the foot-direction with wording here.
We really need
UnsafeCell
equivalent queries - they're on the list.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.
Could/should we make this system generic? - that would avoid the copy/paste problem
We couldn't allow arbitrary hierarchies, since the
Parent
equivalent component could have a maliciousDeref
impl to make the check always pass. However, I see no reason that this couldn't access arbitrary other components.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 is done in #4216, which we can merge before or after this PR.