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

Side by Side Diff: ui/gl/gpu_timing_fake.cc

Issue 1233233002: Added support for TimeStamp queries using QueryCounterEXT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gpu_timing_fake.h" 5 #include "ui/gl/gpu_timing_fake.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gl/gl_mock.h" 8 #include "ui/gl/gl_mock.h"
9 9
10 namespace gfx { 10 namespace gfx {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 void GPUTimingFake::ExpectDisjointCalls(MockGLInterface& gl) { 47 void GPUTimingFake::ExpectDisjointCalls(MockGLInterface& gl) {
48 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(AtLeast(1)) 48 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(AtLeast(1))
49 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGetIntegerv)); 49 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGetIntegerv));
50 } 50 }
51 51
52 void GPUTimingFake::ExpectNoDisjointCalls(MockGLInterface& gl) { 52 void GPUTimingFake::ExpectNoDisjointCalls(MockGLInterface& gl) {
53 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0)); 53 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0));
54 } 54 }
55 55
56 void GPUTimingFake::ExpectGPUTimeStampQuery(
57 MockGLInterface& gl, bool elapsed_query) {
58 EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(Exactly(1))
59 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
60
61 if (!elapsed_query) {
62 // Time Stamp based queries.
63 EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _))
64 .WillRepeatedly(
65 Invoke(this, &GPUTimingFake::FakeGLGetInteger64v));
66
67 EXPECT_CALL(gl, QueryCounter(_, GL_TIMESTAMP)).Times(Exactly(1))
68 .WillRepeatedly(
69 Invoke(this, &GPUTimingFake::FakeGLQueryCounter));
70 } else {
71 // Time Elapsed based queries.
72 EXPECT_CALL(gl, BeginQuery(GL_TIME_ELAPSED, _)).Times(Exactly(1))
73 .WillRepeatedly(
74 Invoke(this, &GPUTimingFake::FakeGLBeginQuery));
75
76 EXPECT_CALL(gl, EndQuery(GL_TIME_ELAPSED)).Times(Exactly(1))
77 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLEndQuery));
78 }
79
80 EXPECT_CALL(gl, GetQueryObjectuiv(_, GL_QUERY_RESULT_AVAILABLE,
81 NotNull()))
82 .WillRepeatedly(
83 Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectuiv));
84
85 EXPECT_CALL(gl, GetQueryObjectui64v(_, GL_QUERY_RESULT, NotNull()))
86 .WillRepeatedly(
87 Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectui64v));
88
89 EXPECT_CALL(gl, DeleteQueries(1, NotNull())).Times(AtLeast(1))
90 .WillRepeatedly(
91 Invoke(this, &GPUTimingFake::FakeGLDeleteQueries));
92 }
93
56 void GPUTimingFake::ExpectGPUTimerQuery( 94 void GPUTimingFake::ExpectGPUTimerQuery(
57 MockGLInterface& gl, bool elapsed_query) { 95 MockGLInterface& gl, bool elapsed_query) {
58 EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(AtLeast(2)) 96 EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(AtLeast(2))
59 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries)); 97 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
60 98
61 if (!elapsed_query) { 99 if (!elapsed_query) {
62 // Time Stamp based queries. 100 // Time Stamp based queries.
63 EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _)) 101 EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _))
64 .WillRepeatedly( 102 .WillRepeatedly(
65 Invoke(this, &GPUTimingFake::FakeGLGetInteger64v)); 103 Invoke(this, &GPUTimingFake::FakeGLGetInteger64v));
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 default: 257 default:
220 FAIL() << "Invalid variable passed to GetIntegerv: " << pname; 258 FAIL() << "Invalid variable passed to GetIntegerv: " << pname;
221 } 259 }
222 } 260 }
223 261
224 GLenum GPUTimingFake::FakeGLGetError() { 262 GLenum GPUTimingFake::FakeGLGetError() {
225 return GL_NO_ERROR; 263 return GL_NO_ERROR;
226 } 264 }
227 265
228 } // namespace gfx 266 } // namespace gfx
OLDNEW
« ui/gl/gpu_timing.cc ('K') | « ui/gl/gpu_timing_fake.h ('k') | ui/gl/gpu_timing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698