-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Long Sleep VSync option #19
Comments
Did you already try setting the "FPSLimitMode = 2", aka. "sleep-yield", instead of the default 1 which is "busy-wait". The default "busy-wait" mode indeed does lock the thread, consuming 100% of the CPU cycles associated with the thread thus killing your battery. It is incredibly accurate though. That is exactly the reason for the implementation of mode 2, "sleep-yield". I did test what you're suggesting but the "high perfomance timer" in Windows is very inaccurate with longer sleeps and as such they are simply unviable for maintaining stable framerates. But doing a dozen of ~1ms sleeps The technical details are described in more detail in this pull request: It sounds to me that the problem is simply that you aren't using mode 2. But if you are, and still experience large CPU usage, that would be a bug as it shouldn't happen. |
VSync by the nature of the technology means that the frames are drawn in step with the screen's refresh rate, meaning the whole screen. It was never designed with windowed mode in mind to begin with in the older DirectX versions. It can work though if you're running at least Windows 7 with desktop composition (Aero) enabled, as in the modern day the alliance of "game -> windows desktop compositor -> display driver" works much better than it used to. And when it works, the "free" fps limiter along with eliminating screen tearing makes the tradeoff of negligible increase in input lag worth it. So forcing vsync, while usually is something you can force from "app-specific settings" of your display driver's control panel, should also be an option in this wrapper. It's a good idea. I'll make a mental note of implementing it at some point unless @ThirteenAG happens to implement it first. |
I'll add these reminders of additional things to implement: |
Hi!
First of all, I really like the idea of this tool!
I've already tried it on some old games that I used to enjoy decades ago.
And it works! But my hope was to prevent extensive usage of CPU which cycles was wasted rendering thousands of redundant FPS and thus heating up my laptop. Sadly, limiting FPS now doesn't do the job.
So my question is, is it possible to add a new VSync option that would save CPU cycles?
I looked into the current implementation of FrameLimiter and there was a
Sleep(1)
in a while-loop that suspended frame swapping. Have you tried it likeSleep(1000 / FPS - elapsed_ms)
? I'm guessing it's not as accurate, but it seems to be more efficient way in terms of CPU consumption.The text was updated successfully, but these errors were encountered: