FPS randomly goes above 60

On macOS and vsync enabled I get random FPS spikes (usually on startup) which go above 60 (into the 80s). Strangely on my own Cocoa based OpenGL view (which vsync enabled) I see a similar thing but the FPS DROPS below 60 and then will stabilize.

Just now I start the game and get 90 FPS and when I quit and restart it goes to 60…

Is there any reason for this? I’m starting to feel like this computer (MacBook Pro 2020) is messed up but I can’t confirm this.

Are you using OpenGL in your SDL app? Or are you using SDL renderer?

If it’s SDL renderer, then the reason is macOS. The way SDL renderer handles vsync on macOS (using the default Metal backend) is that it just sets the underlying CAMetalLayer’s displaySyncEnabled property to YES, and lets macOS take it from there. For whatever reason, for the first second or two macOS doesn’t really honor that property, and so applications can see their FPS zoom way up at first and then settle at 60. (noticed it myself and dug down into SDL’s Metal code to see why)

If you’re just using SDL to set up an OpenGL window & context, I remember there being some special cases in macOS OpenGL that SDL had to work around.

For your Cocoa + OpenGL application, it’s not surprising to see an application’s FPS drop for the first few seconds either.

Unless you’re experiencing graphical glitches or weirdness outside of your own app, I doubt any of this is caused by your MBP failing.

I’m using OpenGL and the spike seems random, i.e. not every time. I agree there may be something wrong with the vsync and I’ve even seen it myself using CVDisplayLinkRef in my own code.

Apple has deprecated OpenGL for some years now and it’s possible they are not fixing bugs which occur because they want us to switch to Metal. So it’s most likely this is not SDL related but rather OpenGL and Apple’s implementation.