Don't release things which will be autoreleased.

This commit is contained in:
Stephen White 2018-05-08 15:53:32 -04:00 committed by Corentin Wallez
parent ae27c7a4bc
commit f77e3cc648
2 changed files with 6 additions and 13 deletions

View File

@ -43,8 +43,7 @@ namespace backend { namespace metal {
ASSERT(compute == nil); ASSERT(compute == nil);
if (blit != nil) { if (blit != nil) {
[blit endEncoding]; [blit endEncoding];
[blit release]; blit = nil; // This will be autoreleased.
blit = nil;
} }
} }
@ -65,16 +64,14 @@ namespace backend { namespace metal {
void EndCompute() { void EndCompute() {
ASSERT(compute != nil); ASSERT(compute != nil);
[compute endEncoding]; [compute endEncoding];
[compute release]; compute = nil; // This will be autoreleased.
compute = nil;
} }
void BeginSubpass(id<MTLCommandBuffer> commandBuffer, uint32_t subpass) { void BeginSubpass(id<MTLCommandBuffer> commandBuffer, uint32_t subpass) {
ASSERT(currentRenderPass); ASSERT(currentRenderPass);
if (render != nil) { if (render != nil) {
[render endEncoding]; [render endEncoding];
[render release]; render = nil; // This will be autoreleased.
render = nil;
} }
const auto& info = currentRenderPass->GetSubpassInfo(subpass); const auto& info = currentRenderPass->GetSubpassInfo(subpass);
@ -144,15 +141,13 @@ namespace backend { namespace metal {
} }
render = [commandBuffer renderCommandEncoderWithDescriptor:descriptor]; render = [commandBuffer renderCommandEncoderWithDescriptor:descriptor];
[descriptor release];
// TODO(cwallez@chromium.org): does any state need to be reset? // TODO(cwallez@chromium.org): does any state need to be reset?
} }
void EndSubpass() { void EndSubpass() {
ASSERT(render != nil); ASSERT(render != nil);
[render endEncoding]; [render endEncoding];
[render release]; render = nil; // This will be autoreleased.
render = nil;
} }
}; };
} }

View File

@ -62,8 +62,7 @@ namespace backend { namespace metal {
} }
Tick(); Tick();
[mPendingCommands release]; mPendingCommands = nil; // This will be autoreleased.
mPendingCommands = nil;
delete mMapTracker; delete mMapTracker;
mMapTracker = nullptr; mMapTracker = nullptr;
@ -171,8 +170,7 @@ namespace backend { namespace metal {
}]; }];
[mPendingCommands commit]; [mPendingCommands commit];
[mPendingCommands release]; mPendingCommands = nil; // This will be autoreleased.
mPendingCommands = nil;
mPendingCommandSerial++; mPendingCommandSerial++;
} }