Skip to content

Commit bb7f521

Browse files
committed
Ensure 2D phase items are sorted before batching (#5942)
# 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.
1 parent 6f2cc0b commit bb7f521

File tree

1 file changed

+4
-1
lines changed
  • crates/bevy_core_pipeline/src/core_2d

1 file changed

+4
-1
lines changed

crates/bevy_core_pipeline/src/core_2d/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ impl Plugin for Core2dPlugin {
4646
.init_resource::<DrawFunctions<Transparent2d>>()
4747
.add_system_to_stage(RenderStage::Extract, extract_core_2d_camera_phases)
4848
.add_system_to_stage(RenderStage::PhaseSort, sort_phase_system::<Transparent2d>)
49-
.add_system_to_stage(RenderStage::PhaseSort, batch_phase_system::<Transparent2d>);
49+
.add_system_to_stage(
50+
RenderStage::PhaseSort,
51+
batch_phase_system::<Transparent2d>.after(sort_phase_system::<Transparent2d>),
52+
);
5053

5154
let pass_node_2d = MainPass2dNode::new(&mut render_app.world);
5255
let mut graph = render_app.world.resource_mut::<RenderGraph>();

0 commit comments

Comments
 (0)