OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGpuResource_DEFINED | 8 #ifndef GrGpuResource_DEFINED |
9 #define GrGpuResource_DEFINED | 9 #define GrGpuResource_DEFINED |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 /** | 166 /** |
167 * Retrieves the amount of GPU memory used by this resource in bytes. It is | 167 * Retrieves the amount of GPU memory used by this resource in bytes. It is |
168 * approximate since we aren't aware of additional padding or copies made | 168 * approximate since we aren't aware of additional padding or copies made |
169 * by the driver. | 169 * by the driver. |
170 * | 170 * |
171 * @return the amount of GPU memory used in bytes | 171 * @return the amount of GPU memory used in bytes |
172 */ | 172 */ |
173 virtual size_t gpuMemorySize() const = 0; | 173 virtual size_t gpuMemorySize() const = 0; |
174 | 174 |
175 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn
try; } | 175 bool setCacheEntry(GrResourceCacheEntry* cacheEntry); |
176 GrResourceCacheEntry* getCacheEntry() const { return fCacheEntry; } | 176 GrResourceCacheEntry* getCacheEntry() const { return fCacheEntry; } |
177 bool isScratch() const; | 177 bool isScratch() const; |
178 | 178 |
179 /** | 179 /** |
180 * If this resource can be used as a scratch resource this returns a valid | 180 * If this resource can be used as a scratch resource this returns a valid |
181 * scratch key. Otherwise it returns a key for which isNullScratch is true. | 181 * scratch key. Otherwise it returns a key for which isNullScratch is true. |
182 */ | 182 */ |
183 const GrResourceKey& getScratchKey() const { return fScratchKey; } | 183 const GrResourceKey& getScratchKey() const { return fScratchKey; } |
184 | 184 |
185 /** | 185 /** |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache | 258 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache |
259 const uint32_t fUniqueID; | 259 const uint32_t fUniqueID; |
260 | 260 |
261 GrResourceKey fScratchKey; | 261 GrResourceKey fScratchKey; |
262 | 262 |
263 typedef GrIORef<GrGpuResource> INHERITED; | 263 typedef GrIORef<GrGpuResource> INHERITED; |
264 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. | 264 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. |
265 }; | 265 }; |
266 | 266 |
267 #endif | 267 #endif |
OLD | NEW |