Closed dazkzi closed 1 year ago
There's not much I can do there unfortunately, it's probably some stuff that needs warming up inside Metal or MTKView.
FWIW I've seen funky swapchain timing behaviour on macOS since forever, mostly when a window becomes obscured or visible. For instance when a window becomes fully obscured, MTKView doesn't trigger the frame callback for a full second, and macOS/MTKView also changed behaviour multiple times about triggering the frame callback for obscured windows.
And without MTKView (using CAMetalLayer directly), there's the opposite problem that throttling to the display refresh rate doesn't work for up to half a second in a newly created window or when a fully obscured window becomes visible.
TL;DR: under-the-hood behaviour like this changes unpredictably quite frequently between macOS versions unfortunately.
This only happens when use OpenGL. Metal is fine.
Ah ok, on macOS OpenGL is implemented on top of Metal though, so it's just more stuff heaped on top. But the same thinking applies, there's probably some warmup stuff that happens in the OpenGL implementation during the first frame.
(OpenGL in general behaves completely unpredictable when it comes to timing, on all platforms).
On m1 mac, there is no such problem. But on other mac, this problem is significant.
It takes too much time to render first frame.