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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrTest.h" 9 #include "GrTest.h"
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 out->appendf("Render Target Binds: %d\n", fRenderTargetBinds); 102 out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);
103 out->appendf("Shader Compilations: %d\n", fShaderCompilations); 103 out->appendf("Shader Compilations: %d\n", fShaderCompilations);
104 out->appendf("Textures Created: %d\n", fTextureCreates); 104 out->appendf("Textures Created: %d\n", fTextureCreates);
105 out->appendf("Texture Uploads: %d\n", fTextureUploads); 105 out->appendf("Texture Uploads: %d\n", fTextureUploads);
106 out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates); 106 out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates);
107 out->appendf("Number of draws: %d\n", fNumDraws); 107 out->appendf("Number of draws: %d\n", fNumDraws);
108 } 108 }
109 #endif 109 #endif
110 110
111 #if GR_CACHE_STATS 111 #if GR_CACHE_STATS
112 void GrResourceCache::getStats(Stats* stats) const {
113 stats->reset();
114
115 stats->fTotal = this->getResourceCount();
116 stats->fNumNonPurgeable = fNonpurgeableResources.count();
117 stats->fNumPurgeable = fPurgeableQueue.count();
118
119 for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
120 stats->update(fNonpurgeableResources[i]);
121 }
122 for (int i = 0; i < fPurgeableQueue.count(); ++i) {
123 stats->update(fPurgeableQueue.at(i));
124 }
125 }
126
127 void GrResourceCache::dumpStats(SkString* out) const { 112 void GrResourceCache::dumpStats(SkString* out) const {
128 this->validate(); 113 this->validate();
129 114
115 int locked = fNonpurgeableResources.count();
116
117 struct Stats {
118 int fScratch;
119 int fExternal;
120 int fBorrowed;
121 int fAdopted;
122 size_t fUnbudgetedSize;
123
124 Stats() : fScratch(0), fExternal(0), fBorrowed(0), fAdopted(0), fUnbudge tedSize(0) {}
125
126 void update(GrGpuResource* resource) {
127 if (resource->cacheAccess().isScratch()) {
128 ++fScratch;
129 }
130 if (resource->cacheAccess().isExternal()) {
131 ++fExternal;
132 }
133 if (resource->cacheAccess().isBorrowed()) {
134 ++fBorrowed;
135 }
136 if (resource->cacheAccess().isAdopted()) {
137 ++fAdopted;
138 }
139 if (!resource->resourcePriv().isBudgeted()) {
140 fUnbudgetedSize += resource->gpuMemorySize();
141 }
142 }
143 };
144
130 Stats stats; 145 Stats stats;
131 146
132 this->getStats(&stats); 147 for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
148 stats.update(fNonpurgeableResources[i]);
149 }
150 for (int i = 0; i < fPurgeableQueue.count(); ++i) {
151 stats.update(fPurgeableQueue.at(i));
152 }
133 153
134 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; 154 float countUtilization = (100.f * fBudgetedCount) / fMaxCount;
135 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; 155 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes;
136 156
137 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); 157 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes);
138 out->appendf("\t\tEntry Count: current %d" 158 out->appendf("\t\tEntry Count: current %d"
139 " (%d budgeted, %d external(%d borrowed, %d adopted), %d locked , %d scratch %.2g%% full), high %d\n", 159 " (%d budgeted, %d external(%d borrowed, %d adopted), %d locked , %d scratch %.2g%% full), high %d\n",
140 stats.fTotal, fBudgetedCount, stats.fExternal, stats.fBorrowed, 160 this->getResourceCount(), fBudgetedCount, stats.fExternal, stat s.fBorrowed,
141 stats.fAdopted, stats.fNumNonPurgeable, stats.fScratch, countUt ilization, 161 stats.fAdopted, locked, stats.fScratch, countUtilization, fHigh WaterCount);
142 fHighWaterCount);
143 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu dgeted) high %d\n", 162 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu dgeted) high %d\n",
144 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization, 163 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization,
145 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); 164 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes));
146 } 165 }
147 166
148 #endif 167 #endif
149 168
150 /////////////////////////////////////////////////////////////////////////////// 169 ///////////////////////////////////////////////////////////////////////////////
151 170
152 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT imestamp; } 171 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT imestamp; }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 SkASSERT(nullptr == fGpu); 288 SkASSERT(nullptr == fGpu);
270 fGpu = new MockGpu(this, options); 289 fGpu = new MockGpu(this, options);
271 SkASSERT(fGpu); 290 SkASSERT(fGpu);
272 this->initCommon(options); 291 this->initCommon(options);
273 292
274 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 293 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
275 // these objects are required for any of tests that use this context. TODO: make stop allocating 294 // these objects are required for any of tests that use this context. TODO: make stop allocating
276 // resources in the buffer pools. 295 // resources in the buffer pools.
277 fDrawingManager->abandon(); 296 fDrawingManager->abandon();
278 } 297 }
OLDNEW
« 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