From 684182a0d8eab7aebca98bec4a20293efdae744e Mon Sep 17 00:00:00 2001 From: HuYingzhuo Date: Sun, 28 Apr 2019 18:17:13 +0800 Subject: [PATCH] =?UTF-8?q?ShaderModuleManage=E5=A2=9E=E5=8A=A0=E6=9E=90?= =?UTF-8?q?=E6=9E=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/VKShaderModuleManage.cpp | 19 ++++++++++++++++++- example/Vulkan/VKShaderModuleManage.h | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/example/Vulkan/VKShaderModuleManage.cpp b/example/Vulkan/VKShaderModuleManage.cpp index 09eabaae..a706e257 100644 --- a/example/Vulkan/VKShaderModuleManage.cpp +++ b/example/Vulkan/VKShaderModuleManage.cpp @@ -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;iright; + + ++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); diff --git a/example/Vulkan/VKShaderModuleManage.h b/example/Vulkan/VKShaderModuleManage.h index 95aafd44..6813b016 100644 --- a/example/Vulkan/VKShaderModuleManage.h +++ b/example/Vulkan/VKShaderModuleManage.h @@ -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);