OLD | NEW |
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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 SK_DECLARE_INST_COUNT(BenchResource); | 25 SK_DECLARE_INST_COUNT(BenchResource); |
26 BenchResource (GrGpu* gpu) | 26 BenchResource (GrGpu* gpu) |
27 : INHERITED(gpu, false) { | 27 : INHERITED(gpu, false) { |
28 this->registerWithCache(); | 28 this->registerWithCache(); |
29 } | 29 } |
30 | 30 |
31 static GrResourceKey ComputeKey(int i) { | 31 static GrResourceKey ComputeKey(int i) { |
32 GrCacheID::Key key; | 32 GrCacheID::Key key; |
33 memset(&key, 0, sizeof(key)); | 33 memset(&key, 0, sizeof(key)); |
34 key.fData32[0] = i; | 34 key.fData32[0] = i; |
35 static int gType = GrResourceKey::GenerateResourceType(); | |
36 static int gDomain = GrCacheID::GenerateDomain(); | 35 static int gDomain = GrCacheID::GenerateDomain(); |
37 return GrResourceKey(GrCacheID(gDomain, key), gType, 0); | 36 return GrResourceKey(GrCacheID(gDomain, key), 0); |
38 } | 37 } |
39 | 38 |
40 | 39 |
41 private: | 40 private: |
42 size_t onGpuMemorySize() const SK_OVERRIDE { return 100; } | 41 size_t onGpuMemorySize() const SK_OVERRIDE { return 100; } |
43 | 42 |
44 typedef GrGpuResource INHERITED; | 43 typedef GrGpuResource INHERITED; |
45 }; | 44 }; |
46 | 45 |
47 static void populate_cache(GrGpu* gpu, int resourceCount) { | 46 static void populate_cache(GrGpu* gpu, int resourceCount) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 136 |
138 private: | 137 private: |
139 SkAutoTUnref<GrContext> fContext; | 138 SkAutoTUnref<GrContext> fContext; |
140 typedef Benchmark INHERITED; | 139 typedef Benchmark INHERITED; |
141 }; | 140 }; |
142 | 141 |
143 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) | 142 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) |
144 DEF_BENCH( return new GrResourceCacheBenchFind(); ) | 143 DEF_BENCH( return new GrResourceCacheBenchFind(); ) |
145 | 144 |
146 #endif | 145 #endif |
OLD | NEW |