From 5799bdee597490d1dda7eb9da426a97464971e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 22 Oct 2026 23:00:13 +0200 Subject: [PATCH] Outputs: Rebuild the post-shader chain when the game moves to another output Post-shader framebuffers (for shaders at output resolution, and those that keep the previous frame) are sized for the output they were built for. Moving the game to a TV or back, or the TV changing size, left them sized for the other one. SetOutputOverride now asks for a rebuild when the output changes. Also corrects the design doc: "auto" render resolution follows the device's screen, not the TV. Co-Authored-By: Claude Opus 5.5 (1M context) --- GPU/Common/PresentationCommon.h | 6 ++++++ docs/multi-swapchain.md | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/GPU/Common/PresentationCommon.h b/GPU/Common/PresentationCommon.h index 88d7ff967f..3a3245492b 100644 --- a/GPU/Common/PresentationCommon.h +++ b/GPU/Common/PresentationCommon.h @@ -118,10 +118,16 @@ public: } // Presents to another output than the primary, until called with nullptr. void SetOutputOverride(const OutputParams *output) { + const bool changed = hasOutputOverride_ != (output != nullptr) || (output && + (output->pixelWidth != outputOverride_.pixelWidth || output->pixelHeight != outputOverride_.pixelHeight || output->orientation != outputOverride_.orientation)); hasOutputOverride_ = output != nullptr; if (output) { outputOverride_ = *output; } + // The post-shader framebuffers are sized for the output, so another one needs them rebuilt (in BeginFrame). + if (changed && usePostShader_) { + restorePostShader_ = true; + } } OutputParams GetOutput() const { return hasOutputOverride_ ? outputOverride_ : PrimaryOutputParams(pixelWidth_, pixelHeight_); diff --git a/docs/multi-swapchain.md b/docs/multi-swapchain.md index 6eb43c1ca9..f662d45480 100644 --- a/docs/multi-swapchain.md +++ b/docs/multi-swapchain.md @@ -230,8 +230,8 @@ viewport to its own swapchain, so it shares the swapchain layer with the screen `PresentationCommon` should get its output size and layout explicitly instead of from `g_display`. Mostly it already does, through `PSP_CoreParameter().pixelWidth/Height` and -`UpdateDisplaySize`, and "auto" render resolution follows the same values, so it scales for the TV -on its own. What still reads the global: +`UpdateDisplaySize`. "Auto" render resolution follows the primary's size, not the TV's (not done). What +still reads the global: - `GetScreenFrame` (insets, DPI) - the stretch logic in `CalculateDisplayOutputRect` (device orientation)