aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTest.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-11-06 05:59:14 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-06 05:59:14 -0800
commitcf1d19805a289c612532cf2d4505bb348b78ba77 (patch)
treea54ed4ffad1796d1ea2debe463f9cd2aa614d372 /src/gpu/GrTest.cpp
parent42597bc99f00553825843b5ed41e81b121773368 (diff)
Revert of Update Layer Hoisting to store its atlas texture in the resource cache (patchset #6 id:100001 of https://codereview.chromium.org/1406013006/ )
Reason for revert: Android Original issue's description: > Update Layer Hoisting to store its atlas texture in the resource cache > > BUG=skia:4346 > > Committed: https://skia.googlesource.com/skia/+/42597bc99f00553825843b5ed41e81b121773368 TBR=bsalomon@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4346 Review URL: https://codereview.chromium.org/1413483004
Diffstat (limited to 'src/gpu/GrTest.cpp')
-rw-r--r--src/gpu/GrTest.cpp55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index eafe902a47..4adc3f7b7b 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -109,27 +109,47 @@ void GrGpu::Stats::dump(SkString* out) {
#endif
#if GR_CACHE_STATS
-void GrResourceCache::getStats(Stats* stats) const {
- stats->reset();
+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->fTotal = this->getResourceCount();
- stats->fNumNonPurgeable = fNonpurgeableResources.count();
- stats->fNumPurgeable = fPurgeableQueue.count();
+ Stats stats;
for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
- stats->update(fNonpurgeableResources[i]);
+ stats.update(fNonpurgeableResources[i]);
}
for (int i = 0; i < fPurgeableQueue.count(); ++i) {
- stats->update(fPurgeableQueue.at(i));
+ stats.update(fPurgeableQueue.at(i));
}
-}
-
-void GrResourceCache::dumpStats(SkString* out) const {
- this->validate();
-
- Stats stats;
-
- this->getStats(&stats);
float countUtilization = (100.f * fBudgetedCount) / fMaxCount;
float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes;
@@ -137,9 +157,8 @@ void GrResourceCache::dumpStats(SkString* out) const {
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));