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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 729683002: Make GrResourceCache2 responsible for calling release, abandon, and ~. (Closed) Base URL: https://skia.googlesource.com/skia.git@revrev
Patch Set: tiny cleanup Created 6 years, 1 month 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/GrGpuResource.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 /* 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 15 matching lines...) Expand all
26 26
27 class StencilResource : public GrGpuResource { 27 class StencilResource : public GrGpuResource {
28 public: 28 public:
29 SK_DECLARE_INST_COUNT(StencilResource); 29 SK_DECLARE_INST_COUNT(StencilResource);
30 StencilResource(GrGpu* gpu, int id) 30 StencilResource(GrGpu* gpu, int id)
31 : INHERITED(gpu, false) 31 : INHERITED(gpu, false)
32 , fID(id) { 32 , fID(id) {
33 this->registerWithCache(); 33 this->registerWithCache();
34 } 34 }
35 35
36 virtual ~StencilResource() { this->release(); }
37
38 static GrResourceKey ComputeKey(int width, int height, int sampleCnt) { 36 static GrResourceKey ComputeKey(int width, int height, int sampleCnt) {
39 return GrStencilBuffer::ComputeKey(width, height, sampleCnt); 37 return GrStencilBuffer::ComputeKey(width, height, sampleCnt);
40 } 38 }
41 39
42 int fID; 40 int fID;
43 41
44 private: 42 private:
45 virtual size_t onGpuMemorySize() const SK_OVERRIDE { 43 virtual size_t onGpuMemorySize() const SK_OVERRIDE {
46 return 100 + ((fID % 1 == 0) ? -5 : 6); 44 return 100 + ((fID % 1 == 0) ? -5 : 6);
47 } 45 }
48 46
49 typedef GrGpuResource INHERITED; 47 typedef GrGpuResource INHERITED;
50 }; 48 };
51 49
52 class TextureResource : public GrGpuResource { 50 class TextureResource : public GrGpuResource {
53 public: 51 public:
54 SK_DECLARE_INST_COUNT(TextureResource); 52 SK_DECLARE_INST_COUNT(TextureResource);
55 TextureResource(GrGpu* gpu, int id) 53 TextureResource(GrGpu* gpu, int id)
56 : INHERITED(gpu, false) 54 : INHERITED(gpu, false)
57 , fID(id) { 55 , fID(id) {
58 this->registerWithCache(); 56 this->registerWithCache();
59 } 57 }
60 58
61 virtual ~TextureResource() { this->release(); }
62
63 static GrResourceKey ComputeKey(const GrSurfaceDesc& desc) { 59 static GrResourceKey ComputeKey(const GrSurfaceDesc& desc) {
64 GrCacheID::Key key; 60 GrCacheID::Key key;
65 memset(&key, 0, sizeof(key)); 61 memset(&key, 0, sizeof(key));
66 key.fData32[0] = (desc.fWidth) | (desc.fHeight << 16); 62 key.fData32[0] = (desc.fWidth) | (desc.fHeight << 16);
67 key.fData32[1] = desc.fConfig | desc.fSampleCnt << 16; 63 key.fData32[1] = desc.fConfig | desc.fSampleCnt << 16;
68 key.fData32[2] = desc.fFlags; 64 key.fData32[2] = desc.fFlags;
69 static int gType = GrResourceKey::GenerateResourceType(); 65 static int gType = GrResourceKey::GenerateResourceType();
70 static int gDomain = GrCacheID::GenerateDomain(); 66 static int gDomain = GrCacheID::GenerateDomain();
71 return GrResourceKey(GrCacheID(gDomain, key), gType, 0); 67 return GrResourceKey(GrCacheID(gDomain, key), gType, 0);
72 } 68 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 256 }
261 257
262 private: 258 private:
263 typedef Benchmark INHERITED; 259 typedef Benchmark INHERITED;
264 }; 260 };
265 261
266 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) 262 DEF_BENCH( return new GrResourceCacheBenchAdd(); )
267 DEF_BENCH( return new GrResourceCacheBenchFind(); ) 263 DEF_BENCH( return new GrResourceCacheBenchFind(); )
268 264
269 #endif 265 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrGpuResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698