mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[dxvk] Apply frame rate limit on presentation timeline
This may reduce latency as we no longer end up stalling subsequent GPU submissions.
This commit is contained in:
parent
166d90b04c
commit
b3cbe36c08
@ -108,10 +108,6 @@ namespace dxvk {
|
||||
m_swapchain, std::numeric_limits<uint64_t>::max(),
|
||||
sync.acquire, VK_NULL_HANDLE, &m_imageIndex);
|
||||
|
||||
bool vsync = mode == VK_PRESENT_MODE_FIFO_KHR
|
||||
|| mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR;
|
||||
|
||||
m_fpsLimiter.delay(vsync);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -134,6 +130,7 @@ namespace dxvk {
|
||||
m_frameQueue.push(frame);
|
||||
m_frameCond.notify_one();
|
||||
} else {
|
||||
applyFrameRateLimit(mode);
|
||||
m_signal->signal(frameId);
|
||||
}
|
||||
|
||||
@ -648,6 +645,14 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void Presenter::applyFrameRateLimit(VkPresentModeKHR mode) {
|
||||
bool vsync = mode == VK_PRESENT_MODE_FIFO_KHR
|
||||
|| mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR;
|
||||
|
||||
m_fpsLimiter.delay(vsync);
|
||||
}
|
||||
|
||||
|
||||
void Presenter::runFrameThread() {
|
||||
env::setThreadName("dxvk-frame");
|
||||
|
||||
@ -667,6 +672,10 @@ namespace dxvk {
|
||||
if (!frame.frameId)
|
||||
return;
|
||||
|
||||
// Apply the FPS limiter before signaling the frame event in
|
||||
// order to reduce latency if the app uses it for frame pacing.
|
||||
applyFrameRateLimit(frame.mode);
|
||||
|
||||
// If the present operation has succeeded, actually wait for it to complete.
|
||||
// Don't bother with it on MAILBOX / IMMEDIATE modes since doing so would
|
||||
// restrict us to the display refresh rate on some platforms (XWayland).
|
||||
|
@ -294,6 +294,9 @@ namespace dxvk {
|
||||
|
||||
void destroySurface();
|
||||
|
||||
void applyFrameRateLimit(
|
||||
VkPresentModeKHR mode);
|
||||
|
||||
void runFrameThread();
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user