From 69f2a91fa84be410952ecfe9209d0948feab0528 Mon Sep 17 00:00:00 2001 From: Mihawk <163614687+mihawk-99@users.noreply.github.com> Date: Sun, 18 Oct 2026 22:51:51 -0400 Subject: [PATCH] Dolphin: report the size of the image it hands over, so frame generation reads all of it Dolphin reported its EFB texture's size (2560x2112) for the frame while the image it hands RetroArch is its swapchain image, sized by its backbuffer (3840x2160 here). RetroArch draws a hardware image whole (patches/series, 0078), so real frames looked right, but frame generation held the frame at the reported size and read the image's top-left part: every generated picture was a zoomed crop of the real one, and on screen the two alternated, a doubled image all the time (the owner's report). On the PS5, Dolphin now keeps its swapchain images' size and reports it (patches/dolphin/ps5-port.patch); the geometry and aspect it gives RetroArch do not change. Also: 0137's marker is now text its edit inserts, so a second run of tools/apply-port-patches.py finds it applied (it stopped the build with "ANCHOR NOT FOUND" on an already patched tree). Console (Base PS5, build c480fe1c): tests/pad/framegen-record.txt records 60 presented pictures; each generated picture differs from the mean of its two real neighbours by 2.9 on average, 31.5 before (build c0ece029); the network is sized 3840x2160, generation 2.6 to 3.0 ms a picture, governor level 0. Evidence in the next commit. Co-Authored-By: Claude --- patches/dolphin/ps5-port.patch | 41 ++++++++++++++++++++++++++++++++++ tools/apply-port-patches.py | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/patches/dolphin/ps5-port.patch b/patches/dolphin/ps5-port.patch index a8bcd53..7fac46b 100644 --- a/patches/dolphin/ps5-port.patch +++ b/patches/dolphin/ps5-port.patch @@ -869,6 +869,47 @@ index 8df1a7e320..2892601cf7 100644 class SWGfx : public SW::SWGfx { +diff --git a/Source/Core/DolphinLibretro/Vulkan.cpp b/Source/Core/DolphinLibretro/Vulkan.cpp +index bc463c7ceb..3206d041e1 100644 +--- a/Source/Core/DolphinLibretro/Vulkan.cpp ++++ b/Source/Core/DolphinLibretro/Vulkan.cpp +@@ -91,6 +91,9 @@ struct VkSwapchainKHR_T + std::mutex mutex; + std::condition_variable condVar; + int current_index; ++#ifdef __PROSPERO__ ++ uint32_t width, height; /* the images' own size, which the frontend draws whole */ ++#endif + }; + static VkSwapchainKHR_T chain; + +@@ -272,6 +275,10 @@ vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInf + swapchain_mask >>= 1; + } + chain.images.resize(chain.count); ++#ifdef __PROSPERO__ ++ chain.width = pCreateInfo->imageExtent.width; ++ chain.height = pCreateInfo->imageExtent.height; ++#endif + + for (uint32_t i = 0; i < chain.count; i++) + { +@@ -402,6 +409,15 @@ static VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, + } + } + ++#ifdef __PROSPERO__ ++ // The image handed over is the swapchain's, drawn whole: its size, not the EFB's, which can ++ // differ and made frame generation read a part of the image (patches/series, 0138). ++ if (chain.width && chain.height) ++ { ++ out_w = chain.width; ++ out_h = chain.height; ++ } ++#endif + // Fallback: negotiated init dimensions (or a sane default). + if (out_w == 0 || out_h == 0) + { diff --git a/Source/Core/VideoBackends/Vulkan/VKMain.cpp b/Source/Core/VideoBackends/Vulkan/VKMain.cpp index 6338e52e3d..10539c661e 100644 --- a/Source/Core/VideoBackends/Vulkan/VKMain.cpp diff --git a/tools/apply-port-patches.py b/tools/apply-port-patches.py index 08bc1ed..8a699dd 100755 --- a/tools/apply-port-patches.py +++ b/tools/apply-port-patches.py @@ -5338,7 +5338,7 @@ EDITS += [ ' extern double ps5_fg_last_core_run_ms;\n' ' if (fg_by_time > fg_gap && ps5_fg_last_core_run_ms * ps5_fg_core_fps < 1000.0)\n' ' fg_gap = fg_by_time;\n', - 'patches/series, 0137: a slow core is not a skipped call'), + 'patches/series, 0137: the clock counts skipped calls only when the core'), ]