Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguity checker emits a lot of warnings with default plugins #1868

Closed
jDomantas opened this issue Apr 10, 2021 · 7 comments
Closed

Ambiguity checker emits a lot of warnings with default plugins #1868

jDomantas opened this issue Apr 10, 2021 · 7 comments
Labels
A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@jDomantas
Copy link

Bevy version

0.5

Operating system & version

Windows 10

What you did

fn main() {
    App::build()
        .insert_resource(ReportExecutionOrderAmbiguities)
        .add_plugins(DefaultPlugins)
        .run();
}

What you expected to happen

No ambiguities reported.

What actually happened

My terminal was flooded with ambiguity warnings:

Apr 10 18:07:56.172  INFO bevy_ecs::schedule::stage: Execution order ambiguities detected, you might want to add an explicit dependency relation between some of these systems:                                                                                     
 * Parallel systems:                                                                                                                                                                                                                                                
 -- "&bevy_render::camera::active_cameras::active_cameras_system" and "&bevy_render::camera::camera::camera_system<bevy_render::camera::projection::OrthographicProjection>"                                                                                        
    conflicts: ["bevy_render::camera::camera::Camera"]                                                                                                                                                                                                              
 -- "&bevy_render::camera::active_cameras::active_cameras_system" and "&bevy_render::camera::camera::camera_system<bevy_render::camera::projection::PerspectiveProjection>"                                                                                         
    conflicts: ["bevy_render::camera::camera::Camera"]                                                                                                                                                                                                              
 -- "&bevy_render::camera::camera::camera_system<bevy_render::camera::projection::OrthographicProjection>" and "&bevy_render::camera::camera::camera_system<bevy_render::camera::projection::PerspectiveProjection>"                                                
    conflicts: ["bevy_render::camera::camera::Camera"]                                                                                                                                                                                                              
 -- "&bevy_ui::widget::text::text_system" and "&bevy_ui::widget::image::image_node_system"                                                                                                                                                                          
    conflicts: ["bevy_asset::assets::Assets<bevy_render::texture::texture::Texture>", "bevy_ui::ui_node::CalculatedSize"]                                                                                                                                           
 -- "&bevy_ui::widget::text::text_system" and "&bevy_text::text2d::text2d_system"                                                                                                                                                                                   
    conflicts: ["bevy_asset::assets::Assets<bevy_render::texture::texture::Texture>", "bevy_asset::assets::Assets<bevy_sprite::texture_atlas::TextureAtlas>", "bevy_asset::assets::Assets<bevy_text::font_atlas_set::FontAtlasSet>", "bevy_text::pipeline::TextPipel
ine<bevy_ecs::entity::Entity>"]                                                                                                                                                                                                                                     
 -- "&bevy_ui::widget::text::text_system" and "&bevy_sprite::sprite::sprite_system"                                                                                                                                                                                 
    conflicts: ["bevy_asset::assets::Assets<bevy_render::texture::texture::Texture>"]                                                                                                                                                                               
 -- "&bevy_ui::widget::image::image_node_system" and "&bevy_text::text2d::text2d_system"                                                                                                                                                                            
    conflicts: ["bevy_asset::assets::Assets<bevy_render::texture::texture::Texture>"]                                                                                                                                                                               
 -- "&bevy_ui::flex::flex_node_system" and "&bevy_transform::hierarchy::hierarchy_maintenance_system::parent_update_system"                                                                                                                                         
    conflicts: ["bevy_transform::components::children::Children"]                                                                                                                                                                                                   
 -- "&bevy_ui::update::ui_z_system" and "&bevy_transform::hierarchy::hierarchy_maintenance_system::parent_update_system"                                                                                                                                            
    conflicts: ["bevy_transform::components::children::Children"]                                                                                                                                                                                                   
 -- "&bevy_render::shader::shader_defs::asset_shader_defs_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::shader::shader_defs::asset_shader_defs_system<bevy_pbr::material::StandardMaterial>"                                               
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_text::text2d::text2d_system" and "&bevy_sprite::sprite::sprite_system"                                                                                                                                                                                   
    conflicts: ["bevy_asset::assets::Assets<bevy_render::texture::texture::Texture>"]                                                                                                                                                                               
 * Exclusive systems at start of stage:                                                                                                                                                                                                                             
 -- "bevy_winit::change_window" and "bevy_audio::audio_output::play_queued_audio_system<bevy_audio::audio_source::AudioSource>"                                                                                                                                     
                                                                                                                                                                                                                                                                    
Apr 10 18:07:56.214  INFO bevy_ecs::schedule::stage: Execution order ambiguities detected, you might want to add an explicit dependency relation between some of these systems:                                                                                     
 * Parallel systems:                                                                                                                                                                                                                                                
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_transform::component
s::global_transform::GlobalTransform>"                                                                                                                                                                                                                              
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::textur
e_atlas::TextureAtlas>"                                                                                                                                                                                                                                             
    conflicts: ["bevy_render::renderer::render_resource::render_resource_bindings::AssetRenderResourceBindings", "bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                        
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::texture_atla
s::TextureAtlasSprite>"                                                                                                                                                                                                                                             
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_ui::ui_node::Node>" 
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_pbr::material:
:StandardMaterial>"                                                                                                                                                                                                                                                 
    conflicts: ["bevy_render::renderer::render_resource::render_resource_bindings::AssetRenderResourceBindings", "bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                        
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::color_material::ColorMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::sprite::Spri
te>"                                                                                                                                                                                                                                                                
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_transform::components::global_transform::GlobalTransform>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_s
prite::texture_atlas::TextureAtlas>"                                                                                                                                                                                                                                
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_transform::components::global_transform::GlobalTransform>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite:
:texture_atlas::TextureAtlasSprite>"                                                                                                                                                                                                                                
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_transform::components::global_transform::GlobalTransform>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_ui::ui_
node::Node>"                                                                                                                                                                                                                                                        
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_transform::components::global_transform::GlobalTransform>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_p
br::material::StandardMaterial>"                                                                                                                                                                                                                                    
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_transform::components::global_transform::GlobalTransform>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite:
:sprite::Sprite>"                                                                                                                                                                                                                                                   
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlas>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::texture_atlas:
:TextureAtlasSprite>"                                                                                                                                                                                                                                               
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlas>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_ui::ui_node::Node>"   
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlas>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_pbr::material::S
tandardMaterial>"                                                                                                                                                                                                                                                   
    conflicts: ["bevy_render::renderer::render_resource::render_resource_bindings::AssetRenderResourceBindings", "bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                        
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlas>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::sprite::Sprite
>"                                                                                                                                                                                                                                                                  
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlasSprite>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_ui::ui_node::Node>"   
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlasSprite>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_pbr::material::S
tandardMaterial>"                                                                                                                                                                                                                                                   
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::texture_atlas::TextureAtlasSprite>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::sprite::Sprite
>"                                                                                                                                                                                                                                                                  
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::camera_node::camera_node_system" and "&bevy_render::render_graph::nodes::camera_node::camera_node_system"                                                                                                                   
    conflicts: ["bevy_render::camera::active_cameras::ActiveCameras"]                                                                                                                                                                                               
 -- "&bevy_render::render_graph::nodes::camera_node::camera_node_system" and "&bevy_render::render_graph::nodes::camera_node::camera_node_system"                                                                                                                   
    conflicts: ["bevy_render::camera::active_cameras::ActiveCameras"]                                                                                                                                                                                               
 -- "&bevy_render::render_graph::nodes::camera_node::camera_node_system" and "&bevy_render::render_graph::nodes::camera_node::camera_node_system"                                                                                                                   
    conflicts: ["bevy_render::camera::active_cameras::ActiveCameras"]                                                                                                                                                                                               
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_ui::ui_node::Node>" and "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_pbr::material::StandardMaterial>"       
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_ui::ui_node::Node>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::sprite::Sprite>"                      
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
 -- "&bevy_render::render_graph::nodes::render_resources_node::asset_render_resources_node_system<bevy_pbr::material::StandardMaterial>" and "&bevy_render::render_graph::nodes::render_resources_node::render_resources_node_system<bevy_sprite::sprite::Sprite>"  
    conflicts: ["bevy_render::pipeline::render_pipelines::RenderPipelines"]                                                                                                                                                                                         
                                                                                                                                                                                                                                                                    
Apr 10 18:07:56.238  INFO bevy_ecs::schedule::stage: Execution order ambiguities detected, you might want to add an explicit dependency relation between some of these systems:                                                                                     
 * Parallel systems:                                                                                                                                                                                                                                                
 -- "&bevy_render::pipeline::render_pipelines::draw_render_pipelines_system" and "&bevy_ui::widget::text::draw_text_system"                                                                                                                                         
    conflicts: ["bevy_asset::assets::Assets<bevy_render::shader::shader::Shader>", "bevy_asset::assets::Assets<bevy_render::pipeline::pipeline::PipelineDescriptor>", "bevy_render::pipeline::pipeline_compiler::PipelineCompiler", "bevy_render::renderer::render_r
esource::render_resource_bindings::RenderResourceBindings", "bevy_render::renderer::render_resource::render_resource_bindings::AssetRenderResourceBindings", "bevy_render::renderer::render_resource::shared_buffers::SharedBuffers", "bevy_render::draw::Draw"]    
 -- "&bevy_render::pipeline::render_pipelines::draw_render_pipelines_system" and "&bevy_text::text2d::draw_text2d_system"                                                                                                                                           
    conflicts: ["bevy_asset::assets::Assets<bevy_render::shader::shader::Shader>", "bevy_asset::assets::Assets<bevy_render::pipeline::pipeline::PipelineDescriptor>", "bevy_render::pipeline::pipeline_compiler::PipelineCompiler", "bevy_render::renderer::render_r
esource::render_resource_bindings::RenderResourceBindings", "bevy_render::renderer::render_resource::render_resource_bindings::AssetRenderResourceBindings", "bevy_render::renderer::render_resource::shared_buffers::SharedBuffers", "bevy_render::draw::Draw"]    
 -- "&bevy_ui::widget::text::draw_text_system" and "&bevy_text::text2d::draw_text2d_system"                                                                                                                                                                         
    conflicts: ["bevy_asset::assets::Assets<bevy_render::shader::shader::Shader>", "bevy_asset::assets::Assets<bevy_render::pipeline::pipeline::PipelineDescriptor>", "bevy_render::pipeline::pipeline_compiler::PipelineCompiler", "bevy_render::renderer::render_r
esource::render_resource_bindings::RenderResourceBindings", "bevy_render::renderer::render_resource::render_resource_bindings::AssetRenderResourceBindings", "bevy_render::renderer::render_resource::shared_buffers::SharedBuffers", "bevy_render::draw::Draw"]    
@TheRawMeatball
Copy link
Member

Hmm, this issue seems like the correct place to continue the discussion that started in #1606 :)

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Apr 10, 2021
@TehPers
Copy link
Contributor

TehPers commented Apr 11, 2021

This actually is part of the reason I've created stages that come after CoreStage::PreUpdate, CoreStage::Update, and CoreStage::PostUpdate. It's easier to filter for ambiguities in my own systems when they're in different stages than the ones added by the default plugins. (Of course, there's still some situations where I need to throw systems in the core stages, for example with a custom camera.)

@jakobhellermann
Copy link
Contributor

jakobhellermann commented Apr 12, 2021

An easy solution would be to allow filtering the ambiguities, something like

app.insert_resource(ReportExecutionOrderAmbiguities::filter(|name| name.contains(env!("CARGO_PKG_NAME")))

would only display the ambiguities in the current crate.

In the future (probably when there is an editor) there could be an .ambiguityignore file which allows you to easily mark a lot of ambiguities as fine without littering ambiguity sets all over the code.

@TheRawMeatball
Copy link
Member

Whoops, misclick 😅

@Ratysz
Copy link
Contributor

Ratysz commented Apr 13, 2021

The intended solution is to add all default systems into their own, private ambiguity set. This will need to be hardcoded; two options:

  • Individually: every default system is ascribed with the ambiguity set, either one by one or through system sets if possible. This is the correct way, but it's a bit grating for Bevy development. However, new systems implemented during further development will be able to check themselves for conflicts trivially.
  • Blanket: all systems present in the schedule when default things are initialized are automatically ascribed with the ambiguity set. This is minimally invasive, but we lose the use of the checker for Bevy development (if we don't do something else special to opt back in, of course). There's also the footgun of inserting user systems before default systems.

@alice-i-cecile alice-i-cecile added the C-Code-Quality A section of code that is hard to understand or change label Dec 12, 2021
@alice-i-cecile
Copy link
Member

Will be resolved-ish by #2766.

@nicopap nicopap moved this to Blocked in Scheduling Jan 31, 2023
@alice-i-cecile alice-i-cecile moved this from Blocked to PR needed in Scheduling Mar 2, 2023
@alice-i-cecile
Copy link
Member

This has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
Status: Needs Implementation
Development

No branches or pull requests

6 participants