From 9fc28cf3b6250e41c09bf8e26ed99b2f7c4db549 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 9 Feb 2022 15:56:32 +0000 Subject: [PATCH] Metal: Fix leak of MTLVertexDescriptor when using vertex pulling Bug: dawn:1175 Change-Id: I1fd833fef830de4165a397e07c3ddaae0d7bdca8 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79762 Commit-Queue: Corentin Wallez Auto-Submit: Corentin Wallez Reviewed-by: Austin Eng Commit-Queue: Austin Eng --- src/dawn/native/metal/RenderPipelineMTL.h | 2 +- src/dawn/native/metal/RenderPipelineMTL.mm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dawn/native/metal/RenderPipelineMTL.h b/src/dawn/native/metal/RenderPipelineMTL.h index 05c70aa0b7..a4c6296b31 100644 --- a/src/dawn/native/metal/RenderPipelineMTL.h +++ b/src/dawn/native/metal/RenderPipelineMTL.h @@ -53,7 +53,7 @@ namespace dawn::native::metal { private: using RenderPipelineBase::RenderPipelineBase; - MTLVertexDescriptor* MakeVertexDesc(); + NSRef MakeVertexDesc(); MTLPrimitiveType mMtlPrimitiveTopology; MTLWinding mMtlFrontFace; diff --git a/src/dawn/native/metal/RenderPipelineMTL.mm b/src/dawn/native/metal/RenderPipelineMTL.mm index ac200028e5..6b7e0fecb7 100644 --- a/src/dawn/native/metal/RenderPipelineMTL.mm +++ b/src/dawn/native/metal/RenderPipelineMTL.mm @@ -436,7 +436,7 @@ namespace dawn::native::metal { return mStagesRequiringStorageBufferLength; } - MTLVertexDescriptor* RenderPipeline::MakeVertexDesc() { + NSRef RenderPipeline::MakeVertexDesc() { MTLVertexDescriptor* mtlVertexDescriptor = [MTLVertexDescriptor new]; // Vertex buffers are packed after all the buffers for the bind groups. @@ -491,7 +491,7 @@ namespace dawn::native::metal { [attribDesc release]; } - return mtlVertexDescriptor; + return AcquireNSRef(mtlVertexDescriptor); } void RenderPipeline::InitializeAsync(Ref renderPipeline,