Remove maxCount resource cache limit
Change-Id: I0f1064c8433d69e24ca3d5b970c99d539dc1dadd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238442
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 0f7deb3..4a31a8e 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -123,8 +123,7 @@
this->releaseAll();
}
-void GrResourceCache::setLimits(int count, size_t bytes) {
- fMaxCount = count;
+void GrResourceCache::setLimit(size_t bytes) {
fMaxBytes = bytes;
this->purgeAsNeeded();
}
@@ -489,8 +488,7 @@
if (!resource->resourcePriv().refsWrappedObjects() &&
resource->resourcePriv().getScratchKey().isValid()) {
// We won't purge an existing resource to make room for this one.
- if (fBudgetedCount < fMaxCount &&
- fBudgetedBytes + resource->gpuMemorySize() <= fMaxBytes) {
+ if (this->wouldFit(resource->gpuMemorySize())) {
resource->resourcePriv().makeBudgeted();
return;
}
@@ -807,14 +805,13 @@
this->getStats(&stats);
- float countUtilization = (100.f * fBudgetedCount) / fMaxCount;
float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes;
- out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes);
+ out->appendf("Budget: %d bytes\n", (int)fMaxBytes);
out->appendf("\t\tEntry Count: current %d"
- " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), high %d\n",
+ " (%d budgeted, %d wrapped, %d locked, %d scratch), high %d\n",
stats.fTotal, fBudgetedCount, stats.fWrapped, stats.fNumNonPurgeable,
- stats.fScratch, countUtilization, fHighWaterCount);
+ stats.fScratch, fHighWaterCount);
out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudgeted) high %d\n",
SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization,
SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes));