-
-
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
[Merged by Bors] - Ensure 2D phase items are sorted before batching #5942
Conversation
Without this we can inappropriately merge batches together without properly accounting for non-batch items between them, and the merged batch will then be sorted incorrectly later.
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 fix makes sense to me, and is minimally intrusive.
Does it make sense to batch a not sorted phase? If not, could the batch system sort by default before batching, and we could remove the independent sort system when batching? |
I was digging through the code that added this (#3460) to try and answer that, and it looks like these systems were originally ordered as I've done here, which was lost in the camera driven rendering rework (#4745). I can't see any discussion about why the systems are separate, and the later removal of the ordering appears to have been accidental when the code was moved (no mention of it in any discussion I could see). |
Thanks for the digging. Merging as trivial then; seems like a merge conflict error or something similiarly trivial. bors r+ |
# Objective Without this we can inappropriately merge batches together without properly accounting for non-batch items between them, and the merged batch will then be sorted incorrectly later. This change seems to reliably fix the issue I was seeing in #5919. ## Solution Ensure the `batch_phase_system` runs after the `sort_phase_system`, so that batching can only look at actually adjacent phase items.
Pull request successfully merged into main. Build succeeded: |
For historical context, I’d have approved this too. |
@superdump does it make sense to merge those two systems in one when batching? that would remove the code of having two systems to call, both iterating the same list |
# Objective Without this we can inappropriately merge batches together without properly accounting for non-batch items between them, and the merged batch will then be sorted incorrectly later. This change seems to reliably fix the issue I was seeing in bevyengine#5919. ## Solution Ensure the `batch_phase_system` runs after the `sort_phase_system`, so that batching can only look at actually adjacent phase items.
# Objective Without this we can inappropriately merge batches together without properly accounting for non-batch items between them, and the merged batch will then be sorted incorrectly later. This change seems to reliably fix the issue I was seeing in bevyengine#5919. ## Solution Ensure the `batch_phase_system` runs after the `sort_phase_system`, so that batching can only look at actually adjacent phase items.
# Objective Without this we can inappropriately merge batches together without properly accounting for non-batch items between them, and the merged batch will then be sorted incorrectly later. This change seems to reliably fix the issue I was seeing in bevyengine#5919. ## Solution Ensure the `batch_phase_system` runs after the `sort_phase_system`, so that batching can only look at actually adjacent phase items.
Objective
Without this we can inappropriately merge batches together without properly accounting for non-batch items between them, and the merged batch will then be sorted incorrectly later.
This change seems to reliably fix the issue I was seeing in #5919.
Solution
Ensure the
batch_phase_system
runs after thesort_phase_system
, so that batching can only look at actually adjacent phase items.