From ba38e164db03a9541473dc214c5d63c0c12a943b Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:23:08 -0400 Subject: [PATCH 01/17] make stuff ambiguous --- crates/bevy_render/src/camera/projection.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 1f187b3729239..970b2b6322cb1 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -24,16 +24,24 @@ pub struct CameraUpdateSystem; impl Plugin for CameraProjectionPlugin { fn build(&self, app: &mut App) { + // Label for `camera_system`, shared across all monomorphizations. + #[derive(SystemLabel)] + struct GenericCameraSystem; + app.register_type::() .add_startup_system_to_stage( StartupStage::PostStartup, - crate::camera::camera_system::, + crate::camera::camera_system:: + .label(GenericCameraSystem) + .ambiguous_with(GenericCameraSystem), ) .add_system_to_stage( CoreStage::PostUpdate, crate::camera::camera_system:: .label(CameraUpdateSystem) - .after(ModifiesWindows), + .label(GenericCameraSystem) + .after(ModifiesWindows) + .ambiguous_with(GenericCameraSystem), ); } } From 9a75c26856586d2df1f8fec8095e640d501f1100 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:23:30 -0400 Subject: [PATCH 02/17] resolve `camera_system<>` ambiguities --- crates/bevy_render/src/camera/projection.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 970b2b6322cb1..7f6124c1b9e2b 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -32,6 +32,8 @@ impl Plugin for CameraPro .add_startup_system_to_stage( StartupStage::PostStartup, crate::camera::camera_system:: + // We assume that each camera will only have one projection, + // so we can ignore ambiguities with all other monormophizations. .label(GenericCameraSystem) .ambiguous_with(GenericCameraSystem), ) @@ -39,8 +41,10 @@ impl Plugin for CameraPro CoreStage::PostUpdate, crate::camera::camera_system:: .label(CameraUpdateSystem) - .label(GenericCameraSystem) .after(ModifiesWindows) + // We assume that each camera will only have one projection, + // so we can ignore ambiguities with all other monormophizations. + .label(GenericCameraSystem) .ambiguous_with(GenericCameraSystem), ); } From 4f79bd248f5246707505f67c3f03e9ca97e1cb69 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:24:13 -0400 Subject: [PATCH 03/17] resolve `update_frusta` ambiguities --- crates/bevy_render/src/view/visibility/mod.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index d6979ac5e0882..aa86a060d9eaa 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -194,21 +194,33 @@ impl Plugin for VisibilityPlugin { update_frusta:: .label(UpdateOrthographicFrusta) .after(camera_system::) - .after(TransformSystem::TransformPropagate), + .after(TransformSystem::TransformPropagate) + // We assume that no camera will have more than one projection component, + // so these systems will run independently of one another. + .ambiguous_with(update_frusta::) + .ambiguous_with(update_frusta::), ) .add_system_to_stage( CoreStage::PostUpdate, update_frusta:: .label(UpdatePerspectiveFrusta) .after(camera_system::) - .after(TransformSystem::TransformPropagate), + .after(TransformSystem::TransformPropagate) + // We assume that no camera will have more than one projection component, + // so these systems will run independently of one another. + .ambiguous_with(update_frusta::) + .ambiguous_with(update_frusta::), ) .add_system_to_stage( CoreStage::PostUpdate, update_frusta:: .label(UpdateProjectionFrusta) .after(camera_system::) - .after(TransformSystem::TransformPropagate), + .after(TransformSystem::TransformPropagate) + // We assume that no camera will have more than one projection component, + // so these systems will run independently of one another. + .ambiguous_with(update_frusta::) + .ambiguous_with(update_frusta::), ) .add_system_to_stage( CoreStage::PostUpdate, From b135aa168f28e11be01a4c7e2759e4a4ac349cb3 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:24:35 -0400 Subject: [PATCH 04/17] add a note about archetype invariants --- crates/bevy_render/src/camera/projection.rs | 1 + crates/bevy_render/src/view/visibility/mod.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 7f6124c1b9e2b..05ee79c2e69ed 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -34,6 +34,7 @@ impl Plugin for CameraPro crate::camera::camera_system:: // We assume that each camera will only have one projection, // so we can ignore ambiguities with all other monormophizations. + // FIXME: Add an archetype invariant for this, when that is supported. .label(GenericCameraSystem) .ambiguous_with(GenericCameraSystem), ) diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index aa86a060d9eaa..643ffa4b5cf09 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -197,6 +197,7 @@ impl Plugin for VisibilityPlugin { .after(TransformSystem::TransformPropagate) // We assume that no camera will have more than one projection component, // so these systems will run independently of one another. + // FIXME: Add an archetype invariant for this, when that is supported. .ambiguous_with(update_frusta::) .ambiguous_with(update_frusta::), ) From 39094381b8aae2a398ee54b38217c45fedc9dcbd Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:24:55 -0400 Subject: [PATCH 05/17] resolve a conflict between camera projections and ui text --- crates/bevy_render/src/camera/camera.rs | 5 +++++ crates/bevy_ui/src/lib.rs | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index df2be98df1b08..fa6edebd80966 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -366,6 +366,11 @@ impl RenderTarget { /// the app, as well as the runtime-selected [`Projection`]. The system runs during the /// [`CoreStage::PostUpdate`] stage. /// +/// ## World Resources +/// +/// [`Res>`] -- For cameras that render to an image, this resource is used to +/// inspect information about the render target. This system will not access any other image assets. +/// /// [`OrthographicProjection`]: crate::camera::OrthographicProjection /// [`PerspectiveProjection`]: crate::camera::PerspectiveProjection /// [`Projection`]: crate::camera::Projection diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 6e47967359214..f4660c60ade35 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -12,7 +12,7 @@ pub mod entity; pub mod update; pub mod widget; -use bevy_render::extract_component::ExtractComponentPlugin; +use bevy_render::{camera::CameraUpdateSystem, extract_component::ExtractComponentPlugin}; pub use flex::*; pub use focus::*; pub use geometry::*; @@ -104,7 +104,12 @@ impl Plugin for UiPlugin { CoreStage::PostUpdate, widget::text_system .before(UiSystem::Flex) - .after(ModifiesWindows), + .after(ModifiesWindows) + // Potential conflict: `Assets` + // In practice, they run independently since `bevy_render::camera_update_system` + // will only ever observe its own render target, and `widget::text_system` + // will never modify a pre-existing `Image` asset. + .ambiguous_with(CameraUpdateSystem), ) .add_system_to_stage( CoreStage::PostUpdate, From 1a7dcb46e55d5997a1c5a624c91db2bb4609a65e Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:25:27 -0400 Subject: [PATCH 06/17] remove a redundant system label --- crates/bevy_render/src/camera/projection.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 05ee79c2e69ed..21cbbd6066c8e 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -19,24 +19,23 @@ impl Default for CameraProjectionPlugin { } } +/// Label for [`camera_system`], shared accross all `T`. +/// +/// [`camera_system`]: crate::camera::camera_system #[derive(SystemLabel, Clone, Eq, PartialEq, Hash, Debug)] pub struct CameraUpdateSystem; impl Plugin for CameraProjectionPlugin { fn build(&self, app: &mut App) { - // Label for `camera_system`, shared across all monomorphizations. - #[derive(SystemLabel)] - struct GenericCameraSystem; - app.register_type::() .add_startup_system_to_stage( StartupStage::PostStartup, crate::camera::camera_system:: + .label(CameraUpdateSystem) // We assume that each camera will only have one projection, // so we can ignore ambiguities with all other monormophizations. // FIXME: Add an archetype invariant for this, when that is supported. - .label(GenericCameraSystem) - .ambiguous_with(GenericCameraSystem), + .ambiguous_with(CameraUpdateSystem), ) .add_system_to_stage( CoreStage::PostUpdate, @@ -45,8 +44,7 @@ impl Plugin for CameraPro .after(ModifiesWindows) // We assume that each camera will only have one projection, // so we can ignore ambiguities with all other monormophizations. - .label(GenericCameraSystem) - .ambiguous_with(GenericCameraSystem), + .ambiguous_with(CameraUpdateSystem), ); } } From 99a413c12c746e2acf9cec598dbd1064736c51f8 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:25:50 -0400 Subject: [PATCH 07/17] resolve ambiguity between projection and text layout --- crates/bevy_text/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index 277a51dd47c81..f39bf64e7fcb4 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -29,7 +29,7 @@ pub mod prelude { use bevy_app::prelude::*; use bevy_asset::AddAsset; use bevy_ecs::{schedule::IntoSystemDescriptor, system::Resource}; -use bevy_render::{RenderApp, RenderStage}; +use bevy_render::{camera::CameraUpdateSystem, RenderApp, RenderStage}; use bevy_sprite::SpriteSystem; use bevy_window::ModifiesWindows; use std::num::NonZeroUsize; @@ -72,7 +72,13 @@ impl Plugin for TextPlugin { .insert_resource(TextPipeline::default()) .add_system_to_stage( CoreStage::PostUpdate, - update_text2d_layout.after(ModifiesWindows), + update_text2d_layout + .after(ModifiesWindows) + // Potential conflict: `Assets` + // In practice, they run independently since `bevy_render::camera_update_system` + // will only ever observe its own render target, and `update_text2d_layout` + // will never modify a pre-existing `Image` asset. + .ambiguous_with(CameraUpdateSystem), ); if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { From 40d16758b520391077c7cba491564efe1acec81d Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:26:10 -0400 Subject: [PATCH 08/17] Link to the archetype invariant issue --- crates/bevy_render/src/camera/projection.rs | 3 ++- crates/bevy_render/src/view/visibility/mod.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 21cbbd6066c8e..0f8acfc5cf1bc 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -34,7 +34,7 @@ impl Plugin for CameraPro .label(CameraUpdateSystem) // We assume that each camera will only have one projection, // so we can ignore ambiguities with all other monormophizations. - // FIXME: Add an archetype invariant for this, when that is supported. + // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(CameraUpdateSystem), ) .add_system_to_stage( @@ -44,6 +44,7 @@ impl Plugin for CameraPro .after(ModifiesWindows) // We assume that each camera will only have one projection, // so we can ignore ambiguities with all other monormophizations. + // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(CameraUpdateSystem), ); } diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index 643ffa4b5cf09..016025f546a22 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -197,7 +197,7 @@ impl Plugin for VisibilityPlugin { .after(TransformSystem::TransformPropagate) // We assume that no camera will have more than one projection component, // so these systems will run independently of one another. - // FIXME: Add an archetype invariant for this, when that is supported. + // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(update_frusta::) .ambiguous_with(update_frusta::), ) @@ -209,6 +209,7 @@ impl Plugin for VisibilityPlugin { .after(TransformSystem::TransformPropagate) // We assume that no camera will have more than one projection component, // so these systems will run independently of one another. + // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(update_frusta::) .ambiguous_with(update_frusta::), ) @@ -220,6 +221,7 @@ impl Plugin for VisibilityPlugin { .after(TransformSystem::TransformPropagate) // We assume that no camera will have more than one projection component, // so these systems will run independently of one another. + // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(update_frusta::) .ambiguous_with(update_frusta::), ) From f9f816ae65a30c0eef2c670dec1fd3e7d2728224 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:26:36 -0400 Subject: [PATCH 09/17] resolve ambiguity between direction and spot lights --- crates/bevy_pbr/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 4a2fa66ec4714..12988ab56dda1 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -160,7 +160,11 @@ impl Plugin for PbrPlugin { .label(SimulationLightSystems::UpdateLightFrusta) // This must run after CheckVisibility because it relies on ComputedVisibility::is_visible() .after(VisibilitySystems::CheckVisibility) - .after(TransformSystem::TransformPropagate), + .after(TransformSystem::TransformPropagate) + // We assume that no entity will be both a directional light and a spot light, + // so these systems will run indepdently of one another. + // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. + .ambiguous_with(update_spot_light_frusta), ) .add_system_to_stage( CoreStage::PostUpdate, From 9add8002b6dc8a7f10d0f2bb3bd68aed96c4709d Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:26:56 -0400 Subject: [PATCH 10/17] remove some redundant explicit ambiguities --- crates/bevy_render/src/view/visibility/mod.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index 016025f546a22..3912774f64e9e 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -210,7 +210,6 @@ impl Plugin for VisibilityPlugin { // We assume that no camera will have more than one projection component, // so these systems will run independently of one another. // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. - .ambiguous_with(update_frusta::) .ambiguous_with(update_frusta::), ) .add_system_to_stage( @@ -218,12 +217,7 @@ impl Plugin for VisibilityPlugin { update_frusta:: .label(UpdateProjectionFrusta) .after(camera_system::) - .after(TransformSystem::TransformPropagate) - // We assume that no camera will have more than one projection component, - // so these systems will run independently of one another. - // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. - .ambiguous_with(update_frusta::) - .ambiguous_with(update_frusta::), + .after(TransformSystem::TransformPropagate), ) .add_system_to_stage( CoreStage::PostUpdate, From d6323d8b03983a6dd08e1fc673ecb800fa8624e0 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:27:15 -0400 Subject: [PATCH 11/17] Make a doc link more helpful --- crates/bevy_render/src/camera/camera.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index fa6edebd80966..0f4afbae34e46 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -368,7 +368,7 @@ impl RenderTarget { /// /// ## World Resources /// -/// [`Res>`] -- For cameras that render to an image, this resource is used to +/// [`Res>`](Assets) -- For cameras that render to an image, this resource is used to /// inspect information about the render target. This system will not access any other image assets. /// /// [`OrthographicProjection`]: crate::camera::OrthographicProjection From 794c18d36aef9439cae0feb06328e5709dadd946 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:27:35 -0400 Subject: [PATCH 12/17] resolve ambiguity between ui text and text layout --- crates/bevy_text/src/text2d.rs | 5 +++++ crates/bevy_ui/src/lib.rs | 6 +++++- crates/bevy_ui/src/widget/text.rs | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index 8097db3e5cddc..a8918d09d85a9 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -145,6 +145,11 @@ pub fn extract_text2d_sprite( /// Updates the layout and size information whenever the text or style is changed. /// This information is computed by the `TextPipeline` on insertion, then stored. +/// +/// ## World Resources +/// +/// [`ResMut>`](Assets) -- This system only adds new [`Image`] assets. +/// It does not modify or observe existing ones. #[allow(clippy::too_many_arguments)] pub fn update_text2d_layout( mut commands: Commands, diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index f4660c60ade35..9e5cd74f02f36 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -109,7 +109,11 @@ impl Plugin for UiPlugin { // In practice, they run independently since `bevy_render::camera_update_system` // will only ever observe its own render target, and `widget::text_system` // will never modify a pre-existing `Image` asset. - .ambiguous_with(CameraUpdateSystem), + .ambiguous_with(CameraUpdateSystem) + // Potential conflict: `Assets` + // Since both systems will only ever insert new [`Image`] assets, + // they will never observe each other's effects. + .ambiguous_with(bevy_text::update_text2d_layout), ) .add_system_to_stage( CoreStage::PostUpdate, diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index ddc7567f1b5e4..0aaa18fb9c239 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -36,6 +36,11 @@ pub fn text_constraint(min_size: Val, size: Val, max_size: Val, scale_factor: f6 /// Updates the layout and size information whenever the text or style is changed. /// This information is computed by the `TextPipeline` on insertion, then stored. +/// +/// ## World Resources +/// +/// [`ResMut>`](Assets) -- This system only adds new [`Image`] assets. +/// It does not modify or observe existing ones. #[allow(clippy::too_many_arguments)] pub fn text_system( mut commands: Commands, From b1e0a56d3e1195701b35e08942c2dc78a71b4046 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:27:56 -0400 Subject: [PATCH 13/17] filter out an ambiguity between direction lights and point clusters --- crates/bevy_pbr/src/light.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index 4d2fc0dca26db..dedf148d185ba 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -1416,7 +1416,11 @@ pub fn update_directional_light_frusta( &mut Frustum, &ComputedVisibility, ), - Or<(Changed, Changed)>, + ( + Or<(Changed, Changed)>, + // Prevents this query from conflicting with camera queries. + Without, + ), >, ) { for (transform, directional_light, mut frustum, visibility) in &mut views { From d8673f9f3ddf31e58e175e7063971417efa8a330 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:28:37 -0400 Subject: [PATCH 14/17] resolve a conflict between image nodes and text layout --- crates/bevy_ui/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 9e5cd74f02f36..86b35728b2b01 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -117,7 +117,12 @@ impl Plugin for UiPlugin { ) .add_system_to_stage( CoreStage::PostUpdate, - widget::image_node_system.before(UiSystem::Flex), + widget::image_node_system + .before(UiSystem::Flex) + // Potential conflict: `Assets` + // They run independently since `widget::image_node_system` will only ever observe + // its own UiImage, and `widget::text_system` will never modify a pre-existing `Image` asset. + .ambiguous_with(bevy_text::update_text2d_layout), ) .add_system_to_stage( CoreStage::PostUpdate, From 8e586703ce67adab68d23e45ce4c72da0bf262c9 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 18 Oct 2022 04:28:59 -0400 Subject: [PATCH 15/17] resolve conflicts between image ui and text ui --- crates/bevy_ui/src/lib.rs | 8 +++++--- crates/bevy_ui/src/widget/image.rs | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 86b35728b2b01..e1c73540c3ac0 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -119,10 +119,12 @@ impl Plugin for UiPlugin { CoreStage::PostUpdate, widget::image_node_system .before(UiSystem::Flex) - // Potential conflict: `Assets` + // Potential conflicts: `Assets` // They run independently since `widget::image_node_system` will only ever observe - // its own UiImage, and `widget::text_system` will never modify a pre-existing `Image` asset. - .ambiguous_with(bevy_text::update_text2d_layout), + // its own UiImage, and `widget::text_system` & `bevy_text::update_text2d_layout` + // will never modify a pre-existing `Image` asset. + .ambiguous_with(bevy_text::update_text2d_layout) + .ambiguous_with(widget::text_system), ) .add_system_to_stage( CoreStage::PostUpdate, diff --git a/crates/bevy_ui/src/widget/image.rs b/crates/bevy_ui/src/widget/image.rs index 7519d4966e126..2a8d806e59b89 100644 --- a/crates/bevy_ui/src/widget/image.rs +++ b/crates/bevy_ui/src/widget/image.rs @@ -2,12 +2,13 @@ use crate::{CalculatedSize, Size, UiImage, Val}; use bevy_asset::Assets; use bevy_ecs::{ component::Component, - query::With, + query::{With, Without}, reflect::ReflectComponent, system::{Query, Res}, }; use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize}; use bevy_render::texture::Image; +use bevy_text::Text; use serde::{Deserialize, Serialize}; /// Describes how to resize the Image node @@ -22,7 +23,7 @@ pub enum ImageMode { /// Updates calculated size of the node based on the image provided pub fn image_node_system( textures: Res>, - mut query: Query<(&mut CalculatedSize, &UiImage), With>, + mut query: Query<(&mut CalculatedSize, &UiImage), (With, Without)>, ) { for (mut calculated_size, image) in &mut query { if let Some(texture) = textures.get(image) { From 7221ecdf36a39f3f3f1f8f350643b33973c8717c Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Mon, 24 Oct 2022 09:40:59 -0400 Subject: [PATCH 16/17] bump ci Revert "bump ci" This reverts commit 1280ff72f820b4a9ccddf353e88b10046bf858b4. From 3321e9fa91d077c79a3b8b176cdebe8fe817fdd7 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 25 Oct 2022 18:05:35 -0400 Subject: [PATCH 17/17] Apply suggestions from code review Co-authored-by: Mike --- crates/bevy_render/src/camera/projection.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 0f8acfc5cf1bc..e7d55758183ca 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -33,7 +33,7 @@ impl Plugin for CameraPro crate::camera::camera_system:: .label(CameraUpdateSystem) // We assume that each camera will only have one projection, - // so we can ignore ambiguities with all other monormophizations. + // so we can ignore ambiguities with all other monomorphizations. // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(CameraUpdateSystem), ) @@ -43,7 +43,7 @@ impl Plugin for CameraPro .label(CameraUpdateSystem) .after(ModifiesWindows) // We assume that each camera will only have one projection, - // so we can ignore ambiguities with all other monormophizations. + // so we can ignore ambiguities with all other monomorphizations. // FIXME: Add an archetype invariant for this https://github.com/bevyengine/bevy/issues/1481. .ambiguous_with(CameraUpdateSystem), );