From f77e3cc64800605cc36e4bba70d44481f908e0bc Mon Sep 17 00:00:00 2001 From: Stephen White Date: Tue, 8 May 2018 15:53:32 -0400 Subject: [PATCH] Don't release things which will be autoreleased. --- src/backend/metal/CommandBufferMTL.mm | 13 ++++--------- src/backend/metal/MetalBackend.mm | 6 ++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/backend/metal/CommandBufferMTL.mm b/src/backend/metal/CommandBufferMTL.mm index e9b367f02f..ef5045f657 100644 --- a/src/backend/metal/CommandBufferMTL.mm +++ b/src/backend/metal/CommandBufferMTL.mm @@ -43,8 +43,7 @@ namespace backend { namespace metal { ASSERT(compute == nil); if (blit != nil) { [blit endEncoding]; - [blit release]; - blit = nil; + blit = nil; // This will be autoreleased. } } @@ -65,16 +64,14 @@ namespace backend { namespace metal { void EndCompute() { ASSERT(compute != nil); [compute endEncoding]; - [compute release]; - compute = nil; + compute = nil; // This will be autoreleased. } void BeginSubpass(id commandBuffer, uint32_t subpass) { ASSERT(currentRenderPass); if (render != nil) { [render endEncoding]; - [render release]; - render = nil; + render = nil; // This will be autoreleased. } const auto& info = currentRenderPass->GetSubpassInfo(subpass); @@ -144,15 +141,13 @@ namespace backend { namespace metal { } render = [commandBuffer renderCommandEncoderWithDescriptor:descriptor]; - [descriptor release]; // TODO(cwallez@chromium.org): does any state need to be reset? } void EndSubpass() { ASSERT(render != nil); [render endEncoding]; - [render release]; - render = nil; + render = nil; // This will be autoreleased. } }; } diff --git a/src/backend/metal/MetalBackend.mm b/src/backend/metal/MetalBackend.mm index 3275582b1b..68982b4649 100644 --- a/src/backend/metal/MetalBackend.mm +++ b/src/backend/metal/MetalBackend.mm @@ -62,8 +62,7 @@ namespace backend { namespace metal { } Tick(); - [mPendingCommands release]; - mPendingCommands = nil; + mPendingCommands = nil; // This will be autoreleased. delete mMapTracker; mMapTracker = nullptr; @@ -171,8 +170,7 @@ namespace backend { namespace metal { }]; [mPendingCommands commit]; - [mPendingCommands release]; - mPendingCommands = nil; + mPendingCommands = nil; // This will be autoreleased. mPendingCommandSerial++; }