1// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOPENGLTIMERQUERY_H
5#define QOPENGLTIMERQUERY_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#if !defined(QT_NO_OPENGL) && !QT_CONFIG(opengles2)
10
11#include <QtCore/QObject>
12#include <QtGui/qopengl.h>
13
14QT_BEGIN_NAMESPACE
15
16class QOpenGLTimerQueryPrivate;
17
18class Q_OPENGL_EXPORT QOpenGLTimerQuery : public QObject
19{
20 Q_OBJECT
21
22public:
23 explicit QOpenGLTimerQuery(QObject *parent = nullptr);
24 ~QOpenGLTimerQuery();
25
26 bool create();
27 void destroy();
28 bool isCreated() const;
29 GLuint objectId() const;
30
31 void begin();
32 void end();
33 GLuint64 waitForTimestamp() const;
34 void recordTimestamp();
35 bool isResultAvailable() const;
36 GLuint64 waitForResult() const;
37
38private:
39 Q_DECLARE_PRIVATE(QOpenGLTimerQuery)
40 Q_DISABLE_COPY(QOpenGLTimerQuery)
41};
42
43
44class QOpenGLTimeMonitorPrivate;
45
46class Q_OPENGL_EXPORT QOpenGLTimeMonitor : public QObject
47{
48 Q_OBJECT
49
50public:
51 explicit QOpenGLTimeMonitor(QObject *parent = nullptr);
52 ~QOpenGLTimeMonitor();
53
54 void setSampleCount(int sampleCount);
55 int sampleCount() const;
56
57 bool create();
58 void destroy();
59 bool isCreated() const;
60 QList<GLuint> objectIds() const;
61
62 int recordSample();
63
64 bool isResultAvailable() const;
65
66 QList<GLuint64> waitForSamples() const;
67 QList<GLuint64> waitForIntervals() const;
68
69 void reset();
70
71private:
72 Q_DECLARE_PRIVATE(QOpenGLTimeMonitor)
73 Q_DISABLE_COPY(QOpenGLTimeMonitor)
74};
75
76QT_END_NAMESPACE
77
78#endif // QT_NO_OPENGL
79
80#endif // QOPENGLTIMERQUERY_H
81

source code of qtbase/src/opengl/qopengltimerquery.h