Qt: Different frame time overheads per OS

This commit is contained in:
Vicki Pfau 2022-01-20 18:13:34 -08:00
parent 1f53174270
commit 24a41d8453
1 changed files with 8 additions and 2 deletions

View File

@ -32,6 +32,12 @@
#endif
#endif
#ifdef _WIN32
#define OVERHEAD_NSEC 1000000
#else
#define OVERHEAD_NSEC 300000
#endif
using namespace QGBA;
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
@ -612,13 +618,13 @@ void PainterGL::draw() {
m_delayTimer.start();
} else {
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);
}
forceRedraw = sync->videoFrameWait;
}
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);