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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error Created 4 years, 8 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
« no previous file with comments | « no previous file | include/gpu/GrBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "Benchmark.h" 8 #include "Benchmark.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
11 11
12 #include "GrGpuResource.h" 12 #include "GrGpuResource.h"
13 #include "GrGpuResourcePriv.h" 13 #include "GrGpuResourcePriv.h"
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "GrGpu.h" 15 #include "GrGpu.h"
16 #include "GrResourceCache.h" 16 #include "GrResourceCache.h"
17 #include "SkCanvas.h" 17 #include "SkCanvas.h"
18 18
19 enum { 19 enum {
20 CACHE_SIZE_COUNT = 4096, 20 CACHE_SIZE_COUNT = 4096,
21 }; 21 };
22 22
23 class BenchResource : public GrGpuResource { 23 class BenchResource : public GrGpuResource {
24 public: 24 public:
25 BenchResource (GrGpu* gpu) 25 BenchResource (GrGpu* gpu)
26 : INHERITED(gpu, kCached_LifeCycle) { 26 : INHERITED(gpu) {
27 this->registerWithCache(); 27 this->registerWithCache(SkBudgeted::kYes);
28 } 28 }
29 29
30 static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) { 30 static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) {
31 static GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); 31 static GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
32 GrUniqueKey::Builder builder(key, kDomain, keyData32Count); 32 GrUniqueKey::Builder builder(key, kDomain, keyData32Count);
33 for (int j = 0; j < keyData32Count; ++j) { 33 for (int j = 0; j < keyData32Count; ++j) {
34 builder[j] = i + j; 34 builder[j] = i + j;
35 } 35 }
36 } 36 }
37 37
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 DEF_BENCH( return new GrResourceCacheBenchFind(4); ) 177 DEF_BENCH( return new GrResourceCacheBenchFind(4); )
178 DEF_BENCH( return new GrResourceCacheBenchFind(5); ) 178 DEF_BENCH( return new GrResourceCacheBenchFind(5); )
179 DEF_BENCH( return new GrResourceCacheBenchFind(10); ) 179 DEF_BENCH( return new GrResourceCacheBenchFind(10); )
180 DEF_BENCH( return new GrResourceCacheBenchFind(25); ) 180 DEF_BENCH( return new GrResourceCacheBenchFind(25); )
181 DEF_BENCH( return new GrResourceCacheBenchFind(54); ) 181 DEF_BENCH( return new GrResourceCacheBenchFind(54); )
182 DEF_BENCH( return new GrResourceCacheBenchFind(55); ) 182 DEF_BENCH( return new GrResourceCacheBenchFind(55); )
183 DEF_BENCH( return new GrResourceCacheBenchFind(56); ) 183 DEF_BENCH( return new GrResourceCacheBenchFind(56); )
184 #endif 184 #endif
185 185
186 #endif 186 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698