Small tweak in texture matching. Fixes #15927

This commit is contained in:
Henrik Rydgård 2022-08-30 16:14:28 +02:00
parent fd863beb96
commit daa62beb39

View File

@ -667,6 +667,14 @@ int TextureCacheCommon::GetBestCandidateIndex(const std::vector<AttachCandidate>
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;