2025-01-16 02:10:03 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include<hgl/graph/VKDevice.h>
|
|
|
|
#include<hgl/type/TypeInfo.h>
|
|
|
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class GraphModule
|
|
|
|
{
|
|
|
|
GPUDevice *device;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
GPUDevice * GetDevice () {return device;} ///<取得GPU设备
|
|
|
|
VkDevice GetVkDevice ()const {return device->GetDevice();} ///<取得VkDevice
|
|
|
|
const GPUPhysicalDevice * GetPhysicalDevice ()const {return device->GetPhysicalDevice();} ///<取得物理设备
|
|
|
|
GPUDeviceAttribute *GetDeviceAttribute () {return device->GetDeviceAttribute();} ///<取得设备属性
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
GraphModule(GPUDevice *dev){device=dev;}
|
|
|
|
virtual ~GraphModule()=default;
|
|
|
|
|
|
|
|
virtual const size_t GetTypeHash()const noexcept=0;
|
|
|
|
virtual const AnsiString &GetName()const=0;
|
|
|
|
};//class GraphModule
|
|
|
|
|
2025-01-19 18:13:06 +08:00
|
|
|
template<typename T,typename BASE> class GraphModuleInherit:public BASE
|
2025-01-16 02:10:03 +08:00
|
|
|
{
|
|
|
|
AnsiString manager_name;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
const size_t GetTypeHash()const noexcept override
|
|
|
|
{
|
|
|
|
return typeid(T).hash_code();
|
|
|
|
}
|
|
|
|
|
|
|
|
const AnsiString &GetName()const override
|
|
|
|
{
|
|
|
|
return manager_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2025-01-19 18:13:06 +08:00
|
|
|
GraphModuleInherit(GPUDevice *dev,const AnsiString &name):BASE(dev)
|
2025-01-16 02:10:03 +08:00
|
|
|
{
|
|
|
|
manager_name=name;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~GraphModuleInherit()=default;
|
|
|
|
};//class GraphModuleInherit
|
|
|
|
|
2025-01-19 18:13:06 +08:00
|
|
|
#define GRAPH_MODULE_CLASS(class_name) class class_name:public GraphModuleInherit<class_name,GraphModule>
|
2025-01-16 02:10:03 +08:00
|
|
|
|
2025-01-19 18:13:06 +08:00
|
|
|
#define GRAPH_MODULE_CONSTRUCT(class_name) class_name::class_name(GPUDevice *dev):GraphModuleInherit<class_name,GraphModule>(dev,#class_name)
|
2025-01-16 02:10:03 +08:00
|
|
|
|
|
|
|
VK_NAMESPACE_END
|