Index: src/gpu/gl/GrGLGpuProgramCache.cpp |
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp |
index d5f2b9d23daa36af1bcd30ccaae987c69f840b02..df8cf60c7b3cf0d04298f61fe9c5e80c1bf1fe69 100644 |
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp |
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp |
@@ -77,13 +77,30 @@ GrGLGpu::ProgramCache::~ProgramCache() { |
#endif |
} |
-void GrGLGpu::ProgramCache::abandon() { |
+void GrGLGpu::ProgramCache::reset() { |
for (int i = 0; i < fCount; ++i) { |
SkASSERT(fEntries[i]->fProgram.get()); |
fEntries[i]->fProgram->abandon(); |
delete fEntries[i]; |
+ fEntries[i] = nullptr; |
} |
fCount = 0; |
+ |
+ // zero out hash table |
+ for (int i = 0; i < 1 << kHashBits; i++) { |
+ fHashTable[i] = nullptr; |
+ } |
+ |
+ fCurrLRUStamp = 0; |
+#ifdef PROGRAM_CACHE_STATS |
+ fTotalRequests = 0; |
+ fCacheMisses = 0; |
+ fHashMisses = 0; |
+#endif |
+} |
+ |
+void GrGLGpu::ProgramCache::abandon() { |
+ this->reset(); |
} |
int GrGLGpu::ProgramCache::search(const GrProgramDesc& desc) const { |