aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar twiz@google.com <twiz@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-27 19:12:00 +0000
committerGravatar twiz@google.com <twiz@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-27 19:12:00 +0000
commit05e70247c31ae927074ef27ea9893634a8dda543 (patch)
tree250f9c0108d71c934e3e9ce1eda507eed7b12844 /src
parent78c6ed0a597b4a3765a366b47f4e3e0677118141 (diff)
Expose functionality to purge the GPU texture cache while running SampleApp.
Press 'p' to purge the cache. A summary of the number of bytes of video memory released is output to the command prompt. Review URL: https://codereview.appspot.com/5587045 git-svn-id: http://skia.googlecode.com/svn/trunk@3097 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrResourceCache.h6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 2132ed6ea7..975f6d0b90 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -115,6 +115,10 @@ void GrContext::freeGpuResources() {
GrSafeSetNull(fPathRendererChain);
}
+size_t GrContext::getGpuTextureCacheBytes() const {
+ return fTextureCache->getCachedResourceBytes();
+}
+
////////////////////////////////////////////////////////////////////////////////
int GrContext::PaintStageVertexLayoutBits(
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index e21c6050a1..f86fcd270f 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -209,6 +209,11 @@ public:
void setLimits(int maxResource, size_t maxResourceBytes);
/**
+ * Returns the number of bytes consumed by cached resources.
+ */
+ size_t getCachedResourceBytes() const { return fEntryBytes; }
+
+ /**
* Controls whether locks should be nestable or not.
*/
enum LockType {
@@ -315,4 +320,3 @@ private:
#endif
#endif
-