aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrResourceCache.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-11-09 13:51:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-09 13:51:06 -0800
commit60029a5397f75aae4bdb994f26bd297edc3e433c (patch)
treeecfe56285b4e3810fb864bd3cb2c07d1855d9638 /src/gpu/GrResourceCache.h
parente5911c9c5b859d60208f4b9ac4bf2a638f4bc35f (diff)
Update Layer Hoisting to store its atlas texture in the resource cache
Diffstat (limited to 'src/gpu/GrResourceCache.h')
-rw-r--r--src/gpu/GrResourceCache.h47
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