refactor: route builtin forward pipeline through shader assets

This commit is contained in:
2026-04-02 19:00:48 +08:00
parent 86144416af
commit 9f7d8fd68d
8 changed files with 585 additions and 220 deletions

View File

@@ -65,17 +65,28 @@ ResourceManager::ScopedDeferredSceneLoad::~ScopedDeferredSceneLoad() {
}
void ResourceManager::Initialize() {
EnsureInitialized();
}
void ResourceManager::EnsureInitialized() {
if (m_asyncLoader) {
return;
}
m_asyncLoader = Core::MakeUnique<AsyncLoader>();
m_asyncLoader->Initialize(2);
std::lock_guard<std::mutex> initLock(m_initializeMutex);
if (m_asyncLoader) {
return;
}
Core::UniqueRef<AsyncLoader> asyncLoader = Core::MakeUnique<AsyncLoader>();
asyncLoader->Initialize(2);
RegisterBuiltinLoader(*this, g_materialLoader);
RegisterBuiltinLoader(*this, g_meshLoader);
RegisterBuiltinLoader(*this, g_shaderLoader);
RegisterBuiltinLoader(*this, g_textureLoader);
m_asyncLoader = std::move(asyncLoader);
}
void ResourceManager::Shutdown() {
@@ -266,6 +277,8 @@ void ResourceManager::LoadAsync(const Containers::String& path, ResourceType typ
void ResourceManager::LoadAsync(const Containers::String& path, ResourceType type,
ImportSettings* settings,
std::function<void(LoadResult)> callback) {
EnsureInitialized();
if (!m_asyncLoader) {
if (callback) {
callback(LoadResult("Async loader is not initialized"));
@@ -408,6 +421,8 @@ bool ResourceManager::IsDeferredSceneLoadEnabled() const {
LoadResult ResourceManager::LoadResource(const Containers::String& path,
ResourceType type,
ImportSettings* settings) {
EnsureInitialized();
const ResourceGUID guid = ResourceGUID::Generate(path);
if (ShouldTraceResourcePath(path)) {