bevy/crates/bevy_pbr/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
..
atmosphere Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
cluster Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
decal Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
deferred Remove prepasses from the render world when they're removed from the main world. (#17565) 2025-02-14 06:43:35 +00:00
light Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
light_probe Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
lightmap Weak handle migration (#17695) 2025-02-05 22:44:20 +00:00
meshlet Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
prepass Allow prepass to run without ATTRIBUTE_NORMAL (#17881) 2025-02-24 21:22:34 +00:00
render Partially fix panics when setting WGPU_SETTINGS_PRIO=webgl2 (#18113) 2025-03-09 20:14:27 +00:00
ssao Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
ssr Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
volumetric_fog Parallelize prepare_assets::<T> systems (#17914) 2025-03-10 05:01:12 +00:00
components.rs Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
extended_material.rs Use global binding arrays for bindless resources. (#17898) 2025-02-21 05:55:36 +00:00
fog.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
lib.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
material_bind_groups.rs Add a new #[data] attribute to AsBindGroup that allows packing data for multiple materials into a single array. (#17965) 2025-02-24 21:38:55 +00:00
material.rs Reextract meshes when their material assets change. (#18123) 2025-03-03 06:28:33 +00:00
mesh_material.rs impl Eq/PartialEq for MeshMaterial{2|3}d (#17990) 2025-02-23 23:58:10 +00:00
parallax.rs
pbr_material.rs Add a new #[data] attribute to AsBindGroup that allows packing data for multiple materials into a single array. (#17965) 2025-02-24 21:38:55 +00:00
wireframe.rs Replace internal uses of insert_or_spawn_batch (#18035) 2025-03-06 16:16:36 +00:00