8#include "../Core/AssetManager.h"
10#include "../TaskSystem/TaskGraphLoader.h"
11#include "../system/system_utils.h"
41 for (
size_t i = 0;
i < path.size(); ++
i)
43 hash ^=
static_cast<uint32_t>(
static_cast<unsigned char>(path[
i]));
65 outErrors.push_back(
"[AssetManager] LoadTaskGraph: path is empty");
75 SYSTEM_LOG <<
"[AssetManager] LoadTaskGraph: cache hit for '"
76 << path <<
"' (id=" <<
id <<
")" << std::endl;
84 SYSTEM_LOG <<
"[AssetManager] LoadTaskGraph: failed to load '"
85 << path <<
"'" << std::endl;
91 SYSTEM_LOG <<
"[AssetManager] LoadTaskGraph: loaded '"
92 << path <<
"' (id=" <<
id <<
")" << std::endl;
104 return it->second.get();
123 SYSTEM_LOG <<
"[AssetManager] UnloadTaskGraph: id=" <<
id
124 <<
" not found in cache" << std::endl;
130 SYSTEM_LOG <<
"[AssetManager] UnloadTaskGraph: released id=" <<
id << std::endl;
ComponentTypeID GetComponentTypeID_Static()
Singleton cache for engine assets.
std::unordered_map< AssetID, std::unique_ptr< TaskGraphTemplate > > m_taskGraphs
Cached task graph templates: AssetID -> owned template.
AssetID LoadTaskGraph(const std::string &path, std::vector< std::string > &outErrors)
Loads a TaskGraphTemplate from path and caches it.
static AssetID ComputeAssetID(const std::string &path)
Computes the 32-bit FNV-1a hash of a file path string.
const TaskGraphTemplate * LoadTaskGraphFromFile(const std::string &path, std::vector< std::string > &outErrors)
Loads a TaskGraphTemplate from path and returns a direct pointer.
void UnloadTaskGraph(AssetID id)
Releases the cached TaskGraphTemplate for id.
const TaskGraphTemplate * GetTaskGraph(AssetID id) const
Returns a non-owning pointer to the cached TaskGraphTemplate.
static AssetManager & Get()
Returns the singleton AssetManager instance.
static TaskGraphTemplate * LoadFromFile(const std::string &path, std::vector< std::string > &outErrors)
Loads a TaskGraphTemplate from a JSON file on disk.
Immutable, shareable task graph asset.
< Provides AssetID and INVALID_ASSET_ID
uint32_t AssetID
Opaque asset identifier: 32-bit FNV-1a hash of the asset file path.
static const AssetID INVALID_ASSET_ID
Sentinel value indicating an invalid / unloaded asset.