splited InitDependentModules
This commit is contained in:
parent
bd9e587691
commit
2516e9cfc1
@ -42,7 +42,9 @@ public:
|
|||||||
GRAPH_MODULE_CONSTRUCT(TextureManager)
|
GRAPH_MODULE_CONSTRUCT(TextureManager)
|
||||||
virtual ~TextureManager();
|
virtual ~TextureManager();
|
||||||
|
|
||||||
bool Init(GraphModulesMap *) override;
|
static const char **GetDependentModules();
|
||||||
|
|
||||||
|
bool Init() override;
|
||||||
|
|
||||||
const VkFormatProperties GetFormatProperties(const VkFormat)const;
|
const VkFormatProperties GetFormatProperties(const VkFormat)const;
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ class GraphModule:public Comparator<GraphModule>
|
|||||||
|
|
||||||
AnsiIDName module_name;
|
AnsiIDName module_name;
|
||||||
|
|
||||||
|
bool module_inited_dependent;
|
||||||
bool module_inited;
|
bool module_inited;
|
||||||
bool module_enabled;
|
bool module_enabled;
|
||||||
bool module_ready;
|
bool module_ready;
|
||||||
@ -130,6 +131,7 @@ public:
|
|||||||
virtual const bool IsPerFrame () {return false;} ///<是否每帧运行
|
virtual const bool IsPerFrame () {return false;} ///<是否每帧运行
|
||||||
virtual const bool IsRender () {return false;} ///<是否为渲染模块
|
virtual const bool IsRender () {return false;} ///<是否为渲染模块
|
||||||
|
|
||||||
|
const bool IsInitedDependent ()const {return module_inited_dependent;} ///<是否已经初始化依赖的模块
|
||||||
const bool IsInited ()const {return module_inited;} ///<是否已经初始化
|
const bool IsInited ()const {return module_inited;} ///<是否已经初始化
|
||||||
const bool IsEnabled ()const noexcept{return module_enabled;} ///<当前模块是否启用
|
const bool IsEnabled ()const noexcept{return module_enabled;} ///<当前模块是否启用
|
||||||
const bool IsReady ()const noexcept{return module_ready;} ///<当前模块是否准备好
|
const bool IsReady ()const noexcept{return module_ready;} ///<当前模块是否准备好
|
||||||
@ -143,7 +145,9 @@ public:
|
|||||||
|
|
||||||
virtual const size_t GetTypeHash()const=0;
|
virtual const size_t GetTypeHash()const=0;
|
||||||
|
|
||||||
virtual bool Init(GraphModulesMap *); ///<初始化当前模块
|
virtual bool InitDependentModules(GraphModulesMap *); ///<初始化依赖的模块
|
||||||
|
|
||||||
|
virtual bool Init()=0; ///<初始化当前模块
|
||||||
|
|
||||||
static const AnsiIDNameSet &GetDependentModules() ///<取得依赖的模块列表
|
static const AnsiIDNameSet &GetDependentModules() ///<取得依赖的模块列表
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,12 @@ public:
|
|||||||
|
|
||||||
GraphModule *gm=new T(gmm,dgm_map);
|
GraphModule *gm=new T(gmm,dgm_map);
|
||||||
|
|
||||||
|
if(!gm->InitDependentModules(gmm))
|
||||||
|
{
|
||||||
|
delete gm;
|
||||||
|
return(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if(!gm->Init())
|
if(!gm->Init())
|
||||||
{
|
{
|
||||||
delete gm;
|
delete gm;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include<hgl/graph/manager/TextureManager.h>
|
#include<hgl/graph/manager/TextureManager.h>
|
||||||
#include<hgl/graph/VKDevice.h>
|
#include<hgl/graph/VKDevice.h>
|
||||||
#include<hgl/graph/VKCommandBuffer.h>
|
#include<hgl/graph/VKCommandBuffer.h>
|
||||||
|
#include<hgl/graph/manager/RenderPassManager.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
const VkFormatProperties TextureManager::GetFormatProperties(const VkFormat format) const
|
const VkFormatProperties TextureManager::GetFormatProperties(const VkFormat format) const
|
||||||
@ -8,8 +9,23 @@ const VkFormatProperties TextureManager::GetFormatProperties(const VkFormat form
|
|||||||
return GetPhysicalDevice()->GetFormatProperties(format);
|
return GetPhysicalDevice()->GetFormatProperties(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureManager::Init()
|
namespace
|
||||||
{
|
{
|
||||||
|
const char *tex_manager_dep[]
|
||||||
|
{
|
||||||
|
"RenderPassManager"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const char **TextureManager::GetDependentModules() ///<取得依赖的模块列表
|
||||||
|
{
|
||||||
|
return tex_manager_dep;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextureManager::Init(GraphModulesMap *gmm)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
GPUDevice *dev=GetDevice();
|
GPUDevice *dev=GetDevice();
|
||||||
|
|
||||||
if(!dev)
|
if(!dev)
|
||||||
|
@ -31,7 +31,7 @@ GraphModule::~GraphModule()
|
|||||||
LOG_INFO("GraphModule::~GraphModule: "+AnsiString(module_name.GetName()))
|
LOG_INFO("GraphModule::~GraphModule: "+AnsiString(module_name.GetName()))
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphModule::Init(GraphModulesMap *gmm)
|
bool GraphModule::InitDependentModules(GraphModulesMap *)
|
||||||
{
|
{
|
||||||
auto dm_list=GetDependentModules();
|
auto dm_list=GetDependentModules();
|
||||||
|
|
||||||
@ -40,27 +40,23 @@ bool GraphModule::Init(GraphModulesMap *gmm)
|
|||||||
if(!gmm)
|
if(!gmm)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
if(!gmm->IsEmpty())
|
if(gmm->IsEmpty())
|
||||||
{
|
return(false);
|
||||||
|
|
||||||
for(auto dm_name:dm_list)
|
for(auto dm_name:dm_list)
|
||||||
{
|
{
|
||||||
GraphModule *dm;
|
GraphModule *dm=gmm->Get(dm_name);
|
||||||
|
|
||||||
if(gmm->Get(dm_name,dm))
|
if(dm&&dm->IsInited())
|
||||||
{
|
|
||||||
if(dm->IsInited())
|
|
||||||
{
|
{
|
||||||
dependent_modules.Add(dm);
|
dependent_modules.Add(dm);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
module_inited=true;
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user