bevy/crates/bevy_render/src
Brian Reavis dacb77d745
Parallelize prepare_assets::<T> systems (#17914)
# Objective

Because `prepare_assets::<T>` had a mutable reference to the
`RenderAssetBytesPerFrame` resource, no render asset preparation could
happen in parallel. This PR fixes this by using an `AtomicUsize` to
count bytes written (if there's a limit in place), so that the system
doesn't need mutable access.

- Related: https://github.com/bevyengine/bevy/pull/12622

**Before**
<img width="1049" alt="Screenshot 2025-02-17 at 11 40 53 AM"
src="https://github.com/user-attachments/assets/040e6184-1192-4368-9597-5ceda4b8251b"
/>

**After**
<img width="836" alt="Screenshot 2025-02-17 at 1 38 37 PM"
src="https://github.com/user-attachments/assets/95488796-3323-425c-b0a6-4cf17753512e"
/>

## Testing

- Tested on a local project (with and without limiting enabled)
- Someone with more knowledge of wgpu/underlying driver guts should
confirm that this doesn't actually bite us by introducing contention
(i.e. if buffer writing really *should be* serial).
2025-03-10 05:01:12 +00:00
..
batching Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
camera Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
diagnostic Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
experimental Implement occlusion culling for directional light shadow maps. (#17951) 2025-02-21 05:56:15 +00:00
mesh Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
primitives Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
render_graph Implement experimental GPU two-phase occlusion culling for the standard 3D mesh pipeline. (#17413) 2025-01-27 05:02:46 +00:00
render_phase Cache opaque deferred entities so we don't have to continuously re-queue them. (#18007) 2025-02-24 21:44:24 +00:00
render_resource Decoupled naga for wgpu testing (#18099) 2025-03-09 21:49:48 +00:00
renderer Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
texture Allowed creating uninitialized images (for use as storage textures) (#17760) 2025-02-10 22:22:07 +00:00
view Remove ChildOf::get and Deref impl (#18080) 2025-02-27 23:11:03 +00:00
alpha.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
bindless.wgsl Use global binding arrays for bindless resources. (#17898) 2025-02-21 05:55:36 +00:00
color_operations.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
extract_component.rs Replace internal uses of insert_or_spawn_batch (#18035) 2025-03-06 16:16:36 +00:00
extract_instances.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
extract_param.rs Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
extract_resource.rs Fix "Unrecognized Option" error when using Criterion-specific arguments in benchmarks (#17222) 2025-01-08 00:09:31 +00:00
globals.rs Weak handle migration (#17695) 2025-02-05 22:44:20 +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 Replace internal uses of insert_or_spawn_batch (#18035) 2025-03-06 16:16:36 +00:00
gpu_readback.rs Upgrade to wgpu v24 (#17542) 2025-02-09 19:40:53 +00:00
lib.rs Parallelize prepare_assets::<T> systems (#17914) 2025-03-10 05:01:12 +00:00
maths.wgsl Atmosphere LUT parameterization improvements (#17555) 2025-02-03 21:52:11 +00:00
pipelined_rendering.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
render_asset.rs Parallelize prepare_assets::<T> systems (#17914) 2025-03-10 05:01:12 +00:00
settings.rs Upgrade to wgpu v24 (#17542) 2025-02-09 19:40:53 +00:00
storage.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
sync_component.rs Refactored ComponentHook Parameters into HookContext (#17503) 2025-01-23 02:45:24 +00:00
sync_world.rs Fix unsound query transmutes on queries obtained from Query::as_readonly() (#17973) 2025-03-04 19:26:31 +00:00