Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: src/gpu/gl/GrGLGpuProgramCache.cpp

Issue 1491823003: reset shader compilations for stats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698