mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-04 00:36:36 +00:00
Only pace presentation if display sync is enabled
This commit is contained in:
parent
76d0eb6b63
commit
654e386263
@ -199,15 +199,17 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pace ourselves by waiting if too many frames are pending presentation
|
if (m_MetalLayer.displaySyncEnabled) {
|
||||||
SDL_LockMutex(m_PresentationMutex);
|
// Pace ourselves by waiting if too many frames are pending presentation
|
||||||
if (m_PendingPresentationCount > 2) {
|
SDL_LockMutex(m_PresentationMutex);
|
||||||
if (SDL_CondWaitTimeout(m_PresentationCond, m_PresentationMutex, 100) == SDL_MUTEX_TIMEDOUT) {
|
if (m_PendingPresentationCount > 2) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
if (SDL_CondWaitTimeout(m_PresentationCond, m_PresentationMutex, 100) == SDL_MUTEX_TIMEDOUT) {
|
||||||
"Presentation wait timed out after 100 ms");
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Presentation wait timed out after 100 ms");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
SDL_UnlockMutex(m_PresentationMutex);
|
||||||
}
|
}
|
||||||
SDL_UnlockMutex(m_PresentationMutex);
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@ -492,16 +494,18 @@ public:
|
|||||||
|
|
||||||
[renderEncoder endEncoding];
|
[renderEncoder endEncoding];
|
||||||
|
|
||||||
// Queue a completion callback on the drawable to pace our rendering
|
if (m_MetalLayer.displaySyncEnabled) {
|
||||||
SDL_LockMutex(m_PresentationMutex);
|
// Queue a completion callback on the drawable to pace our rendering
|
||||||
m_PendingPresentationCount++;
|
|
||||||
SDL_UnlockMutex(m_PresentationMutex);
|
|
||||||
[m_NextDrawable addPresentedHandler:^(id<MTLDrawable>) {
|
|
||||||
SDL_LockMutex(m_PresentationMutex);
|
SDL_LockMutex(m_PresentationMutex);
|
||||||
m_PendingPresentationCount--;
|
m_PendingPresentationCount++;
|
||||||
SDL_CondSignal(m_PresentationCond);
|
|
||||||
SDL_UnlockMutex(m_PresentationMutex);
|
SDL_UnlockMutex(m_PresentationMutex);
|
||||||
}];
|
[m_NextDrawable addPresentedHandler:^(id<MTLDrawable>) {
|
||||||
|
SDL_LockMutex(m_PresentationMutex);
|
||||||
|
m_PendingPresentationCount--;
|
||||||
|
SDL_CondSignal(m_PresentationCond);
|
||||||
|
SDL_UnlockMutex(m_PresentationMutex);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
// Flip to the newly rendered buffer
|
// Flip to the newly rendered buffer
|
||||||
[commandBuffer presentDrawable:m_NextDrawable];
|
[commandBuffer presentDrawable:m_NextDrawable];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user