Fix some more memory leaks in the Metal backend.

This commit is contained in:
Stephen White 2018-04-27 08:14:58 -04:00 committed by Corentin Wallez
parent 22b862e052
commit cce393e0d4
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +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; blit = nil;
} }
} }
@ -64,6 +65,7 @@ namespace backend { namespace metal {
void EndCompute() { void EndCompute() {
ASSERT(compute != nil); ASSERT(compute != nil);
[compute endEncoding]; [compute endEncoding];
[compute release];
compute = nil; compute = nil;
} }
@ -71,6 +73,7 @@ namespace backend { namespace metal {
ASSERT(currentRenderPass); ASSERT(currentRenderPass);
if (render != nil) { if (render != nil) {
[render endEncoding]; [render endEncoding];
[render release];
render = nil; render = nil;
} }
@ -141,12 +144,14 @@ 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; render = nil;
} }
}; };