From f6579df9f33c99969a973b73fe50b501fa665a05 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 5 Jul 2019 17:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8ESharedPtr=E6=8D=A2=E7=94=A8=E6=9B=B4?= =?UTF-8?q?=E8=BD=BB=E9=87=8F=E7=BA=A7=E7=9A=84AutoDelete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/Atomsphere.cpp | 2 +- example/Vulkan/Deferred.cpp | 4 ++-- example/Vulkan/Geometry2D.cpp | 2 +- example/Vulkan/Geometry3D.cpp | 2 +- example/Vulkan/InlineGeometryScene.cpp | 2 +- example/Vulkan/LoadModel.cpp | 2 +- example/Vulkan/SceneTree.cpp | 2 +- example/Vulkan/indices_rect.cpp | 2 +- example/Vulkan/main.cpp | 4 ++-- example/Vulkan/texture_rect.cpp | 2 +- inc/hgl/type/Smart.h | 3 +++ 11 files changed, 15 insertions(+), 12 deletions(-) diff --git a/example/Vulkan/Atomsphere.cpp b/example/Vulkan/Atomsphere.cpp index 43f504ea..0dc31b33 100644 --- a/example/Vulkan/Atomsphere.cpp +++ b/example/Vulkan/Atomsphere.cpp @@ -87,7 +87,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); diff --git a/example/Vulkan/Deferred.cpp b/example/Vulkan/Deferred.cpp index edf4ec12..664bc039 100644 --- a/example/Vulkan/Deferred.cpp +++ b/example/Vulkan/Deferred.cpp @@ -142,7 +142,7 @@ private: bool InitGBufferPipeline(SubpassParam *sp) { - SharedPtr pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,device->GetExtent()); + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->SetCullMode(VK_CULL_MODE_BACK_BIT); @@ -159,7 +159,7 @@ private: bool InitCompositionPipeline(SubpassParam *sp) { - SharedPtr pipeline_creater=new vulkan::PipelineCreater(device,sp->material,device->GetMainRenderPass(),device->GetExtent()); + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,sp->material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->SetCullMode(VK_CULL_MODE_NONE); diff --git a/example/Vulkan/Geometry2D.cpp b/example/Vulkan/Geometry2D.cpp index 3c0d7dad..6a5e18f2 100644 --- a/example/Vulkan/Geometry2D.cpp +++ b/example/Vulkan/Geometry2D.cpp @@ -114,7 +114,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index e6ea5930..6221466f 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -84,7 +84,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 5826d3b8..782277fc 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -137,7 +137,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); diff --git a/example/Vulkan/LoadModel.cpp b/example/Vulkan/LoadModel.cpp index 5fe2cf17..eb9c7978 100644 --- a/example/Vulkan/LoadModel.cpp +++ b/example/Vulkan/LoadModel.cpp @@ -162,7 +162,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); diff --git a/example/Vulkan/SceneTree.cpp b/example/Vulkan/SceneTree.cpp index c504f7a2..53ee88bd 100644 --- a/example/Vulkan/SceneTree.cpp +++ b/example/Vulkan/SceneTree.cpp @@ -74,7 +74,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); diff --git a/example/Vulkan/indices_rect.cpp b/example/Vulkan/indices_rect.cpp index df04b67a..3a0b97c3 100644 --- a/example/Vulkan/indices_rect.cpp +++ b/example/Vulkan/indices_rect.cpp @@ -103,7 +103,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); diff --git a/example/Vulkan/main.cpp b/example/Vulkan/main.cpp index 188f547f..a4961e6b 100644 --- a/example/Vulkan/main.cpp +++ b/example/Vulkan/main.cpp @@ -107,7 +107,7 @@ private: constexpr os_char PIPELINE_FILENAME[]=OS_TEXT("2DSolid.pipeline"); { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); @@ -121,7 +121,7 @@ private: void *data; uint size=filesystem::LoadFileToMemory(PIPELINE_FILENAME,(void **)&data); - SharedPtr pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent(),(uchar *)data,size); + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent(),(uchar *)data,size); pipeline=pipeline_creater->Create(); } diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index 3e9ad671..c8bcd2ea 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -148,7 +148,7 @@ private: bool InitPipeline() { - SharedPtr + AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); diff --git a/inc/hgl/type/Smart.h b/inc/hgl/type/Smart.h index dcdec534..85d3ee9e 100644 --- a/inc/hgl/type/Smart.h +++ b/inc/hgl/type/Smart.h @@ -480,6 +480,9 @@ namespace hgl T *operator -> (){return obj;} + operator T *(){return obj;} + operator const T *()const{return obj;} + void Clear() { obj=nullptr;