1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 07:24:15 +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:
Philip Rebohle 2023-06-21 16:33:06 +02:00
parent 166d90b04c
commit b3cbe36c08
2 changed files with 16 additions and 4 deletions

View File

@ -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).

View File

@ -294,6 +294,9 @@ namespace dxvk {
void destroySurface();
void applyFrameRateLimit(
VkPresentModeKHR mode);
void runFrameThread();
};