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 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 | 10 |
11 #include "Benchmark.h" | 11 #include "Benchmark.h" |
12 #include "GrGpuResource.h" | 12 #include "GrGpuResource.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrResourceCache.h" | 14 #include "GrResourceCache.h" |
15 #include "GrStencilBuffer.h" | 15 #include "GrStencilBuffer.h" |
16 #include "GrTexture.h" | 16 #include "GrTexture.h" |
| 17 #include "GrTexturePriv.h" |
17 #include "SkCanvas.h" | 18 #include "SkCanvas.h" |
18 | 19 |
19 enum { | 20 enum { |
20 CACHE_SIZE_COUNT = 2048, | 21 CACHE_SIZE_COUNT = 2048, |
21 CACHE_SIZE_BYTES = 2 * 1024 * 1024, | 22 CACHE_SIZE_BYTES = 2 * 1024 * 1024, |
22 }; | 23 }; |
23 | 24 |
24 class StencilResource : public GrGpuResource { | 25 class StencilResource : public GrGpuResource { |
25 public: | 26 public: |
26 SK_DECLARE_INST_COUNT(StencilResource); | 27 SK_DECLARE_INST_COUNT(StencilResource); |
(...skipping 28 matching lines...) Expand all Loading... |
55 this->registerWithCache(); | 56 this->registerWithCache(); |
56 } | 57 } |
57 | 58 |
58 virtual ~TextureResource() { this->release(); } | 59 virtual ~TextureResource() { this->release(); } |
59 | 60 |
60 virtual size_t gpuMemorySize() const SK_OVERRIDE { | 61 virtual size_t gpuMemorySize() const SK_OVERRIDE { |
61 return 100 + ((fID % 1 == 0) ? -40 : 33); | 62 return 100 + ((fID % 1 == 0) ? -40 : 33); |
62 } | 63 } |
63 | 64 |
64 static GrResourceKey ComputeKey(const GrTextureDesc& desc) { | 65 static GrResourceKey ComputeKey(const GrTextureDesc& desc) { |
65 return GrTextureImpl::ComputeScratchKey(desc); | 66 return GrTexturePriv::ComputeScratchKey(desc); |
66 } | 67 } |
67 | 68 |
68 int fID; | 69 int fID; |
69 | 70 |
70 private: | 71 private: |
71 typedef GrGpuResource INHERITED; | 72 typedef GrGpuResource INHERITED; |
72 }; | 73 }; |
73 | 74 |
74 static void get_stencil(int i, int* w, int* h, int* s) { | 75 static void get_stencil(int i, int* w, int* h, int* s) { |
75 *w = i % 1024; | 76 *w = i % 1024; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 231 } |
231 | 232 |
232 private: | 233 private: |
233 typedef Benchmark INHERITED; | 234 typedef Benchmark INHERITED; |
234 }; | 235 }; |
235 | 236 |
236 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) | 237 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) |
237 DEF_BENCH( return new GrResourceCacheBenchFind(); ) | 238 DEF_BENCH( return new GrResourceCacheBenchFind(); ) |
238 | 239 |
239 #endif | 240 #endif |
OLD | NEW |