Chromium Code Reviews| Index: include/gpu/GrGpuResource.h |
| diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h |
| index 17cdfc9a4cbe10e82c51e7a57545a0558729fc72..40de6b87daacaf1c0ed306b121d4a004c6b19b04 100644 |
| --- a/include/gpu/GrGpuResource.h |
| +++ b/include/gpu/GrGpuResource.h |
| @@ -10,6 +10,7 @@ |
| #include "SkInstCnt.h" |
| #include "SkTInternalLList.h" |
| +#include "GrResourceKey.h" |
| class GrResourceCacheEntry; |
| class GrResourceCache2; |
| @@ -82,6 +83,8 @@ public: |
| void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEntry; } |
| GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } |
|
robertphillips
2014/08/27 19:11:29
// If this resource can be used as a scratch resou
bsalomon
2014/08/27 20:37:39
Done.
|
| + const GrResourceKey& getScratchKey() const { return fScratchKey; } |
| + |
| /** |
| * Gets an id that is unique for this GrCacheable object. It is static in that it does |
| * not change when the content of the GrCacheable object changes. This will never return |
| @@ -90,7 +93,6 @@ public: |
| uint32_t getUniqueID() const { return fUniqueID; } |
| protected: |
| - |
| // This must be called by every GrGpuObject. It should be called once the object is fully |
| // initialized (i.e. not in a base class constructor). |
| void registerWithCache(); |
| @@ -117,6 +119,12 @@ protected: |
| */ |
| void didChangeGpuMemorySize() const; |
| + /** |
| + * Optionally called by the GrGpuResource subclass if the resource can be used as scratch. |
| + * By default resources are not usable as scratch. This should only be called once. |
| + **/ |
| + void setScratchKey(const GrResourceKey& scratchKey); |
| + |
| private: |
| #ifdef SK_DEBUG |
| friend class GrGpu; // for assert in GrGpu to access getGpu |
| @@ -146,6 +154,8 @@ private: |
| GrResourceCacheEntry* fCacheEntry; // NULL if not in cache |
| const uint32_t fUniqueID; |
| + GrResourceKey fScratchKey; |
| + |
| typedef SkNoncopyable INHERITED; |
| }; |