mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
Vulkan: Recreate an additional swapchain that stays suboptimal
Only out of date and a lost surface recreated one, so a TV whose mode changed without a resize (MoltenVK reports SUBOPTIMAL when the layer's size no longer matches) kept a stretched picture. Like the main swapchain, it's now recreated after a few SUBOPTIMAL presents in a row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
22aa12d047
commit
771e40e297
3 files changed
+10
-1
No files matched your search
@@ -187,7 +187,14 @@ void FrameData::PresentExtraSwapchains(VulkanContext *vulkan) {
|
||||
VkResult res = vkQueuePresentKHR(vulkan->GetGraphicsQueue(), &present);
|
||||
if (res == VK_ERROR_OUT_OF_DATE_KHR || res == VK_ERROR_SURFACE_LOST_KHR) {
|
||||
swapchain->outOfDate = true;
|
||||
} else if (res != VK_SUCCESS && res != VK_SUBOPTIMAL_KHR) {
|
||||
} else if (res == VK_SUBOPTIMAL_KHR) {
|
||||
// Like the main swapchain, recreated once it stays that way (a TV's mode changed without a resize).
|
||||
if (++swapchain->suboptimalFrames > VulkanContext::MAX_INFLIGHT_FRAMES) {
|
||||
swapchain->outOfDate = true;
|
||||
}
|
||||
} else if (res == VK_SUCCESS) {
|
||||
swapchain->suboptimalFrames = 0;
|
||||
} else {
|
||||
ERROR_LOG(Log::G3D, "vkQueuePresentKHR failed for an additional swapchain: %s", VulkanResultToString(res));
|
||||
}
|
||||
swapchain->acquired = false;
|
||||
|
||||
@@ -94,6 +94,7 @@ struct VKRSwapchain {
|
||||
// Render thread. The image acquired for the frame being run, if any.
|
||||
uint32_t curImage = 0;
|
||||
bool acquired = false;
|
||||
int suboptimalFrames = 0;
|
||||
// Set by the render thread, which can't recreate it. Checked at the start of a frame.
|
||||
std::atomic<bool> outOfDate{false};
|
||||
};
|
||||
|
||||
@@ -676,6 +676,7 @@ bool VulkanRenderManager::InitExtraSwapchain(VKRSwapchain *swapchain, std::strin
|
||||
swapchain->framebuffers.push_back(framebuffer);
|
||||
}
|
||||
swapchain->outOfDate = false;
|
||||
swapchain->suboptimalFrames = 0;
|
||||
INFO_LOG(Log::G3D, "Created an additional swapchain: %dx%d, %d images", extent.width, extent.height, (int)count);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user