OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 #ifndef GrResourceCache_DEFINED | 9 #ifndef GrResourceCache_DEFINED |
10 #define GrResourceCache_DEFINED | 10 #define GrResourceCache_DEFINED |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 public: | 50 public: |
51 GrResourceCache(const GrCaps* caps); | 51 GrResourceCache(const GrCaps* caps); |
52 ~GrResourceCache(); | 52 ~GrResourceCache(); |
53 | 53 |
54 // Default maximum number of budgeted resources in the cache. | 54 // Default maximum number of budgeted resources in the cache. |
55 static const int kDefaultMaxCount = 2 * (1 << 12); | 55 static const int kDefaultMaxCount = 2 * (1 << 12); |
56 // Default maximum number of bytes of gpu memory of budgeted resources in th
e cache. | 56 // Default maximum number of bytes of gpu memory of budgeted resources in th
e cache. |
57 static const size_t kDefaultMaxSize = 96 * (1 << 20); | 57 static const size_t kDefaultMaxSize = 96 * (1 << 20); |
58 // Default number of flushes a budgeted resources can go unused in the cache
before it is | 58 // Default number of flushes a budgeted resources can go unused in the cache
before it is |
59 // purged. Large values disable the feature (as the ring buffer of flush tim
estamps would be | 59 // purged. Large values disable the feature (as the ring buffer of flush tim
estamps would be |
60 // large). | 60 // large). This is currently the default until we decide to enable this feat
ure |
61 static const int kDefaultMaxUnusedFlushes = 64; | 61 // of the cache by default. |
| 62 static const int kDefaultMaxUnusedFlushes = 1024; |
62 | 63 |
63 /** Used to access functionality needed by GrGpuResource for lifetime manage
ment. */ | 64 /** Used to access functionality needed by GrGpuResource for lifetime manage
ment. */ |
64 class ResourceAccess; | 65 class ResourceAccess; |
65 ResourceAccess resourceAccess(); | 66 ResourceAccess resourceAccess(); |
66 | 67 |
67 /** | 68 /** |
68 * Sets the cache limits in terms of number of resources, max gpu memory byt
e size, and number | 69 * Sets the cache limits in terms of number of resources, max gpu memory byt
e size, and number |
69 * of GrContext flushes that a resource can be unused before it is evicted.
The latter value is | 70 * of GrContext flushes that a resource can be unused before it is evicted.
The latter value is |
70 * a suggestion and there is no promise that a resource will be purged immed
iately after it | 71 * a suggestion and there is no promise that a resource will be purged immed
iately after it |
71 * hasn't been used in maxUnusedFlushes flushes. | 72 * hasn't been used in maxUnusedFlushes flushes. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 380 |
380 friend class GrGpuResource; // To access all the proxy inline methods. | 381 friend class GrGpuResource; // To access all the proxy inline methods. |
381 friend class GrResourceCache; // To create this type. | 382 friend class GrResourceCache; // To create this type. |
382 }; | 383 }; |
383 | 384 |
384 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { | 385 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { |
385 return ResourceAccess(this); | 386 return ResourceAccess(this); |
386 } | 387 } |
387 | 388 |
388 #endif | 389 #endif |
OLD | NEW |