Added module_init in GraphModule, pareparing to splite "new" and "init" operation, because the dependency is must support.

This commit is contained in:
hyzboy 2024-12-12 13:32:28 +08:00
parent c45047c482
commit 758acafe88
2 changed files with 19 additions and 19 deletions

View File

@ -54,7 +54,7 @@ public: //事件
GraphModuleManager *GetGraphModuleManager(GPUDevice *);
class GraphModule
class GraphModule:public Comparator<GraphModule>
{
GraphModuleManager *module_manager;
@ -62,6 +62,7 @@ class GraphModule
SortedSet<AnsiIDName> dependent_module; ///<依赖的模块
bool module_init;
bool module_enable;
bool module_ready;
@ -72,17 +73,18 @@ protected:
public:
virtual const bool IsRender(){return false;} ///<是否为渲染模块
GraphModuleManager *GetManager (){return module_manager;} ///<取得模块管理器
GPUDevice * GetDevice (){return module_manager->GetDevice();} ///<取得GPU设备
VkDevice GetVkDevice ()const{return module_manager->GetVkDevice();} ///<取得VkDevice
const GPUPhysicalDevice * GetPhysicalDevice ()const{return module_manager->GetPhysicalDevice();} ///<取得物理设备
GPUDeviceAttribute *GetDeviceAttribute (){return module_manager->GetDeviceAttribute();}///<取得设备属性
GPUDeviceAttribute *GetDeviceAttribute (){return module_manager->GetDeviceAttribute();} ///<取得设备属性
static const AnsiIDName *GetModuleName(){return nullptr;} ///<取得模块名称(标准通用的名称比如Upscale供通用模块使用)
virtual const AnsiIDName *GetName()const{return &module_name;} ///<取得名称(完整的私有名称比如FSR3Upscale,DLSS3Upscale)
virtual const bool IsRender (){return false;} ///<是否为渲染模块
const bool IsInit ()const{return module_init;} ///<是否已经初始化
const bool IsEnable ()const noexcept{return module_enable;} ///<当前模块是否启用
const bool IsReady ()const noexcept{return module_ready;} ///<当前模块是否准备好
@ -93,15 +95,13 @@ public:
GraphModule(GraphModuleManager *gmm,const AnsiIDName &name);
virtual ~GraphModule();
virtual bool Init(){return true;} ///<初始化当前模块
virtual bool Init(){module_init=true;return true;} ///<初始化当前模块
int Comp(const GraphModule *gm)const
const int compare(const GraphModule &gm)const override
{
return(dependent_module.Contains(gm->module_name)?1:-1); //如果我依赖于他,那么我比他大
return(dependent_module.Contains(gm.module_name)?1:-1); //如果我依赖于他,那么我比他大
}
CompOperator(const GraphModule *,Comp)
public:
GraphModule * GetModule(const AnsiIDName &name,bool create=false){return module_manager->GetModule(name,create);} ///<获取指定名称的模块

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include<hgl/graph/VKNamespace.h>