I tried to count the FPS in my render loop like this:
while (!glfwWindowShouldClose(window)) {
float current = (float) glfwGetTime();
delta = current - time;
time = current;
std::cout << 1.f / delta << std::endl;
render();
glfwSwapBuffers(window);
glfwPollEvents();
}
...with VSync enabled:
glfwSwapInterval(1);
...but the output looks like this:
72.0857
345.182
73.3988
343.092
71.9065
375.564
71.9188
353.294
71.9324
360.212
72.3131
277.364
So it seems like roughly every second draw call is skipped. How can I check if the drawing was skipped in a frame so that I doesn't count it into the frame rate, what happens in these iterations and why are they skipped?
Ok so it appears to be something Apple broke on M1 MacBooks and there is already an attempt to fix it:
As a temporary fix downgrading to GLFW 3.3 fixes VSync and the FPS counter so that the frame rate stays at stable 60.