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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ~GrResourceCache(); | 53 ~GrResourceCache(); |
54 | 54 |
55 // Default maximum number of budgeted resources in the cache. | 55 // Default maximum number of budgeted resources in the cache. |
56 static const int kDefaultMaxCount = 2 * (1 << 12); | 56 static const int kDefaultMaxCount = 2 * (1 << 12); |
57 // Default maximum number of bytes of gpu memory of budgeted resources in th
e cache. | 57 // Default maximum number of bytes of gpu memory of budgeted resources in th
e cache. |
58 static const size_t kDefaultMaxSize = 96 * (1 << 20); | 58 static const size_t kDefaultMaxSize = 96 * (1 << 20); |
59 // Default number of flushes a budgeted resources can go unused in the cache
before it is | 59 // Default number of flushes a budgeted resources can go unused in the cache
before it is |
60 // purged. Large values disable the feature (as the ring buffer of flush tim
estamps would be | 60 // purged. Large values disable the feature (as the ring buffer of flush tim
estamps would be |
61 // large). This is currently the default until we decide to enable this feat
ure | 61 // large). This is currently the default until we decide to enable this feat
ure |
62 // of the cache by default. | 62 // of the cache by default. |
63 static const int kDefaultMaxUnusedFlushes = 1024; | 63 static const int kDefaultMaxUnusedFlushes = 64; |
64 | 64 |
65 /** Used to access functionality needed by GrGpuResource for lifetime manage
ment. */ | 65 /** Used to access functionality needed by GrGpuResource for lifetime manage
ment. */ |
66 class ResourceAccess; | 66 class ResourceAccess; |
67 ResourceAccess resourceAccess(); | 67 ResourceAccess resourceAccess(); |
68 | 68 |
69 /** | 69 /** |
70 * Sets the cache limits in terms of number of resources, max gpu memory byt
e size, and number | 70 * Sets the cache limits in terms of number of resources, max gpu memory byt
e size, and number |
71 * of GrContext flushes that a resource can be unused before it is evicted.
The latter value is | 71 * of GrContext flushes that a resource can be unused before it is evicted.
The latter value is |
72 * a suggestion and there is no promise that a resource will be purged immed
iately after it | 72 * a suggestion and there is no promise that a resource will be purged immed
iately after it |
73 * hasn't been used in maxUnusedFlushes flushes. | 73 * hasn't been used in maxUnusedFlushes flushes. |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 friend class GrGpuResource; // To access all the proxy inline methods. | 432 friend class GrGpuResource; // To access all the proxy inline methods. |
433 friend class GrResourceCache; // To create this type. | 433 friend class GrResourceCache; // To create this type. |
434 }; | 434 }; |
435 | 435 |
436 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { | 436 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { |
437 return ResourceAccess(this); | 437 return ResourceAccess(this); |
438 } | 438 } |
439 | 439 |
440 #endif | 440 #endif |
OLD | NEW |