mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Fix system param warnings on systems that cannot run anyways (#15397)
# Objective Fix "system skipped" warnings when validation fails on systems that wouldn't run because of run conditions. ## Solution > I think the error is from a system defined as: > > ```rust > no_gpu_preprocessing::batch_and_prepare_sorted_render_phase::<SPI, GFBD> > .run_if(resource_exists::<BatchedInstanceBuffer<GFBD::BufferData>>), > ``` > > So the `run_if` was preventing the panics. Maybe we need to skip validation if `!system_conditions_met`, or at least silence the warning in that case. *By @chescock in https://discord.com/channels/691052431525675048/692572690833473578/1287865365312831562* Validation of system is skipped if the system was already skipped by run conditions. ## Testing Ran alien addict example, no more warnings.
This commit is contained in:
parent
de3c70a8d3
commit
740d1cc9ff
3 changed files with 23 additions and 23 deletions
|
@ -568,19 +568,19 @@ impl ExecutorState {
|
|||
|
||||
should_run &= system_conditions_met;
|
||||
|
||||
// SAFETY:
|
||||
// - The caller ensures that `world` has permission to read any data
|
||||
// required by the system.
|
||||
// - `update_archetype_component_access` has been called for system.
|
||||
let valid_params = unsafe { system.validate_param_unsafe(world) };
|
||||
|
||||
if !valid_params {
|
||||
warn_system_skipped!("System", system.name());
|
||||
self.skipped_systems.insert(system_index);
|
||||
if should_run {
|
||||
// SAFETY:
|
||||
// - The caller ensures that `world` has permission to read any data
|
||||
// required by the system.
|
||||
// - `update_archetype_component_access` has been called for system.
|
||||
let valid_params = unsafe { system.validate_param_unsafe(world) };
|
||||
if !valid_params {
|
||||
warn_system_skipped!("System", system.name());
|
||||
self.skipped_systems.insert(system_index);
|
||||
}
|
||||
should_run &= valid_params;
|
||||
}
|
||||
|
||||
should_run &= valid_params;
|
||||
|
||||
should_run
|
||||
}
|
||||
|
||||
|
|
|
@ -81,14 +81,14 @@ impl SystemExecutor for SimpleExecutor {
|
|||
should_run &= system_conditions_met;
|
||||
|
||||
let system = &mut schedule.systems[system_index];
|
||||
let valid_params = system.validate_param(world);
|
||||
|
||||
if !valid_params {
|
||||
warn_system_skipped!("System", system.name());
|
||||
if should_run {
|
||||
let valid_params = system.validate_param(world);
|
||||
if !valid_params {
|
||||
warn_system_skipped!("System", system.name());
|
||||
}
|
||||
should_run &= valid_params;
|
||||
}
|
||||
|
||||
should_run &= valid_params;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
should_run_span.exit();
|
||||
|
||||
|
|
|
@ -87,14 +87,14 @@ impl SystemExecutor for SingleThreadedExecutor {
|
|||
should_run &= system_conditions_met;
|
||||
|
||||
let system = &mut schedule.systems[system_index];
|
||||
let valid_params = system.validate_param(world);
|
||||
|
||||
if !valid_params {
|
||||
warn_system_skipped!("System", system.name());
|
||||
if should_run {
|
||||
let valid_params = system.validate_param(world);
|
||||
if !valid_params {
|
||||
warn_system_skipped!("System", system.name());
|
||||
}
|
||||
should_run &= valid_params;
|
||||
}
|
||||
|
||||
should_run &= valid_params;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
should_run_span.exit();
|
||||
|
||||
|
|
Loading…
Reference in a new issue