Add report_sets option to ScheduleBuildSettings (#7756)
				
					
				
			# Objective - Fixes #7442. ## Solution - Added `report_sets` option to `ScheduleBuildSettings` like described in the linked issue. The output of the `3d_scene` example when reporting ambiguities with `report_sets` and `use_shortnames` set to `true` (and with #7755 applied) now looks like this: ``` 82 pairs of systems with conflicting data access have indeterminate execution order. Consider adding `before`, `after`, or `ambiguous_with` relationships between these: -- filesystem_watcher_system (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<DynamicScene> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<Scene> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<Shader> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<Mesh> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<SkinnedMeshInverseBindposes> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<Image> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<TextureAtlas> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<ColorMaterial> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<Font> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<FontAtlasSet> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<StandardMaterial> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<Gltf> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<GltfNode> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<GltfPrimitive> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<GltfMesh> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<AudioSource> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<AudioSink> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- update_asset_storage_system<AnimationClip> (LoadAssets) and apply_system_buffers (FirstFlush) conflict on: bevy_ecs::world::World -- scene_spawner_system (Update) and close_when_requested (Update) conflict on: bevy_ecs::world::World -- exit_on_all_closed (PostUpdate) and apply_system_buffers (CalculateBoundsFlush, PostUpdate) conflict on: bevy_ecs::world::World -- exit_on_all_closed (PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- camera_system<Projection> (CameraUpdateSystem, PostUpdate) and apply_system_buffers (CalculateBoundsFlush, PostUpdate) conflict on: bevy_ecs::world::World -- camera_system<Projection> (CameraUpdateSystem, PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- camera_system<OrthographicProjection> (CameraUpdateSystem, PostUpdate) and apply_system_buffers (CalculateBoundsFlush, PostUpdate) conflict on: bevy_ecs::world::World -- camera_system<OrthographicProjection> (CameraUpdateSystem, PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- camera_system<PerspectiveProjection> (CameraUpdateSystem, PostUpdate) and apply_system_buffers (CalculateBoundsFlush, PostUpdate) conflict on: bevy_ecs::world::World -- camera_system<PerspectiveProjection> (CameraUpdateSystem, PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- calculate_bounds (CalculateBounds, PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and visibility_propagate_system (PostUpdate, VisibilityPropagate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_text2d_layout (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and ui_stack_system (PostUpdate, Stack) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and text_system (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_image_calculated_size_system (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and flex_node_system (Flex, PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and add_clusters (AddClusters, PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and play_queued_audio_system<AudioSource> (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and animation_player (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and propagate_transforms (PostUpdate, TransformPropagate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and sync_simple_transforms (PostUpdate, TransformPropagate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_directional_light_cascades (PostUpdate, UpdateDirectionalLightCascades) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_clipping_system (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_frusta<Projection> (PostUpdate, UpdateProjectionFrusta) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_frusta<PerspectiveProjection> (PostUpdate, UpdatePerspectiveFrusta) conflict on: bevy_ecs::world::World -- apply_system_buffers (CalculateBoundsFlush, PostUpdate) and update_frusta<OrthographicProjection> (PostUpdate, UpdateOrthographicFrusta) conflict on: bevy_ecs::world::World -- visibility_propagate_system (PostUpdate, VisibilityPropagate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- update_text2d_layout (PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- ui_stack_system (PostUpdate, Stack) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- text_system (PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- update_image_calculated_size_system (PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- flex_node_system (Flex, PostUpdate) and apply_system_buffers (AddClustersFlush, PostUpdate) conflict on: bevy_ecs::world::World -- flex_node_system (Flex, PostUpdate) and animation_player (PostUpdate) conflict on: ["bevy_transform::components::transform::Transform"] -- apply_system_buffers (AddClustersFlush, PostUpdate) and play_queued_audio_system<AudioSource> (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and animation_player (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and propagate_transforms (PostUpdate, TransformPropagate) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and sync_simple_transforms (PostUpdate, TransformPropagate) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and update_directional_light_cascades (PostUpdate, UpdateDirectionalLightCascades) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and update_clipping_system (PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and update_frusta<Projection> (PostUpdate, UpdateProjectionFrusta) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and update_frusta<PerspectiveProjection> (PostUpdate, UpdatePerspectiveFrusta) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and update_frusta<OrthographicProjection> (PostUpdate, UpdateOrthographicFrusta) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and check_visibility (CheckVisibility, PostUpdate) conflict on: bevy_ecs::world::World -- apply_system_buffers (AddClustersFlush, PostUpdate) and update_directional_light_frusta (PostUpdate, UpdateLightFrusta) conflict on: bevy_ecs::world::World -- Assets<Scene>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<Shader>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<Mesh>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<SkinnedMeshInverseBindposes>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<Image>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<TextureAtlas>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<ColorMaterial>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<Font>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<FontAtlasSet>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<StandardMaterial>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<Gltf>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<GltfNode>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<GltfPrimitive>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<GltfMesh>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<AudioSource>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<AudioSink>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<AnimationClip>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World -- Assets<DynamicScene>::asset_event_system (AssetEvents) and apply_system_buffers (PostUpdateFlush) conflict on: bevy_ecs::world::World ``` Co-authored-by: Edgar Geier <geieredgar@gmail.com>
This commit is contained in:
		
							parent
							
								
									e1a8123145
								
							
						
					
					
						commit
						acff2210c0
					
				| @ -1322,7 +1322,21 @@ impl ScheduleGraph { | ||||
| impl ScheduleGraph { | ||||
|     fn get_node_name(&self, id: &NodeId) -> String { | ||||
|         let mut name = match id { | ||||
|             NodeId::System(_) => self.systems[id.index()].get().unwrap().name().to_string(), | ||||
|             NodeId::System(_) => { | ||||
|                 let name = self.systems[id.index()].get().unwrap().name().to_string(); | ||||
|                 if self.settings.report_sets { | ||||
|                     let sets = self.names_of_sets_containing_node(id); | ||||
|                     if sets.is_empty() { | ||||
|                         name | ||||
|                     } else if sets.len() == 1 { | ||||
|                         format!("{name} (in set {})", sets[0]) | ||||
|                     } else { | ||||
|                         format!("{name} (in sets {})", sets.join(", ")) | ||||
|                     } | ||||
|                 } else { | ||||
|                     name | ||||
|                 } | ||||
|             } | ||||
|             NodeId::Set(_) => self.system_sets[id.index()].name(), | ||||
|         }; | ||||
|         if self.settings.use_shortnames { | ||||
| @ -1453,6 +1467,27 @@ impl ScheduleGraph { | ||||
| 
 | ||||
|         warn!("{}", string); | ||||
|     } | ||||
| 
 | ||||
|     fn traverse_sets_containing_node(&self, id: NodeId, f: &mut impl FnMut(NodeId) -> bool) { | ||||
|         for (set_id, _, _) in self.hierarchy.graph.edges_directed(id, Direction::Incoming) { | ||||
|             if f(set_id) { | ||||
|                 self.traverse_sets_containing_node(set_id, f); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fn names_of_sets_containing_node(&self, id: &NodeId) -> Vec<String> { | ||||
|         let mut sets = HashSet::new(); | ||||
|         self.traverse_sets_containing_node(*id, &mut |set_id| { | ||||
|             !self.system_sets[set_id.index()].is_system_type() && sets.insert(set_id) | ||||
|         }); | ||||
|         let mut sets: Vec<_> = sets | ||||
|             .into_iter() | ||||
|             .map(|set_id| self.get_node_name(&set_id)) | ||||
|             .collect(); | ||||
|         sets.sort(); | ||||
|         sets | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /// Category of errors encountered during schedule construction.
 | ||||
| @ -1525,13 +1560,23 @@ pub enum LogLevel { | ||||
| pub struct ScheduleBuildSettings { | ||||
|     /// Determines whether the presence of ambiguities (systems with conflicting access but indeterminate order)
 | ||||
|     /// is only logged or also results in an [`Ambiguity`](ScheduleBuildError::Ambiguity) error.
 | ||||
|     ///
 | ||||
|     /// Defaults to [`LogLevel::Ignore`].
 | ||||
|     pub ambiguity_detection: LogLevel, | ||||
|     /// Determines whether the presence of redundant edges in the hierarchy of system sets is only
 | ||||
|     /// logged or also results in a [`HierarchyRedundancy`](ScheduleBuildError::HierarchyRedundancy)
 | ||||
|     /// error.
 | ||||
|     ///
 | ||||
|     /// Defaults to [`LogLevel::Warn`].
 | ||||
|     pub hierarchy_detection: LogLevel, | ||||
|     /// If set to true, node names will be shortened instead of the fully qualified type path.
 | ||||
|     ///
 | ||||
|     /// Defaults to `true`.
 | ||||
|     pub use_shortnames: bool, | ||||
|     /// If set to true, report all system sets the conflicting systems are part of.
 | ||||
|     ///
 | ||||
|     /// Defaults to `true`.
 | ||||
|     pub report_sets: bool, | ||||
| } | ||||
| 
 | ||||
| impl Default for ScheduleBuildSettings { | ||||
| @ -1545,7 +1590,8 @@ impl ScheduleBuildSettings { | ||||
|         Self { | ||||
|             ambiguity_detection: LogLevel::Ignore, | ||||
|             hierarchy_detection: LogLevel::Warn, | ||||
|             use_shortnames: false, | ||||
|             use_shortnames: true, | ||||
|             report_sets: true, | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Edgar Geier
						Edgar Geier