| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 Stats stats; | 216 Stats stats; |
| 217 | 217 |
| 218 this->getStats(&stats); | 218 this->getStats(&stats); |
| 219 | 219 |
| 220 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; | 220 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; |
| 221 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; | 221 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; |
| 222 | 222 |
| 223 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); | 223 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); |
| 224 out->appendf("\t\tEntry Count: current %d" | 224 out->appendf("\t\tEntry Count: current %d" |
| 225 " (%d budgeted, %d external(%d borrowed, %d adopted), %d locked
, %d scratch %.2g%% full), high %d\n", | 225 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full),
high %d\n", |
| 226 stats.fTotal, fBudgetedCount, stats.fExternal, stats.fBorrowed, | 226 stats.fTotal, fBudgetedCount, stats.fWrapped, stats.fNumNonPurg
eable, |
| 227 stats.fAdopted, stats.fNumNonPurgeable, stats.fScratch, countUt
ilization, | 227 stats.fScratch, countUtilization, fHighWaterCount); |
| 228 fHighWaterCount); | |
| 229 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu
dgeted) high %d\n", | 228 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbu
dgeted) high %d\n", |
| 230 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization, | 229 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization, |
| 231 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); | 230 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes)); |
| 232 } | 231 } |
| 233 | 232 |
| 234 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, | 233 void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys, |
| 235 SkTArray<double>* values) const { | 234 SkTArray<double>* values) const { |
| 236 this->validate(); | 235 this->validate(); |
| 237 | 236 |
| 238 Stats stats; | 237 Stats stats; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return false; | 315 return false; |
| 317 } | 316 } |
| 318 | 317 |
| 319 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {}
; | 318 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {}
; |
| 320 | 319 |
| 321 private: | 320 private: |
| 322 void onResetContext(uint32_t resetBits) override {} | 321 void onResetContext(uint32_t resetBits) override {} |
| 323 | 322 |
| 324 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} | 323 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} |
| 325 | 324 |
| 326 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 325 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, |
| 327 const SkTArray<GrMipLevel>& texels) override { | 326 const SkTArray<GrMipLevel>& texels) override { |
| 328 return nullptr; | 327 return nullptr; |
| 329 } | 328 } |
| 330 | 329 |
| 331 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResourc
e::LifeCycle, | 330 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, SkBudgeted b
udgeted, |
| 332 const SkTArray<GrMipLevel>& texels) ove
rride { | 331 const SkTArray<GrMipLevel>& texels) ove
rride { |
| 333 return nullptr; | 332 return nullptr; |
| 334 } | 333 } |
| 335 | 334 |
| 336 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, | 335 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, |
| 337 GrWrapOwnership) override { return nullptr;
} | 336 GrWrapOwnership) override { return nullptr;
} |
| 338 | 337 |
| 339 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 338 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
| 340 GrWrapOwnership) override { | 339 GrWrapOwnership) override { |
| 341 return nullptr; | 340 return nullptr; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 SkASSERT(nullptr == fGpu); | 411 SkASSERT(nullptr == fGpu); |
| 413 fGpu = new MockGpu(this, options); | 412 fGpu = new MockGpu(this, options); |
| 414 SkASSERT(fGpu); | 413 SkASSERT(fGpu); |
| 415 this->initCommon(options); | 414 this->initCommon(options); |
| 416 | 415 |
| 417 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 416 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
| 418 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 417 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 419 // resources in the buffer pools. | 418 // resources in the buffer pools. |
| 420 fDrawingManager->abandon(); | 419 fDrawingManager->abandon(); |
| 421 } | 420 } |
| OLD | NEW |