fixed Order for to release graph modules.
This commit is contained in:
parent
fda5b629a2
commit
abad1784c2
@ -13,7 +13,9 @@ class GraphModuleManager
|
|||||||
{
|
{
|
||||||
GPUDevice *device;
|
GPUDevice *device;
|
||||||
|
|
||||||
Map<AnsiIDName,GraphModule *> graph_module_map;
|
List<GraphModule *> module_list; ///<模块列表
|
||||||
|
|
||||||
|
Map<AnsiIDName,GraphModule *> graph_module_map; ///<模块映射表
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -86,12 +88,8 @@ public:
|
|||||||
|
|
||||||
NO_COPY_NO_MOVE(GraphModule)
|
NO_COPY_NO_MOVE(GraphModule)
|
||||||
|
|
||||||
GraphModule(GraphModuleManager *gmm,const AnsiIDName &name)
|
GraphModule(GraphModuleManager *gmm,const AnsiIDName &name);
|
||||||
{
|
virtual ~GraphModule();
|
||||||
module_manager=gmm;
|
|
||||||
module_name=name;
|
|
||||||
}
|
|
||||||
virtual ~GraphModule()=default;
|
|
||||||
|
|
||||||
virtual bool Init(){return true;} ///<初始化当前模块
|
virtual bool Init(){return true;} ///<初始化当前模块
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ RTSwapchain::RTSwapchain(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rc
|
|||||||
RTSwapchain::~RTSwapchain()
|
RTSwapchain::~RTSwapchain()
|
||||||
{
|
{
|
||||||
delete present_complete_semaphore;
|
delete present_complete_semaphore;
|
||||||
delete swapchain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t RTSwapchain::AcquireNextImage()
|
uint32_t RTSwapchain::AcquireNextImage()
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
#include<hgl/graph/module/GraphModule.h>
|
#include<hgl/graph/module/GraphModule.h>
|
||||||
#include<hgl/graph/VKDevice.h>
|
#include<hgl/graph/VKDevice.h>
|
||||||
|
#include<hgl/log/LogInfo.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
GraphModule::GraphModule(GraphModuleManager *gmm,const AnsiIDName &name)
|
||||||
|
{
|
||||||
|
module_manager=gmm;
|
||||||
|
module_name=name;
|
||||||
|
|
||||||
|
LOG_INFO("GraphModule::GraphModule: "+AnsiString(module_name.GetName()))
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphModule::~GraphModule()
|
||||||
|
{
|
||||||
|
LOG_INFO("GraphModule::~GraphModule: "+AnsiString(module_name.GetName()))
|
||||||
|
}
|
||||||
|
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -94,7 +94,10 @@ GraphModule *GraphModuleManager::GetModule(const AnsiIDName &name,bool create)
|
|||||||
gm=CreateGraphModule(name,this);
|
gm=CreateGraphModule(name,this);
|
||||||
|
|
||||||
if(gm)
|
if(gm)
|
||||||
|
{
|
||||||
graph_module_map.Add(name,gm);
|
graph_module_map.Add(name,gm);
|
||||||
|
module_list.Add(gm);
|
||||||
|
}
|
||||||
|
|
||||||
return gm;
|
return gm;
|
||||||
}
|
}
|
||||||
@ -104,10 +107,19 @@ GraphModule *GraphModuleManager::GetModule(const AnsiIDName &name,bool create)
|
|||||||
|
|
||||||
GraphModuleManager::~GraphModuleManager()
|
GraphModuleManager::~GraphModuleManager()
|
||||||
{
|
{
|
||||||
for(auto *gm:graph_module_map)
|
//按顺序加入module_list的,要倒着释放
|
||||||
|
|
||||||
|
GraphModule **gm=module_list.end();
|
||||||
|
|
||||||
|
while(gm>module_list.begin())
|
||||||
{
|
{
|
||||||
delete gm->value;
|
--gm;
|
||||||
|
delete *gm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//其实下面释不释放都无所谓了
|
||||||
|
module_list.Clear();
|
||||||
|
graph_module_map.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphModuleManager::ReleaseModule(GraphModule *gm)
|
void GraphModuleManager::ReleaseModule(GraphModule *gm)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user