bevy/crates/bevy_render/src
James Liu 6d547d7ce6
Allow Mesh-related queue phase systems to parallelize (#11804)
# Objective
Partially addresses #3548. `queue_shadows` and `queue_material_meshes`
cannot parallelize because of the `ResMut<RenderMeshInstances>`
parameter for `queue_material_meshes`.

## Solution
Change the `material_bind_group` field to use atomics instead of needing
full mutable access. Change the `ResMut` to a `Res`, which should allow
both sets of systems to parallelize without issue.

## Performance
Tested against `many_foxes`, this has a significant improvement over the
entire render schedule. (Yellow is this PR, red is main)

![image](https://github.com/bevyengine/bevy/assets/3137680/6cc7f346-4f50-4f12-a383-682a9ce1daf6)

The use of atomics does seem to have a negative effect on
`queue_material_meshes` (roughly a 8.29% increase in time spent in the
system).

![image](https://github.com/bevyengine/bevy/assets/3137680/7907079a-863d-4760-aa5b-df68c006ea36)

`queue_shadows` seems to be ever so slightly slower (1.6% more time
spent) in the system.

![image](https://github.com/bevyengine/bevy/assets/3137680/6d90af73-b922-45e4-bae5-df200e8b9784)

`batch_and_prepare_render_phase` seems to be a mix, but overall seems to
be slightly *faster* by about 5%.

![image](https://github.com/bevyengine/bevy/assets/3137680/fac638ff-8c90-436b-9362-c6209b18957c)
2024-02-20 00:12:41 +00:00
..
batching optimize batch_and_prepare_render_phase (#11323) 2024-01-20 09:30:44 +00:00
camera Derive Reflect for Exposure (#11907) 2024-02-16 19:03:46 +00:00
color Replace deprecated elements (#10991) 2023-12-16 02:25:12 +00:00
mesh Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
primitives Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00
render_graph Rename Core Render Graph Labels (#11882) 2024-02-15 23:15:16 +00:00
render_phase Stop extracting mesh entities to the render world. (#11803) 2024-02-10 10:46:10 +00:00
render_resource Allow Mesh-related queue phase systems to parallelize (#11804) 2024-02-20 00:12:41 +00:00
renderer Multithreaded render command encoding (#9172) 2024-02-09 07:35:35 +00:00
texture Support optional clear color in ColorAttachment. (#11884) 2024-02-16 13:25:55 +00:00
view refactor: Extract parallel queue abstraction (#7348) 2024-02-19 16:31:15 +00:00
deterministic.rs Option to enable deterministic rendering (#11248) 2024-01-09 00:46:01 +00:00
extract_component.rs Revert rendering-related associated type name changes (#11027) 2024-01-22 15:01:55 +00:00
extract_instances.rs Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00
extract_param.rs Enable the unsafe_op_in_unsafe_fn lint (#11591) 2024-01-28 23:18:11 +00:00
extract_resource.rs Use warn_once where relevant instead of manually implementing a single warn check (#11693) 2024-02-05 21:05:43 +00:00
globals.rs Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +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 Reorder render sets, refactor bevy_sprite to take advantage (#9236) 2023-08-27 14:33:49 +00:00
lib.rs Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
maths.wgsl Use instancing for sprites (#9597) 2023-09-02 18:03:19 +00:00
pipelined_rendering.rs wait for render app when main world is dropped (#11737) 2024-02-08 14:09:17 +00:00
render_asset.rs Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
settings.rs Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +00:00
spatial_bundle.rs Implement Clone for VisibilityBundle and SpatialBundle (#10394) 2023-11-07 21:25:00 +00:00