15QQuick3DProfilerAdapter::QQuick3DProfilerAdapter(QObject *parent) :
16 QQmlAbstractProfilerAdapter(parent), next(0)
18 QQuick3DProfiler::initialize(
this);
20 connect(
this, &QQmlAbstractProfilerAdapter::profilingEnabled,
21 QQuick3DProfiler::s_instance, &QQuick3DProfiler::startProfilingImpl, Qt::DirectConnection);
22 connect(
this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting,
23 QQuick3DProfiler::s_instance, &QQuick3DProfiler::startProfilingImpl, Qt::DirectConnection);
24 connect(
this, &QQmlAbstractProfilerAdapter::referenceTimeKnown,
25 QQuick3DProfiler::s_instance, &QQuick3DProfiler::setTimer, Qt::DirectConnection);
26 connect(
this, &QQmlAbstractProfilerAdapter::profilingDisabled,
27 QQuick3DProfiler::s_instance, &QQuick3DProfiler::stopProfilingImpl, Qt::DirectConnection);
28 connect(
this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting,
29 QQuick3DProfiler::s_instance, &QQuick3DProfiler::stopProfilingImpl, Qt::DirectConnection);
30 connect(
this, &QQmlAbstractProfilerAdapter::dataRequested,
31 QQuick3DProfiler::s_instance, &QQuick3DProfiler::reportDataImpl, Qt::DirectConnection);
32 connect(QQuick3DProfiler::s_instance, &QQuick3DProfiler::dataReady,
33 this, &QQuick3DProfilerAdapter::receiveData, Qt::DirectConnection);
45 QList<QByteArray> &messages,
46 const QHash<
int, QByteArray> &eventData)
51 ds << data.time << data.messageType << data.detailType;
53 switch (data.messageType) {
54 case QQuick3DProfiler::Event:
56 case QQuick3DProfiler::Quick3DFrame:
57 if (data.detailType == QQuick3DProfiler::Quick3DEventData) {
58 ds << eventData[data.subdata1];
60 ds << data.subdata1 << data.subdata2;
61 if (data.ids[0] || data.ids[1])
62 ds << data.ids[0] << data.ids[1];
66 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Invalid message type.");
70 messages.append(ds.squeezedData());
74qint64 QQuick3DProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages)
76 while (next < m_data.size()) {
77 if (m_data[next].time <= until && messages.size() <= s_numMessagesPerBatch)
78 QQuick3DProfilerDataToByteArrays(m_data[next++], messages, m_eventData);
80 return m_data[next].time;