| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrTest.h" | 8 #include "GrTest.h" |
| 9 | 9 |
| 10 #include "GrBatchAtlas.h" | 10 #include "GrBatchAtlas.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 Stats stats; | 217 Stats stats; |
| 218 | 218 |
| 219 this->getStats(&stats); | 219 this->getStats(&stats); |
| 220 | 220 |
| 221 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; | 221 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; |
| 222 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; | 222 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; |
| 223 | 223 |
| 224 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); | 224 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); |
| 225 out->appendf("\t\tEntry Count: current %d" | 225 out->appendf("\t\tEntry Count: current %d" |
| 226 " (%d budgeted, %d external(%d borrowed, %d adopted), %d locked
, %d scratch %.2g%% full), high %d\n", | 226 " (%d budgeted, %d external, %d locked, %d scratch %.2g%% full)
, high %d\n", |
| 227 stats.fTotal, fBudgetedCount, stats.fExternal, stats.fBorrowed, | 227 stats.fTotal, fBudgetedCount, stats.fExternal, stats.fNumNonPur
geable, |
| 228 stats.fAdopted, stats.fNumNonPurgeable, stats.fScratch, countUt
ilization, | 228 stats.fScratch, countUtilization, fHighWaterCount); |
| 229 fHighWaterCount); | |
| 230 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu
dgeted) high %d\n", | 229 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu
dgeted) high %d\n", |
| 231 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization, | 230 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization, |
| 232 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); | 231 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); |
| 233 } | 232 } |
| 234 | 233 |
| 235 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, | 234 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, |
| 236 SkTArray<double>* values) const { | 235 SkTArray<double>* values) const { |
| 237 this->validate(); | 236 this->validate(); |
| 238 | 237 |
| 239 Stats stats; | 238 Stats stats; |
| 240 this->getStats(&stats); | 239 this->getStats(&stats); |
| 241 | 240 |
| 242 keys->push_back(SkString("gpu_cache_total_entries")); values->push_back(stat
s.fTotal); | 241 keys->push_back(SkString("gpu_cache_total_entries")); values->push_back(stat
s.fTotal); |
| 243 keys->push_back(SkString("gpu_cache_external_entries")); values->push_back(s
tats.fExternal); | 242 keys->push_back(SkString("gpu_cache_external_entries")); values->push_back(s
tats.fExternal); |
| 244 keys->push_back(SkString("gpu_cache_borrowed_entries")); values->push_back(s
tats.fBorrowed); | |
| 245 keys->push_back(SkString("gpu_cache_adopted_entries")); values->push_back(st
ats.fAdopted); | |
| 246 keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(s
tats.fNumPurgeable); | 243 keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(s
tats.fNumPurgeable); |
| 247 keys->push_back(SkString("gpu_cache_non_purgable_entries")); values->push_ba
ck(stats.fNumNonPurgeable); | 244 keys->push_back(SkString("gpu_cache_non_purgable_entries")); values->push_ba
ck(stats.fNumNonPurgeable); |
| 248 keys->push_back(SkString("gpu_cache_scratch_entries")); values->push_back(st
ats.fScratch); | 245 keys->push_back(SkString("gpu_cache_scratch_entries")); values->push_back(st
ats.fScratch); |
| 249 keys->push_back(SkString("gpu_cache_unbudgeted_size")); values->push_back((d
ouble)stats.fUnbudgetedSize); | 246 keys->push_back(SkString("gpu_cache_unbudgeted_size")); values->push_back((d
ouble)stats.fUnbudgetedSize); |
| 250 } | 247 } |
| 251 | 248 |
| 252 #endif | 249 #endif |
| 253 | 250 |
| 254 /////////////////////////////////////////////////////////////////////////////// | 251 /////////////////////////////////////////////////////////////////////////////// |
| 255 | 252 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return false; | 321 return false; |
| 325 } | 322 } |
| 326 | 323 |
| 327 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {}
; | 324 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {}
; |
| 328 | 325 |
| 329 private: | 326 private: |
| 330 void onResetContext(uint32_t resetBits) override {} | 327 void onResetContext(uint32_t resetBits) override {} |
| 331 | 328 |
| 332 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} | 329 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} |
| 333 | 330 |
| 334 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 331 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted, |
| 335 const SkTArray<GrMipLevel>& texels) override { | 332 const SkTArray<GrMipLevel>& texels) override { |
| 336 return nullptr; | 333 return nullptr; |
| 337 } | 334 } |
| 338 | 335 |
| 339 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResourc
e::LifeCycle, | 336 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, SkBudgeted, |
| 340 const SkTArray<GrMipLevel>& texels) ove
rride { | 337 const SkTArray<GrMipLevel>& texels) ove
rride { |
| 341 return nullptr; | 338 return nullptr; |
| 342 } | 339 } |
| 343 | 340 |
| 344 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, | 341 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, |
| 345 GrWrapOwnership) override { return nullptr;
} | 342 GrWrapOwnership) override { return nullptr;
} |
| 346 | 343 |
| 347 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 344 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
| 348 GrWrapOwnership) override { | 345 GrWrapOwnership) override { |
| 349 return nullptr; | 346 return nullptr; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 SkASSERT(nullptr == fGpu); | 420 SkASSERT(nullptr == fGpu); |
| 424 fGpu = new MockGpu(this, options); | 421 fGpu = new MockGpu(this, options); |
| 425 SkASSERT(fGpu); | 422 SkASSERT(fGpu); |
| 426 this->initCommon(options); | 423 this->initCommon(options); |
| 427 | 424 |
| 428 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 425 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
| 429 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 426 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 430 // resources in the buffer pools. | 427 // resources in the buffer pools. |
| 431 fDrawingManager->abandon(); | 428 fDrawingManager->abandon(); |
| 432 } | 429 } |
| OLD | NEW |