| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
| 9 | 9 |
| 10 #include "builders/GrGLProgramBuilder.h" | 10 #include "builders/GrGLProgramBuilder.h" |
| 11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
| 12 #include "GrGLPathRendering.h" | 12 #include "GrGLPathRendering.h" |
| 13 #include "glsl/GrGLSLFragmentProcessor.h" | 13 #include "glsl/GrGLSLFragmentProcessor.h" |
| 14 #include "glsl/GrGLSLProgramDataManager.h" | 14 #include "glsl/GrGLSLProgramDataManager.h" |
| 15 #include "glsl/GrGLSLProgramDesc.h" | 15 #include "glsl/GrGLSLProgramDesc.h" |
| 16 #include "SkRTConf.h" | |
| 17 #include "SkTSearch.h" | 16 #include "SkTSearch.h" |
| 18 | 17 |
| 19 #ifdef PROGRAM_CACHE_STATS | 18 #ifdef PROGRAM_CACHE_STATS |
| 20 SK_CONF_DECLARE(bool, c_DisplayCache, "gpu.displayCache", false, | 19 // Display program cache usage |
| 21 "Display program cache usage."); | 20 static const bool c_DisplayCache{false}; |
| 22 #endif | 21 #endif |
| 23 | 22 |
| 24 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 23 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
| 25 | 24 |
| 26 struct GrGLGpu::ProgramCache::Entry { | 25 struct GrGLGpu::ProgramCache::Entry { |
| 27 | 26 |
| 28 Entry() : fProgram(nullptr), fLRUStamp(0) {} | 27 Entry() : fProgram(nullptr), fLRUStamp(0) {} |
| 29 | 28 |
| 30 SkAutoTUnref<GrGLProgram> fProgram; | 29 SkAutoTUnref<GrGLProgram> fProgram; |
| 31 unsigned int fLRUStamp; | 30 unsigned int fLRUStamp; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 211 |
| 213 if (SK_MaxU32 == fCurrLRUStamp) { | 212 if (SK_MaxU32 == fCurrLRUStamp) { |
| 214 // wrap around! just trash our LRU, one time hit. | 213 // wrap around! just trash our LRU, one time hit. |
| 215 for (int i = 0; i < fCount; ++i) { | 214 for (int i = 0; i < fCount; ++i) { |
| 216 fEntries[i]->fLRUStamp = 0; | 215 fEntries[i]->fLRUStamp = 0; |
| 217 } | 216 } |
| 218 } | 217 } |
| 219 ++fCurrLRUStamp; | 218 ++fCurrLRUStamp; |
| 220 return SkRef(entry->fProgram.get()); | 219 return SkRef(entry->fProgram.get()); |
| 221 } | 220 } |
| OLD | NEW |