glutin
glutin copied to clipboard
On MacOS Vsync does nothing (rendering occurs as fast as possible) if window is hidden
This is easily tested by measuring time between frames, creating a window, and moving the window behind another window.
The frame time will drop to around 0. This effectively busy-loops and can quickly heat up a laptop or drain battery. I encountered a version of this issue (with a library similar to glutin
) where I left a program running with my laptop closed and came back and it was super hot.
This is an issue other similar libraries have encountered as well: https://github.com/libsdl-org/SDL/issues/1871
Their solution was to insert a sleep when the window is not visible.
I put together a small repository that reproduces this issue: https://github.com/kettle11/winit_framerate_test