From a1d8ad52cb7320bb67dfac8550a00bb2831e298f Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 5 Dec 2024 13:49:44 +0800 Subject: [PATCH 1/5] use newly Compartor<> --- CMAssetsManage | 2 +- CMCore | 2 +- CMSceneGraph | 2 +- CMUtil | 2 +- inc/hgl/graph/module/GraphModule.h | 11 +++++++- inc/hgl/graph/mtl/Material2DCreateConfig.h | 8 +++--- inc/hgl/graph/mtl/Material3DCreateConfig.h | 8 +++--- inc/hgl/graph/mtl/MaterialConfig.h | 6 ++--- inc/hgl/graph/mtl/ShaderVariableType.h | 30 ++++++++-------------- res | 2 +- src/ShaderGen/ShaderVariableType.cpp | 2 +- 11 files changed, 34 insertions(+), 41 deletions(-) diff --git a/CMAssetsManage b/CMAssetsManage index 85436b5a..cf6a54d4 160000 --- a/CMAssetsManage +++ b/CMAssetsManage @@ -1 +1 @@ -Subproject commit 85436b5a7b0bc9347fcd3321a6895464470f1353 +Subproject commit cf6a54d484436eea700bc4f4ea002ed23eed6dc8 diff --git a/CMCore b/CMCore index 753b78dd..6e1f32f3 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 753b78dddf234cd305b5d211c687b311eebaaf8a +Subproject commit 6e1f32f38eca4cdc1088e737abf58ffec5e2592b diff --git a/CMSceneGraph b/CMSceneGraph index c958a6cb..b1e3ffe3 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit c958a6cb2ac4a52716eabc1c45eba184f4c7e46c +Subproject commit b1e3ffe312b18ecad36849d9d53288bbb25af8dc diff --git a/CMUtil b/CMUtil index f7dce030..a7f4afab 160000 --- a/CMUtil +++ b/CMUtil @@ -1 +1 @@ -Subproject commit f7dce0304822280d0db23ae607783b7c3cd183fa +Subproject commit a7f4afab8029f52dff43840062c8b6cb2008bd67 diff --git a/inc/hgl/graph/module/GraphModule.h b/inc/hgl/graph/module/GraphModule.h index bc67c39c..cd3bf9b1 100644 --- a/inc/hgl/graph/module/GraphModule.h +++ b/inc/hgl/graph/module/GraphModule.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include @@ -60,6 +60,8 @@ class GraphModule AnsiIDName module_name; + SortedSet dependent_module; ///<依赖的模块 + bool module_enable; bool module_ready; @@ -93,6 +95,13 @@ public: virtual bool Init(){return true;} ///<初始化当前模块 + int Comp(const GraphModule *gm)const + { + 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);} ///<获取指定名称的模块 diff --git a/inc/hgl/graph/mtl/Material2DCreateConfig.h b/inc/hgl/graph/mtl/Material2DCreateConfig.h index 443cac67..81f56710 100644 --- a/inc/hgl/graph/mtl/Material2DCreateConfig.h +++ b/inc/hgl/graph/mtl/Material2DCreateConfig.h @@ -6,7 +6,7 @@ #include STD_MTL_NAMESPACE_BEGIN -struct Material2DCreateConfig:public MaterialCreateConfig +struct Material2DCreateConfig:public MaterialCreateConfig,public Comparator { CoordinateSystem2D coordinate_system; ///<使用的坐标系 @@ -32,9 +32,9 @@ public: position_format=VAT_VEC2; } - int Comp(const Material2DCreateConfig &cfg)const + const int compare(const Material2DCreateConfig &cfg)const override { - int off=MaterialCreateConfig::Comp(cfg); + int off=MaterialCreateConfig::compare(cfg); if(off)return off; @@ -48,8 +48,6 @@ public: return off; } - - CompOperator(const Material2DCreateConfig &,Comp) };//struct Material2DCreateConfig:public MaterialCreateConfig MaterialCreateInfo *CreateVertexColor2D(const Material2DCreateConfig *); diff --git a/inc/hgl/graph/mtl/Material3DCreateConfig.h b/inc/hgl/graph/mtl/Material3DCreateConfig.h index fcdfc32e..e76cbad0 100644 --- a/inc/hgl/graph/mtl/Material3DCreateConfig.h +++ b/inc/hgl/graph/mtl/Material3DCreateConfig.h @@ -6,7 +6,7 @@ STD_MTL_NAMESPACE_BEGIN -struct Material3DCreateConfig:public MaterialCreateConfig +struct Material3DCreateConfig:public MaterialCreateConfig,public Comparator { bool camera; ///<包含摄像机矩阵信息 @@ -32,9 +32,9 @@ public: // reverse_depth=false; } - int Comp(const Material3DCreateConfig &cfg)const + const int compare(const Material3DCreateConfig &cfg)const override { - int off=MaterialCreateConfig::Comp(cfg); + int off=MaterialCreateConfig::compare(cfg); if(off)return off; @@ -48,8 +48,6 @@ public: return off; } - - CompOperator(const Material3DCreateConfig &,Comp) };//struct Material3DCreateConfig:public MaterialCreateConfig MaterialCreateInfo *CreateVertexColor3D(const Material3DCreateConfig *); diff --git a/inc/hgl/graph/mtl/MaterialConfig.h b/inc/hgl/graph/mtl/MaterialConfig.h index 94e32c56..5cdca42f 100644 --- a/inc/hgl/graph/mtl/MaterialConfig.h +++ b/inc/hgl/graph/mtl/MaterialConfig.h @@ -13,7 +13,7 @@ class MaterialCreateInfo; /** * 材质配置结构 */ -struct MaterialCreateConfig +struct MaterialCreateConfig:public Comparator { const GPUDeviceAttribute *dev_attr; @@ -42,7 +42,7 @@ public: prim=p; } - virtual int Comp(const MaterialCreateConfig &cfg)const + const int compare(const MaterialCreateConfig &cfg)const override { int off; @@ -59,8 +59,6 @@ public: return off; } - - CompOperator(const MaterialCreateConfig &,Comp) };//struct MaterialCreateConfig STD_MTL_NAMESPACE_END #endif//HGL_GRAPH_MTL_CONFIG_INCLUDE diff --git a/inc/hgl/graph/mtl/ShaderVariableType.h b/inc/hgl/graph/mtl/ShaderVariableType.h index 329ab7b8..93d9d4a3 100644 --- a/inc/hgl/graph/mtl/ShaderVariableType.h +++ b/inc/hgl/graph/mtl/ShaderVariableType.h @@ -28,7 +28,7 @@ namespace hgl #pragma pack(push,1) - struct ShaderVariableType + struct ShaderVariableType:public Comparator { union { @@ -158,9 +158,7 @@ namespace hgl const bool Check()const; - int Comp(const ShaderVariableType &svt)const; - - CompOperator(const ShaderVariableType &,Comp) + const int compare(const ShaderVariableType &svt)const override; const char *GetTypename()const; @@ -281,7 +279,7 @@ namespace hgl using SVList=List; - struct ShaderVariableArray + struct ShaderVariableArray:public Comparator { uint count; @@ -304,44 +302,36 @@ namespace hgl Clear(); } - int Comp(const ShaderVariableArray *sva)const + const int compare(const ShaderVariableArray &sva)const override { - if(!sva) - return 1; - - int off=count-sva->count; + int off=count-sva.count; if(off)return off; for(uint i=0;iitems[i].location; + off=items[i].location-sva.items[i].location; if(off) return off; - if(items[i].type.ToCode()>sva->items[i].type.ToCode()) + if(items[i].type.ToCode()>sva.items[i].type.ToCode()) return 1; //ToCode返回的是uint64,可能差值超大,所以不能直接用-的结果 - if(items[i].type.ToCode()items[i].type.ToCode()) + if(items[i].type.ToCode()items[i].interpolation); + off=int(items[i].interpolation)-int(sva.items[i].interpolation); if(off) return off; - off=hgl::strcmp(items[i].name,sva->items[i].name); + off=hgl::strcmp(items[i].name,sva.items[i].name); if(off) return off; } return 0; } - - int Comp(const ShaderVariableArray &sva)const{return Comp(&sva);} - - CompOperator(const ShaderVariableArray *,Comp) - CompOperator(const ShaderVariableArray &,Comp) bool Init(const uint c=0) { diff --git a/res b/res index e1a36d78..475d8ad4 160000 --- a/res +++ b/res @@ -1 +1 @@ -Subproject commit e1a36d78f0eead5f6bb65493432c4690637b991d +Subproject commit 475d8ad43ceee084cd24f5d0bed59de9f6aa36fd diff --git a/src/ShaderGen/ShaderVariableType.cpp b/src/ShaderGen/ShaderVariableType.cpp index 652bb42c..2d5a381f 100644 --- a/src/ShaderGen/ShaderVariableType.cpp +++ b/src/ShaderGen/ShaderVariableType.cpp @@ -85,7 +85,7 @@ const bool ShaderVariableType::Check()const return(true); } -int ShaderVariableType::Comp(const ShaderVariableType &svt)const +const int ShaderVariableType::compare(const ShaderVariableType &svt)const { int off=(int)base_type-(int)svt.base_type; From dd5a78cbaa801ca5f39f4e5a543e16cf86e65aa8 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 5 Dec 2024 13:55:56 +0800 Subject: [PATCH 2/5] renamed to Comparator.h from CompOperator.h --- CMCore | 2 +- CMSceneGraph | 2 +- inc/hgl/graph/mtl/ShaderVariableType.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMCore b/CMCore index 6e1f32f3..ae1be856 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 6e1f32f38eca4cdc1088e737abf58ffec5e2592b +Subproject commit ae1be856b96aa3d26da8937cca416e8fe4360678 diff --git a/CMSceneGraph b/CMSceneGraph index b1e3ffe3..441ca9ce 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit b1e3ffe312b18ecad36849d9d53288bbb25af8dc +Subproject commit 441ca9ce5558d6825c92c7dd1b9f93b80404fb41 diff --git a/inc/hgl/graph/mtl/ShaderVariableType.h b/inc/hgl/graph/mtl/ShaderVariableType.h index 93d9d4a3..43898cb3 100644 --- a/inc/hgl/graph/mtl/ShaderVariableType.h +++ b/inc/hgl/graph/mtl/ShaderVariableType.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include namespace hgl { From 6c160f5c533546ca511539d0e06e72cc2b9b351d Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 12 Dec 2024 13:30:11 +0800 Subject: [PATCH 3/5] supported new Comparator<> and ItemComparator<> --- CMCore | 2 +- CMUtil | 2 +- inc/hgl/graph/MaterialRenderList.h | 6 ++--- inc/hgl/graph/RenderNode.h | 7 +++++- inc/hgl/graph/VKRenderable.h | 9 +++----- inc/hgl/graph/font/Font.h | 4 +--- src/SceneGraph/MaterialRenderList.cpp | 19 ++++++++------- src/SceneGraph/Vulkan/VKRenderable.cpp | 32 +++++++++++++++----------- 8 files changed, 41 insertions(+), 40 deletions(-) diff --git a/CMCore b/CMCore index ae1be856..7295d68a 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit ae1be856b96aa3d26da8937cca416e8fe4360678 +Subproject commit 7295d68a5e6f2b9bc9ad08dc397375850af50bf7 diff --git a/CMUtil b/CMUtil index a7f4afab..6582b635 160000 --- a/CMUtil +++ b/CMUtil @@ -1 +1 @@ -Subproject commit a7f4afab8029f52dff43840062c8b6cb2008bd67 +Subproject commit 6582b635c9b93284c29dd7e1bc6dc5ecf59a8705 diff --git a/inc/hgl/graph/MaterialRenderList.h b/inc/hgl/graph/MaterialRenderList.h index c9da1c99..7784b3c6 100644 --- a/inc/hgl/graph/MaterialRenderList.h +++ b/inc/hgl/graph/MaterialRenderList.h @@ -8,14 +8,14 @@ class RenderAssignBuffer; class SceneNode; struct CameraInfo; -struct RenderPipelineIndex +struct RenderPipelineIndex:public Comparator { Material *material; Pipeline *pipeline; public: - const int Comp(const RenderPipelineIndex &rli)const + const int compare(const RenderPipelineIndex &rli)const override { if(materialrli.material)return(1); @@ -26,8 +26,6 @@ public: return(0); } - CompOperator(const RenderPipelineIndex &,Comp) - public: RenderPipelineIndex() diff --git a/inc/hgl/graph/RenderNode.h b/inc/hgl/graph/RenderNode.h index 319acf8c..1b990fe1 100644 --- a/inc/hgl/graph/RenderNode.h +++ b/inc/hgl/graph/RenderNode.h @@ -11,7 +11,7 @@ namespace hgl class MaterialInstance; class SceneNode; - struct RenderNode + struct RenderNode:public Comparator { uint index; ///<在MaterialRenderList中的索引 @@ -22,6 +22,11 @@ namespace hgl Vector3f world_position; float to_camera_distance; + + public: + + //该函数位于MaterialRenderList.cpp + const int compare(const RenderNode &)const override; }; using RenderNodeList=List; diff --git a/inc/hgl/graph/VKRenderable.h b/inc/hgl/graph/VKRenderable.h index 5a40e799..9d98b662 100644 --- a/inc/hgl/graph/VKRenderable.h +++ b/inc/hgl/graph/VKRenderable.h @@ -12,7 +12,7 @@ VK_NAMESPACE_BEGIN * 原始图元数据缓冲区
* 提供在渲染之前的数据绑定信息 */ -struct PrimitiveDataBuffer +struct PrimitiveDataBuffer:public Comparator { uint32_t vab_count; VkBuffer * vab_list; @@ -32,14 +32,14 @@ public: PrimitiveDataBuffer(const uint32_t,IndexBuffer *,VertexDataManager *_v=nullptr); ~PrimitiveDataBuffer(); - const bool Comp(const PrimitiveDataBuffer *pdb)const; + const int compare(const PrimitiveDataBuffer &pdb)const override; };//struct PrimitiveDataBuffer /** * 原始图元渲染数据
* 提供在渲染时的数据 */ -struct PrimitiveRenderData +struct PrimitiveRenderData:public ComparatorData { //因为要VAB是流式访问,所以我们这个结构会被用做排序依据 //也因此,把vertex_offset放在最前面 @@ -59,9 +59,6 @@ public: vertex_offset =vo; first_index =fi; } - - CompOperatorMemcmp(const PrimitiveRenderData &); - CompOperatorMemcmpPointer(PrimitiveRenderData); }; /** diff --git a/inc/hgl/graph/font/Font.h b/inc/hgl/graph/font/Font.h index c630996b..5a1395a3 100644 --- a/inc/hgl/graph/font/Font.h +++ b/inc/hgl/graph/font/Font.h @@ -12,7 +12,7 @@ namespace hgl /** * 字体信息 */ - struct Font + struct Font:public ComparatorData { os_char name[MAX_FONT_NAME_LENGTH]; ///<字体名称 @@ -28,8 +28,6 @@ namespace hgl Font(); Font(const os_char *,int,int,bool b=false,bool i=false,bool=true); - - CompOperatorMemcmp(const Font &); ///<比较操作符重载 };//struct Font }//namespace graph }//namespace hgl diff --git a/src/SceneGraph/MaterialRenderList.cpp b/src/SceneGraph/MaterialRenderList.cpp index 078697a7..4aee43b8 100644 --- a/src/SceneGraph/MaterialRenderList.cpp +++ b/src/SceneGraph/MaterialRenderList.cpp @@ -26,13 +26,13 @@ 这样就可以保证所有的渲染操作就算要切VBO,也不需要切换INDIRECT缓冲区,定位指令也很方便。 */ -template<> -int Comparator::compare(const hgl::graph::RenderNode &obj_one,const hgl::graph::RenderNode &obj_two) const +VK_NAMESPACE_BEGIN +const int RenderNode::compare(const RenderNode &other)const { hgl::int64 off; - hgl::graph::Renderable *ri_one=obj_one.scene_node->GetRenderable(); - hgl::graph::Renderable *ri_two=obj_two.scene_node->GetRenderable(); + hgl::graph::Renderable *ri_one=other.scene_node->GetRenderable(); + hgl::graph::Renderable *ri_two=scene_node->GetRenderable(); auto *prim_one=ri_one->GetPrimitive(); auto *prim_two=ri_two->GetPrimitive(); @@ -63,8 +63,8 @@ int Comparator::compare(const hgl::graph::RenderNode &ob //比较距离。。。。。。。。。。。。。。。。。。。。。还不知道这个是正了还是反了,等测出来确认后修改下面的返回值和这里的注释 - float foff=obj_one.to_camera_distance - -obj_two.to_camera_distance; + float foff=other.to_camera_distance + -to_camera_distance; if(foff>0) return 1; @@ -72,7 +72,6 @@ int Comparator::compare(const hgl::graph::RenderNode &ob return -1; } -VK_NAMESPACE_BEGIN MaterialRenderList::MaterialRenderList(GPUDevice *d,bool l2w,const RenderPipelineIndex &rpi) { device=d; @@ -280,8 +279,8 @@ void MaterialRenderList::Stat() { ro=rn->scene_node->GetRenderable(); - if(last_data_buffer->Comp(ro->GetDataBuffer())) - if(last_render_data->_Comp(ro->GetRenderData())==0) + if(*last_data_buffer!=*ro->GetDataBuffer()) + if(*last_render_data==*ro->GetRenderData()) { ++ri->instance_count; ++rn; @@ -399,7 +398,7 @@ void MaterialRenderList::ProcIndirectRender() void MaterialRenderList::Render(RenderItem *ri) { - if(!ri->pdb->Comp(last_data_buffer)) //换buf了 + if(*(ri->pdb)!=*last_data_buffer) //换buf了 { if(indirect_draw_count) //如果有间接绘制的数据,赶紧给画了 ProcIndirectRender(); diff --git a/src/SceneGraph/Vulkan/VKRenderable.cpp b/src/SceneGraph/Vulkan/VKRenderable.cpp index 24402039..0ed3831c 100644 --- a/src/SceneGraph/Vulkan/VKRenderable.cpp +++ b/src/SceneGraph/Vulkan/VKRenderable.cpp @@ -24,25 +24,29 @@ PrimitiveDataBuffer::~PrimitiveDataBuffer() delete[] vab_list; } -const bool PrimitiveDataBuffer::Comp(const PrimitiveDataBuffer *pdb)const +const int PrimitiveDataBuffer::compare(const PrimitiveDataBuffer &pdb)const { - if(!pdb)return(false); + ptrdiff_t off; - if(vdm&&pdb->vdm) - return (vdm==pdb->vdm); + off=&vdm-&pdb.vdm; + if(off) + return off; - if(vab_count!=pdb->vab_count)return(false); + off=vab_count-pdb.vab_count; + if(off) + return off; - for(uint32_t i=0;ivab_list[i])return(false); - if(vab_offset[i]!=pdb->vab_offset[i])return(false); - } + off=hgl_cmp(vab_list,pdb.vab_list,vab_count); + if(off) + return off; - if(ibo!=pdb->ibo) - return(false); + off=hgl_cmp(vab_offset,pdb.vab_offset,vab_count); + if(off) + return off; - return(true); + off=ibo-pdb.ibo; + + return off; } Renderable::Renderable(Primitive *r,MaterialInstance *mi,Pipeline *p,PrimitiveDataBuffer *pdb,PrimitiveRenderData *prd) @@ -61,7 +65,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p) const VIL *vil=mi->GetVIL(); - if(vil->Comp(p->GetVIL())) + if(*vil!=*p->GetVIL()) return(nullptr); const uint32_t input_count=vil->GetVertexAttribCount(VertexInputGroup::Basic); //不统计Bone/LocalToWorld组的 From c45047c482b9963d07525bc642ab8f9efef6e8f9 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 12 Dec 2024 13:30:51 +0800 Subject: [PATCH 4/5] suppported newly codes about Hash --- inc/hgl/graph/manager/RenderPassManager.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/inc/hgl/graph/manager/RenderPassManager.h b/inc/hgl/graph/manager/RenderPassManager.h index 3b19c82e..ade8c1d5 100644 --- a/inc/hgl/graph/manager/RenderPassManager.h +++ b/inc/hgl/graph/manager/RenderPassManager.h @@ -1,12 +1,15 @@ -#pragma once +#pragma once #include #include #include VK_NAMESPACE_BEGIN -using RenderPassHASHCode=util::HashCodeXXH3_128; -#define CreateRenderPassHash util::CreateXXH3_128Hash +using RenderPassHASHCode=util::HashCode<128/8>; +inline util::Hash *CreateRenderPassHash() +{ + return util::CreateHash(util::HASH::xxH3_128); +} class RenderPassManager:public GraphModule { From 758acafe88308ea2b86f4510c4beec9d29c4fa81 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 12 Dec 2024 13:32:28 +0800 Subject: [PATCH 5/5] Added module_init in GraphModule, pareparing to splite "new" and "init" operation, because the dependency is must support. --- inc/hgl/graph/module/GraphModule.h | 34 +++++++++++------------ inc/hgl/graph/module/GraphModuleFactory.h | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/inc/hgl/graph/module/GraphModule.h b/inc/hgl/graph/module/GraphModule.h index cd3bf9b1..2bb6fcf8 100644 --- a/inc/hgl/graph/module/GraphModule.h +++ b/inc/hgl/graph/module/GraphModule.h @@ -54,7 +54,7 @@ public: //事件 GraphModuleManager *GetGraphModuleManager(GPUDevice *); -class GraphModule +class GraphModule:public Comparator { GraphModuleManager *module_manager; @@ -62,6 +62,7 @@ class GraphModule SortedSet dependent_module; ///<依赖的模块 + bool module_init; bool module_enable; bool module_ready; @@ -72,19 +73,20 @@ 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();} ///<取得设备属性 - 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();}///<取得设备属性 + static const AnsiIDName *GetModuleName(){return nullptr;} ///<取得模块名称(标准通用的名称,比如Upscale,供通用模块使用) + virtual const AnsiIDName *GetName()const{return &module_name;} ///<取得名称(完整的私有名称,比如FSR3Upscale,DLSS3Upscale) + + virtual const bool IsRender (){return false;} ///<是否为渲染模块 - static const AnsiIDName *GetModuleName(){return nullptr;} ///<取得模块名称(标准通用的名称,比如Upscale,供通用模块使用) - virtual const AnsiIDName *GetName()const{return &module_name;} ///<取得名称(完整的私有名称,比如FSR3Upscale,DLSS3Upscale) - - const bool IsEnable ()const noexcept{return module_enable;} ///<当前模块是否启用 - const bool IsReady ()const noexcept{return module_ready;} ///<当前模块是否准备好 + const bool IsInit ()const{return module_init;} ///<是否已经初始化 + const bool IsEnable ()const noexcept{return module_enable;} ///<当前模块是否启用 + const bool IsReady ()const noexcept{return module_ready;} ///<当前模块是否准备好 public: @@ -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);} ///<获取指定名称的模块 diff --git a/inc/hgl/graph/module/GraphModuleFactory.h b/inc/hgl/graph/module/GraphModuleFactory.h index 2a83dfa3..1a70bd7f 100644 --- a/inc/hgl/graph/module/GraphModuleFactory.h +++ b/inc/hgl/graph/module/GraphModuleFactory.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include @@ -42,4 +42,4 @@ public: #define REGISTRY_GRAPH_MODULE(Class) {RegistryGraphModuleFactory(#Class,new RegistryGraphModule);} -VK_NAMESPACE_END \ No newline at end of file +VK_NAMESPACE_END