Change: allow video-drivers to miss deadlines slightly

Before, every next frame was calculated from the current time.
If for some reason the current frame was drifting a bit, the
next would too, and the next more, etc etc. This meant we rarely
hit the targets we would like, like 33.33fps.

Instead, allow video-drivers to drift slightly, and schedule the
next frame based on the time the last should have happened. Only
if the drift gets too much, that deadlines are missed for longer
period of times, schedule the next frame based on the current
time.

This makes the FPS a lot smoother, as sleeps aren't as exact as
you might think.
This commit is contained in:
Patric Stout
2021-02-17 15:14:59 +01:00
committed by Patric Stout
parent c81c6e5eb7
commit ae7a2b9f02
7 changed files with 61 additions and 13 deletions

View File

@@ -126,6 +126,8 @@ public:
}
protected:
const uint ALLOWED_DRIFT = 5; ///< How many times videodriver can miss deadlines without it being overly compensated.
/**
* Get the resolution of the main screen.
*/