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

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: 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
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;
};
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrResourceKey.h » ('j') | include/gpu/GrResourceKey.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698