Core: Reduce frame idle delay.

Otherwise we only have a single vblank of time left.  Sometimes that's not
enough.  Effectively, this makes us only sleep one vblank at a time.
This commit is contained in:
Unknown W. Brackets committed 2017-03-24 21:55:24 -07:00
1 parent 33db883024
commit cf37da47ba
1 file changed
+3 -4
+3 -4
View File
@@ -596,10 +596,9 @@ static void DoFrameIdleTiming() {
// If we have over at least a vblank of spare time, maintain at least 30fps in delay.
// This prevents fast forward during loading screens.
const double thresh = lastFrameTime + (numVBlanksSinceFlip - 1) * scaledVblank;
if (numVBlanksSinceFlip >= 2 && time_now_d() < thresh) {
// Give a little extra wiggle room in case the next vblank does more work.
const double goal = lastFrameTime + numVBlanksSinceFlip * scaledVblank - 0.001;
// Give a little extra wiggle room in case the next vblank does more work.
const double goal = lastFrameTime + (numVBlanksSinceFlip - 1) * scaledVblank - 0.001;
if (numVBlanksSinceFlip >= 2 && time_now_d() < goal) {
while (time_now_d() < goal) {
#ifdef _WIN32
sleep_ms(1);