From 3768be5020d4d142bbb3fddfd781a1b252a18af7 Mon Sep 17 00:00:00 2001 From: DadaCap <167002618+DadaCap@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:24:35 +0100 Subject: [PATCH] vulkan_present: the capture buffer is made of host-cached memory (RT-PRESENT-CAPTURE-CACHED) make_capture_buffer took the first host-visible, coherent memory type. On NVIDIA that is an uncached type, and a host read of it is many times slower than of cached memory. Since the launch splash (#939) every frame the title presents before its first non-black one is scanned on the CPU in finish_startup_frame, with the submit and tracker locks held, so on a large window the scan starves every other submission and the title's hang watchdog ends the boot at the landing screen. The cached type is chosen first, the way probe_read_source already does. Co-Authored-By: Claude Fable 5.2 --- runtime/src/vulkan_present.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h index f01167cf4a..317efd8495 100644 --- a/runtime/src/vulkan_present.h +++ b/runtime/src/vulkan_present.h @@ -1368,10 +1368,17 @@ class VulkanPresenter { vkGetPhysicalDeviceMemoryProperties_(physical_, &memory); constexpr VkMemoryPropertyFlags wanted = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; std::uint32_t type = UINT32_MAX; - for (std::uint32_t i = 0; i < memory.memoryTypeCount; ++i) - if ((requirements.memoryTypeBits & (1u << i)) && (memory.memoryTypes[i].propertyFlags & wanted) == wanted) { - type = i; - break; + // Host-cached system memory first, as probe_read_source does: the buffer is only read on the CPU (read_back, the + // present dump, and every startup frame in finish_startup_frame, which scans it with the submit lock held), + // and a host read of an uncached type is many times slower. + for (int pass = 0; pass < 2 && type == UINT32_MAX; ++pass) + for (std::uint32_t i = 0; i < memory.memoryTypeCount; ++i) { + const VkMemoryPropertyFlags f = memory.memoryTypes[i].propertyFlags; + const bool cached = (f & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) && !(f & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); + if ((requirements.memoryTypeBits & (1u << i)) && (f & wanted) == wanted && (pass || cached)) { + type = i; + break; + } } VkMemoryAllocateInfo allocate{VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO}; allocate.allocationSize = requirements.size;