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

Unified Diff: ui/gl/gpu_timing_fake.cc

Issue 1687353002: Force time elapsed queries on certain drivers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add bug to commit message Created 4 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 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 03f4af3d6ea06256a8c2d21d292d3e47545cd219..5747033c83f61240e3aa1307d48ea41a07702699 100644
--- a/ui/gl/gpu_timing_fake.cc
+++ b/ui/gl/gpu_timing_fake.cc
@@ -16,6 +16,9 @@ using ::testing::AtMost;
using ::testing::Exactly;
using ::testing::Invoke;
using ::testing::NotNull;
+using ::testing::DoAll;
+using ::testing::Return;
+using ::testing::SetArgPointee;
int64_t GPUTimingFake::fake_cpu_time_ = 0;
@@ -75,13 +78,20 @@ void GPUTimingFake::ExpectNoDisjointCalls(MockGLInterface& gl) {
EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0));
}
-void GPUTimingFake::ExpectGPUTimeStampQuery(
- MockGLInterface& gl, bool elapsed_query) {
+void GPUTimingFake::ExpectGPUTimeStampQuery(MockGLInterface& gl,
+ bool elapsed_query,
+ bool query_timestamp_counter_bits) {
David Yen 2016/02/17 19:04:55 Whether or not timestamp counter bits is actually
Ian Ewell 2016/02/17 21:06:30 Done.
EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(Exactly(1))
.WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
if (!elapsed_query) {
// Time Stamp based queries.
+ if (query_timestamp_counter_bits) {
+ EXPECT_CALL(gl,
+ GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, NotNull()))
+ .Times(Exactly(1))
+ .WillRepeatedly(DoAll(SetArgPointee<2>(64), Return()));
+ }
EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _))
.WillRepeatedly(
Invoke(this, &GPUTimingFake::FakeGLGetInteger64v));
@@ -91,6 +101,12 @@ void GPUTimingFake::ExpectGPUTimeStampQuery(
Invoke(this, &GPUTimingFake::FakeGLQueryCounter));
} else {
// Time Elapsed based queries.
+ if (query_timestamp_counter_bits) {
+ EXPECT_CALL(gl,
+ GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, NotNull()))
+ .Times(Exactly(1))
+ .WillRepeatedly(DoAll(SetArgPointee<2>(0), Return()));
+ }
EXPECT_CALL(gl, BeginQuery(GL_TIME_ELAPSED, _)).Times(Exactly(1))
.WillRepeatedly(
Invoke(this, &GPUTimingFake::FakeGLBeginQuery));
@@ -121,6 +137,10 @@ void GPUTimingFake::ExpectGPUTimerQuery(
if (!elapsed_query) {
// Time Stamp based queries.
+ EXPECT_CALL(gl, GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, NotNull()))
+ .Times(Exactly(1))
+ .WillRepeatedly(DoAll(SetArgPointee<2>(64), Return()));
+
EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _))
.WillRepeatedly(
Invoke(this, &GPUTimingFake::FakeGLGetInteger64v));
« 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