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

Unified 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: Removed GetQueryivEXT test with QueryCounter 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gpu_timing_fake.h ('k') | ui/gl/gpu_timing_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gpu_timing_fake.cc
diff --git a/ui/gl/gpu_timing_fake.cc b/ui/gl/gpu_timing_fake.cc
index e7c1df99d06084ff589c81b65fa8d5c35486cf18..e3299794cd656b868598a5dbbddaf337a6d62bc6 100644
--- a/ui/gl/gpu_timing_fake.cc
+++ b/ui/gl/gpu_timing_fake.cc
@@ -53,9 +53,48 @@ void GPUTimingFake::ExpectNoDisjointCalls(MockGLInterface& gl) {
EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0));
}
+void GPUTimingFake::ExpectGPUTimeStampQuery(
+ MockGLInterface& gl, bool elapsed_query) {
+ EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(Exactly(1))
+ .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
+
+ if (!elapsed_query) {
+ // Time Stamp based queries.
+ EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _))
+ .WillRepeatedly(
+ Invoke(this, &GPUTimingFake::FakeGLGetInteger64v));
+
+ EXPECT_CALL(gl, QueryCounter(_, GL_TIMESTAMP)).Times(Exactly(1))
+ .WillRepeatedly(
+ Invoke(this, &GPUTimingFake::FakeGLQueryCounter));
+ } else {
+ // Time Elapsed based queries.
+ EXPECT_CALL(gl, BeginQuery(GL_TIME_ELAPSED, _)).Times(Exactly(1))
+ .WillRepeatedly(
+ Invoke(this, &GPUTimingFake::FakeGLBeginQuery));
+
+ EXPECT_CALL(gl, EndQuery(GL_TIME_ELAPSED)).Times(Exactly(1))
+ .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLEndQuery));
+ }
+
+ EXPECT_CALL(gl, GetQueryObjectuiv(_, GL_QUERY_RESULT_AVAILABLE,
+ NotNull()))
+ .WillRepeatedly(
+ Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectuiv));
+
+ EXPECT_CALL(gl, GetQueryObjectui64v(_, GL_QUERY_RESULT, NotNull()))
+ .WillRepeatedly(
+ Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectui64v));
+
+ EXPECT_CALL(gl, DeleteQueries(1, NotNull())).Times(AtLeast(1))
+ .WillRepeatedly(
+ Invoke(this, &GPUTimingFake::FakeGLDeleteQueries));
+}
+
void GPUTimingFake::ExpectGPUTimerQuery(
MockGLInterface& gl, bool elapsed_query) {
- EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(AtLeast(2))
+ EXPECT_CALL(gl, GenQueries(1, NotNull()))
+ .Times(AtLeast(elapsed_query ? 1 : 2))
.WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
if (!elapsed_query) {
@@ -86,7 +125,8 @@ void GPUTimingFake::ExpectGPUTimerQuery(
.WillRepeatedly(
Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectui64v));
- EXPECT_CALL(gl, DeleteQueries(1, NotNull())).Times(AtLeast(2))
+ EXPECT_CALL(gl, DeleteQueries(1, NotNull()))
+ .Times(AtLeast(elapsed_query ? 1 : 2))
.WillRepeatedly(
Invoke(this, &GPUTimingFake::FakeGLDeleteQueries));
}
« no previous file with comments | « 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