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,6 +199,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_MetalLayer.displaySyncEnabled) {
|
||||
// Pace ourselves by waiting if too many frames are pending presentation
|
||||
SDL_LockMutex(m_PresentationMutex);
|
||||
if (m_PendingPresentationCount > 2) {
|
||||
@ -209,6 +210,7 @@ public:
|
||||
}
|
||||
SDL_UnlockMutex(m_PresentationMutex);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
virtual void cleanupRenderContext() override
|
||||
@ -492,6 +494,7 @@ public:
|
||||
|
||||
[renderEncoder endEncoding];
|
||||
|
||||
if (m_MetalLayer.displaySyncEnabled) {
|
||||
// Queue a completion callback on the drawable to pace our rendering
|
||||
SDL_LockMutex(m_PresentationMutex);
|
||||
m_PendingPresentationCount++;
|
||||
@ -502,6 +505,7 @@ public:
|
||||
SDL_CondSignal(m_PresentationCond);
|
||||
SDL_UnlockMutex(m_PresentationMutex);
|
||||
}];
|
||||
}
|
||||
|
||||
// Flip to the newly rendered buffer
|
||||
[commandBuffer presentDrawable:m_NextDrawable];
|
||||
|
Loading…
x
Reference in New Issue
Block a user