moved device_render_pass to RenderFramework from GPUDevice.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/platform/Window.h>
|
||||
@@ -29,11 +29,14 @@ public:
|
||||
Window * GetWindow (){return win;}
|
||||
GPUDevice * GetDevice (){return device;}
|
||||
|
||||
RenderPass * GetRenderPass (){return device_render_pass;}
|
||||
|
||||
public:
|
||||
|
||||
GraphModuleManager *GetModuleManager(){return module_manager;}
|
||||
RenderPassManager * GetRenderPassManager(){return render_pass_manager;}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
RenderFramework(const OSString &);
|
||||
@@ -41,6 +44,12 @@ public:
|
||||
|
||||
virtual bool Init(uint w,uint h);
|
||||
|
||||
public: // event
|
||||
|
||||
void OnResize(uint w,uint h);
|
||||
void OnActive(bool);
|
||||
void OnClose();
|
||||
|
||||
};//class RenderFramework
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -37,15 +37,10 @@ class GPUDevice
|
||||
|
||||
private:
|
||||
|
||||
RenderPass *device_render_pass;
|
||||
|
||||
RTSwapchain *sc_rt;
|
||||
|
||||
RTSwapchain *CreateSwapchainRenderTarget();
|
||||
|
||||
void InitRenderPassManage();
|
||||
void ClearRenderPassManage();
|
||||
|
||||
private:
|
||||
|
||||
VkCommandBuffer CreateCommandBuffer(const AnsiString &);
|
||||
@@ -78,8 +73,6 @@ public:
|
||||
const VkColorSpaceKHR GetColorSpace ()const {return attr->surface_format.colorSpace;}
|
||||
VkQueue GetGraphicsQueue () {return attr->graphics_queue;}
|
||||
|
||||
RenderPass * GetRenderPass () {return device_render_pass;}
|
||||
|
||||
RTSwapchain * GetSwapchainRT () {return sc_rt;}
|
||||
|
||||
const VkExtent2D & GetSwapchainSize ()const {return sc_rt->GetExtent();}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/type/Map.h>
|
||||
@@ -28,14 +28,30 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
GraphModule * GetModule(const size_t type_hash) {return GetObjectFromList(module_map,type_hash);} ///<取得指定类型的模块
|
||||
GraphModule * Get(const size_t type_hash) {return GetObjectFromList(module_map,type_hash);} ///<取得指定类型的模块
|
||||
template<typename T>
|
||||
T * GetModule() {return(GetModule(typeid(T).hash_code()));} ///<取得指定类型的模块
|
||||
T * Get() {return((T *)Get(typeid(T).hash_code()));} ///<取得指定类型的模块
|
||||
|
||||
bool ConatainsModule(const size_t &type_hash)const {return module_map.ContainsKey(type_hash);} ///<确认是否包含指定类型的模块
|
||||
bool Contains(const size_t &type_hash)const {return module_map.ContainsKey(type_hash);} ///<确认是否包含指定类型的模块
|
||||
|
||||
template<typename T>
|
||||
bool Contains()const{return Contains(typeid(T).hash_code());} ///<确认是否包含指定类型的模块
|
||||
|
||||
bool Registry(GraphModule *); ///<注册一个模块
|
||||
bool Unregistry(GraphModule *); ///<注销一个模块
|
||||
|
||||
template<typename T>
|
||||
T *GetOrCreate() ///<注册一个模块
|
||||
{
|
||||
if(Contains<T>())
|
||||
return Get<T>();
|
||||
|
||||
T *result=new T(device);
|
||||
|
||||
Registry(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
};//class GraphModuleManager
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/module/GraphModule.h>
|
||||
#include<hgl/type/Map.h>
|
||||
@@ -25,6 +25,8 @@ private:
|
||||
RenderPassManager(GPUDevice *);
|
||||
~RenderPassManager();
|
||||
|
||||
friend class GraphModuleManager;
|
||||
|
||||
private:
|
||||
|
||||
RenderPass * CreateRenderPass( const List<VkAttachmentDescription> &desc_list,
|
||||
|
Reference in New Issue
Block a user