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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 815833004: Add a simpler key type for scratch resource keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: final fix Created 5 years, 11 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 #include "Benchmark.h" 9 #include "Benchmark.h"
10 10
(...skipping 14 matching lines...) Expand all
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
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
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