mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #13066 from hrydgard/vulkan-outofdate-handling
Move the Vulkan swapchain out-of-date checking to the vkQueuePresentKHR call
This commit is contained in:
commit
59af3d5823
1 changed files with 12 additions and 7 deletions
|
@ -1031,14 +1031,11 @@ void VulkanRenderManager::BeginSubmitFrame(int frame) {
|
|||
if (res == VK_SUBOPTIMAL_KHR) {
|
||||
// Hopefully the resize will happen shortly. Ignore - one frame might look bad or something.
|
||||
WLOG("VK_SUBOPTIMAL_KHR returned - ignoring");
|
||||
outOfDateFrames_++;
|
||||
} else if (res == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
WLOG("VK_ERROR_OUT_OF_DATE_KHR returned - not presenting");
|
||||
frameData.skipSwap = true;
|
||||
outOfDateFrames_++;
|
||||
} else {
|
||||
_assert_msg_(G3D, res == VK_SUCCESS, "vkAcquireNextImageKHR failed! result=%s", VulkanResultToString(res));
|
||||
outOfDateFrames_ = 0;
|
||||
}
|
||||
|
||||
VkCommandBufferBeginInfo begin{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
|
||||
|
@ -1141,13 +1138,21 @@ void VulkanRenderManager::EndSubmitFrame(int frame) {
|
|||
present.waitSemaphoreCount = 1;
|
||||
|
||||
VkResult res = vkQueuePresentKHR(vulkan_->GetGraphicsQueue(), &present);
|
||||
// TODO: Deal with VK_SUBOPTIMAL_KHR ?
|
||||
if (res == VK_ERROR_OUT_OF_DATE_KHR || res == VK_SUBOPTIMAL_KHR) {
|
||||
// ignore, it'll be fine. this happens sometimes during resizes, and we do make sure to recreate the swap chain.
|
||||
if (res == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
// We clearly didn't get this in vkAcquireNextImageKHR because of the skipSwap check above.
|
||||
// Do the increment.
|
||||
outOfDateFrames_++;
|
||||
} else if (res == VK_SUBOPTIMAL_KHR) {
|
||||
outOfDateFrames_++;
|
||||
} else if (res != VK_SUCCESS) {
|
||||
_assert_msg_(G3D, false, "vkQueuePresentKHR failed! result=%s", VulkanResultToString(res));
|
||||
} else {
|
||||
_assert_msg_(G3D, res == VK_SUCCESS, "vkQueuePresentKHR failed! result=%s", VulkanResultToString(res));
|
||||
// Success
|
||||
outOfDateFrames_ = 0;
|
||||
}
|
||||
} else {
|
||||
// We only get here if vkAcquireNextImage returned VK_ERROR_OUT_OF_DATE.
|
||||
outOfDateFrames_++;
|
||||
frameData.skipSwap = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue