bevy/crates/bevy_render/src
Joseph ddbfa48711
Simplify parallel iteration methods (#8854)
# Objective

The `QueryParIter::for_each_mut` function is required when doing
parallel iteration with mutable queries.
This results in an unfortunate stutter:
`query.par_iter_mut().par_for_each_mut()` ('mut' is repeated).

## Solution

- Make `for_each` compatible with mutable queries, and deprecate
`for_each_mut`. In order to prevent `for_each` from being called
multiple times in parallel, we take ownership of the QueryParIter.

---

## Changelog

- `QueryParIter::for_each` is now compatible with mutable queries.
`for_each_mut` has been deprecated as it is now redundant.

## Migration Guide

The method `QueryParIter::for_each_mut` has been deprecated and is no
longer functional. Use `for_each` instead, which now supports mutable
queries.

```rust
// Before:
query.par_iter_mut().for_each_mut(|x| ...);

// After:
query.par_iter_mut().for_each(|x| ...);
```

The method `QueryParIter::for_each` now takes ownership of the
`QueryParIter`, rather than taking a shared reference.

```rust
// Before:
let par_iter = my_query.par_iter().batching_strategy(my_batching_strategy);
par_iter.for_each(|x| {
    // ...Do stuff with x...
    par_iter.for_each(|y| {
        // ...Do nested stuff with y...
    });
});

// After:
my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|x| {
    // ...Do stuff with x...
    my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|y| {
        // ...Do nested stuff with y...
    });
});
```
2023-07-23 11:09:24 +00:00
..
camera Return URect instead of (UVec2, UVec2) in Camera::physical_viewport_rect (#9085) 2023-07-15 21:25:22 +00:00
color bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
mesh Fix doc typo (#9162) 2023-07-15 21:11:07 +00:00
primitives bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
render_graph Add ViewNode to simplify render node management (#8118) 2023-05-08 19:42:23 +00:00
render_phase Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
render_resource Add GpuArrayBuffer and BatchedUniformBuffer (#8204) 2023-07-21 16:46:56 +00:00
renderer Refs #8975 -- Add return to RenderDevice::poll() (#8977) 2023-06-28 01:05:03 +00:00
texture Fix panic whilst loading UASTC encoded ktx2 textures (#9158) 2023-07-23 01:27:37 +00:00
view Simplify parallel iteration methods (#8854) 2023-07-23 11:09:24 +00:00
extract_component.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
extract_param.rs Use UnsafeWorldCell to increase code quality for SystemParam (#8174) 2023-04-01 15:45:07 +00:00
extract_resource.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
globals.rs Webgpu support (#8336) 2023-05-04 22:07:57 +00:00
globals.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
gpu_component_array_buffer.rs Add GpuArrayBuffer and BatchedUniformBuffer (#8204) 2023-07-21 16:46:56 +00:00
lib.rs Add GpuArrayBuffer and BatchedUniformBuffer (#8204) 2023-07-21 16:46:56 +00:00
pipelined_rendering.rs Stop using unwrap in the pipelined rendering thread (#9052) 2023-07-23 01:06:25 +00:00
render_asset.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
settings.rs Webgpu support (#8336) 2023-05-04 22:07:57 +00:00
spatial_bundle.rs enum Visibility component (#6320) 2022-12-25 00:39:29 +00:00