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" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #endif | 99 #endif |
100 } | 100 } |
101 | 101 |
102 int GrGLGpu::ProgramCache::search(const GrProgramDesc& desc) const { | 102 int GrGLGpu::ProgramCache::search(const GrProgramDesc& desc) const { |
103 ProgDescLess less; | 103 ProgDescLess less; |
104 return SkTSearch(fEntries, fCount, desc, sizeof(Entry*), less); | 104 return SkTSearch(fEntries, fCount, desc, sizeof(Entry*), less); |
105 } | 105 } |
106 | 106 |
107 GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu, | 107 GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu, |
108 const GrPipeline& pipeline, | 108 const GrPipeline& pipeline, |
109 const GrPrimitiveProcessor& primP
roc) { | 109 const GrPrimitiveProcessor& primP
roc, |
| 110 bool isPoints) { |
110 #ifdef PROGRAM_CACHE_STATS | 111 #ifdef PROGRAM_CACHE_STATS |
111 ++fTotalRequests; | 112 ++fTotalRequests; |
112 #endif | 113 #endif |
113 | 114 |
114 // Get GrGLProgramDesc | 115 // Get GrGLProgramDesc |
115 GrProgramDesc desc; | 116 GrProgramDesc desc; |
116 if (!GrProgramDesc::Build(&desc, primProc, pipeline, *gpu->glCaps().glslCaps
())) { | 117 if (!GrProgramDesc::Build(&desc, primProc, isPoints, pipeline, *gpu->glCaps(
).glslCaps())) { |
117 GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n"); | 118 GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n"); |
118 return nullptr; | 119 return nullptr; |
119 } | 120 } |
120 desc.finalize(); | 121 desc.finalize(); |
121 | 122 |
122 Entry* entry = nullptr; | 123 Entry* entry = nullptr; |
123 | 124 |
124 uint32_t hashIdx = desc.getChecksum(); | 125 uint32_t hashIdx = desc.getChecksum(); |
125 hashIdx ^= hashIdx >> 16; | 126 hashIdx ^= hashIdx >> 16; |
126 if (kHashBits <= 8) { | 127 if (kHashBits <= 8) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 213 |
213 if (SK_MaxU32 == fCurrLRUStamp) { | 214 if (SK_MaxU32 == fCurrLRUStamp) { |
214 // wrap around! just trash our LRU, one time hit. | 215 // wrap around! just trash our LRU, one time hit. |
215 for (int i = 0; i < fCount; ++i) { | 216 for (int i = 0; i < fCount; ++i) { |
216 fEntries[i]->fLRUStamp = 0; | 217 fEntries[i]->fLRUStamp = 0; |
217 } | 218 } |
218 } | 219 } |
219 ++fCurrLRUStamp; | 220 ++fCurrLRUStamp; |
220 return SkRef(entry->fProgram.get()); | 221 return SkRef(entry->fProgram.get()); |
221 } | 222 } |
OLD | NEW |