Release swapchain earlier

Encoders now have a buffer for next image so that they can encode one
and the compositor write to an other one.
This commit is contained in:
Patrick Nicolas
2024-09-11 23:41:10 +02:00
parent 517b572c75
commit 7e8c479cc5
11 changed files with 311 additions and 253 deletions
+20 -16
View File
@@ -391,23 +391,11 @@ static void comp_wivrn_present_thread(std::stop_token stop_token, wivrn_comp_tar
}
}
auto res = vk.device.waitForFences(*cn->psc.fence, true, UINT64_MAX);
// Get local copies before releasing the image
auto view_info = cn->psc.view_info;
auto frame_index = cn->psc.frame_index;
try
{
for (auto & encoder: encoders)
{
encoder->Encode(*cn->cnx, cn->psc.view_info, cn->psc.frame_index);
}
}
catch (std::exception & e)
{
U_LOG_W("encode error: %s", e.what());
}
catch (...)
{
// Ignore errors
}
auto res = vk.device.waitForFences(*cn->psc.fence, true, UINT64_MAX);
// Update encoder status, release image
if ((cn->psc.status &= ~status_bit) == 0)
@@ -422,6 +410,22 @@ static void comp_wivrn_present_thread(std::stop_token stop_token, wivrn_comp_tar
}
}
}
try
{
for (auto & encoder: encoders)
{
encoder->Encode(*cn->cnx, view_info, frame_index);
}
}
catch (std::exception & e)
{
U_LOG_W("encode error: %s", e.what());
}
catch (...)
{
// Ignore errors
}
}
}