Metal: Fix Device::pendingCommands being freed under us

This commit is contained in:
Corentin Wallez 2017-07-11 18:59:43 -04:00 committed by Corentin Wallez
parent 77a29986b0
commit a7bfc9d2ac
1 changed files with 2 additions and 0 deletions

View File

@ -202,6 +202,7 @@ namespace metal {
id<MTLCommandBuffer> Device::GetPendingCommandBuffer() { id<MTLCommandBuffer> Device::GetPendingCommandBuffer() {
if (pendingCommands == nil) { if (pendingCommands == nil) {
pendingCommands = [commandQueue commandBuffer]; pendingCommands = [commandQueue commandBuffer];
[pendingCommands retain];
} }
return pendingCommands; return pendingCommands;
} }
@ -220,6 +221,7 @@ namespace metal {
}]; }];
[pendingCommands commit]; [pendingCommands commit];
[pendingCommands release];
pendingCommands = nil; pendingCommands = nil;
pendingCommandSerial ++; pendingCommandSerial ++;
} }