1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +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(
VkResult result,
VkPresentModeKHR mode,
uint64_t frameId) {
if (m_signal == nullptr || !frameId)
return;
@ -127,6 +128,7 @@ namespace dxvk {
PresenterFrame frame = { };
frame.result = result;
frame.mode = mode;
frame.frameId = frameId;
m_frameQueue.push(frame);
@ -666,7 +668,9 @@ namespace dxvk {
return;
// 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(),
m_swapchain, frame.frameId, std::numeric_limits<uint64_t>::max());

View File

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

View File

@ -203,7 +203,8 @@ namespace dxvk {
// Signal the frame and then immediately destroy the reference.
// This is necessary since the front-end may want to explicitly
// 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;
}