Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrResourceAllocator_DEFINED |
| 9 | #define GrResourceAllocator_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/gpu/GrSurface.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "src/gpu/GrGpuResourcePriv.h" |
Greg Daniel | f91aeb2 | 2019-06-18 09:58:02 -0400 | [diff] [blame] | 13 | #include "src/gpu/GrSurfaceProxy.h" |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 14 | |
Ben Wagner | 729a23f | 2019-05-17 16:29:34 -0400 | [diff] [blame] | 15 | #include "src/core/SkArenaAlloc.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 16 | #include "src/core/SkTDynamicHash.h" |
| 17 | #include "src/core/SkTMultiMap.h" |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 18 | |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 19 | class GrDeinstantiateProxyTracker; |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 20 | class GrResourceProvider; |
| 21 | |
Robert Phillips | 715d08c | 2018-07-18 13:56:48 -0400 | [diff] [blame] | 22 | // Print out explicit allocation information |
| 23 | #define GR_ALLOCATION_SPEW 0 |
| 24 | |
Robert Phillips | da1be46 | 2018-07-27 07:18:06 -0400 | [diff] [blame] | 25 | // Print out information about interval creation |
| 26 | #define GR_TRACK_INTERVAL_CREATION 0 |
| 27 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 28 | /* |
| 29 | * The ResourceAllocator explicitly distributes GPU resources at flush time. It operates by |
| 30 | * being given the usage intervals of the various proxies. It keeps these intervals in a singly |
| 31 | * linked list sorted by increasing start index. (It also maintains a hash table from proxyID |
| 32 | * to interval to find proxy reuse). When it comes time to allocate the resources it |
| 33 | * traverses the sorted list and: |
| 34 | * removes intervals from the active list that have completed (returning their GrSurfaces |
| 35 | * to the free pool) |
| 36 | |
| 37 | * allocates a new resource (preferably from the free pool) for the new interval |
| 38 | * adds the new interval to the active list (that is sorted by increasing end index) |
| 39 | * |
| 40 | * Note: the op indices (used in the usage intervals) come from the order of the ops in |
| 41 | * their opLists after the opList DAG has been linearized. |
Robert Phillips | 82774f8 | 2019-06-20 14:38:27 -0400 | [diff] [blame] | 42 | * |
| 43 | ************************************************************************************************* |
| 44 | * How does instantiation failure handling work when explicitly allocating? |
| 45 | * |
| 46 | * In the gather usage intervals pass all the GrSurfaceProxies used in the flush should be |
| 47 | * gathered (i.e., in GrOpList::gatherProxyIntervals). |
| 48 | * |
| 49 | * The allocator will churn through this list but could fail anywhere. |
| 50 | * |
| 51 | * Allocation failure handling occurs at two levels: |
| 52 | * |
| 53 | * 1) If the GrSurface backing an opList fails to allocate then the entire opList is dropped. |
| 54 | * |
| 55 | * 2) If an individual GrSurfaceProxy fails to allocate then any ops that use it are dropped |
| 56 | * (via GrOpList::purgeOpsWithUninstantiatedProxies) |
| 57 | * |
| 58 | * The pass to determine which ops to drop is a bit laborious so we only check the opLists and |
| 59 | * individual ops when something goes wrong in allocation (i.e., when the return code from |
| 60 | * GrResourceAllocator::assign is bad) |
| 61 | * |
| 62 | * All together this means we should never attempt to draw an op which is missing some |
| 63 | * required GrSurface. |
| 64 | * |
| 65 | * One wrinkle in this plan is that promise images are fulfilled during the gather interval pass. |
| 66 | * If any of the promise images fail at this stage then the allocator is set into an error |
| 67 | * state and all allocations are then scanned for failures during the main allocation pass. |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 68 | */ |
| 69 | class GrResourceAllocator { |
| 70 | public: |
Robert Phillips | c476e5d | 2019-03-26 14:50:08 -0400 | [diff] [blame] | 71 | GrResourceAllocator(GrResourceProvider* resourceProvider, |
| 72 | GrDeinstantiateProxyTracker* tracker |
| 73 | SkDEBUGCODE(, int numOpLists)) |
| 74 | : fResourceProvider(resourceProvider) |
| 75 | , fDeinstantiateTracker(tracker) |
| 76 | SkDEBUGCODE(, fNumOpLists(numOpLists)) { |
| 77 | } |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 78 | |
Robert Phillips | 5b65a84 | 2017-11-13 15:48:12 -0500 | [diff] [blame] | 79 | ~GrResourceAllocator(); |
| 80 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 81 | unsigned int curOp() const { return fNumOps; } |
| 82 | void incOps() { fNumOps++; } |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 83 | |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 84 | /** Indicates whether a given call to addInterval represents an actual usage of the |
| 85 | * provided proxy. This is mainly here to accomodate deferred proxies attached to opLists. |
| 86 | * In that case we need to create an extra long interval for them (due to the upload) but |
| 87 | * don't want to count that usage/reference towards the proxy's recyclability. |
| 88 | */ |
| 89 | enum class ActualUse : bool { |
| 90 | kNo = false, |
| 91 | kYes = true |
| 92 | }; |
| 93 | |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 94 | // Add a usage interval from 'start' to 'end' inclusive. This is usually used for renderTargets. |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 95 | // If an existing interval already exists it will be expanded to include the new range. |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 96 | void addInterval(GrSurfaceProxy*, unsigned int start, unsigned int end, ActualUse actualUse |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 97 | SkDEBUGCODE(, bool isDirectDstRead = false)); |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 98 | |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 99 | enum class AssignError { |
| 100 | kNoError, |
| 101 | kFailedProxyInstantiation |
| 102 | }; |
| 103 | |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 104 | // Returns true when the opLists from 'startIndex' to 'stopIndex' should be executed; |
| 105 | // false when nothing remains to be executed. |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 106 | // If any proxy fails to instantiate, the AssignError will be set to kFailedProxyInstantiation. |
| 107 | // If this happens, the caller should remove all ops which reference an uninstantiated proxy. |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 108 | // This is used to execute a portion of the queued opLists in order to reduce the total |
| 109 | // amount of GPU resources required. |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 110 | bool assign(int* startIndex, int* stopIndex, AssignError* outError); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 111 | |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 112 | void determineRecyclability(); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 113 | void markEndOfOpList(int opListIndex); |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 114 | |
Robert Phillips | 715d08c | 2018-07-18 13:56:48 -0400 | [diff] [blame] | 115 | #if GR_ALLOCATION_SPEW |
| 116 | void dumpIntervals(); |
| 117 | #endif |
| 118 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 119 | private: |
| 120 | class Interval; |
| 121 | |
| 122 | // Remove dead intervals from the active list |
| 123 | void expire(unsigned int curIndex); |
| 124 | |
Robert Phillips | c476e5d | 2019-03-26 14:50:08 -0400 | [diff] [blame] | 125 | bool onOpListBoundary() const; |
| 126 | void forceIntermediateFlush(int* stopIndex); |
| 127 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 128 | // These two methods wrap the interactions with the free pool |
Robert Phillips | 715d08c | 2018-07-18 13:56:48 -0400 | [diff] [blame] | 129 | void recycleSurface(sk_sp<GrSurface> surface); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 130 | sk_sp<GrSurface> findSurfaceFor(const GrSurfaceProxy* proxy, bool needsStencil); |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 131 | |
Robert Phillips | 57aa367 | 2017-07-21 11:38:13 -0400 | [diff] [blame] | 132 | struct FreePoolTraits { |
| 133 | static const GrScratchKey& GetKey(const GrSurface& s) { |
| 134 | return s.resourcePriv().getScratchKey(); |
| 135 | } |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 136 | |
Robert Phillips | 57aa367 | 2017-07-21 11:38:13 -0400 | [diff] [blame] | 137 | static uint32_t Hash(const GrScratchKey& key) { return key.hash(); } |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 138 | static void OnFree(GrSurface* s) { s->unref(); } |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 139 | }; |
Robert Phillips | 57aa367 | 2017-07-21 11:38:13 -0400 | [diff] [blame] | 140 | typedef SkTMultiMap<GrSurface, GrScratchKey, FreePoolTraits> FreePoolMultiMap; |
| 141 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 142 | typedef SkTDynamicHash<Interval, unsigned int> IntvlHash; |
| 143 | |
| 144 | class Interval { |
| 145 | public: |
| 146 | Interval(GrSurfaceProxy* proxy, unsigned int start, unsigned int end) |
| 147 | : fProxy(proxy) |
| 148 | , fProxyID(proxy->uniqueID().asUInt()) |
| 149 | , fStart(start) |
| 150 | , fEnd(end) |
| 151 | , fNext(nullptr) { |
| 152 | SkASSERT(proxy); |
Robert Phillips | da1be46 | 2018-07-27 07:18:06 -0400 | [diff] [blame] | 153 | #if GR_TRACK_INTERVAL_CREATION |
| 154 | fUniqueID = CreateUniqueID(); |
| 155 | SkDebugf("New intvl %d: proxyID: %d [ %d, %d ]\n", |
| 156 | fUniqueID, proxy->uniqueID().asUInt(), start, end); |
| 157 | #endif |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 158 | } |
| 159 | |
Robert Phillips | 3966738 | 2019-04-17 16:03:30 -0400 | [diff] [blame] | 160 | // Used when recycling an interval |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 161 | void resetTo(GrSurfaceProxy* proxy, unsigned int start, unsigned int end) { |
| 162 | SkASSERT(proxy); |
Robert Phillips | 3966738 | 2019-04-17 16:03:30 -0400 | [diff] [blame] | 163 | SkASSERT(!fProxy && !fNext); |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 164 | |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 165 | fUses = 0; |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 166 | fProxy = proxy; |
| 167 | fProxyID = proxy->uniqueID().asUInt(); |
| 168 | fStart = start; |
| 169 | fEnd = end; |
| 170 | fNext = nullptr; |
Robert Phillips | da1be46 | 2018-07-27 07:18:06 -0400 | [diff] [blame] | 171 | #if GR_TRACK_INTERVAL_CREATION |
| 172 | fUniqueID = CreateUniqueID(); |
| 173 | SkDebugf("New intvl %d: proxyID: %d [ %d, %d ]\n", |
| 174 | fUniqueID, proxy->uniqueID().asUInt(), start, end); |
| 175 | #endif |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 176 | } |
| 177 | |
Robert Phillips | 5b65a84 | 2017-11-13 15:48:12 -0500 | [diff] [blame] | 178 | ~Interval() { |
| 179 | SkASSERT(!fAssignedSurface); |
| 180 | } |
| 181 | |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 182 | const GrSurfaceProxy* proxy() const { return fProxy; } |
| 183 | GrSurfaceProxy* proxy() { return fProxy; } |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 184 | |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 185 | unsigned int start() const { return fStart; } |
| 186 | unsigned int end() const { return fEnd; } |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 187 | |
| 188 | void setNext(Interval* next) { fNext = next; } |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 189 | const Interval* next() const { return fNext; } |
| 190 | Interval* next() { return fNext; } |
| 191 | |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 192 | void markAsRecyclable() { fIsRecyclable = true;} |
| 193 | bool isRecyclable() const { return fIsRecyclable; } |
| 194 | |
| 195 | void addUse() { fUses++; } |
| 196 | int uses() { return fUses; } |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 197 | |
| 198 | void extendEnd(unsigned int newEnd) { |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 199 | if (newEnd > fEnd) { |
| 200 | fEnd = newEnd; |
Robert Phillips | da1be46 | 2018-07-27 07:18:06 -0400 | [diff] [blame] | 201 | #if GR_TRACK_INTERVAL_CREATION |
| 202 | SkDebugf("intvl %d: extending from %d to %d\n", fUniqueID, fEnd, newEnd); |
| 203 | #endif |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 204 | } |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 205 | } |
| 206 | |
Robert Phillips | 5b65a84 | 2017-11-13 15:48:12 -0500 | [diff] [blame] | 207 | void assign(sk_sp<GrSurface>); |
Ben Wagner | 5d1adbf | 2018-05-28 13:35:39 -0400 | [diff] [blame] | 208 | bool wasAssignedSurface() const { return fAssignedSurface != nullptr; } |
Robert Phillips | 5b65a84 | 2017-11-13 15:48:12 -0500 | [diff] [blame] | 209 | sk_sp<GrSurface> detachSurface() { return std::move(fAssignedSurface); } |
| 210 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 211 | // for SkTDynamicHash |
| 212 | static const uint32_t& GetKey(const Interval& intvl) { |
| 213 | return intvl.fProxyID; |
| 214 | } |
| 215 | static uint32_t Hash(const uint32_t& key) { return key; } |
| 216 | |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 217 | private: |
Robert Phillips | 5b65a84 | 2017-11-13 15:48:12 -0500 | [diff] [blame] | 218 | sk_sp<GrSurface> fAssignedSurface; |
| 219 | GrSurfaceProxy* fProxy; |
| 220 | uint32_t fProxyID; // This is here b.c. DynamicHash requires a ref to the key |
| 221 | unsigned int fStart; |
| 222 | unsigned int fEnd; |
| 223 | Interval* fNext; |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 224 | unsigned int fUses = 0; |
| 225 | bool fIsRecyclable = false; |
Robert Phillips | da1be46 | 2018-07-27 07:18:06 -0400 | [diff] [blame] | 226 | |
| 227 | #if GR_TRACK_INTERVAL_CREATION |
| 228 | uint32_t fUniqueID; |
| 229 | |
| 230 | uint32_t CreateUniqueID(); |
| 231 | #endif |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 232 | }; |
| 233 | |
| 234 | class IntervalList { |
| 235 | public: |
| 236 | IntervalList() = default; |
| 237 | ~IntervalList() { |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 238 | // The only time we delete an IntervalList is in the GrResourceAllocator dtor. |
| 239 | // Since the arena allocator will clean up for us we don't bother here. |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 240 | } |
| 241 | |
Robert Phillips | df25e3a | 2018-08-08 12:48:40 -0400 | [diff] [blame] | 242 | bool empty() const { |
| 243 | SkASSERT(SkToBool(fHead) == SkToBool(fTail)); |
| 244 | return !SkToBool(fHead); |
| 245 | } |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 246 | const Interval* peekHead() const { return fHead; } |
Robert Phillips | c73666f | 2019-04-24 08:49:48 -0400 | [diff] [blame] | 247 | Interval* peekHead() { return fHead; } |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 248 | Interval* popHead(); |
| 249 | void insertByIncreasingStart(Interval*); |
| 250 | void insertByIncreasingEnd(Interval*); |
Robert Phillips | 4150eea | 2018-02-07 17:08:21 -0500 | [diff] [blame] | 251 | Interval* detachAll(); |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 252 | |
| 253 | private: |
Robert Phillips | df25e3a | 2018-08-08 12:48:40 -0400 | [diff] [blame] | 254 | SkDEBUGCODE(void validate() const;) |
| 255 | |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 256 | Interval* fHead = nullptr; |
Robert Phillips | df25e3a | 2018-08-08 12:48:40 -0400 | [diff] [blame] | 257 | Interval* fTail = nullptr; |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 258 | }; |
| 259 | |
Brian Salomon | 309b053 | 2018-10-10 17:22:00 -0400 | [diff] [blame] | 260 | // Compositing use cases can create > 80 intervals. |
| 261 | static const int kInitialArenaSize = 128 * sizeof(Interval); |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 262 | |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 263 | GrResourceProvider* fResourceProvider; |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 264 | GrDeinstantiateProxyTracker* fDeinstantiateTracker; |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 265 | FreePoolMultiMap fFreePool; // Recently created/used GrSurfaces |
| 266 | IntvlHash fIntvlHash; // All the intervals, hashed by proxyID |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 267 | |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 268 | IntervalList fIntvlList; // All the intervals sorted by increasing start |
| 269 | IntervalList fActiveIntvls; // List of live intervals during assignment |
Robert Phillips | c476e5d | 2019-03-26 14:50:08 -0400 | [diff] [blame] | 270 | // (sorted by increasing end) |
| 271 | unsigned int fNumOps = 0; |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 272 | SkTArray<unsigned int> fEndOfOpListOpIndices; |
| 273 | int fCurOpListIndex = 0; |
Robert Phillips | c476e5d | 2019-03-26 14:50:08 -0400 | [diff] [blame] | 274 | SkDEBUGCODE(const int fNumOpLists = -1;) |
Robert Phillips | 8186cbe | 2017-11-01 17:32:39 -0400 | [diff] [blame] | 275 | |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 276 | SkDEBUGCODE(bool fAssigned = false;) |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 277 | |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 278 | char fStorage[kInitialArenaSize]; |
| 279 | SkArenaAlloc fIntervalAllocator{fStorage, kInitialArenaSize, kInitialArenaSize}; |
| 280 | Interval* fFreeIntervalList = nullptr; |
Robert Phillips | 82774f8 | 2019-06-20 14:38:27 -0400 | [diff] [blame] | 281 | bool fLazyInstantiationError = false; |
Robert Phillips | 5af44de | 2017-07-18 14:49:38 -0400 | [diff] [blame] | 282 | }; |
| 283 | |
| 284 | #endif // GrResourceAllocator_DEFINED |