This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements a revision of the existing resources, assets, and loader system to add support for delayed or streamed loading.
Currently loading has to happen synchronously: a
staging-areais populated with desired assets and resources. The area is sorted by dependencies between the resources and assets, and incrementally repopulated as new dependencies and resource artefacts emerge from loading an asset's data. This is fine and convenient, but it does not allow for data to be loaded in the background, forcing either synchronous loads during gameplay introducing lag stutters, or forcing long load screens to preload as much data as possible.This PR aims to separate loading into two phases, if desired:
allocatedminimally, only loading as little data into them as absolutely necessary. Other resources like framebuffers, shaders, etc. are loaded as before.In order to achieve this the following needs to be done:
deferrable-resourceis introduced. Resources of this type can be loaded minimally.allocatewhen called on adeferrable-resourcewill perform minimal allocation, rather than full allocation.loadwhen called on adeferrable-resourcewill perform full allocation with data loading. The resource's data field must be properly populated before this function can be called. Alternatively, the standardupdate-buffer-dataorresize-buffermay be used as well.deferrable-assetis introduced. Assets of this type can be loaded minimally.allocatewhen called on adeferrable-assetwill perform minimal loading, only producing as much metadata as necessary for standard operation, and producingdeferrable-resourceinstances that are "close enough" to the real resource type once loaded fully.loadwhen called on adeferrable-assetwill perform full allocation with data loading. The data of resources it generates will be populated fully so that they may beloaded as well.deferred-staging-areais introduced. Whencommitis called on such an area, the loader will perform a deferred load, and keep track of the assets and resources that have not been fully loaded yet.streamed-loaderis introduced. This loader keeps a background thread and derived context for use in background streamed loading. Whencommitis called on adeferred-staging-areawith the keyword argument:stream T, then it will automatically start loading in the remaining assets and resources in the background.