Skip to content

Conversation

andriyDev
Copy link
Contributor

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.

@andriyDev andriyDev added A-Assets Load files from disk to use for things like images, models, and sounds D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Refinement Improves output quality, without fixing a clear bug or adding new functionality. labels Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Refinement Improves output quality, without fixing a clear bug or adding new functionality. D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant