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 "GrGpuGL.h" | 8 #include "GrGpuGL.h" |
9 | 9 |
10 #include "GrEffect.h" | 10 #include "GrEffect.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #endif | 26 #endif |
27 { | 27 { |
28 } | 28 } |
29 | 29 |
30 GrGpuGL::ProgramCache::~ProgramCache() { | 30 GrGpuGL::ProgramCache::~ProgramCache() { |
31 // dump stats | 31 // dump stats |
32 #ifdef PROGRAM_CACHE_STATS | 32 #ifdef PROGRAM_CACHE_STATS |
33 SkDebugf("--- Program Cache ---\n"); | 33 SkDebugf("--- Program Cache ---\n"); |
34 SkDebugf("Total requests: %d\n", fTotalRequests); | 34 SkDebugf("Total requests: %d\n", fTotalRequests); |
35 SkDebugf("Cache misses: %d\n", fCacheMisses); | 35 SkDebugf("Cache misses: %d\n", fCacheMisses); |
36 SkDebugf("Cache miss %%: %f\n", (float)fCacheMisses/(float)fTotalRequests); | 36 SkDebugf("Cache miss %%: %f\n", (fTotalRequests > 0) |
| 37 ? (float)fCacheMisses/(float)fTotalRequests
: 0.0f); |
37 SkDebugf("---------------------\n"); | 38 SkDebugf("---------------------\n"); |
38 #endif | 39 #endif |
39 } | 40 } |
40 | 41 |
41 void GrGpuGL::ProgramCache::abandon() { | 42 void GrGpuGL::ProgramCache::abandon() { |
42 for (int i = 0; i < fCount; ++i) { | 43 for (int i = 0; i < fCount; ++i) { |
43 GrAssert(NULL != fEntries[i].fProgram.get()); | 44 GrAssert(NULL != fEntries[i].fProgram.get()); |
44 fEntries[i].fProgram->abandon(); | 45 fEntries[i].fProgram->abandon(); |
45 fEntries[i].fProgram.reset(NULL); | 46 fEntries[i].fProgram.reset(NULL); |
46 } | 47 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 GrGLProgram::kAttribLayouts[attribType].fCount, | 305 GrGLProgram::kAttribLayouts[attribType].fCount, |
305 GrGLProgram::kAttribLayouts[attribType].fType, | 306 GrGLProgram::kAttribLayouts[attribType].fType, |
306 GrGLProgram::kAttribLayouts[attribType].fNormalized, | 307 GrGLProgram::kAttribLayouts[attribType].fNormalized, |
307 stride, | 308 stride, |
308 reinterpret_cast<GrGLvoid*>( | 309 reinterpret_cast<GrGLvoid*>( |
309 vertexOffsetInBytes + vertexAttrib->fOffset)); | 310 vertexOffsetInBytes + vertexAttrib->fOffset)); |
310 } | 311 } |
311 | 312 |
312 attribState->disableUnusedAttribArrays(this, usedAttribArraysMask); | 313 attribState->disableUnusedAttribArrays(this, usedAttribArraysMask); |
313 } | 314 } |
OLD | NEW |