How do I limit FPS? #3234
-
I am making a game with WGPU and Winit. One small issue I've encountered is limiting fps. From what I understand, I can have either VSync or uncapped frame redrawing. How would I limit this to something like 120 fps without using vsync? It's not a necessity, but is nice for things like menus |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The trick is that you need to limit it yourself cpu side. Take a look at something like https://docs.rs/spin_sleep/latest/spin_sleep/struct.LoopHelper.html which lets you set a target rate. This can also help with latency (though I'm working on a more advanced implementation in https://github.com/BVE-Reborn/pacy) |
Beta Was this translation helpful? Give feedback.
The trick is that you need to limit it yourself cpu side. Take a look at something like https://docs.rs/spin_sleep/latest/spin_sleep/struct.LoopHelper.html which lets you set a target rate. This can also help with latency (though I'm working on a more advanced implementation in https://github.com/BVE-Reborn/pacy)