diff options
author | robertphillips <robertphillips@google.com> | 2015-11-09 13:51:06 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-09 13:51:06 -0800 |
commit | 60029a5397f75aae4bdb994f26bd297edc3e433c (patch) | |
tree | ecfe56285b4e3810fb864bd3cb2c07d1855d9638 /src/gpu/GrResourceCache.h | |
parent | e5911c9c5b859d60208f4b9ac4bf2a638f4bc35f (diff) |
Update Layer Hoisting to store its atlas texture in the resource cache
BUG=skia:4346
Committed: https://skia.googlesource.com/skia/+/42597bc99f00553825843b5ed41e81b121773368
Review URL: https://codereview.chromium.org/1406013006
Diffstat (limited to 'src/gpu/GrResourceCache.h')
-rw-r--r-- | src/gpu/GrResourceCache.h | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h index 2412174121..ed2affeae3 100644 --- a/src/gpu/GrResourceCache.h +++ b/src/gpu/GrResourceCache.h @@ -182,7 +182,52 @@ public: void notifyFlushOccurred(); -#if GR_GPU_STATS +#if GR_CACHE_STATS + struct Stats { + int fTotal; + int fNumPurgeable; + int fNumNonPurgeable; + + int fScratch; + int fExternal; + int fBorrowed; + int fAdopted; + size_t fUnbudgetedSize; + + Stats() { this->reset(); } + + void reset() { + fTotal = 0; + fNumPurgeable = 0; + fNumNonPurgeable = 0; + 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(); + } + } + }; + + void getStats(Stats*) const; + void dumpStats(SkString*) const; #endif |