Fix V-Sync wait when frame period was less than 3 ms

This commit is contained in:
Cameron Gutman committed 2026-11-15 00:48:18 -06:00
1 parent f924722793
commit ec59857a98
1 file changed
+4 -1
@@ -276,7 +276,10 @@ void Pacer::handleVsync(int timeUntilNextVsyncMillis)
if (m_PacingQueue.isEmpty()) {
// Wait for a frame to arrive or our V-sync timeout to expire
if (!m_PacingQueueNotEmpty.wait(&m_FrameQueueLock, SDL_max(timeUntilNextVsyncMillis, TIMER_SLACK_MS) - TIMER_SLACK_MS)) {
unsigned long waitTimeMs = timeUntilNextVsyncMillis > 0
? SDL_max(timeUntilNextVsyncMillis - TIMER_SLACK_MS, 1)
: 0;
if (!m_PacingQueueNotEmpty.wait(&m_FrameQueueLock, waitTimeMs)) {
// Wait timed out - unlock and bail
m_FrameQueueLock.unlock();
return;