class

AssetManager

Base AssetManager providing UUID-based asset cache and retrieval. Subclassed by EditorAssetManager (scan/import) and RuntimeAssetManager (packed).

Module
AssetSystem
Header
#include "AssetSystem/AssetManager.h"
Namespace
Mowo

Constructors

SignatureNameDescription
virtual ~AssetManager()~AssetManager

Public functions

ReturnsNameDescription
AssetManager&GetSingleton access
AssetManager*TryGetout-of-line; reading s_instance
voidSetInstancefrom a consumer TU across the MowoEngine.Game.dll boundary as an inline triggers a dllimport mismatch on the static storage.
boolInitializeLifecycle
voidShutdown
voidUpdateCalled once per frame: runs the eviction tick.
intGetGpuUploadBudgetPerFrameMax GPU uploads (CreateGPU calls) a subclass Update should drain per frame; <= 0 means unbounded.
voidSetEvictionStrategy
EvictionStrategyGetEvictionStrategy
voidSetMemoryBudgetThe budget follows asset.MemoryBudgetMB whenever that cvar changes (0 = keep the current one); FQualityAutoTier::ResolveDeviceBudgets claims it from the device's VRAM.
uint64_tGetMemoryBudget
uint64_tGetEstimatedUsage
voidRefreshMemoryEstimatesRe-reads every cached asset's estimate.
voidTouchAssetBump the LRU stamp (GetAsset does this automatically).
voidPinAssetPinned assets are never auto-evicted (UI atlases, always-resident).
boolUnloadAssetExplicit unload: DestroyGPU + Unload + drop from the cache.
voidUnloadAssetsInSetBulk variant for streaming sector unload.
size_tReleaseUnreferencedSinceClosing a level or an asset editor freed nothing: everything it loaded stayed cached until usage crossed the whole budget (measured: three asset editors 3.06 -> 4.32 GB private, 4.17 GB after closing them).
uint64_tGetFrameCounterUpdate() count, the clock lastAccessFrame and the sweeps above run on.
Ref<Asset>GetAssetGet an asset by UUID.
Ref<T>GetAssetGet a typed asset by UUID.
Ref<T>GetAssetByPathGet a typed asset by source path.
Ref<Asset>RequestAssetAsyncThe one load-by-path verb a caller below the editor/runtime split can use: hands back the asset only when it is fully resident, otherwise starts (or continues) loading it off the calling thread and returns null.
voidResolveMaterialTexturesBind a material's texture slots from wherever the caller is — a mesh applying its authored slot materials does it on the main thread, inside the GPU drain.
boolIsImportInFlightTrue while sourcePath is being imported in the background — queued, parsing, or uploading.
voidResolveHandleResolve an AssetHandle — fills in the Ref if the asset is loaded
boolIsAssetLoaded
boolReloadInPlaceRe-reads a resident asset in place from absolutePath: the object survives, so every Ref and handle in scenes and components keeps working and sees the new version.
std::vector<Ref<Asset>>GetResidentAssetsEvery asset in the cache, copied out under its lock so the caller can touch them without holding it — an editor save that has to reach the live copy of what it just wrote walks this.
AssetRegistry&GetRegistryRegistry access
const AssetRegistry&GetRegistry
const GPUContext&GetGPUContextGPU Context

Function details

~AssetManager

C++
virtual ~AssetManager()

Get

C++
static AssetManager& Get()

Singleton access

TryGet

C++
static AssetManager* TryGet()

out-of-line; reading s_instance

SetInstance

C++
static void SetInstance(AssetManager* instance)

from a consumer TU across the MowoEngine.Game.dll boundary as an inline triggers a dllimport mismatch on the static storage.

Initialize

C++
virtual bool Initialize(const GPUContext& ctx)

Lifecycle

Shutdown

C++
virtual void Shutdown()

Update

C++
virtual void Update()

Called once per frame: runs the eviction tick. Subclasses doing their own per-frame work (GPU uploads) must call the base.

GetGpuUploadBudgetPerFrame

C++
static int GetGpuUploadBudgetPerFrame()

Max GPU uploads (CreateGPU calls) a subclass Update should drain per frame; <= 0 means unbounded. Backed by the asset.UploadsPerFrame cvar so a burst of finished async imports is time-sliced instead of hitching the frame that receives them all.

SetEvictionStrategy

C++
void SetEvictionStrategy(EvictionStrategy s)

GetEvictionStrategy

C++
EvictionStrategy GetEvictionStrategy() const

SetMemoryBudget

C++
void SetMemoryBudget(uint64_t bytes)

The budget follows asset.MemoryBudgetMB whenever that cvar changes (0 = keep the current one); FQualityAutoTier::ResolveDeviceBudgets claims it from the device's VRAM. A direct SetMemoryBudget stands until the cvar next moves.

GetMemoryBudget

C++
uint64_t GetMemoryBudget() const

GetEstimatedUsage

C++
uint64_t GetEstimatedUsage() const

RefreshMemoryEstimates

C++
void RefreshMemoryEstimates()

Re-reads every cached asset's estimate. An entry's size was captured when it was cached — for a mesh, before its GPU buffers existed, so it counted 0 for the rest of its life. EvictionTick refreshes on its own every few frames; a caller that needs the number now asks here.

TouchAsset

C++
void TouchAsset(UUID id)

Bump the LRU stamp (GetAsset does this automatically).

PinAsset

C++
void PinAsset(UUID id, bool pinned)

Pinned assets are never auto-evicted (UI atlases, always-resident).

UnloadAsset

C++
bool UnloadAsset(UUID id)

Explicit unload: DestroyGPU + Unload + drop from the cache. Fails (false) when something besides the cache still holds a ref — yanking GPU resources from under a live user is a crash, not a cleanup.

UnloadAssetsInSet

C++
void UnloadAssetsInSet(const std::vector<UUID>& ids)

Bulk variant for streaming sector unload.

ReleaseUnreferencedSince

C++
size_t ReleaseUnreferencedSince(uint64_t frame)

Closing a level or an asset editor freed nothing: everything it loaded stayed cached until usage crossed the whole budget (measured: three asset editors 3.06 -> 4.32 GB private, 4.17 GB after closing them). The host calls this a few updates after a document closed: it unloads every unpinned asset nothing outside the cache holds and nobody touched since frame. Components keep raw pointers into assets, so the host touches whatever its still-open documents use first. Returns how many unloaded.

GetFrameCounter

C++
uint64_t GetFrameCounter() const

Update() count, the clock lastAccessFrame and the sweeps above run on.

GetAsset

C++
Ref<Asset> GetAsset(UUID id) const

Get an asset by UUID. Returns null if not loaded.

GetAsset

C++
template<typename T> Ref<T> GetAsset(UUID id) const

Get a typed asset by UUID.

GetAssetByPath

C++
template<typename T> Ref<T> GetAssetByPath(const std::string& path)

Get a typed asset by source path.

RequestAssetAsync

C++
virtual Ref<Asset> RequestAssetAsync(const std::string& sourcePath)

The one load-by-path verb a caller below the editor/runtime split can use: hands back the asset only when it is fully resident, otherwise starts (or continues) loading it off the calling thread and returns null. Poll it — the frame it returns non-null is the frame to use the asset. Repeat calls for one path coalesce into one load. The base only probes the cache, which is what a bare manager in a test wants.

ResolveMaterialTextures

C++
virtual void ResolveMaterialTextures(const Ref<Asset>& material)

Bind a material's texture slots from wherever the caller is — a mesh applying its authored slot materials does it on the main thread, inside the GPU drain. The base resolves them now, which is what a packaged game with cooked textures wants; the editor imports what is missing in the background and binds each slot as its texture lands, instead of decoding every slot of every material in the one frame a model finishes.

IsImportInFlight

C++
virtual bool IsImportInFlight(const std::string& sourcePath) const

True while sourcePath is being imported in the background — queued, parsing, or uploading. A big model takes seconds, and a tile that looks idle meanwhile reads as a broken asset. The base loads synchronously, so nothing is ever in flight there.

ResolveHandle

C++
template<typename T> void ResolveHandle(AssetHandle<T>& handle)

Resolve an AssetHandle — fills in the Ref if the asset is loaded

IsAssetLoaded

C++
bool IsAssetLoaded(UUID id) const

ReloadInPlace

C++
virtual bool ReloadInPlace(const std::string& sourcePath, const std::string& absolutePath)

Re-reads a resident asset in place from absolutePath: the object survives, so every Ref and handle in scenes and components keeps working and sees the new version. sourcePath is the registry's path for it ("Content/..."). False when it is not resident here (nothing to reload) or the new version failed to load (the asset is then marked Invalid). The editor's override goes through its reimport, which also refreshes the registry's stamps.

GetResidentAssets

C++
std::vector<Ref<Asset>> GetResidentAssets() const

Every asset in the cache, copied out under its lock so the caller can touch them without holding it — an editor save that has to reach the live copy of what it just wrote walks this.

GetRegistry

C++
AssetRegistry& GetRegistry()

Registry access

GetRegistry

C++
const AssetRegistry& GetRegistry() const

GetGPUContext

C++
const GPUContext& GetGPUContext() const

GPU Context

Generated from AssetSystem/AssetManager.h via assetsystem.json · Nov 4, 2026Version 1.0.0