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

Side by Side Diff: tools/timer/GpuTimer.cpp

Issue 639793002: Revert of Make the Sk GL context class an abstract base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « tools/timer/GpuTimer.h ('k') | tools/timer/Timer.h » ('j') | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "GpuTimer.h" 8 #include "GpuTimer.h"
9 #include "gl/SkGLContext.h" 9 #include "gl/SkGLContextHelper.h"
10 #include "gl/GrGLUtil.h" 10 #include "gl/GrGLUtil.h"
11 11
12 GpuTimer::GpuTimer(const SkGLContext* glctx) : fContext(glctx) { 12 GpuTimer::GpuTimer(const SkGLContextHelper* glctx) : fContext(glctx) {
13 if (fContext) { 13 if (fContext) {
14 fContext->ref(); 14 fContext->ref();
15 fContext->makeCurrent(); 15 fContext->makeCurrent();
16 fStarted = false; 16 fStarted = false;
17 fSupported = GrGLGetVersion(fContext->gl()) > GR_GL_VER(3,3) || 17 fSupported = GrGLGetVersion(fContext->gl()) > GR_GL_VER(3,3) ||
18 fContext->hasExtension("GL_ARB_timer_query") || 18 fContext->hasExtension("GL_ARB_timer_query") ||
19 fContext->hasExtension("GL_EXT_timer_query"); 19 fContext->hasExtension("GL_EXT_timer_query");
20 20
21 if (fSupported) { 21 if (fSupported) {
22 SK_GL(*fContext, GenQueries(1, &fQuery)); 22 SK_GL(*fContext, GenQueries(1, &fQuery));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 GrGLuint64 totalGPUTimeElapsed = 0; 68 GrGLuint64 totalGPUTimeElapsed = 0;
69 SK_GL(*fContext, GetQueryObjectui64v(fQuery, 69 SK_GL(*fContext, GetQueryObjectui64v(fQuery,
70 GR_GL_QUERY_RESULT, 70 GR_GL_QUERY_RESULT,
71 &totalGPUTimeElapsed)); 71 &totalGPUTimeElapsed));
72 72
73 return totalGPUTimeElapsed / 1000000.0; 73 return totalGPUTimeElapsed / 1000000.0;
74 } else { 74 } else {
75 return 0; 75 return 0;
76 } 76 }
77 } 77 }
OLDNEW
« no previous file with comments | « tools/timer/GpuTimer.h ('k') | tools/timer/Timer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698