Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: src/gpu/GrTest.cpp

Issue 1413483004: Revert of Update Layer Hoisting to store its atlas texture in the resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTest.cpp
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index eafe902a477de63666610a4a67c8c4e0b832e040..4adc3f7b7b770585a34e92729b3efe509c4c60e9 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -109,27 +109,47 @@
#endif
#if GR_CACHE_STATS
-void GrResourceCache::getStats(Stats* stats) const {
- stats->reset();
-
- stats->fTotal = this->getResourceCount();
- stats->fNumNonPurgeable = fNonpurgeableResources.count();
- stats->fNumPurgeable = fPurgeableQueue.count();
-
- for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
- stats->update(fNonpurgeableResources[i]);
- }
- for (int i = 0; i < fPurgeableQueue.count(); ++i) {
- stats->update(fPurgeableQueue.at(i));
- }
-}
-
void GrResourceCache::dumpStats(SkString* out) const {
this->validate();
+ int locked = fNonpurgeableResources.count();
+
+ struct Stats {
+ int fScratch;
+ int fExternal;
+ int fBorrowed;
+ int fAdopted;
+ size_t fUnbudgetedSize;
+
+ Stats() : fScratch(0), fExternal(0), fBorrowed(0), fAdopted(0), fUnbudgetedSize(0) {}
+
+ void update(GrGpuResource* resource) {
+ if (resource->cacheAccess().isScratch()) {
+ ++fScratch;
+ }
+ if (resource->cacheAccess().isExternal()) {
+ ++fExternal;
+ }
+ if (resource->cacheAccess().isBorrowed()) {
+ ++fBorrowed;
+ }
+ if (resource->cacheAccess().isAdopted()) {
+ ++fAdopted;
+ }
+ if (!resource->resourcePriv().isBudgeted()) {
+ fUnbudgetedSize += resource->gpuMemorySize();
+ }
+ }
+ };
+
Stats stats;
- this->getStats(&stats);
+ for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
+ stats.update(fNonpurgeableResources[i]);
+ }
+ for (int i = 0; i < fPurgeableQueue.count(); ++i) {
+ stats.update(fPurgeableQueue.at(i));
+ }
float countUtilization = (100.f * fBudgetedCount) / fMaxCount;
float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes;
@@ -137,9 +157,8 @@
out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes);
out->appendf("\t\tEntry Count: current %d"
" (%d budgeted, %d external(%d borrowed, %d adopted), %d locked, %d scratch %.2g%% full), high %d\n",
- stats.fTotal, fBudgetedCount, stats.fExternal, stats.fBorrowed,
- stats.fAdopted, stats.fNumNonPurgeable, stats.fScratch, countUtilization,
- fHighWaterCount);
+ this->getResourceCount(), fBudgetedCount, stats.fExternal, stats.fBorrowed,
+ stats.fAdopted, locked, stats.fScratch, countUtilization, 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));
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698