aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-11-14 06:47:39 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-14 06:47:39 -0800
commitac49acda520292b059bc37fd368dff912626c3d9 (patch)
tree64b8e7e0e2471aac0c27f0eb947c4a4f9dc0a4b3 /include
parent407aa584d183c1bf314f5defd1cf0202e8a96c89 (diff)
Revert of Replace GrResourceCache with GrResourceCache2. (patchset #7 id:120001 of https://codereview.chromium.org/716143004/)
Reason for revert: broken again Original issue's description: > Replace GrResourceCache with GrResourceCache2. > > BUG=skia:2889 > > Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6 > > Committed: https://skia.googlesource.com/skia/+/407aa584d183c1bf314f5defd1cf0202e8a96c89 TBR=robertphillips@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2889 Review URL: https://codereview.chromium.org/726913002
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrConfig.h18
-rw-r--r--include/gpu/GrContext.h10
-rw-r--r--include/gpu/GrGpuResource.h4
-rw-r--r--include/gpu/GrUserConfig.h12
-rw-r--r--include/gpu/SkGr.h5
5 files changed, 41 insertions, 8 deletions
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index d48ccd5dc6..e70c978fc0 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -213,6 +213,24 @@ typedef unsigned __int64 uint64_t;
#endif
/**
+ * GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
+ * maximum size of the texture cache in vram. The value is only a default and
+ * can be overridden at runtime.
+ */
+#if !defined(GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT)
+ #define GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT 96
+#endif
+
+/**
+ * GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT specifies the maximum number of
+ * textures the texture cache can hold in vram. The value is only a default and
+ * can be overridden at runtime.
+ */
+#if !defined(GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT)
+ #define GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT 2048
+#endif
+
+/**
* GR_STROKE_PATH_RENDERING controls whether or not the GrStrokePathRenderer can be selected
* as a path renderer. GrStrokePathRenderer is currently an experimental path renderer.
*/
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 3dbf7b3ea8..97acda1e79 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -33,6 +33,7 @@ class GrOvalRenderer;
class GrPath;
class GrPathRenderer;
class GrResourceEntry;
+class GrResourceCache;
class GrResourceCache2;
class GrStencilBuffer;
class GrTestTarget;
@@ -882,6 +883,7 @@ public:
GrDrawTarget* getTextTarget();
const GrIndexBuffer* getQuadIndexBuffer() const;
GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; }
+ GrResourceCache* getResourceCache() { return fResourceCache; }
GrResourceCache2* getResourceCache2() { return fResourceCache2; }
// Called by tests that draw directly to the context via GrDrawTarget
@@ -946,6 +948,7 @@ private:
const GrClipData* fClip; // TODO: make this ref counted
GrDrawState* fDrawState;
+ GrResourceCache* fResourceCache;
GrResourceCache2* fResourceCache2;
GrFontCache* fFontCache;
SkAutoTDelete<GrLayerCache> fLayerCache;
@@ -959,6 +962,7 @@ private:
// Set by OverbudgetCB() to request that GrContext flush before exiting a draw.
bool fFlushToReduceCacheSize;
+
GrAARectRenderer* fAARectRenderer;
GrOvalRenderer* fOvalRenderer;
@@ -999,6 +1003,8 @@ private:
size_t rowBytes,
bool filter);
+ GrTexture* createNewScratchTexture(const GrSurfaceDesc& desc);
+
/**
* These functions create premul <-> unpremul effects if it is possible to generate a pair
* of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. Otherwise, they
@@ -1009,9 +1015,9 @@ private:
/**
* This callback allows the resource cache to callback into the GrContext
- * when the cache is still over budget after a purge.
+ * when the cache is still overbudget after a purge.
*/
- static void OverBudgetCB(void* data);
+ static bool OverbudgetCB(void* data);
typedef SkRefCnt INHERITED;
};
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 3c87117124..5231b15f89 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -16,6 +16,7 @@
class GrContext;
class GrGpu;
class GrResourceCache2;
+class GrResourceCacheEntry;
/**
* Base class for GrGpuResource. Handles the various types of refs we need. Separated out as a base
@@ -125,7 +126,7 @@ private:
};
/**
- * Base class for objects that can be kept in the GrResourceCache2.
+ * Base class for objects that can be kept in the GrResourceCache.
*/
class SK_API GrGpuResource : public GrIORef<GrGpuResource> {
public:
@@ -256,6 +257,7 @@ private:
uint32_t fFlags;
+ GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
mutable size_t fGpuMemorySize;
const uint32_t fUniqueID;
diff --git a/include/gpu/GrUserConfig.h b/include/gpu/GrUserConfig.h
index 4ff95f73b5..092ff9d8bc 100644
--- a/include/gpu/GrUserConfig.h
+++ b/include/gpu/GrUserConfig.h
@@ -19,4 +19,16 @@
*/
//#define GR_GEOM_BUFFER_MAP_THRESHOLD (1<<15)
+/**
+ * This gives a threshold in megabytes for the maximum size of the texture cache
+ * in vram. The value is only a default and can be overridden at runtime.
+ */
+//#define GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT 96
+
+/**
+ * This specifies the maximum number of textures the texture cache can hold
+ * in vram. The value is only a default and can be overridden at runtime.
+ */
+//#define GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT 2048
+
#endif
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index 8025c956ef..026525be5d 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -68,11 +68,6 @@ static inline GrColor SkColor2GrColorJustAlpha(SkColor c) {
////////////////////////////////////////////////////////////////////////////////
-// The cache listens for these messages to purge junk resources proactively.
-struct GrResourceInvalidatedMessage {
- GrResourceKey key;
-};
-
bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams*);
GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams*);