aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-14 19:31:39 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-14 19:31:39 +0000
commitff17584e1c15f68ccc296be517e8a6776a9ddabd (patch)
tree958bba76565d9a81b6034a9ce5852c821938631f
parent706f6212c60dd8861a0ae922a77c455a08360aa3 (diff)
Attached ClipMaskManager to GPU resource freeing system
-rw-r--r--src/gpu/GrContext.cpp3
-rw-r--r--src/gpu/GrDrawTarget.h6
-rw-r--r--src/gpu/GrGpu.h6
3 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 8d5b88f4b3..aaf2ae462b 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -110,6 +110,9 @@ void GrContext::resetContext() {
void GrContext::freeGpuResources() {
this->flush();
+
+ fGpu->purgeResources();
+
fTextureCache->removeAll();
fFontCache->freeAll();
// a path renderer may be holding onto resources
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index c0e70dd0cf..bf6e41bb2e 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -545,6 +545,12 @@ public:
*/
virtual void clear(const GrIRect* rect, GrColor color) = 0;
+ /**
+ * Release any resources that are cached but not currently in use. This
+ * is intended to give an application some recourse when resources are low.
+ */
+ virtual void purgeResources() {};
+
////////////////////////////////////////////////////////////////////////////
/**
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index aeb51f829a..ba73f7da06 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -318,6 +318,12 @@ public:
// GrDrawTarget overrides
virtual void clear(const GrIRect* rect, GrColor color);
+ virtual void purgeResources() SK_OVERRIDE {
+ // The clip mask manager can rebuild all its clip masks so just
+ // get rid of them all.
+ fClipMaskManager.releaseResources();
+ }
+
// After the client interacts directly with the 3D context state the GrGpu
// must resync its internal state and assumptions about 3D context state.
// Each time this occurs the GrGpu bumps a timestamp.