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
3 // found in the LICENSE file.
5 #ifndef UI_GL_GPU_TIMING_FAKE_H_
6 #define UI_GL_GPU_TIMING_FAKE_H_
11 #include "ui/gl/gl_bindings.h"
14 class MockGLInterface
;
23 // Used to set the current GPU time queries will return.
24 void SetCurrentGLTime(GLint64 current_time
);
26 // Used to signal a disjoint occurred for disjoint timer queries.
29 // GPUTimer fake queries which can be called multiple times.
30 void ExpectGetErrorCalls(MockGLInterface
& gl
);
31 void ExpectDisjointCalls(MockGLInterface
& gl
);
32 void ExpectNoDisjointCalls(MockGLInterface
& gl
);
34 // GPUTimer fake queries which can only be called once per setup.
35 void ExpectGPUTimeStampQuery(MockGLInterface
& gl
, bool elapsed_query
);
36 void ExpectGPUTimerQuery(MockGLInterface
& gl
, bool elapsed_query
);
37 void ExpectOffsetCalculationQuery(MockGLInterface
& gl
);
38 void ExpectNoOffsetCalculationQuery(MockGLInterface
& gl
);
41 void FakeGLGenQueries(GLsizei n
, GLuint
* ids
);
42 void FakeGLDeleteQueries(GLsizei n
, const GLuint
* ids
);
43 void FakeGLBeginQuery(GLenum target
, GLuint id
);
44 void FakeGLEndQuery(GLenum target
);
45 void FakeGLGetQueryObjectuiv(GLuint id
, GLenum pname
, GLuint
* params
);
46 void FakeGLQueryCounter(GLuint id
, GLenum target
);
47 void FakeGLGetInteger64v(GLenum pname
, GLint64
* data
);
48 void FakeGLGetQueryObjectui64v(GLuint id
, GLenum pname
, GLuint64
* params
);
49 void FakeGLGetIntegerv(GLenum pname
, GLint
* params
);
50 GLenum
FakeGLGetError();
53 bool disjointed_
= false;
54 GLint64 current_time_
= 0;
55 GLuint next_query_id_
= 0;
56 std::set
<GLuint
> allocated_queries_
;
58 enum QueryResultType
{
59 kQueryResultType_Invalid
,
60 kQueryResultType_TimeStamp
,
61 kQueryResultType_Elapsed
62 } type_
= kQueryResultType_Invalid
;
63 GLint64 begin_time_
= 0;
66 std::map
<GLuint
, QueryResult
> query_results_
;
70 GLint64 begin_time_
= 0;
78 ElapsedQuery current_elapsed_query_
;
83 #endif // UI_GL_GPU_TIMING_FAKE_H_