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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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 | dm/DMSrcSink.cpp » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 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 #include "Benchmark.h" 9 #include "Benchmark.h"
10 10
11 #if SK_SUPPORT_GPU 11 #if SK_SUPPORT_GPU
12 12
13 #include "GrGpuResource.h" 13 #include "GrGpuResource.h"
14 #include "GrGpuResourcePriv.h" 14 #include "GrGpuResourcePriv.h"
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrGpu.h" 16 #include "GrGpu.h"
17 #include "GrResourceCache.h" 17 #include "GrResourceCache.h"
18 #include "SkCanvas.h" 18 #include "SkCanvas.h"
19 19
20 enum { 20 enum {
21 CACHE_SIZE_COUNT = 4096, 21 CACHE_SIZE_COUNT = 4096,
22 }; 22 };
23 23
24 class BenchResource : public GrGpuResource { 24 class BenchResource : public GrGpuResource {
25 public: 25 public:
26 BenchResource (GrGpu* gpu) 26 BenchResource (GrGpu* gpu)
27 : INHERITED(gpu, kCached_LifeCycle) { 27 : INHERITED(gpu, kCached_LifeCycle, GrGpuResource::kOther) {
28 this->registerWithCache(); 28 this->registerWithCache();
29 } 29 }
30 30
31 static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) { 31 static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) {
32 static GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); 32 static GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
33 GrUniqueKey::Builder builder(key, kDomain, keyData32Count); 33 GrUniqueKey::Builder builder(key, kDomain, keyData32Count);
34 for (int j = 0; j < keyData32Count; ++j) { 34 for (int j = 0; j < keyData32Count; ++j) {
35 builder[j] = i + j; 35 builder[j] = i + j;
36 } 36 }
37 } 37 }
38 38
39 GrRenderTarget* arrgh() override { return NULL; }
40
39 private: 41 private:
40 size_t onGpuMemorySize() const override { return 100; } 42 size_t onGpuMemorySize() const override { return 100; }
41 typedef GrGpuResource INHERITED; 43 typedef GrGpuResource INHERITED;
42 }; 44 };
43 45
44 static void populate_cache(GrGpu* gpu, int resourceCount, int keyData32Count) { 46 static void populate_cache(GrGpu* gpu, int resourceCount, int keyData32Count) {
45 for (int i = 0; i < resourceCount; ++i) { 47 for (int i = 0; i < resourceCount; ++i) {
46 GrUniqueKey key; 48 GrUniqueKey key;
47 BenchResource::ComputeKey(i, keyData32Count, &key); 49 BenchResource::ComputeKey(i, keyData32Count, &key);
48 GrGpuResource* resource = new BenchResource(gpu); 50 GrGpuResource* resource = new BenchResource(gpu);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 DEF_BENCH( return new GrResourceCacheBenchFind(4); ) 180 DEF_BENCH( return new GrResourceCacheBenchFind(4); )
179 DEF_BENCH( return new GrResourceCacheBenchFind(5); ) 181 DEF_BENCH( return new GrResourceCacheBenchFind(5); )
180 DEF_BENCH( return new GrResourceCacheBenchFind(10); ) 182 DEF_BENCH( return new GrResourceCacheBenchFind(10); )
181 DEF_BENCH( return new GrResourceCacheBenchFind(25); ) 183 DEF_BENCH( return new GrResourceCacheBenchFind(25); )
182 DEF_BENCH( return new GrResourceCacheBenchFind(54); ) 184 DEF_BENCH( return new GrResourceCacheBenchFind(54); )
183 DEF_BENCH( return new GrResourceCacheBenchFind(55); ) 185 DEF_BENCH( return new GrResourceCacheBenchFind(55); )
184 DEF_BENCH( return new GrResourceCacheBenchFind(56); ) 186 DEF_BENCH( return new GrResourceCacheBenchFind(56); )
185 #endif 187 #endif
186 188
187 #endif 189 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698