Framebuffer texture matching: Remove heuristics other than seqCount

This commit is contained in:
Henrik Rydgård 2022-08-27 11:01:11 +02:00
parent 769f3d1466
commit cb8497731d

View file

@ -673,28 +673,11 @@ int TextureCacheCommon::GetBestCandidateIndex(const std::vector<AttachCandidate>
int bestRelevancy = -1;
int bestIndex = -1;
// TODO: Instead of scores, we probably want to use std::min_element to pick the top element, using
// a comparison function.
// We simply use the sequence counter as relevancy nowadays.
for (int i = 0; i < (int)candidates.size(); i++) {
const AttachCandidate &candidate = candidates[i];
int relevancy = candidate.seqCount;
// Bonus point for matching stride.
if (candidate.channel == RASTER_COLOR && candidate.fb->fb_stride == candidate.entry.bufw) {
relevancy += 1000;
}
// Bonus points for no offset.
if (candidate.match.xOffset == 0 && candidate.match.yOffset == 0) {
relevancy += 100;
}
if (candidate.channel == RASTER_COLOR && candidate.fb->last_frame_render == gpuStats.numFlips) {
relevancy += 50;
} else if (candidate.channel == RASTER_DEPTH && candidate.fb->last_frame_depth_render == gpuStats.numFlips) {
relevancy += 50;
}
if (relevancy > bestRelevancy) {
bestRelevancy = relevancy;
bestIndex = i;
@ -918,6 +901,7 @@ bool TextureCacheCommon::MatchFramebuffer(
// If they match "exactly", it's non-CLUT and from the top left.
if (exactMatch) {
// TODO: Better checks for compatible strides here.
if (fb_stride != entry.bufw) {
WARN_LOG_ONCE(diffStrides1, G3D, "Found matching framebuffer with different strides %d != %d", entry.bufw, (int)fb_stride);
}