| 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 "SkRTConf.h" | 15 #include "SkRTConf.h" |
| 16 #include "SkTSearch.h" | 16 #include "SkTSearch.h" |
| 17 | 17 |
| 18 #ifdef PROGRAM_CACHE_STATS | 18 #ifdef PROGRAM_CACHE_STATS |
| 19 SK_CONF_DECLARE(bool, c_DisplayCache, "gpu.displayCache", false, | 19 SK_CONF_DECLARE(bool, c_DisplayCache, "gpu.displayCache", false, |
| 20 "Display program cache usage."); | 20 "Display program cache usage."); |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 23 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
| 24 | 24 |
| 25 struct GrGLGpu::ProgramCache::Entry { | 25 struct GrGLGpu::ProgramCache::Entry { |
| 26 | 26 |
| 27 Entry() : fProgram(nullptr), fLRUStamp(0) {} | 27 Entry() : fProgram(nullptr), fLRUStamp(0) {} |
| 28 | 28 |
| 29 SkAutoTUnref<GrGLProgram> fProgram; | 29 SkAutoTUnref<GrGLProgram> fProgram; |
| 30 unsigned int fLRUStamp; | 30 unsigned int fLRUStamp; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 struct GrGLGpu::ProgramCache::ProgDescLess { | 33 struct GrGLGpu::ProgramCache::ProgDescLess { |
| 34 bool operator() (const GrProgramDesc& desc, const Entry* entry) { | 34 bool operator() (const GrProgramDesc& desc, const Entry* entry) { |
| 35 SkASSERT(entry->fProgram.get()); | 35 SkASSERT(entry->fProgram.get()); |
| 36 return GrProgramDesc::Less(desc, entry->fProgram->getDesc()); | 36 return GrProgramDesc::Less(desc, entry->fProgram->getDesc()); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 if (SK_MaxU32 == fCurrLRUStamp) { | 212 if (SK_MaxU32 == fCurrLRUStamp) { |
| 213 // wrap around! just trash our LRU, one time hit. | 213 // wrap around! just trash our LRU, one time hit. |
| 214 for (int i = 0; i < fCount; ++i) { | 214 for (int i = 0; i < fCount; ++i) { |
| 215 fEntries[i]->fLRUStamp = 0; | 215 fEntries[i]->fLRUStamp = 0; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 ++fCurrLRUStamp; | 218 ++fCurrLRUStamp; |
| 219 return SkRef(entry->fProgram.get()); | 219 return SkRef(entry->fProgram.get()); |
| 220 } | 220 } |
| OLD | NEW |