From a4ade63c5573be1923281e213adc15f333409fe0 Mon Sep 17 00:00:00 2001 From: Timothy Davis Date: Sat, 22 Apr 2023 01:23:59 +0930 Subject: [PATCH 1/8] Get things working for 0.11 --- Cargo.toml | 4 +-- examples/2d.rs | 8 ++--- examples/activate.rs | 8 ++--- examples/billboard.rs | 8 ++--- examples/circle.rs | 7 ++-- examples/firework.rs | 7 ++-- examples/force_field.rs | 8 ++--- examples/gradient.rs | 8 ++--- examples/init.rs | 8 ++--- examples/instancing.rs | 8 ++--- examples/lifetime.rs | 7 ++-- examples/multicam.rs | 11 ++++--- examples/portal.rs | 7 ++-- examples/random.rs | 7 ++-- examples/spawn.rs | 8 ++--- examples/spawn_on_command.rs | 8 ++--- examples/visibility.rs | 8 ++--- src/lib.rs | 7 ++-- src/plugin.rs | 64 +++++++++++++++++++++--------------- src/render/mod.rs | 2 +- src/spawn.rs | 7 ++-- 21 files changed, 114 insertions(+), 96 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0fc63629..5b00d060 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ bitflags = "1.3" typetag = "0.2" [dependencies.bevy] -version = "0.10" +git = "https://github.com/bevyengine/bevy" default-features = false features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", "x11" ] @@ -41,7 +41,7 @@ features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", "x11" ] all-features = true [dev-dependencies] -# Same version as Bevy 0.10 (bevy_render) +# Same version as Bevy 0.11 (bevy_render) wgpu = "0.15" # For shader snippet validation naga = "0.11" diff --git a/examples/2d.rs b/examples/2d.rs index 5075b6b1..ae2c091f 100644 --- a/examples/2d.rs +++ b/examples/2d.rs @@ -32,11 +32,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update_plane) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update_plane)) .run(); Ok(()) diff --git a/examples/activate.rs b/examples/activate.rs index bf8487ce..0208bab2 100644 --- a/examples/activate.rs +++ b/examples/activate.rs @@ -30,11 +30,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update)) .run(); Ok(()) diff --git a/examples/billboard.rs b/examples/billboard.rs index 740451a8..ca12f1d3 100644 --- a/examples/billboard.rs +++ b/examples/billboard.rs @@ -28,11 +28,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(rotate_camera) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, rotate_camera)) .run(); Ok(()) diff --git a/examples/circle.rs b/examples/circle.rs index c5fa9fd2..b7869333 100644 --- a/examples/circle.rs +++ b/examples/circle.rs @@ -26,10 +26,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) + .add_systems(Update, bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) .run(); Ok(()) diff --git a/examples/firework.rs b/examples/firework.rs index 6017641a..aebc8af0 100644 --- a/examples/firework.rs +++ b/examples/firework.rs @@ -29,10 +29,11 @@ fn main() -> Result<(), Box> { level: bevy::log::Level::WARN, filter: "bevy_hanabi=warn,firework=trace".to_string(), })) - .add_system(bevy::window::close_on_esc) + .add_systems(Update, bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) .run(); Ok(()) diff --git a/examples/force_field.rs b/examples/force_field.rs index af6fa728..38dc3e9b 100644 --- a/examples/force_field.rs +++ b/examples/force_field.rs @@ -42,13 +42,13 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) //.add_plugin(LookTransformPlugin) //.add_plugin(OrbitCameraPlugin::default()) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update)) .run(); Ok(()) diff --git a/examples/gradient.rs b/examples/gradient.rs index 29f04df9..cab2fa10 100644 --- a/examples/gradient.rs +++ b/examples/gradient.rs @@ -27,11 +27,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update)) .run(); Ok(()) diff --git a/examples/init.rs b/examples/init.rs index 9c0254a6..28f35b37 100644 --- a/examples/init.rs +++ b/examples/init.rs @@ -34,11 +34,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(rotate_camera) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, rotate_camera)) .run(); Ok(()) diff --git a/examples/instancing.rs b/examples/instancing.rs index 1c47815e..4824d802 100644 --- a/examples/instancing.rs +++ b/examples/instancing.rs @@ -173,12 +173,12 @@ fn main() { level: bevy::log::Level::WARN, filter: "bevy_hanabi=warn,instancing=trace".to_string(), })) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) .insert_resource(InstanceManager::new(5, 4)) - .add_startup_system(setup) - .add_system(keyboard_input_system) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, keyboard_input_system)) //.add_system(stress_test.after(keyboard_input_system)) .run(); } diff --git a/examples/lifetime.rs b/examples/lifetime.rs index 104748cc..fe7cab8d 100644 --- a/examples/lifetime.rs +++ b/examples/lifetime.rs @@ -38,10 +38,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) + .add_systems(Update, bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) .run(); Ok(()) diff --git a/examples/multicam.rs b/examples/multicam.rs index 1f9a7684..b7747d8b 100644 --- a/examples/multicam.rs +++ b/examples/multicam.rs @@ -20,11 +20,14 @@ fn main() { level: bevy::log::Level::WARN, filter: "bevy_hanabi=warn,multicam=trace".to_string(), })) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update_camera_viewports) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems( + Update, + (bevy::window::close_on_esc, update_camera_viewports), + ) .run(); } diff --git a/examples/portal.rs b/examples/portal.rs index 4d07b4f9..348f953f 100644 --- a/examples/portal.rs +++ b/examples/portal.rs @@ -24,10 +24,11 @@ fn main() -> Result<(), Box> { level: bevy::log::Level::WARN, filter: "bevy_hanabi=warn,portal=trace".to_string(), })) - .add_system(bevy::window::close_on_esc) + .add_systems(Update, bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) .run(); Ok(()) diff --git a/examples/random.rs b/examples/random.rs index 0cd2b15a..e4014b50 100644 --- a/examples/random.rs +++ b/examples/random.rs @@ -28,10 +28,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) + .add_systems(Update, bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) .run(); Ok(()) diff --git a/examples/spawn.rs b/examples/spawn.rs index 5feed5c3..837585d0 100644 --- a/examples/spawn.rs +++ b/examples/spawn.rs @@ -39,11 +39,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update_accel) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update_accel)) .run(); Ok(()) diff --git a/examples/spawn_on_command.rs b/examples/spawn_on_command.rs index 65a52ec7..bf38827b 100644 --- a/examples/spawn_on_command.rs +++ b/examples/spawn_on_command.rs @@ -31,11 +31,11 @@ fn main() -> Result<(), Box> { }) .set(RenderPlugin { wgpu_settings }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update)) .run(); Ok(()) diff --git a/examples/visibility.rs b/examples/visibility.rs index 54b3aa0e..a58eb5e1 100644 --- a/examples/visibility.rs +++ b/examples/visibility.rs @@ -46,11 +46,11 @@ fn main() -> Result<(), Box> { ..default() }), ) - .add_system(bevy::window::close_on_esc) .add_plugin(HanabiPlugin) - .add_plugin(WorldInspectorPlugin::default()) - .add_startup_system(setup) - .add_system(update) + // Have to wait for update. + // .add_plugin(WorldInspectorPlugin::default()) + .add_systems(Startup, setup) + .add_systems(Update, (bevy::window::close_on_esc, update)) .run(); Ok(()) diff --git a/src/lib.rs b/src/lib.rs index 4af0fa04..a856fa35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1287,10 +1287,9 @@ else { return c1; } app.init_resource::(); app.insert_resource(Random(new_rng())); app.add_asset::(); - app.add_system( - compile_effects - .in_base_set(CoreSet::PostUpdate) - .after(VisibilitySystems::CheckVisibility), + app.add_systems( + PostUpdate, + compile_effects.after(VisibilitySystems::CheckVisibility), ); app diff --git a/src/plugin.rs b/src/plugin.rs index 02cd0cba..c03a5bbb 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -10,7 +10,7 @@ use bevy::{ render_resource::{SpecializedComputePipelines, SpecializedRenderPipelines}, renderer::{RenderAdapterInfo, RenderDevice}, view::visibility::VisibilitySystems, - RenderApp, RenderSet, + Render, RenderApp, RenderSet, }, }; @@ -71,22 +71,28 @@ impl Plugin for HanabiPlugin { .insert_resource(Random(spawn::new_rng())) .init_resource::() .init_asset_loader::() - .configure_sets(( - EffectSystems::TickSpawners - .in_base_set(CoreSet::PostUpdate) - // This checks the visibility to skip work, so needs to run after - // ComputedVisibility was updated. - .after(VisibilitySystems::CheckVisibility), - EffectSystems::CompileEffects - .in_base_set(CoreSet::PostUpdate) - // This checks the visibility to skip work, so needs to run after - // ComputedVisibility was updated. - .after(VisibilitySystems::CheckVisibility), - EffectSystems::GatherRemovedEffects.in_base_set(CoreSet::PostUpdate), - )) - .add_system(tick_spawners.in_set(EffectSystems::TickSpawners)) - .add_system(compile_effects.in_set(EffectSystems::CompileEffects)) - .add_system(gather_removed_effects.in_set(EffectSystems::GatherRemovedEffects)); + .configure_sets( + PostUpdate, + ( + EffectSystems::TickSpawners + // This checks the visibility to skip work, so needs to run after + // ComputedVisibility was updated. + .after(VisibilitySystems::CheckVisibility), + EffectSystems::CompileEffects + // This checks the visibility to skip work, so needs to run after + // ComputedVisibility was updated. + .after(VisibilitySystems::CheckVisibility), + EffectSystems::GatherRemovedEffects, + ), + ) + .add_systems( + PostUpdate, + ( + tick_spawners.in_set(EffectSystems::TickSpawners), + compile_effects.in_set(EffectSystems::CompileEffects), + gather_removed_effects.in_set(EffectSystems::GatherRemovedEffects), + ), + ); // Register the component reflection app.register_type::(); @@ -110,17 +116,23 @@ impl Plugin for HanabiPlugin { .init_resource::() .init_resource::() .init_resource::() - .configure_sets(( - EffectSystems::PrepareEffects.in_set(RenderSet::Prepare), - EffectSystems::QueueEffects.in_set(RenderSet::Queue), - )) + .configure_sets( + Render, + ( + EffectSystems::PrepareEffects.in_set(RenderSet::Prepare), + EffectSystems::QueueEffects.in_set(RenderSet::Queue), + ), + ) .edit_schedule(ExtractSchedule, |schedule| { - schedule - .add_system(extract_effects) - .add_system(extract_effect_events); + schedule.add_systems((extract_effects, extract_effect_events)); }) - .add_system(prepare_effects.in_set(EffectSystems::PrepareEffects)) - .add_system(queue_effects.in_set(EffectSystems::QueueEffects)); + .add_systems( + Render, + ( + prepare_effects.in_set(EffectSystems::PrepareEffects), + queue_effects.in_set(EffectSystems::QueueEffects), + ), + ); // Register the draw function for drawing the particles. This will be called // during the main 2D/3D pass, at the Transparent2d/3d phase, after the diff --git a/src/render/mod.rs b/src/render/mod.rs index cdfc8394..d78625d2 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -2813,7 +2813,7 @@ impl Node for VfxSimulateDriverNode { _render_context: &mut RenderContext, _world: &World, ) -> Result<(), NodeRunError> { - graph.run_sub_graph(crate::plugin::simulate_graph::NAME, vec![])?; + graph.run_sub_graph(crate::plugin::simulate_graph::NAME, vec![], None)?; Ok(()) } } diff --git a/src/spawn.rs b/src/spawn.rs index 733e0115..750692a7 100644 --- a/src/spawn.rs +++ b/src/spawn.rs @@ -779,10 +779,9 @@ mod test { app.init_resource::