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

Side by Side Diff: src/gpu/gl/GrGpuGL_program.cpp

Issue 12426019: Fix divide-by-zero in program cache tracking (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698