Update MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm

Make fallback screen names consistent.
This commit is contained in:
Bill Hollings 2024-04-23 16:42:34 -04:00 committed by GitHub
parent a97ba52dbf
commit dae20de48a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -615,14 +615,12 @@ void MVKSwapchain::initSurfaceImages(const VkSwapchainCreateInfoKHR* pCreateInfo
if (mtlLayer) {
NSString* screenName = @"Main Screen";
#if MVK_MACOS && !MVK_MACCAT
// To prevent deadlocks, avoid dispatching to the main thread at the cost of a less informative log.
if (NSThread.currentThread.isMainThread) {
// To prevent deadlocks, avoid dispatching screenMVK to the main thread at the cost of a less informative log.
if (NSThread.isMainThread) {
auto* screen = mtlLayer.screenMVK;
if ([screen respondsToSelector:@selector(localizedName)]) {
screenName = screen.localizedName;
}
} else {
screenName = @"?";
}
#endif
MVKLogInfo("Created %d swapchain images with size (%d, %d) and contents scale %.1f in layer %s (%p) on screen %s.",