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

Side by Side Diff: bench/BenchGpuTimer_gl.cpp

Issue 12328111: Use glGetStringi to get extensions when available. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 10 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 | « no previous file | gyp/gpu.gypi » ('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 "BenchGpuTimer_gl.h" 8 #include "BenchGpuTimer_gl.h"
9 #include "gl/SkGLContext.h" 9 #include "gl/SkGLContext.h"
10 #include "gl/GrGLUtil.h" 10 #include "gl/GrGLUtil.h"
11 11
12 BenchGpuTimer::BenchGpuTimer(const SkGLContext* glctx) { 12 BenchGpuTimer::BenchGpuTimer(const SkGLContext* glctx) {
13 fContext = glctx; 13 fContext = glctx;
14 glctx->ref(); 14 glctx->ref();
15 glctx->makeCurrent(); 15 glctx->makeCurrent();
16 fStarted = false; 16 fStarted = false;
17 fSupported = GrGLGetVersion(glctx->gl()) > GR_GL_VER(3,3) || 17 fSupported = GrGLGetVersion(glctx->gl()) > GR_GL_VER(3,3) ||
18 GrGLHasExtension(glctx->gl(), "GL_ARB_timer_query") || 18 glctx->hasExtension("GL_ARB_timer_query") ||
19 GrGLHasExtension(glctx->gl(), "GL_EXT_timer_query"); 19 glctx->hasExtension("GL_EXT_timer_query");
20 20
21 if (fSupported) { 21 if (fSupported) {
22 SK_GL(*glctx, GenQueries(1, &fQuery)); 22 SK_GL(*glctx, GenQueries(1, &fQuery));
23 } 23 }
24 } 24 }
25 25
26 BenchGpuTimer::~BenchGpuTimer() { 26 BenchGpuTimer::~BenchGpuTimer() {
27 if (fSupported) { 27 if (fSupported) {
28 fContext->makeCurrent(); 28 fContext->makeCurrent();
29 SK_GL(*fContext, DeleteQueries(1, &fQuery)); 29 SK_GL(*fContext, DeleteQueries(1, &fQuery));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 GrGLuint64 totalGPUTimeElapsed = 0; 65 GrGLuint64 totalGPUTimeElapsed = 0;
66 SK_GL(*fContext, GetQueryObjectui64v(fQuery, 66 SK_GL(*fContext, GetQueryObjectui64v(fQuery,
67 GR_GL_QUERY_RESULT, 67 GR_GL_QUERY_RESULT,
68 &totalGPUTimeElapsed)); 68 &totalGPUTimeElapsed));
69 69
70 return totalGPUTimeElapsed / 1000000.0; 70 return totalGPUTimeElapsed / 1000000.0;
71 } else { 71 } else {
72 return 0; 72 return 0;
73 } 73 }
74 } 74 }
OLDNEW
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698