ShaderModuleManage增加析构函数

This commit is contained in:
HuYingzhuo 2019-04-28 18:17:13 +08:00
parent 9d8da06a3e
commit 684182a0d8
2 changed files with 20 additions and 3 deletions

View File

@ -6,6 +6,23 @@
#include"VKShaderParse.h"
VK_NAMESPACE_BEGIN
ShaderModuleManage::~ShaderModuleManage()
{
const int count=shader_list.GetCount();
if(count>0)
{
auto **p=shader_list.GetDataList();
for(int i=0;i<count;i++)
{
delete (*p)->right;
++p;
}
}
}
const ShaderModule *ShaderModuleManage::CreateShader(const VkShaderStageFlagBits shader_stage_bit,const void *spv_data,const uint32_t spv_size)
{
VkPipelineShaderStageCreateInfo *shader_stage=new VkPipelineShaderStageCreateInfo;
@ -85,7 +102,7 @@ bool ShaderModuleManage::ReleaseShader(const ShaderModule *const_sm)
return(true);
}
const Material *ShaderModuleManage::CreateMaterial(const VertexShaderModule *vertex_shader_module,const ShaderModule *fragment_shader_module)const
Material *ShaderModuleManage::CreateMaterial(const VertexShaderModule *vertex_shader_module,const ShaderModule *fragment_shader_module)const
{
if(!vertex_shader_module||!fragment_shader_module)
return(nullptr);

View File

@ -58,8 +58,8 @@ public:
const ShaderModule *GetShader (int);
bool ReleaseShader (const ShaderModule *);
const Material * CreateMaterial(const VertexShaderModule *vertex_shader_module,const ShaderModule *fragment_shader_module)const;
const Material * CreateMaterial(const UTF8String &vertex_shader_filename,const UTF8String &fragment_shader_filename)
Material * CreateMaterial(const VertexShaderModule *vertex_shader_module,const ShaderModule *fragment_shader_module)const;
Material * CreateMaterial(const UTF8String &vertex_shader_filename,const UTF8String &fragment_shader_filename)
{
const ShaderModule *vs=CreateShader(VK_SHADER_STAGE_VERTEX_BIT,vertex_shader_filename);