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];
|
CGDirectDisplayID displayId = [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId);
|
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId);
|
||||||
double framesPerSecond = CGDisplayModeGetRefreshRate(mode);
|
double framesPerSecond = CGDisplayModeGetRefreshRate(mode);
|
||||||
CGDisplayModeRelease(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.
|
// Builtin panels, e.g., on MacBook, report a zero refresh rate.
|
||||||
if (framesPerSecond == 0)
|
if (framesPerSecond == 0)
|
||||||
framesPerSecond = 60.0;
|
framesPerSecond = 60.0;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pRefreshCycleDuration->refreshDuration = (uint64_t)1e9 / framesPerSecond;
|
pRefreshCycleDuration->refreshDuration = (uint64_t)1e9 / framesPerSecond;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user