diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index da7ed8e5a9..fe2420a663 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -20,7 +20,19 @@ use super::{In, IntoSystem, ReadOnlySystem, SystemParamBuilder}; #[derive(Clone)] pub struct SystemMeta { pub(crate) name: Cow<'static, str>, + /// The set of component accesses for this system. This is used to determine + /// - soundness issues (e.g. multiple [`SystemParam`]s mutably accessing the same component) + /// - ambiguities in the schedule (e.g. two systems that have some sort of conflicting access) pub(crate) component_access_set: FilteredAccessSet, + /// This [`Access`] is used to determine which systems can run in parallel with each other + /// in the multithreaded executor. + /// + /// We use a [`ArchetypeComponentId`] as it is more precise than just checking [`ComponentId`]: + /// for example if you have one system with `Query<&mut T, With>` and one system with `Query<&mut T, With>` + /// they conflict if you just look at the [`ComponentId`] of `T`; but if there are no archetypes with + /// both `A`, `B` and `T` then in practice there's no risk of conflict. By using [`ArchetypeComponentId`] + /// we can be more precise because we can check if the existing archetypes of the [`World`] + /// cause a conflict pub(crate) archetype_component_access: Access, // NOTE: this must be kept private. making a SystemMeta non-send is irreversible to prevent // SystemParams from overriding each other