1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxvk] Only synchronize with presents with FIFO present modes

This commit is contained in:
Philip Rebohle 2023-06-16 19:45:11 +02:00
parent 5d1196733b
commit 08363edb05
3 changed files with 12 additions and 4 deletions

View File

@ -118,6 +118,7 @@ namespace dxvk {
void Presenter::signalFrame( void Presenter::signalFrame(
VkResult result, VkResult result,
VkPresentModeKHR mode,
uint64_t frameId) { uint64_t frameId) {
if (m_signal == nullptr || !frameId) if (m_signal == nullptr || !frameId)
return; return;
@ -127,6 +128,7 @@ namespace dxvk {
PresenterFrame frame = { }; PresenterFrame frame = { };
frame.result = result; frame.result = result;
frame.mode = mode;
frame.frameId = frameId; frame.frameId = frameId;
m_frameQueue.push(frame); m_frameQueue.push(frame);
@ -666,7 +668,9 @@ namespace dxvk {
return; return;
// If the present operation has succeeded, actually wait for it to complete. // If the present operation has succeeded, actually wait for it to complete.
if (frame.result >= 0) { // Don't bother with it on MAILBOX / IMMEDIATE modes since doing so would
// restrict us to the display refresh rate on some platforms (XWayland).
if (frame.result >= 0 && (frame.mode == VK_PRESENT_MODE_FIFO_KHR || frame.mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR)) {
VkResult vr = m_vkd->vkWaitForPresentKHR(m_vkd->device(), VkResult vr = m_vkd->vkWaitForPresentKHR(m_vkd->device(),
m_swapchain, frame.frameId, std::numeric_limits<uint64_t>::max()); m_swapchain, frame.frameId, std::numeric_limits<uint64_t>::max());

View File

@ -75,6 +75,7 @@ namespace dxvk {
*/ */
struct PresenterFrame { struct PresenterFrame {
uint64_t frameId; uint64_t frameId;
VkPresentModeKHR mode;
VkResult result; VkResult result;
}; };
@ -150,10 +151,12 @@ namespace dxvk {
* called before GPU work prior to the present submission has * called before GPU work prior to the present submission has
* completed in order to maintain consistency. * completed in order to maintain consistency.
* \param [in] result Presentation result * \param [in] result Presentation result
* \param [in] mode Present mode
* \param [in] frameId Frame number * \param [in] frameId Frame number
*/ */
void signalFrame( void signalFrame(
VkResult result, VkResult result,
VkPresentModeKHR mode,
uint64_t frameId); uint64_t frameId);
/** /**

View File

@ -203,7 +203,8 @@ namespace dxvk {
// Signal the frame and then immediately destroy the reference. // Signal the frame and then immediately destroy the reference.
// This is necessary since the front-end may want to explicitly // This is necessary since the front-end may want to explicitly
// destroy the presenter object. // destroy the presenter object.
entry.present.presenter->signalFrame(entry.result, entry.present.frameId); entry.present.presenter->signalFrame(entry.result,
entry.present.presentMode, entry.present.frameId);
entry.present.presenter = nullptr; entry.present.presenter = nullptr;
} }