From b8486b4a58e6f0748b350225bf84ff3156c86694 Mon Sep 17 00:00:00 2001 From: lixonik <71736299+lixonik@users.noreply.github.com> Date: Sat, 28 Nov 2026 00:29:23 +0300 Subject: [PATCH] vulkan_present: keep continuous readback valid on OUT_OF_DATE present --- runtime/src/vulkan_present.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h index da9376e54..d81b3ddfa 100644 --- a/runtime/src/vulkan_present.h +++ b/runtime/src/vulkan_present.h @@ -694,12 +694,15 @@ class VulkanPresenter { last_tore_ = true; ++tear_presents_; } - if (copy_frame && capture_ptr_) { // a temporary splash-only allocation may have just been released - captured_ = true; - captured_extent_ = extent_; - captured_format_ = format_; - if (disk_sample) pending_capture_ = frame.done; - } + if (copy_frame && capture_ptr_ && disk_sample) pending_capture_ = frame.done; + } + if (copy_frame && capture_ptr_ && + (result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_OUT_OF_DATE_KHR)) { + // Even when vkQueuePresentKHR reports OUT_OF_DATE after a resize, the frame was rendered and copied + // into capture_buffer_, so continuous read_back() stays valid (pending_capture_ stays shown-only above). + captured_ = true; + captured_extent_ = extent_; + captured_format_ = format_; } if (result == VK_ERROR_SURFACE_LOST_KHR) { // The surface was lost during the present (display disconnected, a driver reset of the window's