Fix crash in vkCreateSwapchainKHR() on macOS 10.14 and earlier

This commit is contained in:
Tom Butterworth 2022-08-18 16:54:20 +01:00
parent d447ea7940
commit 07ac3c8603

View File

@ -402,10 +402,12 @@ void MVKSwapchain::initSurfaceImages(const VkSwapchainCreateInfoKHR* pCreateInfo
_presentableImages.push_back(_device->createPresentableSwapchainImage(&imgInfo, this, imgIdx, NULL));
}
#if MVK_MACOS && !MVK_MACCAT
NSString* screenName = _mtlLayer.screenMVK.localizedName;
#else
NSString* screenName = @"Main Screen";
#if MVK_MACOS && !MVK_MACCAT
if ([_mtlLayer.screenMVK respondsToSelector:@selector(localizedName)])
{
screenName = _mtlLayer.screenMVK.localizedName;
}
#endif
MVKLogInfo("Created %d swapchain images with initial size (%d, %d) and contents scale %.1f for screen %s.",
imgCnt, imgExtent.width, imgExtent.height, _mtlLayer.contentsScale, screenName.UTF8String);