Skip to content

Commit

Permalink
Replacement: Avoid rebuild until ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Oct 19, 2021
1 parent 3229a15 commit 0036c87
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions GPU/Common/TextureCacheCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,14 @@ TexCacheEntry *TextureCacheCommon::SetTexture() {
reason = "scaling";
}
}
if (match && (entry->status & TexCacheEntry::STATUS_TO_REPLACE) && replacementTimeThisFrame_ <= replacementFrameBudget_) {
match = false;
reason = "replacing";
if (match && (entry->status & TexCacheEntry::STATUS_TO_REPLACE) && replacementTimeThisFrame_ < replacementFrameBudget_) {
int w0 = gstate.getTextureWidth(0);
int h0 = gstate.getTextureHeight(0);
ReplacedTexture &replaced = FindReplacement(entry, w0, h0);
if (replaced.Valid()) {
match = false;
reason = "replacing";
}
}

if (match) {
Expand Down Expand Up @@ -1285,6 +1290,7 @@ ReplacedTexture &TextureCacheCommon::FindReplacement(TexCacheEntry *entry, int &
} else if (replaced.Valid()) {
entry->status |= TexCacheEntry::STATUS_TO_REPLACE;
}
replacementTimeThisFrame_ += time_now_d() - replaceStart;
return replacer_.FindNone();
}

Expand Down

0 comments on commit 0036c87

Please sign in to comment.