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

Side by Side Diff: src/gpu/GrResourceCache2.cpp

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address initial comments Created 5 years, 11 months 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
OLDNEW
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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 void GrResourceCache2::didChangeBudgetStatus(GrGpuResource* resource) { 299 void GrResourceCache2::didChangeBudgetStatus(GrGpuResource* resource) {
300 SkASSERT(!fPurging); 300 SkASSERT(!fPurging);
301 SkASSERT(resource); 301 SkASSERT(resource);
302 SkASSERT(this->isInCache(resource)); 302 SkASSERT(this->isInCache(resource));
303 303
304 size_t size = resource->gpuMemorySize(); 304 size_t size = resource->gpuMemorySize();
305 305
306 if (resource->cacheAccess().isBudgeted()) { 306 if (resource->cacheAccess().isBudgeted()) {
307 ++fBudgetedCount; 307 ++fBudgetedCount;
308 fBudgetedBytes += size; 308 fBudgetedBytes += size;
309 #if GR_CACHE_STATS
310 fBudgetedHighWaterBytes = SkTMax(fBudgetedBytes, fBudgetedHighWaterBytes );
311 fBudgetedHighWaterCount = SkTMax(fBudgetedCount, fBudgetedHighWaterCount );
312 #endif
309 this->purgeAsNeeded(); 313 this->purgeAsNeeded();
310 } else { 314 } else {
311 --fBudgetedCount; 315 --fBudgetedCount;
312 fBudgetedBytes -= size; 316 fBudgetedBytes -= size;
313 } 317 }
314 318
315 this->validate(); 319 this->validate();
316 } 320 }
317 321
318 void GrResourceCache2::internalPurgeAsNeeded() { 322 void GrResourceCache2::internalPurgeAsNeeded() {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 485
482 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); 486 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes);
483 SkDebugf("\t\tEntry Count: current %d" 487 SkDebugf("\t\tEntry Count: current %d"
484 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig h %d\n", 488 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig h %d\n",
485 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig hWaterCount); 489 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig hWaterCount);
486 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget ed) high %d\n", 490 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget ed) high %d\n",
487 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa terBytes); 491 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa terBytes);
488 } 492 }
489 493
490 #endif 494 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrGpuResourceCacheAccess.h ('k') | src/gpu/SkGpuDevice.h » ('j') | tests/SurfaceTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698