mirror of https://github.com/mgba-emu/mgba.git
Qt: Different frame time overheads per OS
This commit is contained in:
parent
1f53174270
commit
24a41d8453
|
@ -32,6 +32,12 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define OVERHEAD_NSEC 1000000
|
||||||
|
#else
|
||||||
|
#define OVERHEAD_NSEC 300000
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace QGBA;
|
using namespace QGBA;
|
||||||
|
|
||||||
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
|
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
|
||||||
|
@ -612,13 +618,13 @@ void PainterGL::draw() {
|
||||||
m_delayTimer.start();
|
m_delayTimer.start();
|
||||||
} else {
|
} else {
|
||||||
if (sync->audioWait || sync->videoFrameWait) {
|
if (sync->audioWait || sync->videoFrameWait) {
|
||||||
while (m_delayTimer.nsecsElapsed() + 300000 < 1000000000 / sync->fpsTarget) {
|
while (m_delayTimer.nsecsElapsed() + OVERHEAD_NSEC < 1000000000 / sync->fpsTarget) {
|
||||||
QThread::usleep(500);
|
QThread::usleep(500);
|
||||||
}
|
}
|
||||||
forceRedraw = sync->videoFrameWait;
|
forceRedraw = sync->videoFrameWait;
|
||||||
}
|
}
|
||||||
if (!forceRedraw) {
|
if (!forceRedraw) {
|
||||||
forceRedraw = m_delayTimer.nsecsElapsed() + 300000 >= 1000000000 / m_window->screen()->refreshRate();
|
forceRedraw = m_delayTimer.nsecsElapsed() + OVERHEAD_NSEC >= 1000000000 / m_window->screen()->refreshRate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mCoreSyncWaitFrameEnd(sync);
|
mCoreSyncWaitFrameEnd(sync);
|
||||||
|
|
Loading…
Reference in New Issue