From ba72addfbfba71f86ae853191cb08e308abbb55f Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 22 Oct 2020 01:29:09 +0800 Subject: [PATCH] fix memory leak at InlineGeometryScene.cpp --- CMakeLists.txt | 1 - example/Vulkan/InlineGeometryScene.cpp | 5 ++++- example/Vulkan/texture_rect.cpp | 2 +- inc/hgl/graph/VKRenderResource.h | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78306f00..1aa69628 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ SET(ULRE CMCore ULRE.VulkanRender ULRE.SceneGraph MathGeoLib - ${JSONCPP_LIBRARY} ${RENDER_LIBRARY} ${Vulkan_LIBRARIES}) diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 9a7c2db8..82144b4e 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -99,6 +99,9 @@ private: texture.color =CreateTextureFromFile(device,OS_TEXT("res/image/Brickwall/Albedo.Tex2D")); texture.normal =CreateTextureFromFile(device,OS_TEXT("res/image/Brickwall/Normal.Tex2D")); + + db->Add(texture.color); + db->Add(texture.normal); } { @@ -170,7 +173,7 @@ private: cci.halfExtend=10; cci.radius=10; cci.numberSlices=128; - cci.numberStacks=1; + cci.numberStacks=32; ro_cone=CreateRenderableCone(db,material,&cci); } diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index 71b77dfc..d0f0bc40 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -53,7 +53,7 @@ private: Sampler * sampler =nullptr; MaterialInstance * material_instance =nullptr; RenderableInstance *renderable_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_world_matrix =nullptr; Pipeline * pipeline =nullptr; private: diff --git a/inc/hgl/graph/VKRenderResource.h b/inc/hgl/graph/VKRenderResource.h index 077c70fd..a2dc4606 100644 --- a/inc/hgl/graph/VKRenderResource.h +++ b/inc/hgl/graph/VKRenderResource.h @@ -119,7 +119,7 @@ public: //Get Pipeline * GetPipeline (const PipelineID &id){return rm_pipeline.Get(id);} DescriptorSets * GetDescSets (const DescriptorSetsID &id){return rm_desc_sets.Get(id);} Renderable * GetRenderable (const RenderableID &id){return rm_renderables.Get(id);} - GPUBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);} + GPUBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);} Sampler * GetSampler (const SamplerID &id){return rm_samplers.Get(id);} Texture * GetTexture (const TextureID &id){return rm_textures.Get(id);} RenderableInstance *GetRenderableInstance (const RenderableInstanceID &id){return rm_renderable_instances.Get(id);}