Closed st0rmbtw closed 5 months ago
GLFW only provides rendering capacilities like Vsync for OpenGL, not for Metal, to the best of my knowledge.
Moreover, using swap-chain modifying functions like Vsync from GLFW to control the swap-chain of LLGL is undefined behavior and should be avoided, even with the OpenGL backend. LLGL has its own swap-interval function SwapChain::SetVsyncInterval
.
Having said that, I am not aware of a sync interval functionality in Metal other than the property of a preferred frame rate that can usually only be lower from 60 FPS downwards:
https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/MTLBestPracticesGuide/FrameRate.html
For the Metal backend, SetVsyncInterval(0)
will only set this property to its default value of 60.
If you can point me to documentation how to disable sync interval for MTKView
, I'm happy to integrate it into LLGL.
I'm not sure if it's the right thing or not but there is this property: https://developer.apple.com/documentation/quartzcore/cametallayer/2887087-displaysyncenabled
Awesome, that works! I haven't interacted with the CAMetalLayer
of the MTKView
a lot so far, but that seems to do the trick.
Metal
ignores VSync interval set byglfwSwapInterval
andSwapChain::SetVsyncInterval
functions. FPS is still capped to the monitor refresh rate, even though I disabled VSync by callingglfwSwapInterval(0)
andSwapChain::SetVsyncInterval(0)
.FPS is capped when the window is not fullscreen though, but when it is FPS is uncapped even if VSync interval is set to a value > 0.
With
OpenGL
FPS is uncapped in windowed mode when VSync is disabled and always uncapped in fullscreen even if VSync is enabled.main.cpp
custom_surface.hpp
custom_surface.cpp
macOS version: Ventura 13.6.7