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);
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<MTLCommandBuffer> 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.
}
};
}

View File

@ -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++;
}