Use maximumFramesPerSecond only as fallback
This commit is contained in:
parent
a0490cec0f
commit
d66238035c
@ -439,19 +439,19 @@ VkResult MVKSwapchain::getRefreshCycleDuration(VkRefreshCycleDurationGOOGLE *pRe
|
||||
}
|
||||
}
|
||||
|
||||
#if MVK_XCODE_13
|
||||
// macOS 12+ only
|
||||
double framesPerSecond = [screen maximumFramesPerSecond];
|
||||
#else
|
||||
CGDirectDisplayID displayId = [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId);
|
||||
double framesPerSecond = CGDisplayModeGetRefreshRate(mode);
|
||||
CGDisplayModeRelease(mode);
|
||||
|
||||
#if MVK_XCODE_13
|
||||
if (framesPerSecond == 0 && [screen respondsToSelector: @selector(maximumFramesPerSecond)])
|
||||
framesPerSecond = [screen maximumFramesPerSecond];
|
||||
#endif
|
||||
|
||||
// Builtin panels, e.g., on MacBook, report a zero refresh rate.
|
||||
if (framesPerSecond == 0)
|
||||
framesPerSecond = 60.0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pRefreshCycleDuration->refreshDuration = (uint64_t)1e9 / framesPerSecond;
|
||||
|
Loading…
x
Reference in New Issue
Block a user