Stricter checks for negative framebuffer offsets. Fixes #15937

This commit is contained in:
Henrik Rydgård 2022-09-01 08:26:23 +02:00
parent 437d6d30a0
commit 1c9ec36fd8

View File

@ -947,7 +947,10 @@ bool TextureCacheCommon::MatchFramebuffer(
matchInfo->yOffset = entry.bufw == 0 ? 0 : pixelOffset / (int)entry.bufw;
matchInfo->xOffset = entry.bufw == 0 ? 0 : pixelOffset % (int)entry.bufw;
} else if (pixelOffset < 0) {
matchInfo->yOffset = entry.bufw == 0 ? 0 : pixelOffset / (int)entry.bufw;
// We don't support negative Y offsets, and negative X offsets are only for the Killzone workaround.
if (pixelOffset < -(int)entry.bufw || !PSP_CoreParameter().compat.flags().SplitFramebufferMargin) {
return false;
}
matchInfo->xOffset = entry.bufw == 0 ? 0 : -(-pixelOffset % (int)entry.bufw);
}
}
@ -957,11 +960,6 @@ bool TextureCacheCommon::MatchFramebuffer(
return false;
}
if (matchInfo->yOffset < 0 && matchInfo->yOffset - minSubareaHeight <= 0) {
// Can't be inside the framebuffer.
return false;
}
if (fb_stride != entry.bufw) {
if (noOffset) {
WARN_LOG_ONCE(diffStrides2, G3D, "Matching framebuffer(matching_clut = %s) different strides %d != %d", matchingClutFormat ? "yes" : "no", entry.bufw, fb_stride);