| 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 |
| 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 SK_DECLARE_INST_COUNT(BenchResource); | |
| 27 BenchResource (GrGpu* gpu) | 26 BenchResource (GrGpu* gpu) |
| 28 : INHERITED(gpu, kCached_LifeCycle) { | 27 : INHERITED(gpu, kCached_LifeCycle) { |
| 29 this->registerWithCache(); | 28 this->registerWithCache(); |
| 30 } | 29 } |
| 31 | 30 |
| 32 static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) { | 31 static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) { |
| 33 static GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 32 static GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
| 34 GrUniqueKey::Builder builder(key, kDomain, keyData32Count); | 33 GrUniqueKey::Builder builder(key, kDomain, keyData32Count); |
| 35 for (int j = 0; j < keyData32Count; ++j) { | 34 for (int j = 0; j < keyData32Count; ++j) { |
| 36 builder[j] = i + j; | 35 builder[j] = i + j; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 DEF_BENCH( return new GrResourceCacheBenchFind(4); ) | 178 DEF_BENCH( return new GrResourceCacheBenchFind(4); ) |
| 180 DEF_BENCH( return new GrResourceCacheBenchFind(5); ) | 179 DEF_BENCH( return new GrResourceCacheBenchFind(5); ) |
| 181 DEF_BENCH( return new GrResourceCacheBenchFind(10); ) | 180 DEF_BENCH( return new GrResourceCacheBenchFind(10); ) |
| 182 DEF_BENCH( return new GrResourceCacheBenchFind(25); ) | 181 DEF_BENCH( return new GrResourceCacheBenchFind(25); ) |
| 183 DEF_BENCH( return new GrResourceCacheBenchFind(54); ) | 182 DEF_BENCH( return new GrResourceCacheBenchFind(54); ) |
| 184 DEF_BENCH( return new GrResourceCacheBenchFind(55); ) | 183 DEF_BENCH( return new GrResourceCacheBenchFind(55); ) |
| 185 DEF_BENCH( return new GrResourceCacheBenchFind(56); ) | 184 DEF_BENCH( return new GrResourceCacheBenchFind(56); ) |
| 186 #endif | 185 #endif |
| 187 | 186 |
| 188 #endif | 187 #endif |
| OLD | NEW |