RuntimeAssetManager
Runtime asset manager — the shipping-build counterpart of EditorAssetManager. Archives mount through the VFS (no bypass), assets load through the same AssetSerializer registry the editor uses, and async loads ride the StreamingIOQueue's priority lanes: CPU-side Import/Load on the queue's completion pool, GPU upload drained on the main thread in Update().
- Module
- AssetSystem
- Header
#include "AssetSystem/RuntimeAssetManager.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using LoadCallback = std::function<void(UUID, Ref<Asset>)> |
Constructors
| Signature | Name | Description |
|---|---|---|
RuntimeAssetManager() | RuntimeAssetManager | |
~RuntimeAssetManager() override | ~RuntimeAssetManager |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Initialize | |
void | Shutdown | |
void | Update | base tick + pending GPU uploads |
void | RegisterSerializer | Serializers (same registry contract as the editor) |
Ref<Asset> | LoadAsset | Loading Sync: registry lookup → serializer Import/Load → CreateGPU → cache. |
Ref<T> | LoadAsset | |
void | LoadAssetAsync | Async: CPU phase on a StreamingIOQueue completion thread at the given priority; the callback fires on the MAIN thread (next Update) after the GPU phase. |
void | RequestPreload | Streaming integration: fire-and-forget warmup / release. |
void | RequestUnload | |
Ref<Asset> | RequestAssetAsync | Path form of RequestPreload for callers that poll every frame (a collider waiting on its proxy mesh): one IO request per asset however many times it is asked before the load lands. |
bool | MountArchive | Archives Mounts at the VFS root so registry source paths resolve as-is. |
void | UnmountAll | |
bool | FileExists | |
std::vector<uint8_t> | ReadFile |
Function details
RuntimeAssetManager
RuntimeAssetManager()~RuntimeAssetManager
~RuntimeAssetManager() overrideInitialize
bool Initialize(const GPUContext& ctx) overrideShutdown
void Shutdown() overrideUpdate
void Update() overridebase tick + pending GPU uploads
RegisterSerializer
void RegisterSerializer(Scope<AssetSerializer> serializer)Serializers (same registry contract as the editor)
LoadAsset
Ref<Asset> LoadAsset(UUID id)Loading Sync: registry lookup → serializer Import/Load → CreateGPU → cache. Returns null when the UUID isn't registered or load fails.
LoadAsset
template<typename T> Ref<T> LoadAsset(UUID id)LoadAssetAsync
void LoadAssetAsync(UUID id, LoadCallback cb, IOPriority priority = IOPriority::Normal)Async: CPU phase on a StreamingIOQueue completion thread at the given priority; the callback fires on the MAIN thread (next Update) after the GPU phase. Already-cached assets call back from the next Update too, so callers see ONE consistent threading story.
RequestPreload
void RequestPreload(UUID id, IOPriority priority = IOPriority::Low)Streaming integration: fire-and-forget warmup / release.
RequestUnload
void RequestUnload(UUID id)RequestAssetAsync
Ref<Asset> RequestAssetAsync(const std::string& sourcePath) overridePath form of RequestPreload for callers that poll every frame (a collider waiting on its proxy mesh): one IO request per asset however many times it is asked before the load lands.
MountArchive
bool MountArchive(const std::string& archivePath, int priority = 200)Archives Mounts at the VFS root so registry source paths resolve as-is.
UnmountAll
void UnmountAll()FileExists
bool FileExists(const std::string& path) constReadFile
std::vector<uint8_t> ReadFile(const std::string& path) const