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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 639873002: Use presence of a content key as non-scratch indicator (Closed) Base URL: https://skia.googlesource.com/skia.git@pp
Patch Set: rebase again Created 6 years, 2 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 | 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 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 this->registerWithCache(); 57 this->registerWithCache();
58 } 58 }
59 59
60 virtual ~TextureResource() { this->release(); } 60 virtual ~TextureResource() { this->release(); }
61 61
62 virtual size_t gpuMemorySize() const SK_OVERRIDE { 62 virtual size_t gpuMemorySize() const SK_OVERRIDE {
63 return 100 + ((fID % 1 == 0) ? -40 : 33); 63 return 100 + ((fID % 1 == 0) ? -40 : 33);
64 } 64 }
65 65
66 static GrResourceKey ComputeKey(const GrTextureDesc& desc) { 66 static GrResourceKey ComputeKey(const GrTextureDesc& desc) {
67 return GrTexturePriv::ComputeScratchKey(desc); 67 GrCacheID::Key key;
68 memset(&key, 0, sizeof(key));
69 key.fData32[0] = (desc.fWidth) | (desc.fHeight << 16);
70 key.fData32[1] = desc.fConfig | desc.fSampleCnt << 16;
71 key.fData32[2] = desc.fFlags;
72 static int gType = GrResourceKey::GenerateResourceType();
73 static int gDomain = GrCacheID::GenerateDomain();
74 return GrResourceKey(GrCacheID(gDomain, key), gType, 0);
68 } 75 }
69 76
70 int fID; 77 int fID;
71 78
72 private: 79 private:
73 typedef GrGpuResource INHERITED; 80 typedef GrGpuResource INHERITED;
74 }; 81 };
75 82
76 static void get_stencil(int i, int* w, int* h, int* s) { 83 static void get_stencil(int i, int* w, int* h, int* s) {
77 *w = i % 1024; 84 *w = i % 1024;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 239 }
233 240
234 private: 241 private:
235 typedef Benchmark INHERITED; 242 typedef Benchmark INHERITED;
236 }; 243 };
237 244
238 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) 245 DEF_BENCH( return new GrResourceCacheBenchAdd(); )
239 DEF_BENCH( return new GrResourceCacheBenchFind(); ) 246 DEF_BENCH( return new GrResourceCacheBenchFind(); )
240 247
241 #endif 248 #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