mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-30 10:54:15 +01:00
Wait on Swapchain Image copy to complete
Certain titles can have a display frames out of order due to not waiting on the copy from the final RT to the swapchain image to occur. Although `PresentFrame` does wait on the syncpoint, that isn't enough to ensure the source texture is up-to-date due to us signalling syncpoints early. By waiting on the swapchain texture after the copy is submitted, we now implicitly wait on the source texture's cycle to be signalled thus waiting on the frame to be done which fixes the issue.
This commit is contained in:
parent
5b7572a8b3
commit
1fe6d92970
@ -129,16 +129,20 @@ namespace skyline::gpu {
|
|||||||
else
|
else
|
||||||
throw exception("vkAcquireNextImageKHR returned an unhandled result '{}'", vk::to_string(nextImage.first));
|
throw exception("vkAcquireNextImageKHR returned an unhandled result '{}'", vk::to_string(nextImage.first));
|
||||||
}
|
}
|
||||||
|
auto &nextImageTexture{images.at(nextImage.second)};
|
||||||
|
|
||||||
std::ignore = gpu.vkDevice.waitForFences(*acquireFence, true, std::numeric_limits<u64>::max());
|
std::ignore = gpu.vkDevice.waitForFences(*acquireFence, true, std::numeric_limits<u64>::max());
|
||||||
|
|
||||||
texture->SynchronizeHost();
|
texture->SynchronizeHost();
|
||||||
images.at(nextImage.second)->CopyFrom(texture, vk::ImageSubresourceRange{
|
nextImageTexture->CopyFrom(texture, vk::ImageSubresourceRange{
|
||||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||||
.levelCount = 1,
|
.levelCount = 1,
|
||||||
.layerCount = 1,
|
.layerCount = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Wait on the copy to the swapchain image to complete before submitting for presentation
|
||||||
|
nextImageTexture->WaitOnFence();
|
||||||
|
|
||||||
auto getMonotonicNsNow{[]() -> i64 {
|
auto getMonotonicNsNow{[]() -> i64 {
|
||||||
timespec time;
|
timespec time;
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &time))
|
if (clock_gettime(CLOCK_MONOTONIC, &time))
|
||||||
|
Loading…
Reference in New Issue
Block a user