| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 | 9 |
| 10 #include "GrResourceCache2.h" | 10 #include "GrResourceCache2.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 #endif | 476 #endif |
| 477 SkASSERT(content == fContentHash.count()); | 477 SkASSERT(content == fContentHash.count()); |
| 478 SkASSERT(scratch + couldBeScratch == fScratchMap.count()); | 478 SkASSERT(scratch + couldBeScratch == fScratchMap.count()); |
| 479 | 479 |
| 480 // This assertion is not currently valid because we can be in recursive noti
fyIsPurgeable() | 480 // This assertion is not currently valid because we can be in recursive noti
fyIsPurgeable() |
| 481 // calls. This will be fixed when subresource registration is explicit. | 481 // calls. This will be fixed when subresource registration is explicit. |
| 482 // bool overBudget = budgetedBytes > fMaxBytes || budgetedCount > fMaxCount; | 482 // bool overBudget = budgetedBytes > fMaxBytes || budgetedCount > fMaxCount; |
| 483 // SkASSERT(!overBudget || locked == count || fPurging); | 483 // SkASSERT(!overBudget || locked == count || fPurging); |
| 484 } | 484 } |
| 485 #endif | 485 #endif |
| 486 | |
| 487 #if GR_CACHE_STATS | |
| 488 void GrResourceCache2::printStats() const { | |
| 489 this->validate(); | |
| 490 | |
| 491 int locked = 0; | |
| 492 int scratch = 0; | |
| 493 int wrapped = 0; | |
| 494 size_t unbudgetedSize = 0; | |
| 495 | |
| 496 ResourceList::Iter iter; | |
| 497 GrGpuResource* resource = iter.init(fResources, ResourceList::Iter::kHead_It
erStart); | |
| 498 | |
| 499 for ( ; resource; resource = iter.next()) { | |
| 500 if (!resource->isPurgeable()) { | |
| 501 ++locked; | |
| 502 } | |
| 503 if (resource->cacheAccess().isScratch()) { | |
| 504 ++scratch; | |
| 505 } | |
| 506 if (resource->cacheAccess().isWrapped()) { | |
| 507 ++wrapped; | |
| 508 } | |
| 509 if (!resource->cacheAccess().isBudgeted()) { | |
| 510 unbudgetedSize += resource->gpuMemorySize(); | |
| 511 } | |
| 512 } | |
| 513 | |
| 514 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; | |
| 515 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; | |
| 516 | |
| 517 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | |
| 518 SkDebugf("\t\tEntry Count: current %d" | |
| 519 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", | |
| 520 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); | |
| 521 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", | |
| 522 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); | |
| 523 } | |
| 524 | |
| 525 #endif | |
| OLD | NEW |