Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Common/Thread/Waitable.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class LimitedWaitable : public Waitable {
cond_.wait(lock, [&] { return triggered_.load(); });
}

bool WaitFor(double budget) {
bool WaitFor(double budget_s) {
if (triggered_)
return true;

uint32_t us = budget > 0 ? (uint32_t)(budget * 1000000.0) : 0;
uint32_t us = budget_s > 0 ? (uint32_t)(budget_s * 1000000.0) : 0;
if (us == 0)
return false;

Expand Down
3 changes: 2 additions & 1 deletion GPU/Common/ReplacedTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ bool ReplacedTexture::Poll(double budget) {
lastUsed_ = now;

// Let's not even start a new texture if we're already behind.
if (budget <= 0.0)
// Note that 0.0 is used as a signalling value that we don't want to wait (just handling already finished textures).
if (budget < 0.0)
return false;

_assert_(!threadWaitable_);
Expand Down
11 changes: 9 additions & 2 deletions GPU/Common/TextureCacheCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,12 +1594,19 @@ ReplacedTexture *TextureCacheCommon::FindReplacement(TexCacheEntry *entry, int *
}

void TextureCacheCommon::PollReplacement(TexCacheEntry *entry, int *w, int *h, int *d) {
double budget = replacementFrameBudgetSeconds_ - replacementTimeThisFrame_;
double waitBudget = replacementFrameBudgetSeconds_ - replacementTimeThisFrame_;
// Note: Don't avoid the Poll call if budget is 0, we do meaningful things there.
// Poll also handles negative budgets.

double replaceStart = time_now_d();
if (entry->replacedTexture->Poll(budget)) {

// Unless the mode is set to Instant (where the user explicitly wants to wait for each texture),
// it's just a waste of time to wait here really. OK, we might get a texture one frame early but
// we wasted a lot of time waiting, likely slowing down our framerate.
if (g_Config.iReplacementTextureLoadSpeed != ReplacementTextureLoadSpeed::INSTANT) {
waitBudget = 0.0;
}
if (entry->replacedTexture->Poll(waitBudget)) {
if (entry->replacedTexture->State() == ReplacementState::ACTIVE) {
entry->replacedTexture->GetSize(0, w, h);
// Consider it already "scaled.".
Expand Down
Loading