Fix build errors on Simulator not supporting MTLDrawable present time options.

This commit is contained in:
Bill Hollings 2020-08-25 13:04:52 -04:00
parent dd59aea71f
commit 5f6dd8fe81
2 changed files with 8 additions and 1 deletions

View File

@ -1179,6 +1179,11 @@ void MVKPresentableSwapchainImage::presentCAMetalDrawable(id<MTLCommandBuffer> m
}];
if (hasPresentTime) {
#if MVK_OS_SIMULATOR
// If MTLDrawable.presentedTime/addPresentedHandler isn't supported, just treat it as if the
// present happened when requested
_swapchain->recordPresentTime(presentID, desiredPresentTime, desiredPresentTime);
#else
if ([_mtlDrawable respondsToSelector: @selector(addPresentedHandler:)]) {
[_mtlDrawable addPresentedHandler: ^(id<MTLDrawable> drawable) {
// Record the presentation time
@ -1191,7 +1196,9 @@ void MVKPresentableSwapchainImage::presentCAMetalDrawable(id<MTLCommandBuffer> m
// present happened when requested
_swapchain->recordPresentTime(presentID, desiredPresentTime, desiredPresentTime);
}
#endif
}
}
// Resets the MTLTexture and CAMetalDrawable underlying this image.

View File

@ -78,7 +78,7 @@ MVKSemaphoreImpl::~MVKSemaphoreImpl() {
#pragma mark -
#pragma mark MVKSemaphoreMTLEvent
#pragma mark MVKSemaphoreMTLFence
// Could use any encoder. Assume BLIT is fastest and lightest.
// Nil mtlCmdBuff will do nothing.