mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix up GL changes causing timing issues
This commit is contained in:
parent
2d6087aa98
commit
60ec3e0e99
|
@ -441,7 +441,7 @@ void PainterGL::draw() {
|
||||||
if (!mCoreSyncWaitFrameStart(sync)) {
|
if (!mCoreSyncWaitFrameStart(sync)) {
|
||||||
mCoreSyncWaitFrameEnd(sync);
|
mCoreSyncWaitFrameEnd(sync);
|
||||||
++m_lagging;
|
++m_lagging;
|
||||||
if (m_delayTimer.elapsed() < 1000 / m_surface->screen()->refreshRate()) {
|
if ((sync->audioWait || sync->videoFrameWait) && m_delayTimer.elapsed() < 1000 / m_surface->screen()->refreshRate()) {
|
||||||
QTimer::singleShot(1, this, &PainterGL::draw);
|
QTimer::singleShot(1, this, &PainterGL::draw);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -453,16 +453,18 @@ void PainterGL::draw() {
|
||||||
}
|
}
|
||||||
if (!m_delayTimer.isValid()) {
|
if (!m_delayTimer.isValid()) {
|
||||||
m_delayTimer.start();
|
m_delayTimer.start();
|
||||||
} else if (sync->audioWait || sync->videoFrameWait) {
|
} else {
|
||||||
while (m_delayTimer.nsecsElapsed() + 2000000 < 1000000000 / sync->fpsTarget) {
|
if (sync->audioWait || sync->videoFrameWait) {
|
||||||
QThread::usleep(500);
|
while (m_delayTimer.nsecsElapsed() + 2000000 < 1000000000 / sync->fpsTarget) {
|
||||||
|
QThread::usleep(500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
m_delayTimer.restart();
|
||||||
}
|
}
|
||||||
mCoreSyncWaitFrameEnd(sync);
|
mCoreSyncWaitFrameEnd(sync);
|
||||||
|
|
||||||
performDraw();
|
performDraw();
|
||||||
m_backend->swap(m_backend);
|
m_backend->swap(m_backend);
|
||||||
m_delayTimer.restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PainterGL::forceDraw() {
|
void PainterGL::forceDraw() {
|
||||||
|
@ -546,7 +548,6 @@ void PainterGL::dequeue() {
|
||||||
m_buffer = nullptr;
|
m_buffer = nullptr;
|
||||||
}
|
}
|
||||||
m_buffer = buffer;
|
m_buffer = buffer;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PainterGL::dequeueAll() {
|
void PainterGL::dequeueAll() {
|
||||||
|
|
Loading…
Reference in New Issue