diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index 8f884e6bb980e..9bf893f6a2d5c 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -149,9 +149,9 @@ impl Plugin for MeshRenderPlugin { batch_and_prepare_render_phase::, batch_and_prepare_render_phase::, ) - .in_set(RenderSet::PrepareResources), + .in_set(RenderSet::PrepareBatches), write_batched_instance_buffer:: - .in_set(RenderSet::PrepareResourcesFlush), + .in_set(RenderSet::PrepareBatchesFlush), prepare_skins.in_set(RenderSet::PrepareResources), prepare_morphs.in_set(RenderSet::PrepareResources), prepare_mesh_bind_group.in_set(RenderSet::PrepareBindGroups), diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 7f013c0a4fb28..02501a3151e58 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -102,8 +102,12 @@ pub enum RenderSet { Prepare, /// A sub-set within [`Prepare`](RenderSet::Prepare) for initializing buffers, textures and uniforms for use in bind groups. PrepareResources, - /// The copy of [`apply_deferred`] that runs between [`PrepareResources`](RenderSet::PrepareResources) and ['PrepareBindGroups'](RenderSet::PrepareBindGroups). + /// The copy of [`apply_deferred`] that runs between [`PrepareResources`](RenderSet::PrepareResources) and ['PrepareBatches'](RenderSet::PrepareBatches). PrepareResourcesFlush, + /// A sub-set within [`Prepare`](RenderSet::Prepare) that prepares batches of meshes. + PrepareBatches, + /// The copy of [`apply_deferred`] that runs between [`PrepareBatches`](RenderSet::PrepareBatches) and ['PrepareBindGroups'](RenderSet::PrepareBindGroups). + PrepareBatchesFlush, /// A sub-set within [`Prepare`](RenderSet::Prepare) for constructing bind groups, or other data that relies on render resources prepared in [`PrepareResources`](RenderSet::PrepareResources). PrepareBindGroups, /// The copy of [`apply_deferred`] that runs immediately after [`Prepare`](RenderSet::Prepare). @@ -137,6 +141,7 @@ impl Render { schedule.add_systems(( apply_deferred.in_set(ManageViewsFlush), apply_deferred.in_set(PrepareResourcesFlush), + apply_deferred.in_set(PrepareBatchesFlush), apply_deferred.in_set(RenderFlush), apply_deferred.in_set(PrepareFlush), apply_deferred.in_set(CleanupFlush), @@ -166,7 +171,13 @@ impl Render { .after(prepare_assets::), ); schedule.configure_sets( - (PrepareResources, PrepareResourcesFlush, PrepareBindGroups) + ( + PrepareResources, + PrepareResourcesFlush, + PrepareBatches, + PrepareBatchesFlush, + PrepareBindGroups, + ) .chain() .in_set(Prepare), );