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

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: Make compatible with chrome 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
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;
robertphillips 2015/01/15 20:48:17 It seems like we should be purging here ?
bsalomon 2015/01/15 21:14:06 good point, done.
309 this->purgeAsNeeded(); 309 #if GR_CACHE_STATS
310 fBudgetedHighWaterBytes = SkTMax(fBudgetedBytes, fBudgetedHighWaterBytes );
311 fBudgetedHighWaterCount = SkTMax(fBudgetedCount, fBudgetedHighWaterCount );
312 #endif
310 } else { 313 } else {
311 --fBudgetedCount; 314 --fBudgetedCount;
312 fBudgetedBytes -= size; 315 fBudgetedBytes -= size;
313 } 316 }
314 317
315 this->validate(); 318 this->validate();
316 } 319 }
317 320
318 void GrResourceCache2::internalPurgeAsNeeded() { 321 void GrResourceCache2::internalPurgeAsNeeded() {
319 SkASSERT(!fPurging); 322 SkASSERT(!fPurging);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 484
482 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); 485 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes);
483 SkDebugf("\t\tEntry Count: current %d" 486 SkDebugf("\t\tEntry Count: current %d"
484 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig h %d\n", 487 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig h %d\n",
485 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig hWaterCount); 488 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", 489 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget ed) high %d\n",
487 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa terBytes); 490 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa terBytes);
488 } 491 }
489 492
490 #endif 493 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698