use short name in IDName

This commit is contained in:
hyzboy 2025-01-14 12:54:19 +08:00
parent baa2e758f2
commit f23ef6c90e
10 changed files with 28 additions and 28 deletions

2
CMCore

@ -1 +1 @@
Subproject commit 8c86a153ebe97bb03a6abf4bb7c0ac7bebb8eb4f Subproject commit 29e758f96317da6e01173faf4efa1dc4ca3a43b2

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include<hgl/type/List.h> #include<hgl/type/List.h>
#include<hgl/platform/Window.h> #include<hgl/platform/Window.h>
@ -69,7 +69,7 @@ public: //module
template<typename T> template<typename T>
T * GetModule(){return graph_module_map.Get<T>();} ///<获取指定类型的模块 T * GetModule(){return graph_module_map.Get<T>();} ///<获取指定类型的模块
GraphModule * GetModule(const AnsiIDName &name,bool create=false); ///<获取指定名称的模块 GraphModule * GetModule(const AIDName &name,bool create=false); ///<获取指定名称的模块
//template<typename T> T *AddModule() //template<typename T> T *AddModule()
//{ //{

View File

@ -10,7 +10,7 @@ namespace hgl
namespace graph namespace graph
{ {
using SceneNodeID =uint64; using SceneNodeID =uint64;
using SceneNodeName =UTF16IDName; using SceneNodeName =U16IDName;
/** /**
* <br> * <br>

View File

@ -15,7 +15,7 @@ class GraphModule
{ {
RenderFramework *render_framework; RenderFramework *render_framework;
AnsiIDName module_name; AIDName module_name;
bool module_inited; bool module_inited;
bool module_enabled; bool module_enabled;
@ -25,7 +25,7 @@ protected:
template<typename T> template<typename T>
T * GetModule(bool create=false){return render_framework->GetModule<T>(create);} ///<获取指定类型的模块 T * GetModule(bool create=false){return render_framework->GetModule<T>(create);} ///<获取指定类型的模块
GraphModule * GetModule(const AnsiIDName &name,bool create=false); ///<获取指定名称的模块 GraphModule * GetModule(const AIDName &name,bool create=false); ///<获取指定名称的模块
protected: protected:
@ -41,8 +41,8 @@ public:
RenderFramework * GetFramework () {return render_framework;} ///<取得渲染框架 RenderFramework * GetFramework () {return render_framework;} ///<取得渲染框架
const AnsiIDName & GetName ()const {return module_name;} ///<取得模块名称(标准通用的名称比如Upscale供通用模块使用) const AIDName & GetName ()const {return module_name;} ///<取得模块名称(标准通用的名称比如Upscale供通用模块使用)
virtual const AnsiIDName & GetFullName ()const {return module_name;} ///<取得名称(完整的私有名称比如FSR3Upscale,DLSS3Upscale) virtual const AIDName & GetFullName ()const {return module_name;} ///<取得名称(完整的私有名称比如FSR3Upscale,DLSS3Upscale)
virtual const bool IsPerFrame () {return false;} ///<是否每帧运行 virtual const bool IsPerFrame () {return false;} ///<是否每帧运行
virtual const bool IsRender () {return false;} ///<是否为渲染模块 virtual const bool IsRender () {return false;} ///<是否为渲染模块
@ -57,7 +57,7 @@ public:
protected: protected:
GraphModule(RenderFramework *rf,const AnsiIDName &name); GraphModule(RenderFramework *rf,const AIDName &name);
public: public:
@ -76,7 +76,7 @@ public: //回调事件
virtual void OnPostFrame(){} ///<帧绘制后回调 virtual void OnPostFrame(){} ///<帧绘制后回调
};//class GraphModule };//class GraphModule
using GraphModuleMapByIDName=Map<AnsiIDName,GraphModule *>; using GraphModuleMapByIDName=Map<AIDName,GraphModule *>;
//template<typename T,typename BASE> class GraphModuleInherit:public BASE //template<typename T,typename BASE> class GraphModuleInherit:public BASE
//{ //{
@ -98,9 +98,9 @@ using GraphModuleMapByIDName=Map<AnsiIDName,GraphModule *>;
NO_COPY_NO_MOVE(name) \ NO_COPY_NO_MOVE(name) \
static const size_t StaticHash(){return typeid(name).hash_code();} \ static const size_t StaticHash(){return typeid(name).hash_code();} \
const size_t GetTypeHash()const override{return name::StaticHash();} \ const size_t GetTypeHash()const override{return name::StaticHash();} \
static const AnsiIDName &GetModuleName() \ static const AIDName &GetModuleName() \
{ \ { \
static const AnsiIDName id_name(#name); \ static const AIDName id_name(#name); \
return id_name; \ return id_name; \
} \ } \
\ \

View File

@ -28,7 +28,7 @@ public:
if(!rf) if(!rf)
return(nullptr); return(nullptr);
Map<AnsiIDName,GraphModule *> dgm_map; Map<AIDName,GraphModule *> dgm_map;
//检查依赖模块 //检查依赖模块
{ {
@ -36,7 +36,7 @@ public:
if(!dependent_modules.IsEmpty()) if(!dependent_modules.IsEmpty())
{ {
for(const AnsiIDName &name:dependent_modules) for(const AIDName &name:dependent_modules)
{ {
GraphModule *dgm=rf->GetModule(name,true); GraphModule *dgm=rf->GetModule(name,true);

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include<hgl/graph/VK.h> #include<hgl/graph/VK.h>
#include<hgl/type/IDName.h> #include<hgl/type/IDName.h>
@ -11,7 +11,7 @@ class GraphModulesMap
{ {
SortedSet<GraphModule *> gm_set; SortedSet<GraphModule *> gm_set;
Map<AnsiIDName,GraphModule *> gm_map_by_name; Map<AIDName,GraphModule *> gm_map_by_name;
Map<size_t,GraphModule *> gm_map_by_hash; Map<size_t,GraphModule *> gm_map_by_hash;
List<GraphModule *> gm_list; //按创建顺序记录,用于倒序释放 List<GraphModule *> gm_list; //按创建顺序记录,用于倒序释放
@ -25,7 +25,7 @@ public:
return gm_set.IsEmpty(); return gm_set.IsEmpty();
} }
GraphModule *Get(const AnsiIDName &name) GraphModule *Get(const AIDName &name)
{ {
GraphModule *gm; GraphModule *gm;
@ -46,7 +46,7 @@ public:
template<typename T> template<typename T>
const bool IsLoaded()const{return gm_map_by_hash.ContainsKey(T::GetTypeHash());} const bool IsLoaded()const{return gm_map_by_hash.ContainsKey(T::GetTypeHash());}
const bool IsLoaded(const AnsiIDName &name)const{return gm_map_by_name.ContainsKey(name);} const bool IsLoaded(const AIDName &name)const{return gm_map_by_name.ContainsKey(name);}
bool Release(GraphModule *gm); ///<释放一个模块 bool Release(GraphModule *gm); ///<释放一个模块

2
res

@ -1 +1 @@
Subproject commit e1a36d78f0eead5f6bb65493432c4690637b991d Subproject commit 475d8ad43ceee084cd24f5d0bed59de9f6aa36fd

View File

@ -1,4 +1,4 @@
#include<hgl/graph/RenderFramework.h> #include<hgl/graph/RenderFramework.h>
#include<hgl/graph/manager/RenderPassManager.h> #include<hgl/graph/manager/RenderPassManager.h>
#include<hgl/graph/manager/TextureManager.h> #include<hgl/graph/manager/TextureManager.h>
#include<hgl/graph/module/SwapchainModule.h> #include<hgl/graph/module/SwapchainModule.h>
@ -21,7 +21,7 @@ namespace
}//namespace }//namespace
GraphModule *CreateGraphModule(const AnsiIDName &name,RenderFramework *rf); GraphModule *CreateGraphModule(const AIDName &name,RenderFramework *rf);
namespace namespace
{ {
@ -40,7 +40,7 @@ namespace
} }
}//namespace }//namespace
GraphModule *RenderFramework::GetModule(const AnsiIDName &name,bool create) GraphModule *RenderFramework::GetModule(const AIDName &name,bool create)
{ {
GraphModule *gm=graph_module_map.Get(name); GraphModule *gm=graph_module_map.Get(name);

View File

@ -55,7 +55,7 @@ bool GraphModulesMap::Release(GraphModule *gm)
return(true); return(true);
} }
GraphModule::GraphModule(RenderFramework *rf,const AnsiIDName &name) GraphModule::GraphModule(RenderFramework *rf,const AIDName &name)
{ {
render_framework=rf; render_framework=rf;
module_name=name; module_name=name;
@ -68,7 +68,7 @@ GraphModule::~GraphModule()
LOG_INFO("GraphModule::~GraphModule: "+AnsiString(module_name.GetName())) LOG_INFO("GraphModule::~GraphModule: "+AnsiString(module_name.GetName()))
} }
GraphModule *GraphModule::GetModule(const AnsiIDName &name,bool create) GraphModule *GraphModule::GetModule(const AIDName &name,bool create)
{ {
render_framework->GetModule(name,create); render_framework->GetModule(name,create);
} }

View File

@ -1,4 +1,4 @@
#include<hgl/graph/module/GraphModuleFactory.h> #include<hgl/graph/module/GraphModuleFactory.h>
#include<hgl/type/IDName.h> #include<hgl/type/IDName.h>
#include<hgl/type/Map.h> #include<hgl/type/Map.h>
#include<hgl/type/String.h> #include<hgl/type/String.h>
@ -7,7 +7,7 @@ VK_NAMESPACE_BEGIN
namespace namespace
{ {
using GraphModuleFactoryMap=ObjectMap<AnsiIDName,GraphModuleFactory>; using GraphModuleFactoryMap=ObjectMap<AIDName,GraphModuleFactory>;
static GraphModuleFactoryMap *gmf_map=nullptr; static GraphModuleFactoryMap *gmf_map=nullptr;
} }
@ -33,7 +33,7 @@ bool RegistryGraphModuleFactory(const char *module_name,GraphModuleFactory *gmf)
if(!gmf_map) if(!gmf_map)
InitGraphModuleFactory(); InitGraphModuleFactory();
AnsiIDName name(module_name); AIDName name(module_name);
if(gmf_map->ContainsKey(name)) if(gmf_map->ContainsKey(name))
return(false); return(false);
@ -43,7 +43,7 @@ bool RegistryGraphModuleFactory(const char *module_name,GraphModuleFactory *gmf)
return(true); return(true);
} }
GraphModule *CreateGraphModule(const AnsiIDName &name,RenderFramework *rf) GraphModule *CreateGraphModule(const AIDName &name,RenderFramework *rf)
{ {
if(!rf) if(!rf)
return(nullptr); return(nullptr);