Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquick3drenderstats_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DRENDERSTATS_H
5#define QQUICK3DRENDERSTATS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3D/qtquick3dglobal.h>
19#include <QtCore/qobject.h>
20#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.h>
21#include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h>
22
24
25struct QSSGRenderLayer;
26class QQuickItem;
27
28class Q_QUICK3D_EXPORT QQuick3DRenderStats : public QObject
29{
31 Q_PROPERTY(int fps READ fps NOTIFY fpsChanged)
32 Q_PROPERTY(float frameTime READ frameTime NOTIFY frameTimeChanged)
33 Q_PROPERTY(float renderTime READ renderTime NOTIFY renderTimeChanged)
34 Q_PROPERTY(float renderPrepareTime READ renderPrepareTime NOTIFY renderTimeChanged)
35 Q_PROPERTY(float syncTime READ syncTime NOTIFY syncTimeChanged)
36 Q_PROPERTY(float maxFrameTime READ maxFrameTime NOTIFY maxFrameTimeChanged)
37
38 Q_PROPERTY(bool extendedDataCollectionEnabled READ extendedDataCollectionEnabled WRITE setExtendedDataCollectionEnabled NOTIFY extendedDataCollectionEnabledChanged)
39 Q_PROPERTY(quint64 drawCallCount READ drawCallCount NOTIFY drawCallCountChanged)
40 Q_PROPERTY(quint64 drawVertexCount READ drawVertexCount NOTIFY drawVertexCountChanged)
41 Q_PROPERTY(quint64 imageDataSize READ imageDataSize NOTIFY imageDataSizeChanged)
42 Q_PROPERTY(quint64 meshDataSize READ meshDataSize NOTIFY meshDataSizeChanged)
43 Q_PROPERTY(int renderPassCount READ renderPassCount NOTIFY renderPassCountChanged)
44 Q_PROPERTY(QString renderPassDetails READ renderPassDetails NOTIFY renderPassDetailsChanged)
45 Q_PROPERTY(QString textureDetails READ textureDetails NOTIFY textureDetailsChanged)
46 Q_PROPERTY(QString meshDetails READ meshDetails NOTIFY meshDetailsChanged)
47 Q_PROPERTY(int pipelineCount READ pipelineCount NOTIFY pipelineCountChanged)
48 Q_PROPERTY(qint64 materialGenerationTime READ materialGenerationTime NOTIFY materialGenerationTimeChanged)
49 Q_PROPERTY(qint64 effectGenerationTime READ effectGenerationTime NOTIFY effectGenerationTimeChanged)
50 Q_PROPERTY(qint64 pipelineCreationTime READ pipelineCreationTime NOTIFY pipelineCreationTimeChanged)
51 Q_PROPERTY(quint32 vmemAllocCount READ vmemAllocCount NOTIFY vmemAllocCountChanged)
52 Q_PROPERTY(quint64 vmemUsedBytes READ vmemUsedBytes NOTIFY vmemUsedBytesChanged)
53 Q_PROPERTY(QString graphicsApiName READ graphicsApiName NOTIFY graphicsApiNameChanged)
54 Q_PROPERTY(float lastCompletedGpuTime READ lastCompletedGpuTime NOTIFY lastCompletedGpuTimeChanged)
55
56public:
58
59 int fps() const;
60 float frameTime() const;
61 float renderTime() const;
62 float renderPrepareTime() const;
63 float syncTime() const;
64 float maxFrameTime() const;
65
66 void startSync();
67 void endSync(bool dump = false);
68
69 void startRender();
70 void startRenderPrepare();
71 void endRenderPrepare();
72 void endRender(bool dump = false);
73
74 void setRhiContext(QSSGRhiContext *ctx, QSSGRenderLayer *layer);
75
76 bool extendedDataCollectionEnabled() const;
77 void setExtendedDataCollectionEnabled(bool enable);
78
79 quint64 drawCallCount() const;
80 quint64 drawVertexCount() const;
81 quint64 imageDataSize() const;
82 quint64 meshDataSize() const;
83 int renderPassCount() const;
84 QString renderPassDetails() const;
85 QString textureDetails() const;
86 QString meshDetails() const;
87 int pipelineCount() const;
88 qint64 materialGenerationTime() const;
89 qint64 effectGenerationTime() const;
90 qint64 pipelineCreationTime() const;
91 quint32 vmemAllocCount() const;
92 quint64 vmemUsedBytes() const;
93 QString graphicsApiName() const;
94 float lastCompletedGpuTime() const;
95
96 Q_INVOKABLE void releaseCachedResources();
97
98 void setWindow(QQuickWindow *window);
99
123
124private Q_SLOTS:
125 void onFrameSwapped();
126
127private:
128 float timestamp() const;
129 void processRhiContextStats();
130 void notifyRhiContextStats();
131
132 QElapsedTimer m_frameTimer;
133 int m_frameCount = 0;
134 float m_secTimer = 0;
135 float m_notifyTimer = 0;
136 float m_renderStartTime = 0;
137 float m_renderPrepareStartTime = 0;
138 float m_syncStartTime = 0;
139
140 float m_internalMaxFrameTime = 0;
141 float m_maxFrameTime = 0;
142
143 int m_fps = 0;
144
145 struct Results {
146 float frameTime = 0;
147 float renderTime = 0;
148 float renderPrepareTime = 0;
149 float syncTime = 0;
150 float lastCompletedGpuTime = 0;
151 quint64 drawCallCount = 0;
152 quint64 drawVertexCount = 0;
154 quint64 meshDataSize = 0;
155 int renderPassCount = 0;
156 QString renderPassDetails;
157 QString textureDetails;
158 QString meshDetails;
159 QSet<QRhiTexture *> activeTextures;
160 QSet<QSSGRenderMesh *> activeMeshes;
161 int pipelineCount = 0;
162 qint64 materialGenerationTime = 0;
163 qint64 effectGenerationTime = 0;
164 QRhiStats rhiStats;
165 };
166
167 Results m_results;
168 Results m_notifiedResults;
169 QSSGRhiContextStats *m_contextStats = nullptr;
170 bool m_extendedDataCollectionEnabled = false;
171 QSSGRenderLayer *m_layer = nullptr;
172 QMetaObject::Connection m_frameSwappedConnection;
173 QQuickWindow *m_window = nullptr;
174 bool m_renderingThisFrame = false;
175 QString m_graphicsApiName;
176};
177
179
181
182#endif // QQUICK3DRENDERSTATS_H
\inmodule QtCore
\inmodule QtCore Represents a handle to a signal-slot (or signal-functor) connection.
\inmodule QtCore
Definition qobject.h:90
void graphicsApiNameChanged()
void lastCompletedGpuTimeChanged()
void pipelineCreationTimeChanged()
void materialGenerationTimeChanged()
void textureDetailsChanged()
void vmemAllocCountChanged()
void drawVertexCountChanged()
void effectGenerationTimeChanged()
void extendedDataCollectionEnabledChanged()
void renderPassDetailsChanged()
void renderPassCountChanged()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
Definition qset.h:18
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
EGLContext ctx
Combined button and popup list for selecting options.
EGLOutputLayerEXT layer
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1504
GLboolean enable
static QString dump(const QByteArray &)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
unsigned int quint32
Definition qtypes.h:45
unsigned long long quint64
Definition qtypes.h:56
long long qint64
Definition qtypes.h:55
static size_t imageDataSize(const xcb_image_t *image)
aWidget window() -> setWindowTitle("New Window Title")
[2]
\inmodule QtGui
Definition qrhi.h:1745
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent