bevy/crates
James Liu c5e89894f4 Remove task_pool parameter from par_for_each(_mut) (#4705)
# Objective
Fixes #3183. Requiring a `&TaskPool` parameter is sort of meaningless if the only correct one is to use the one provided by `Res<ComputeTaskPool>` all the time.

## Solution
Have `QueryState` save a clone of the `ComputeTaskPool` which is used for all `par_for_each` functions.

~~Adds a small overhead of the internal `Arc` clone as a part of the startup, but the ergonomics win should be well worth this hardly-noticable overhead.~~

Updated the docs to note that it will panic the task pool is not present as a resource.

# Future Work
If https://github.com/bevyengine/rfcs/pull/54 is approved, we can replace these resource lookups with a static function call instead to get the `ComputeTaskPool`.

---

## Changelog
Removed: The `task_pool` parameter of `Query(State)::par_for_each(_mut)`. These calls will use the `World`'s `ComputeTaskPool` resource instead.

## Migration Guide
The `task_pool` parameter for `Query(State)::par_for_each(_mut)` has been removed. Remove these parameters from all calls to these functions.

Before:
```rust
fn parallel_system(
   task_pool: Res<ComputeTaskPool>,
   query: Query<&MyComponent>,
) {
   query.par_for_each(&task_pool, 32, |comp| {
        ...
   });
}
```

After:

```rust
fn parallel_system(query: Query<&MyComponent>) {
   query.par_for_each(32, |comp| {
        ...
   });
}
```

If using `Query(State)` outside of a system run by the scheduler, you may need to manually configure and initialize a `ComputeTaskPool` as a resource in the `World`.
2022-05-30 16:59:38 +00:00
..
bevy_animation Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_app Make bevy_app's optional bevy_reflect dependency actually optional (#4846) 2022-05-26 02:04:22 +00:00
bevy_asset Update ndk-glue requirement from 0.5 to 0.6 (#3624) 2022-05-16 18:32:26 +00:00
bevy_audio Add missing audio/ogg file extensions: .oga, .spx (#4703) 2022-05-09 13:37:40 +00:00
bevy_core Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_core_pipeline Allow minimising in 2d (#4527) 2022-05-30 15:32:48 +00:00
bevy_derive Decouple some dependencies (#3886) 2022-04-27 19:08:11 +00:00
bevy_diagnostic Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_dylib Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_dynamic_plugin Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_ecs Remove task_pool parameter from par_for_each(_mut) (#4705) 2022-05-30 16:59:38 +00:00
bevy_ecs_compile_fail_tests Make derived SystemParam readonly if possible (#4650) 2022-05-09 16:09:33 +00:00
bevy_encase_derive Migrate to encase from crevice (#4339) 2022-05-18 21:09:21 +00:00
bevy_gilrs Change gamepad.rs tuples to normal structs (#4519) 2022-05-02 13:20:55 +00:00
bevy_gltf Fixing confusing near and far fields in Camera (#4457) 2022-05-16 16:37:33 +00:00
bevy_hierarchy Support returning data out of with_children (#4708) 2022-05-17 22:37:51 +00:00
bevy_input Update keyboard.rs docs in bevy_input (#4517) 2022-05-17 04:16:54 +00:00
bevy_internal Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_log Update tracing-tracy requirement from 0.8.0 to 0.9.0 (#4786) 2022-05-27 11:54:57 +00:00
bevy_macro_utils bevy_reflect_derive: Tidying up the code (#4712) 2022-05-12 19:43:23 +00:00
bevy_math Document bevy_math (#4591) 2022-04-26 18:23:29 +00:00
bevy_pbr Use uniform buffer usage for SkinnedMeshUniform instead of all usages (#4816) 2022-05-20 22:05:32 +00:00
bevy_ptr bevy_ptr works in no_std environments (#4760) 2022-05-16 17:45:10 +00:00
bevy_reflect bevy_reflect: Improve debug formatting for reflected types (#4218) 2022-05-30 16:41:31 +00:00
bevy_render OrthographicProjection: place origin at integer pixel with WindowSize scaling mode (#4085) 2022-05-30 15:14:12 +00:00
bevy_scene Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_sprite Migrate to encase from crevice (#4339) 2022-05-18 21:09:21 +00:00
bevy_tasks Remove unused CountdownEvent (#4290) 2022-04-26 21:20:12 +00:00
bevy_text Update layout/style when scale factor changes too (#4689) 2022-05-09 14:18:02 +00:00
bevy_time Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_transform Nightly clippy fixes (#3491) 2022-05-17 04:38:03 +00:00
bevy_ui Allow minimising in 2d (#4527) 2022-05-30 15:32:48 +00:00
bevy_utils Make public macros more robust with $crate (#4655) 2022-05-06 19:29:45 +00:00
bevy_window Improve docs and naming for RawWindowHandle functionality (#4335) 2022-05-26 00:09:23 +00:00
bevy_winit Optionally resize Window canvas element to fit parent element (#4726) 2022-05-20 23:13:48 +00:00