Metal renderer fps cap?

I have noticed a bit of a strange behaviour with the SDL renderer on a Mac. When I use the metal renderer it seems like the fps is being capped at around 90-130 fps, even for empty scenes (no actual drawing, just clear and present). When I choose the OpenGL renderer with otherwise the exact same settings, I get uncapped frame rates that easily go into the thousands. So it does not appear to be related to the PRESENTVSYNC flag.

It seems like it does not matter if I specifically choose the metal driver or if I pass -1 to Createrenderer and let it choose by itself. As long as the metal driver is used I only get around 120 fps.

It does not seem to be bad performance, as if I make the scene much more complex I still get the same 120 fps. So it behaves more like a cap. With OpenGL I see a concrete link between scene complexity and fps, the more I draw the lower the fps. With metal it stays at around 120.

Just curious if anyone saw this behaviour and if it’s expected or maybe I’m doing something wrong.

Are you running fullscreen or windowed? What version of macOS?

I think when windowed there’s a cap when it comes to Metal as well. But I’ve seen it it even in code that isn’t using SDL, so I think it’s a macOS thing, not a bug in SDL.

Probably has something to do with the way the drawables swapchain interacts with the rest of the windowing system when running in windowed mode.

I don’t think this is a bug in SDL. It’s probably some Metal thing. I also noticed that moving the window to a different screen changed the fps to a different value. I was just curious if anyone knows about this.

My results were from running in a window, I did not try Fullscreen yet.

I am almost sure that it was different on an earlier OS version, but I don’t have any way to go back and check this. I can confirm that this is not a regression with 2.0.18 as older SDL versions have the same behavior.