mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 02:33:43 +01:00
Add more accurate sleep function (well, not more accurate on Windows unfortunately)
This commit is contained in:
1 parent
29032f4a70
commit
7cc4a0f3a3
6 files changed
+37
-15
No files matched your search
+3
-3
@@ -1251,9 +1251,9 @@ void NativeFrame(GraphicsContext *graphicsContext) {
|
||||
// Simple throttling to not burn the GPU in the menu.
|
||||
// TODO: This is only necessary in MAILBOX or IMMEDIATE presentation modes.
|
||||
double diffTime = time_now_d() - startTime;
|
||||
int sleepTime = (int)(1000.0 / refreshRate) - (int)(diffTime * 1000.0);
|
||||
if (sleepTime > 0)
|
||||
sleep_ms(sleepTime, "fallback-throttle");
|
||||
int sleepTimeUs = (int)(1000000 * ((1.0 / refreshRate) - diffTime));
|
||||
if (sleepTimeUs > 0)
|
||||
sleep_us(sleepTimeUs, "fallback-throttle");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user