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

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

Issue 640283004: Refactor SkGLContext to be actually extendable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: win compile fix. 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 | « tests/GLInterfaceValidationTest.cpp ('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 /* 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/SkGLContext.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 SkGLContext* 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->gl()->hasExtension("GL_ARB_timer_query") ||
19 fContext->hasExtension("GL_EXT_timer_query"); 19 fContext->gl()->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));
23 } 23 }
24 } 24 }
25 } 25 }
26 26
27 GpuTimer::~GpuTimer() { 27 GpuTimer::~GpuTimer() {
28 if (fContext) { 28 if (fContext) {
29 if (fSupported) { 29 if (fSupported) {
(...skipping 38 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 | « tests/GLInterfaceValidationTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698