diff options
author | 2012-01-27 19:12:00 +0000 | |
---|---|---|
committer | 2012-01-27 19:12:00 +0000 | |
commit | 05e70247c31ae927074ef27ea9893634a8dda543 (patch) | |
tree | 250f9c0108d71c934e3e9ce1eda507eed7b12844 /samplecode | |
parent | 78c6ed0a597b4a3765a366b47f4e3e0677118141 (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 'samplecode')
-rw-r--r-- | samplecode/SampleApp.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index d3d2aa708a..898bda0be8 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -1537,6 +1537,17 @@ bool SampleWindow::onHandleChar(SkUnichar uni) { this->updateTitle(); } return true; + case 'p': + { + GrContext* grContext = this->getGrContext(); + if (grContext) { + size_t cacheBytes = grContext->getGpuTextureCacheBytes(); + grContext->freeGpuResources(); + SkDebugf("Purged %d bytes from the GPU resource cache.\n", + cacheBytes); + } + } + return true; case 's': fScale = !fScale; this->inval(NULL); |