You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Send the entire loaded asset instead of decomposing it on the loader task. (bevyengine#21204)
# Objective
- The previous state had the loader task send a single
`InternalAssetEvent::Loaded` for every root asset **and** each of its
subassets. The `handle_internal_asset_events` system reads these events
one at a time. This means these two threads are racing. So it's possible
to see some of the subassets loaded without the root asset being loaded
in a frame, and then have to wait an additional frame to see the
remaining subassets and root asset loaded.
## Solution
- Instead of recursively sending the subassets inside the loader task,
just send the `LoadedAsset` in its entirety.
- Do the recursion when processing the loaded asset. Since we're doing
this in the system, the entire loaded asset will be processed in a
single frame.
- This also reduces contention of the channel.
## Testing
- None. This is kinda a "fake issue". In order to see it, handling a
loaded asset in `handle_internal_asset_events` needs to finish the last
received subasset before the loader task sends the root asset. This is
probably pretty unlikely, but could in theory cause flaky tests.
0 commit comments