blob: eb95f5689307a6fbe6ef4bbae628306d9a74049f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef TIMERQUERYGL_H
#define TIMERQUERYGL_H
#if ENABLE_PROFILER
#include "Runtime/GfxDevice/GfxTimerQuery.h"
class TimerQueryGL : public GfxTimerQuery
{
public:
TimerQueryGL();
~TimerQueryGL();
virtual void Measure();
void MeasureBegin();
virtual ProfileTimeFormat GetElapsed(UInt32 flags);
bool PollResult(UInt64& prevTime, bool wait);
private:
GLuint m_Query;
ProfileTimeFormat m_Time;
};
class TimerQueriesGL
{
public:
TimerQueriesGL();
GLuint AllocateQuery();
void ReleaseQuery(GLuint query);
void BeginTimerQueries();
void EndTimerQueries();
bool IsActive() const { return m_Active; }
void AddActiveTimerQuery(TimerQueryGL* query);
void PollTimerQueries(bool wait);
bool PollNextTimerQuery(bool wait);
private:
enum
{
kStartTimeQueryCount = 3,
kMaxFreeQueries = 128
};
GLuint m_FreeQueries[kMaxFreeQueries];
int m_NumFreeQueries;
UInt64 m_LastQueryTime;
TimerQueryGL* m_StartTimeQueries[kStartTimeQueryCount];
int m_StartTimeQueryIndex;
typedef List<TimerQueryGL> TimerQueryList;
TimerQueryList m_ActiveTimerQueries;
TimerQueryList m_PolledTimerQueries;
bool m_Active;
};
extern TimerQueriesGL g_TimerQueriesGL;
#endif
#endif
|