OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
9 #include "gpu/command_buffer/service/gpu_service_test.h" | 9 #include "gpu/command_buffer/service/gpu_service_test.h" |
10 #include "gpu/command_buffer/service/gpu_tracer.h" | 10 #include "gpu/command_buffer/service/gpu_tracer.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 void DeleteQueriesARB(GLsizei n, const GLuint* ids) { | 84 void DeleteQueriesARB(GLsizei n, const GLuint* ids) { |
85 for (GLsizei i = 0; i < n; i++) { | 85 for (GLsizei i = 0; i < n; i++) { |
86 alloced_queries_.erase(ids[i]); | 86 alloced_queries_.erase(ids[i]); |
87 query_timestamp_.erase(ids[i]); | 87 query_timestamp_.erase(ids[i]); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void GetQueryObjectiv(GLuint id, GLenum pname, GLint* params) { | 91 void GetQueryObjectivARB(GLuint id, GLenum pname, GLint* params) { |
92 switch (pname) { | 92 switch (pname) { |
93 case GL_QUERY_RESULT_AVAILABLE: { | 93 case GL_QUERY_RESULT_AVAILABLE: { |
94 std::map<GLuint, GLint64>::iterator it = query_timestamp_.find(id); | 94 std::map<GLuint, GLint64>::iterator it = query_timestamp_.find(id); |
95 if (it != query_timestamp_.end() && it->second <= current_time_) | 95 if (it != query_timestamp_.end() && it->second <= current_time_) |
96 *params = 1; | 96 *params = 1; |
97 else | 97 else |
98 *params = 0; | 98 *params = 0; |
99 break; | 99 break; |
100 } | 100 } |
101 default: | 101 default: |
102 FAIL() << "Invalid variable passed to GetQueryObjectiv: " << pname; | 102 FAIL() << "Invalid variable passed to GetQueryObjectivARB: " << pname; |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 void QueryCounter(GLuint id, GLenum target) { | 106 void QueryCounter(GLuint id, GLenum target) { |
107 switch (target) { | 107 switch (target) { |
108 case GL_TIMESTAMP: | 108 case GL_TIMESTAMP: |
109 ASSERT_TRUE(alloced_queries_.find(id) != alloced_queries_.end()); | 109 ASSERT_TRUE(alloced_queries_.find(id) != alloced_queries_.end()); |
110 query_timestamp_[id] = current_time_; | 110 query_timestamp_[id] = current_time_; |
111 break; | 111 break; |
112 default: | 112 default: |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 GpuServiceTest::TearDown(); | 248 GpuServiceTest::TearDown(); |
249 } | 249 } |
250 | 250 |
251 void ExpectTraceQueryMocks() { | 251 void ExpectTraceQueryMocks() { |
252 if (GetTracerType() != kTracerTypeInvalid) { | 252 if (GetTracerType() != kTracerTypeInvalid) { |
253 // Delegate query APIs used by GPUTrace to a GlFakeQueries | 253 // Delegate query APIs used by GPUTrace to a GlFakeQueries |
254 EXPECT_CALL(*gl_, GenQueriesARB(2, NotNull())).Times(AtLeast(1)) | 254 EXPECT_CALL(*gl_, GenQueriesARB(2, NotNull())).Times(AtLeast(1)) |
255 .WillRepeatedly( | 255 .WillRepeatedly( |
256 Invoke(&gl_fake_queries_, &GlFakeQueries::GenQueriesARB)); | 256 Invoke(&gl_fake_queries_, &GlFakeQueries::GenQueriesARB)); |
257 | 257 |
258 EXPECT_CALL(*gl_, GetQueryObjectiv(_, GL_QUERY_RESULT_AVAILABLE, | 258 EXPECT_CALL(*gl_, GetQueryObjectivARB(_, GL_QUERY_RESULT_AVAILABLE, |
259 NotNull())) | 259 NotNull())) |
260 .WillRepeatedly( | 260 .WillRepeatedly( |
261 Invoke(&gl_fake_queries_, &GlFakeQueries::GetQueryObjectiv)); | 261 Invoke(&gl_fake_queries_, &GlFakeQueries::GetQueryObjectivARB)); |
262 | 262 |
263 if (GetTracerType() == kTracerTypeDisjointTimer) { | 263 if (GetTracerType() == kTracerTypeDisjointTimer) { |
264 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, _)) | 264 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, _)) |
265 .WillRepeatedly( | 265 .WillRepeatedly( |
266 Invoke(&gl_fake_queries_, &GlFakeQueries::GetInteger64v)); | 266 Invoke(&gl_fake_queries_, &GlFakeQueries::GetInteger64v)); |
267 } | 267 } |
268 | 268 |
269 EXPECT_CALL(*gl_, QueryCounter(_, GL_TIMESTAMP)).Times(AtLeast(2)) | 269 EXPECT_CALL(*gl_, QueryCounter(_, GL_TIMESTAMP)).Times(AtLeast(2)) |
270 .WillRepeatedly( | 270 .WillRepeatedly( |
271 Invoke(&gl_fake_queries_, &GlFakeQueries::QueryCounter)); | 271 Invoke(&gl_fake_queries_, &GlFakeQueries::QueryCounter)); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 kTraceGroupMarker)); | 689 kTraceGroupMarker)); |
690 | 690 |
691 ASSERT_TRUE(tracer_tester.BeginDecoding()); | 691 ASSERT_TRUE(tracer_tester.BeginDecoding()); |
692 EXPECT_TRUE(tracer_tester.Begin(category_name, trace_name, | 692 EXPECT_TRUE(tracer_tester.Begin(category_name, trace_name, |
693 kTraceGroupMarker)); | 693 kTraceGroupMarker)); |
694 ASSERT_TRUE(tracer_tester.EndDecoding()); | 694 ASSERT_TRUE(tracer_tester.EndDecoding()); |
695 } | 695 } |
696 | 696 |
697 } // namespace gles2 | 697 } // namespace gles2 |
698 } // namespace gpu | 698 } // namespace gpu |
OLD | NEW |