-
Notifications
You must be signed in to change notification settings - Fork 0
/
profiler.h
54 lines (47 loc) · 1.62 KB
/
profiler.h
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
#ifndef PROFILER_H
#define PROFILER_H
#include <QObject>
class FrameResult;
class QMoveEvent;
struct ProfilerPrivate;
class Profiler : public QObject
{
Q_OBJECT
public:
explicit Profiler(QObject *parent = 0);
~Profiler();
void pushGpuMarker(char const *name);
void popGpuMarker();
void synchronizeFrame();
void emitResults();
void resizeGL(int width, int height);
void paintGL();
void moveEvent(const QMoveEvent *ev);
// Options
void setBorder(int left, int right, int top, int bottom);
void setOffset(float left, float right, float top, float bottom);
static void setProfiler(Profiler *profiler);
static Profiler* profiler();
signals:
void onFrameResult(const FrameResult& result);
private:
ProfilerPrivate *m_private;
};
#if defined(GL_DEBUG) && !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
# define PROFILER_SYNC_FRAME() ::Profiler::profiler()->synchronizeFrame()
# define PROFILER_PUSH_GPU_MARKER(name) ::Profiler::profiler()->pushGpuMarker(name)
# define PROFILER_POP_GPU_MARKER() ::Profiler::profiler()->popGpuMarker()
# define PROFILER_EMIT_RESULTS() ::Profiler::profiler()->emitResults()
# define PROFILER_MOVE_EVENT(ev) ::Profiler::profiler()->moveEvent(ev);
# define PROFILER_RESIZE_GL(width,height) ::Profiler::profiler()->resizeGL(width,height)
# define PROFILER_PAINT_GL() ::Profiler::profiler()->paintGL()
#else
# define PROFILER_SYNC_FRAME()
# define PROFILER_PUSH_GPU_MARKER(name)
# define PROFILER_POP_GPU_MARKER()
# define PROFILER_EMIT_RESULTS()
# define PROFILER_MOVE_EVENT(ev)
# define PROFILER_RESIZE_GL(width,height)
# define PROFILER_PAINT_GL()
#endif // GL_DEBUG
#endif // PROFILER_H