Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: include/gpu/GrGpuResource.h

Issue 510053003: Make textures register with GrResourceCache2 as scratch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add new h file to git repo Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrBinHashKey.h ('k') | include/gpu/GrResourceKey.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrGpuResource.h
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 17cdfc9a4cbe10e82c51e7a57545a0558729fc72..5e852a9a040a719a3c4a736d84b833632bbbcf6e 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,12 @@ public:
void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEntry; }
GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; }
+ /**
+ * If this resource can be used as a scratch resource this returns a valid
+ * scratch key. Otherwise it returns a key for which isNullScratch is true.
+ */
+ 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 +97,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 +123,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 +158,8 @@ private:
GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
const uint32_t fUniqueID;
+ GrResourceKey fScratchKey;
+
typedef SkNoncopyable INHERITED;
};
« no previous file with comments | « include/gpu/GrBinHashKey.h ('k') | include/gpu/GrResourceKey.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698