Return image to swapchain after encode is done

Vulkan video encode may use the original image, only mark it as free
once it is done encoding.
This commit is contained in:
Patrick Nicolas
2025-08-23 11:07:48 +02:00
parent aade274777
commit 66b7b1fabb
+14 -14
View File
@@ -483,20 +483,6 @@ 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);
// Update encoder status, release image
if ((cn->psc.status &= ~status_bit) == 0)
{
cn->psc.status.notify_all();
for (auto & img: cn->psc.images)
{
if (img.status == pseudo_swapchain::status_t::encoding)
{
img.status = pseudo_swapchain::status_t::free;
break;
}
}
}
try
{
for (auto & encoder: encoders)
@@ -513,6 +499,20 @@ static void comp_wivrn_present_thread(std::stop_token stop_token, wivrn_comp_tar
{
// Ignore errors
}
// Update encoder status, release image
if ((cn->psc.status &= ~status_bit) == 0)
{
cn->psc.status.notify_all();
for (auto & img: cn->psc.images)
{
if (img.status == pseudo_swapchain::status_t::encoding)
{
img.status = pseudo_swapchain::status_t::free;
break;
}
}
}
}
}