From daa62beb39592a64ea2513459b6f07c008e41a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 30 Aug 2022 16:14:28 +0200 Subject: [PATCH] Small tweak in texture matching. Fixes #15927 --- GPU/Common/TextureCacheCommon.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 96ac9ca8b4..5aa097ecf2 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -667,6 +667,14 @@ int TextureCacheCommon::GetBestCandidateIndex(const std::vector const AttachCandidate &candidate = candidates[i]; int relevancy = candidate.seqCount; + // Add a small negative penalty if the texture is currently bound as a framebuffer, and offset is not zero. + // Should avoid problems when pingponging two nearby buffers, like in Wipeout Pure in #15927 + if (candidate.channel == RASTER_COLOR && + (candidate.match.yOffset != 0 || candidate.match.xOffset != 0) && + (candidate.fb->fb_address & 0x1FFFFF) == (gstate.getFrameBufAddress() & 0x1FFFFF)) { + relevancy -= 2; + } + if (relevancy > bestRelevancy) { bestRelevancy = relevancy; bestIndex = i;