summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf3
-rw-r--r--src/animation/backend/abstractevaluateclipanimatorjob.cpp2
-rw-r--r--src/animation/backend/abstractevaluateclipanimatorjob_p.h3
-rw-r--r--src/animation/backend/animationclip_p.h8
-rw-r--r--src/animation/backend/animationutils_p.h10
-rw-r--r--src/animation/backend/channelmapping.cpp3
-rw-r--r--src/animation/backend/fcurve_p.h14
-rw-r--r--src/animation/backend/gltfimporter.cpp12
-rw-r--r--src/animation/backend/loadanimationclipjob.cpp2
-rw-r--r--src/animation/backend/loadanimationclipjob_p.h2
-rw-r--r--src/animation/frontend/qanimationaspect.cpp20
-rw-r--r--src/animation/frontend/qcallbackmapping.cpp1
-rw-r--r--src/core/aspects/aspectcommanddebugger.cpp20
-rw-r--r--src/core/aspects/aspectcommanddebugger_p.h18
-rw-r--r--src/core/aspects/aspects.pri10
-rw-r--r--src/core/aspects/qabstractaspect.cpp18
-rw-r--r--src/core/aspects/qabstractaspect.h9
-rw-r--r--src/core/aspects/qabstractaspect_p.h13
-rw-r--r--src/core/aspects/qaspectengine.cpp24
-rw-r--r--src/core/aspects/qaspectengine_p.h10
-rw-r--r--src/core/aspects/qaspectmanager.cpp99
-rw-r--r--src/core/aspects/qaspectmanager_p.h8
-rw-r--r--src/core/changes/qcomponentaddedchange.h10
-rw-r--r--src/core/changes/qcomponentremovedchange.h10
-rw-r--r--src/core/changes/qdynamicpropertyupdatedchange.h4
-rw-r--r--src/core/changes/qnodecommand.h4
-rw-r--r--src/core/changes/qnodecreatedchange.h6
-rw-r--r--src/core/changes/qnodedestroyedchange.h4
-rw-r--r--src/core/changes/qpropertynodeaddedchange.h4
-rw-r--r--src/core/changes/qpropertynoderemovedchange.h4
-rw-r--r--src/core/changes/qpropertyupdatedchange.h4
-rw-r--r--src/core/changes/qpropertyupdatedchangebase.h4
-rw-r--r--src/core/changes/qpropertyvalueaddedchange.h4
-rw-r--r--src/core/changes/qpropertyvalueaddedchangebase.h6
-rw-r--r--src/core/changes/qpropertyvalueremovedchange.h4
-rw-r--r--src/core/changes/qpropertyvalueremovedchangebase.h6
-rw-r--r--src/core/changes/qscenechange.cpp1
-rw-r--r--src/core/changes/qscenechange.h10
-rw-r--r--src/core/changes/qscenechange_p.h7
-rw-r--r--src/core/changes/qskeletoncreatedchange_p.h6
-rw-r--r--src/core/changes/qstaticpropertyupdatedchangebase.h6
-rw-r--r--src/core/changes/qstaticpropertyvalueaddedchangebase.h2
-rw-r--r--src/core/changes/qstaticpropertyvalueremovedchangebase.h2
-rw-r--r--src/core/configure.json3
-rw-r--r--src/core/jobs/qaspectjob.cpp12
-rw-r--r--src/core/jobs/qaspectjob.h3
-rw-r--r--src/core/jobs/qaspectjob_p.h71
-rw-r--r--src/core/jobs/qaspectjobmanager.cpp14
-rw-r--r--src/core/jobs/qaspectjobmanager_p.h4
-rw-r--r--src/core/jobs/qaspectjobproviderinterface_p.h3
-rw-r--r--src/core/jobs/qthreadpooler.cpp117
-rw-r--r--src/core/jobs/qthreadpooler_p.h15
-rw-r--r--src/core/jobs/task.cpp20
-rw-r--r--src/core/jobs/task_p.h4
-rw-r--r--src/core/nodes/qbackendnode.cpp12
-rw-r--r--src/core/nodes/qbackendnode.h12
-rw-r--r--src/core/nodes/qnode.cpp19
-rw-r--r--src/core/nodes/qnode.h12
-rw-r--r--src/core/qchangearbiter_p.h2
-rw-r--r--src/core/qpostman_p.h2
-rw-r--r--src/core/qscheduler.cpp19
-rw-r--r--src/core/qscheduler_p.h4
-rw-r--r--src/core/qt3dcore_global.h6
-rw-r--r--src/core/resources/qloadgltf_p.h80
-rw-r--r--src/core/resources/qresourcemanager_p.h8
-rw-r--r--src/core/resources/resources.pri1
-rw-r--r--src/core/services/nullservices_p.h14
-rw-r--r--src/core/services/qservicelocator.cpp16
-rw-r--r--src/core/services/qservicelocator_p.h3
-rw-r--r--src/core/services/qsysteminformationservice.cpp302
-rw-r--r--src/core/services/qsysteminformationservice_p.h24
-rw-r--r--src/core/services/qsysteminformationservice_p_p.h87
-rw-r--r--src/core/transforms/matrix4x4_avx2.cpp10
-rw-r--r--src/core/transforms/matrix4x4_sse.cpp10
-rw-r--r--src/input/backend/assignkeyboardfocusjob.cpp2
-rw-r--r--src/input/backend/assignkeyboardfocusjob_p.h2
-rw-r--r--src/input/backend/axisaccumulatorjob.cpp2
-rw-r--r--src/input/backend/axisaccumulatorjob_p.h2
-rw-r--r--src/input/backend/keyeventdispatcherjob.cpp2
-rw-r--r--src/input/backend/keyeventdispatcherjob_p.h2
-rw-r--r--src/input/backend/loadproxydevicejob.cpp2
-rw-r--r--src/input/backend/loadproxydevicejob_p.h2
-rw-r--r--src/input/backend/mouseeventdispatcherjob.cpp2
-rw-r--r--src/input/backend/mouseeventdispatcherjob_p.h2
-rw-r--r--src/input/backend/updateaxisactionjob.cpp4
-rw-r--r--src/input/backend/updateaxisactionjob_p.h2
-rw-r--r--src/input/frontend/qinputaspect.cpp38
-rw-r--r--src/logic/callbackjob.cpp2
-rw-r--r--src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp8
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp14
-rw-r--r--src/quick3d/quick3dscene2d/items/qscene2d.cpp9
-rw-r--r--src/quick3d/quick3dscene2d/items/qscene2d.h3
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d.cpp2
-rw-r--r--src/render/backend/abstractrenderer_p.h2
-rw-r--r--src/render/backend/cameralens.cpp56
-rw-r--r--src/render/backend/cameralens_p.h7
-rw-r--r--src/render/backend/render-backend.pri13
-rw-r--r--src/render/backend/rendersettings.cpp1
-rw-r--r--src/render/framegraph/qbuffercapture.cpp4
-rw-r--r--src/render/framegraph/qrendercapture.cpp4
-rw-r--r--src/render/framegraph/rendercapture.cpp26
-rw-r--r--src/render/framegraph/rendercapture_p.h2
-rw-r--r--src/render/frontend/qcameralens.cpp38
-rw-r--r--src/render/frontend/qcameralens_p.h21
-rw-r--r--src/render/frontend/qlevelofdetail.cpp20
-rw-r--r--src/render/frontend/qlevelofdetailswitch.cpp37
-rw-r--r--src/render/frontend/qlevelofdetailswitch.h3
-rw-r--r--src/render/frontend/qrenderaspect.cpp128
-rw-r--r--src/render/frontend/qrenderaspect_p.h3
-rw-r--r--src/render/frontend/qrenderplugin_p.h3
-rw-r--r--src/render/frontend/qrendersettings.cpp8
-rw-r--r--src/render/frontend/sphere.cpp48
-rw-r--r--src/render/geometry/gltfskeletonloader.cpp8
-rw-r--r--src/render/geometry/skeleton_p.h4
-rw-r--r--src/render/jobs/calcboundingvolumejob.cpp2
-rw-r--r--src/render/jobs/calcgeometrytrianglevolumes.cpp2
-rw-r--r--src/render/jobs/computefilteredboundingvolumejob.cpp37
-rw-r--r--src/render/jobs/computefilteredboundingvolumejob_p.h4
-rw-r--r--src/render/jobs/expandboundingvolumejob.cpp2
-rw-r--r--src/render/jobs/filterentitybycomponentjob_p.h2
-rw-r--r--src/render/jobs/filterlayerentityjob.cpp2
-rw-r--r--src/render/jobs/framecleanupjob.cpp2
-rw-r--r--src/render/jobs/frustumcullingjob.cpp2
-rw-r--r--src/render/jobs/genericlambdajob_p.h4
-rw-r--r--src/render/jobs/jobs.pri2
-rw-r--r--src/render/jobs/lightgatherer.cpp2
-rw-r--r--src/render/jobs/loadbufferjob.cpp2
-rw-r--r--src/render/jobs/loadbufferjob_p.h3
-rw-r--r--src/render/jobs/loadgeometryjob.cpp4
-rw-r--r--src/render/jobs/loadgeometryjob_p.h3
-rw-r--r--src/render/jobs/loadscenejob.cpp4
-rw-r--r--src/render/jobs/loadscenejob_p.h1
-rw-r--r--src/render/jobs/loadskeletonjob.cpp4
-rw-r--r--src/render/jobs/loadskeletonjob_p.h3
-rw-r--r--src/render/jobs/pickboundingvolumejob.cpp4
-rw-r--r--src/render/jobs/pickboundingvolumejob_p.h2
-rw-r--r--src/render/jobs/raycastingjob.cpp2
-rw-r--r--src/render/jobs/raycastingjob_p.h2
-rw-r--r--src/render/jobs/sendbuffercapturejob.cpp6
-rw-r--r--src/render/jobs/sendbuffercapturejob_p.h1
-rw-r--r--src/render/jobs/sendrendercapturejob.cpp86
-rw-r--r--src/render/jobs/sendrendercapturejob_p.h90
-rw-r--r--src/render/jobs/updateentitylayersjob.cpp2
-rw-r--r--src/render/jobs/updatelevelofdetailjob.cpp2
-rw-r--r--src/render/jobs/updatelevelofdetailjob_p.h2
-rw-r--r--src/render/jobs/updatemeshtrianglelistjob.cpp2
-rw-r--r--src/render/jobs/updateshaderdatatransformjob.cpp2
-rw-r--r--src/render/jobs/updateskinningpalettejob.cpp2
-rw-r--r--src/render/jobs/updatetreeenabledjob.cpp2
-rw-r--r--src/render/jobs/updateworldtransformjob.cpp4
-rw-r--r--src/render/jobs/updateworldtransformjob_p.h1
-rw-r--r--src/render/materialsystem/shader_p.h2
-rw-r--r--src/render/renderers/opengl/jobs/filtercompatibletechniquejob.cpp2
-rw-r--r--src/render/renderers/opengl/jobs/materialparametergathererjob.cpp2
-rw-r--r--src/render/renderers/opengl/jobs/renderviewcommandupdaterjob.cpp2
-rw-r--r--src/render/renderers/opengl/jobs/renderviewinitializerjob.cpp2
-rw-r--r--src/render/renderers/opengl/jobs/renderviewjobutils.cpp1
-rw-r--r--src/render/renderers/opengl/renderer/renderer.cpp146
-rw-r--r--src/render/renderers/opengl/renderer/renderer_p.h18
-rw-r--r--src/render/texture/texture_p.h2
-rw-r--r--src/render/texture/textureimage_p.h2
-rw-r--r--tests/auto/animation/animationutils/tst_animationutils.cpp4
-rw-r--r--tests/auto/core/common/testpostmanarbiter.h1
-rw-r--r--tests/auto/core/core.pro4
-rw-r--r--tests/auto/core/nodes/tst_nodes.cpp12
-rw-r--r--tests/auto/core/qaspectengine/tst_qaspectengine.cpp8
-rw-r--r--tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp12
-rw-r--r--tests/auto/core/qservicelocator/tst_qservicelocator.cpp16
-rw-r--r--tests/auto/core/threadpooler/tst_threadpooler.cpp16
-rw-r--r--tests/auto/render/commons/testrenderer.cpp8
-rw-r--r--tests/auto/render/commons/testrenderer.h17
-rw-r--r--tests/auto/render/computecommand/tst_computecommand.cpp8
-rw-r--r--tests/auto/render/entity/tst_entity.cpp6
-rw-r--r--tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp2
-rw-r--r--tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp2
-rw-r--r--tests/auto/render/raycastingjob/tst_raycastingjob.cpp4
-rw-r--r--tests/auto/render/render.pro1
-rw-r--r--tests/auto/render/renderer/tst_renderer.cpp33
-rw-r--r--tests/auto/render/sendrendercapturejob/sendrendercapturejob.pro12
-rw-r--r--tests/auto/render/sendrendercapturejob/tst_sendrendercapturejob.cpp85
-rw-r--r--tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp1
-rw-r--r--tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp2
-rw-r--r--tests/manual/rendercapture-qml/main.qml2
-rw-r--r--tools/qgltf/qgltf.cpp42
184 files changed, 1247 insertions, 1393 deletions
diff --git a/.qmake.conf b/.qmake.conf
index ab88c5d54..89d164a2e 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,5 +5,6 @@ load(qt_build_config)
DEFINES += QT_NO_FOREACH
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
+DEFINES += BUILD_QT3D_MODULE
-MODULE_VERSION = 5.14.1
+MODULE_VERSION = 5.15.0
diff --git a/src/animation/backend/abstractevaluateclipanimatorjob.cpp b/src/animation/backend/abstractevaluateclipanimatorjob.cpp
index e3c8e9e40..5267d4526 100644
--- a/src/animation/backend/abstractevaluateclipanimatorjob.cpp
+++ b/src/animation/backend/abstractevaluateclipanimatorjob.cpp
@@ -75,7 +75,7 @@ void AbstractEvaluateClipAnimatorJob::setPostFrameData(const AnimationRecord &re
}), mainThreadCB.end());
// Should now only have callbacks to be called on main thread
- Q_DJOB(AbstractEvaluateClipAnimatorJob);
+ Q_D(AbstractEvaluateClipAnimatorJob);
d->m_record = record;
d->m_callbacks = mainThreadCB;
}
diff --git a/src/animation/backend/abstractevaluateclipanimatorjob_p.h b/src/animation/backend/abstractevaluateclipanimatorjob_p.h
index 7027a8639..2a8914faa 100644
--- a/src/animation/backend/abstractevaluateclipanimatorjob_p.h
+++ b/src/animation/backend/abstractevaluateclipanimatorjob_p.h
@@ -64,6 +64,9 @@ protected:
AbstractEvaluateClipAnimatorJob();
void setPostFrameData(const AnimationRecord &record, const QVector<AnimationCallbackAndValue> &callbacks);
+
+private:
+ Q_DECLARE_PRIVATE(AbstractEvaluateClipAnimatorJob)
};
} // Animation
diff --git a/src/animation/backend/animationclip_p.h b/src/animation/backend/animationclip_p.h
index 22f589f72..ce97ef2c7 100644
--- a/src/animation/backend/animationclip_p.h
+++ b/src/animation/backend/animationclip_p.h
@@ -129,10 +129,10 @@ private:
inline QDebug operator<<(QDebug dbg, const AnimationClip &animationClip)
{
QDebugStateSaver saver(dbg);
- dbg << "QNodeId =" << animationClip.peerId() << endl
- << "Name =" << animationClip.name() << endl
- << "Duration: " << animationClip.duration() << endl
- << "Channels:" << endl;
+ dbg << "QNodeId =" << animationClip.peerId() << Qt::endl
+ << "Name =" << animationClip.name() << Qt::endl
+ << "Duration: " << animationClip.duration() << Qt::endl
+ << "Channels:" << Qt::endl;
const QVector<Channel> channels = animationClip.channels();
for (const auto &channel : channels) {
diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h
index eab15f0e5..8c71e704a 100644
--- a/src/animation/backend/animationutils_p.h
+++ b/src/animation/backend/animationutils_p.h
@@ -98,10 +98,10 @@ struct MappingData
inline QDebug operator<<(QDebug dbg, const MappingData &mapping)
{
QDebugStateSaver saver(dbg);
- dbg << "targetId =" << mapping.targetId << endl
- << "jointIndex =" << mapping.jointIndex << endl
- << "jointTransformComponent: " << mapping.jointTransformComponent << endl
- << "propertyName:" << mapping.propertyName << endl
+ dbg << "targetId =" << mapping.targetId << Qt::endl
+ << "jointIndex =" << mapping.jointIndex << Qt::endl
+ << "jointTransformComponent: " << mapping.jointTransformComponent << Qt::endl
+ << "propertyName:" << mapping.propertyName << Qt::endl
<< "channelIndices:" << mapping.channelIndices;
return dbg;
}
@@ -251,7 +251,7 @@ inline QDebug operator<<(QDebug dbg, const ClipFormat &format)
dbg << format.sourceClipIndices[j] << "";
dbg << "src clip mask =" << format.sourceClipMask[i];
- dbg << endl;
+ dbg << Qt::endl;
sourceIndex += componentCount;
}
return dbg;
diff --git a/src/animation/backend/channelmapping.cpp b/src/animation/backend/channelmapping.cpp
index 42942fdd3..1e3aa76f0 100644
--- a/src/animation/backend/channelmapping.cpp
+++ b/src/animation/backend/channelmapping.cpp
@@ -59,7 +59,6 @@ ChannelMapping::ChannelMapping()
, m_componentCount(0)
, m_propertyName(nullptr)
, m_callback(nullptr)
- , m_callbackFlags(0)
, m_skeletonId()
, m_mappingType(MappingType::ChannelMappingType)
{
@@ -74,7 +73,7 @@ void ChannelMapping::cleanup()
m_propertyName = nullptr;
m_componentCount = 0;
m_callback = nullptr;
- m_callbackFlags = 0;
+ m_callbackFlags = {};
m_skeletonId = Qt3DCore::QNodeId();
}
diff --git a/src/animation/backend/fcurve_p.h b/src/animation/backend/fcurve_p.h
index 935db5922..4c5cfb351 100644
--- a/src/animation/backend/fcurve_p.h
+++ b/src/animation/backend/fcurve_p.h
@@ -101,7 +101,7 @@ private:
inline QDebug operator<<(QDebug dbg, const FCurve &fcurve)
{
QDebugStateSaver saver(dbg);
- dbg << "Keyframe Count = " << fcurve.keyframeCount() << endl;
+ dbg << "Keyframe Count = " << fcurve.keyframeCount() << Qt::endl;
for (int i = 0; i < fcurve.keyframeCount(); ++i) {
const Keyframe &kf = fcurve.keyframe(i);
switch (kf.interpolation) {
@@ -110,14 +110,14 @@ inline QDebug operator<<(QDebug dbg, const FCurve &fcurve)
<< ", value = " << kf.value
<< ", leftHandle = " << kf.leftControlPoint
<< ", rightHandle = " << kf.rightControlPoint
- << endl;
+ << Qt::endl;
break;
}
case QKeyFrame::ConstantInterpolation:
case QKeyFrame::LinearInterpolation: {
dbg << "t = " << fcurve.localTime(i)
<< ", value = " << kf.value
- << endl;
+ << Qt::endl;
break;
}
}
@@ -139,8 +139,8 @@ struct ChannelComponent
inline QDebug operator<<(QDebug dbg, const ChannelComponent &channelComponent)
{
QDebugStateSaver saver(dbg);
- dbg << "Channel Component Name: " << channelComponent.name << endl
- << "FCurve:" << channelComponent.fcurve << endl;
+ dbg << "Channel Component Name: " << channelComponent.name << Qt::endl
+ << "FCurve:" << channelComponent.fcurve << Qt::endl;
return dbg;
}
#endif
@@ -159,8 +159,8 @@ struct Channel
inline QDebug operator<<(QDebug dbg, const Channel &channel)
{
QDebugStateSaver saver(dbg);
- dbg << "Channel Name: " << channel.name << endl
- << "Channels:" << channel.channelComponents.size() << endl;
+ dbg << "Channel Name: " << channel.name << Qt::endl
+ << "Channels:" << channel.channelComponents.size() << Qt::endl;
for (const auto &channelComponent : qAsConst(channel.channelComponents)) {
dbg << channelComponent;
diff --git a/src/animation/backend/gltfimporter.cpp b/src/animation/backend/gltfimporter.cpp
index 718acbb79..a5127efd0 100644
--- a/src/animation/backend/gltfimporter.cpp
+++ b/src/animation/backend/gltfimporter.cpp
@@ -35,6 +35,9 @@
****************************************************************************/
#include "gltfimporter_p.h"
+
+#include <Qt3DCore/private/qloadgltf_p.h>
+
#include <Qt3DAnimation/private/animationlogging_p.h>
#include <Qt3DAnimation/private/fcurve_p.h>
#include <Qt3DAnimation/private/keyframe_p.h>
@@ -434,12 +437,7 @@ GLTFImporter::GLTFImporter()
bool GLTFImporter::load(QIODevice *ioDev)
{
- QByteArray jsonData = ioDev->readAll();
- QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
- if (sceneDocument.isNull())
- sceneDocument = QJsonDocument::fromJson(jsonData);
-
- if (Q_UNLIKELY(!setJSON(sceneDocument))) {
+ if (Q_UNLIKELY(!setJSON(qLoadGLTF(ioDev->readAll())))) {
qWarning("not a JSON document");
return false;
}
@@ -517,7 +515,7 @@ GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int ani
const auto interpolationType = gltfToQKeyFrameInterpolation(sampler.interpolationMode);
if (sampler.inputAccessorIndex == -1 || sampler.outputAccessorIndex == -1) {
- qWarning() << "Skipping channel due to invalid accessor indices in the sampler" << endl;
+ qWarning() << "Skipping channel due to invalid accessor indices in the sampler" << Qt::endl;
continue;
}
diff --git a/src/animation/backend/loadanimationclipjob.cpp b/src/animation/backend/loadanimationclipjob.cpp
index 86d7edf87..93d4c2d9d 100644
--- a/src/animation/backend/loadanimationclipjob.cpp
+++ b/src/animation/backend/loadanimationclipjob.cpp
@@ -85,7 +85,7 @@ void LoadAnimationClipJob::clearDirtyAnimationClips()
void LoadAnimationClipJob::run()
{
Q_ASSERT(m_handler);
- Q_DJOB(LoadAnimationClipJob);
+ Q_D(LoadAnimationClipJob);
d->m_updatedNodes.reserve(m_animationClipHandles.size());
AnimationClipLoaderManager *animationClipManager = m_handler->animationClipLoaderManager();
diff --git a/src/animation/backend/loadanimationclipjob_p.h b/src/animation/backend/loadanimationclipjob_p.h
index 42cf27854..07d78d416 100644
--- a/src/animation/backend/loadanimationclipjob_p.h
+++ b/src/animation/backend/loadanimationclipjob_p.h
@@ -76,6 +76,8 @@ protected:
void run() override;
private:
+ Q_DECLARE_PRIVATE(LoadAnimationClipJob)
+
QVector<HAnimationClip> m_animationClipHandles;
Handler *m_handler;
};
diff --git a/src/animation/frontend/qanimationaspect.cpp b/src/animation/frontend/qanimationaspect.cpp
index 850132a39..744346e1f 100644
--- a/src/animation/frontend/qanimationaspect.cpp
+++ b/src/animation/frontend/qanimationaspect.cpp
@@ -104,34 +104,34 @@ QAnimationAspect::QAnimationAspect(QAnimationAspectPrivate &dd, QObject *parent)
qRegisterMetaType<QVector<Qt3DCore::Sqt>>();
qRegisterMetaType<Qt3DAnimation::QAbstractAnimationClip*>();
- d->registerBackendType<QAbstractAnimationClip, true>(
+ registerBackendType<QAbstractAnimationClip, true>(
QSharedPointer<Animation::NodeFunctor<Animation::AnimationClip, Animation::AnimationClipLoaderManager>>::create(d->m_handler.data(),
d->m_handler->animationClipLoaderManager()));
- d->registerBackendType<QClock, true>(
+ registerBackendType<QClock, true>(
QSharedPointer<Animation::NodeFunctor<Animation::Clock, Animation::ClockManager>>::create(d->m_handler.data(),
d->m_handler->clockManager()));
- d->registerBackendType<QClipAnimator, true>(
+ registerBackendType<QClipAnimator, true>(
QSharedPointer<Animation::NodeFunctor<Animation::ClipAnimator, Animation::ClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->clipAnimatorManager()));
- d->registerBackendType<QBlendedClipAnimator, true>(
+ registerBackendType<QBlendedClipAnimator, true>(
QSharedPointer<Animation::NodeFunctor<Animation::BlendedClipAnimator, Animation::BlendedClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->blendedClipAnimatorManager()));
- d->registerBackendType<QAbstractChannelMapping, true>(
+ registerBackendType<QAbstractChannelMapping, true>(
QSharedPointer<Animation::NodeFunctor<Animation::ChannelMapping, Animation::ChannelMappingManager>>::create(d->m_handler.data(),
d->m_handler->channelMappingManager()));
- d->registerBackendType<QChannelMapper, true>(
+ registerBackendType<QChannelMapper, true>(
QSharedPointer<Animation::NodeFunctor<Animation::ChannelMapper, Animation::ChannelMapperManager>>::create(d->m_handler.data(),
d->m_handler->channelMapperManager()));
- d->registerBackendType<QLerpClipBlend, true>(
+ registerBackendType<QLerpClipBlend, true>(
QSharedPointer<Animation::ClipBlendNodeFunctor<Animation::LerpClipBlend, Animation::ClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->clipBlendNodeManager()));
- d->registerBackendType<QAdditiveClipBlend, true>(
+ registerBackendType<QAdditiveClipBlend, true>(
QSharedPointer<Animation::ClipBlendNodeFunctor<Animation::AdditiveClipBlend, Animation::ClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->clipBlendNodeManager()));
- d->registerBackendType<QClipBlendValue, true>(
+ registerBackendType<QClipBlendValue, true>(
QSharedPointer<Animation::ClipBlendNodeFunctor<Animation::ClipBlendValue, Animation::ClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->clipBlendNodeManager()));
- d->registerBackendType<Qt3DCore::QAbstractSkeleton, true>(
+ registerBackendType<Qt3DCore::QAbstractSkeleton, true>(
QSharedPointer<Animation::NodeFunctor<Animation::Skeleton, Animation::SkeletonManager>>::create(d->m_handler.data(),
d->m_handler->skeletonManager()));
}
diff --git a/src/animation/frontend/qcallbackmapping.cpp b/src/animation/frontend/qcallbackmapping.cpp
index 24b5d2e6e..a86785012 100644
--- a/src/animation/frontend/qcallbackmapping.cpp
+++ b/src/animation/frontend/qcallbackmapping.cpp
@@ -51,7 +51,6 @@ QCallbackMappingPrivate::QCallbackMappingPrivate()
, m_channelName()
, m_type(static_cast<int>(QVariant::Invalid))
, m_callback(nullptr)
- , m_callbackFlags(0)
{
m_mappingType = QChannelMappingCreatedChangeBase::CallbackMapping;
}
diff --git a/src/core/aspects/aspectcommanddebugger.cpp b/src/core/aspects/aspectcommanddebugger.cpp
index eceec1bbd..7635f44c0 100644
--- a/src/core/aspects/aspectcommanddebugger.cpp
+++ b/src/core/aspects/aspectcommanddebugger.cpp
@@ -39,12 +39,12 @@
#include "aspectcommanddebugger_p.h"
-#include <Qt3DCore/qaspectengine.h>
#include <QtNetwork/QTcpSocket>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <Qt3DCore/private/qabstractaspect_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p.h>
QT_BEGIN_NAMESPACE
@@ -64,13 +64,6 @@ struct CommandHeader
} // anonymous
-AspectCommandDebugger::ReadBuffer::ReadBuffer()
- : buffer()
- , startIdx(0)
- , endIdx(0)
-{
-}
-
void AspectCommandDebugger::ReadBuffer::insert(const QByteArray &array)
{
buffer.insert(endIdx, array);
@@ -88,9 +81,9 @@ void AspectCommandDebugger::ReadBuffer::trim()
}
}
-AspectCommandDebugger::AspectCommandDebugger(QObject *parent)
+AspectCommandDebugger::AspectCommandDebugger(QSystemInformationService *parent)
: QTcpServer(parent)
- , m_aspectEngine(nullptr)
+ , m_service(parent)
{
}
@@ -115,11 +108,6 @@ void AspectCommandDebugger::initialize()
qWarning() << Q_FUNC_INFO << "failed to listen on port 8883";
}
-void AspectCommandDebugger::setAspectEngine(QAspectEngine *engine)
-{
- m_aspectEngine = engine;
-}
-
void AspectCommandDebugger::asynchronousReplyFinished(AsynchronousCommandReply *reply)
{
Q_ASSERT(reply->isFinished());
@@ -189,7 +177,7 @@ void AspectCommandDebugger::executeCommand(const QString &command,
QTcpSocket *socket)
{
// Only a single aspect is going to reply
- const QVariant response = m_aspectEngine->executeCommand(command);
+ const QVariant response = m_service->executeCommand(command);
if (response.userType() == qMetaTypeId<AsynchronousCommandReply *>()) { // AsynchronousCommand
// Store the command | socket in a table
AsynchronousCommandReply *reply = response.value<AsynchronousCommandReply *>();
diff --git a/src/core/aspects/aspectcommanddebugger_p.h b/src/core/aspects/aspectcommanddebugger_p.h
index bb6100df5..b39708ab1 100644
--- a/src/core/aspects/aspectcommanddebugger_p.h
+++ b/src/core/aspects/aspectcommanddebugger_p.h
@@ -54,32 +54,30 @@
//
#include <QTcpServer>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QAspectEngine;
+class QSystemInformationService;
namespace Debug {
class AsynchronousCommandReply;
-class Q_AUTOTEST_EXPORT AspectCommandDebugger : public QTcpServer
+class Q_3DCORE_PRIVATE_EXPORT AspectCommandDebugger : public QTcpServer
{
Q_OBJECT
public:
- explicit AspectCommandDebugger(QObject *parent = nullptr);
+ explicit AspectCommandDebugger(QSystemInformationService *parent = nullptr);
void initialize();
- void setAspectEngine(QAspectEngine *engine);
-
- struct ReadBuffer {
- ReadBuffer();
+ struct Q_3DCORE_PRIVATE_EXPORT ReadBuffer {
QByteArray buffer;
- int startIdx;
- int endIdx;
+ int startIdx = 0;
+ int endIdx = 0;
inline int size() const { return endIdx - startIdx; }
void insert(const QByteArray &array);
@@ -95,7 +93,7 @@ private:
void executeCommand(const QString &command, QTcpSocket *socket);
QVector<QTcpSocket *> m_connections;
- QAspectEngine *m_aspectEngine;
+ QSystemInformationService *m_service;
ReadBuffer m_readBuffer;
QHash<AsynchronousCommandReply *, QTcpSocket *> m_asyncCommandToSocketEntries;
diff --git a/src/core/aspects/aspects.pri b/src/core/aspects/aspects.pri
index 5e8327192..068f74389 100644
--- a/src/core/aspects/aspects.pri
+++ b/src/core/aspects/aspects.pri
@@ -4,7 +4,8 @@ SOURCES += \
$$PWD/qabstractaspect.cpp \
$$PWD/qaspectengine.cpp \
$$PWD/qaspectfactory.cpp \
- $$PWD/qaspectmanager.cpp
+ $$PWD/qaspectmanager.cpp \
+ $$PWD/aspectcommanddebugger.cpp
HEADERS += \
$$PWD/qabstractaspect.h \
@@ -12,13 +13,10 @@ HEADERS += \
$$PWD/qabstractaspect_p.h \
$$PWD/qaspectengine_p.h \
$$PWD/qaspectfactory_p.h \
- $$PWD/qaspectmanager_p.h
+ $$PWD/qaspectmanager_p.h \
+ $$PWD/aspectcommanddebugger_p.h
INCLUDEPATH += $$PWD
include($$QT3D_BUILD_ROOT/src/core/qt3dcore-config.pri)
QT_FOR_CONFIG += 3dcore-private
-qtConfig(qt3d-profile-jobs): {
- HEADERS += $$PWD/aspectcommanddebugger_p.h
- SOURCES += $$PWD/aspectcommanddebugger.cpp
-}
diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp
index 6e0d3bd02..a2aed732b 100644
--- a/src/core/aspects/qabstractaspect.cpp
+++ b/src/core/aspects/qabstractaspect.cpp
@@ -92,13 +92,6 @@ void QAbstractAspectPrivate::onEngineAboutToShutdown()
}
/*! \internal */
-void QAbstractAspectPrivate::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing)
-{
- const auto f = supportsSyncing ? QAbstractAspectPrivate::SupportsSyncing : QAbstractAspectPrivate::DefaultMapper;
- m_backendCreatorFunctors.insert(&obj, {functor, f});
-}
-
-/*! \internal */
void QAbstractAspectPrivate::unregisterBackendType(const QMetaObject &mo)
{
m_backendCreatorFunctors.remove(&mo);
@@ -190,6 +183,13 @@ void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackend
d->m_backendCreatorFunctors.insert(&obj, {functor, QAbstractAspectPrivate::DefaultMapper});
}
+void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing)
+{
+ Q_D(QAbstractAspect);
+ const auto f = supportsSyncing ? QAbstractAspectPrivate::SupportsSyncing : QAbstractAspectPrivate::DefaultMapper;
+ d->m_backendCreatorFunctors.insert(&obj, {functor, f});
+}
+
void QAbstractAspect::unregisterBackendType(const QMetaObject &obj)
{
Q_D(QAbstractAspect);
@@ -508,9 +508,9 @@ QVector<QAspectJobPtr> QAbstractAspectPrivate::jobsToExecute(qint64 time)
return res;
}
-void QAbstractAspectPrivate::jobsDone()
+void QAbstractAspectPrivate::jobsDone(QAspectManager *manager)
{
-
+ Q_UNUSED(manager)
}
/*!
diff --git a/src/core/aspects/qabstractaspect.h b/src/core/aspects/qabstractaspect.h
index cb3d02089..3b2f31c50 100644
--- a/src/core/aspects/qabstractaspect.h
+++ b/src/core/aspects/qabstractaspect.h
@@ -78,7 +78,10 @@ protected:
template<class Frontend>
void registerBackendType(const QBackendNodeMapperPtr &functor);
+ template<class Frontend, bool supportsSyncing>
+ void registerBackendType(const QBackendNodeMapperPtr &functor);
void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor);
+ void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing);
template<class Frontend>
void unregisterBackendType();
void unregisterBackendType(const QMetaObject &);
@@ -105,6 +108,12 @@ void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor)
registerBackendType(Frontend::staticMetaObject, functor);
}
+template<class Frontend, bool supportsSyncing>
+void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor)
+{
+ registerBackendType(Frontend::staticMetaObject, functor, supportsSyncing);
+}
+
template<class Frontend>
void QAbstractAspect::unregisterBackendType()
{
diff --git a/src/core/aspects/qabstractaspect_p.h b/src/core/aspects/qabstractaspect_p.h
index b4120cb20..9435f2bc6 100644
--- a/src/core/aspects/qabstractaspect_p.h
+++ b/src/core/aspects/qabstractaspect_p.h
@@ -127,7 +127,7 @@ public:
QAbstractAspectJobManager *jobManager() const;
QVector<QAspectJobPtr> jobsToExecute(qint64 time) override;
- void jobsDone() override;
+ void jobsDone(Qt3DCore::QAspectManager *manager) override;
QBackendNode *createBackendNode(const NodeTreeChange &change) const;
void clearBackendNode(const NodeTreeChange &change) const;
@@ -138,10 +138,7 @@ public:
virtual void onEngineAboutToShutdown();
- // TODO: Make public at some point
- template<class Frontend, bool supportsSyncing>
- void registerBackendType(const QBackendNodeMapperPtr &functor);
- void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing);
+ // TODO: Make these public in 5.8
template<class Frontend>
void unregisterBackendType();
void unregisterBackendType(const QMetaObject &mo);
@@ -167,12 +164,6 @@ public:
static QAbstractAspectPrivate *get(QAbstractAspect *aspect);
};
-template<class Frontend, bool supportsSyncing>
-void QAbstractAspectPrivate::registerBackendType(const QBackendNodeMapperPtr &functor)
-{
- registerBackendType(Frontend::staticMetaObject, functor, supportsSyncing);
-}
-
template<class Frontend>
void QAbstractAspectPrivate::unregisterBackendType()
{
diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp
index 426741a61..d28306197 100644
--- a/src/core/aspects/qaspectengine.cpp
+++ b/src/core/aspects/qaspectengine.cpp
@@ -55,12 +55,9 @@
#include <Qt3DCore/private/qpostman_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/private/qservicelocator_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p.h>
#include <Qt3DCore/qt3dcore-config.h>
-#if QT_CONFIG(qt3d_profile_jobs)
-#include <Qt3DCore/private/aspectcommanddebugger_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
namespace{
@@ -122,9 +119,6 @@ QAspectEnginePrivate::QAspectEnginePrivate()
, m_scene(nullptr)
, m_initialized(false)
, m_runMode(QAspectEngine::Automatic)
- #if QT_CONFIG(qt3d_profile_jobs)
- , m_commandDebugger(new Debug::AspectCommandDebugger(q_func()))
- #endif
{
qRegisterMetaType<Qt3DCore::QAbstractAspect *>();
qRegisterMetaType<Qt3DCore::QObserverInterface *>();
@@ -276,10 +270,6 @@ void QAspectEnginePrivate::initialize()
arbiter->setScene(m_scene);
m_initialized = true;
m_aspectManager->setPostConstructorInit(m_scene->postConstructorInit());
-#if QT_CONFIG(qt3d_profile_jobs)
- m_commandDebugger->setAspectEngine(q_func());
- m_commandDebugger->initialize();
-#endif
}
/*!
@@ -419,16 +409,8 @@ QVariant QAspectEngine::executeCommand(const QString &command)
if (d->m_aspects.isEmpty())
return QLatin1String("No loaded aspect");
- QString reply;
- reply += QLatin1String("Loaded aspects:");
- for (QAbstractAspect *aspect : qAsConst(d->m_aspects)) {
- const QString name = d->m_factory.aspectName(aspect);
- if (!name.isEmpty())
- reply += QLatin1String("\n * ") + name;
- else
- reply += QLatin1String("\n * <unnamed>");
- }
- return reply;
+ const QStringList names = d->m_aspectManager->serviceLocator()->systemInformation()->aspectNames();
+ return names.join(QLatin1String("\n"));
}
QStringList args = command.split(QLatin1Char(' '));
diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h
index c83940435..8f3abcd38 100644
--- a/src/core/aspects/qaspectengine_p.h
+++ b/src/core/aspects/qaspectengine_p.h
@@ -69,12 +69,6 @@ class QAspectManager;
class QPostman;
class QScene;
-#if QT_CONFIG(qt3d_profile_jobs)
-namespace Debug {
-class AspectCommandDebugger;
-} // Debug
-#endif
-
class Q_3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate
{
public:
@@ -93,10 +87,6 @@ public:
bool m_initialized;
QAspectEngine::RunMode m_runMode;
-#if QT_CONFIG(qt3d_profile_jobs)
- Debug::AspectCommandDebugger *m_commandDebugger;
-#endif
-
void initialize();
void shutdown();
diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp
index f24248399..f276d633e 100644
--- a/src/core/aspects/qaspectmanager.cpp
+++ b/src/core/aspects/qaspectmanager.cpp
@@ -57,6 +57,7 @@
#include <Qt3DCore/private/qchangearbiter_p.h>
#include <Qt3DCore/private/qscheduler_p.h>
#include <Qt3DCore/private/qservicelocator_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p_p.h>
#include <Qt3DCore/private/qthreadpooler_p.h>
#include <Qt3DCore/private/qtickclock_p.h>
#include <Qt3DCore/private/qtickclockservice_p.h>
@@ -98,16 +99,18 @@ int RequestFrameEvent::requestEventType = QEvent::registerEventType();
\class Qt3DCore::QAspectManager
\internal
*/
-QAspectManager::QAspectManager(QObject *parent)
+QAspectManager::QAspectManager(QAspectEngine *parent)
: QObject(parent)
+ , m_engine(parent)
, m_root(nullptr)
, m_scheduler(new QScheduler(this))
, m_jobManager(new QAspectJobManager(this))
, m_changeArbiter(new QChangeArbiter(this))
- , m_serviceLocator(new QServiceLocator())
+ , m_serviceLocator(new QServiceLocator(parent))
, m_simulationLoopRunning(false)
, m_driveMode(QAspectEngine::Automatic)
, m_postConstructorInit(nullptr)
+ , m_jobsInLastFrame(0)
{
qRegisterMetaType<QSurface *>("QSurface*");
qCDebug(Aspects) << Q_FUNC_INFO;
@@ -449,57 +452,49 @@ void QAspectManager::processFrame()
//
// Doing this as the first call in the new frame ensures the lock free approach works
// without any such data race.
-#if QT_CONFIG(qt3d_profile_jobs)
- const quint32 arbiterId = 4096;
- JobRunStats changeArbiterStats;
- changeArbiterStats.jobId.typeAndInstance[0] = arbiterId;
- changeArbiterStats.jobId.typeAndInstance[1] = 0;
- changeArbiterStats.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
- changeArbiterStats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
-#endif
-
- // Tell the NodePostConstructorInit to process any pending nodes which will add them to our list of
- // tree changes
- m_postConstructorInit->processNodes();
-
- // Add and Remove Nodes
- const QVector<NodeTreeChange> nodeTreeChanges = std::move(m_nodeTreeChanges);
- for (const NodeTreeChange &change : nodeTreeChanges) {
- // Buckets ensure that even if we have intermingled node added / removed
- // buckets, we preserve the order of the sequences
-
- for (QAbstractAspect *aspect : qAsConst(m_aspects)) {
- switch (change.type) {
- case NodeTreeChange::Added:
- aspect->d_func()->createBackendNode(change);
- break;
- case NodeTreeChange::Removed:
- aspect->d_func()->clearBackendNode(change);
- break;
+ {
+ // scope for QTaskLogger
+ QTaskLogger logger(m_serviceLocator->systemInformation(), 4096, 0);
+
+ // Tell the NodePostConstructorInit to process any pending nodes which will add them to our list of
+ // tree changes
+ m_postConstructorInit->processNodes();
+
+ // Add and Remove Nodes
+ const QVector<NodeTreeChange> nodeTreeChanges = std::move(m_nodeTreeChanges);
+ for (const NodeTreeChange &change : nodeTreeChanges) {
+ // Buckets ensure that even if we have intermingled node added / removed
+ // buckets, we preserve the order of the sequences
+
+ for (QAbstractAspect *aspect : qAsConst(m_aspects)) {
+ switch (change.type) {
+ case NodeTreeChange::Added:
+ aspect->d_func()->createBackendNode(change);
+ break;
+ case NodeTreeChange::Removed:
+ aspect->d_func()->clearBackendNode(change);
+ break;
+ }
}
}
- }
- // Sync node / subnode relationship changes
- const auto dirtySubNodes = m_changeArbiter->takeDirtyFrontEndSubNodes();
- if (dirtySubNodes.size())
- for (QAbstractAspect *aspect : qAsConst(m_aspects))
- QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndSubNodes(dirtySubNodes);
-
- // Sync property updates
- const auto dirtyFrontEndNodes = m_changeArbiter->takeDirtyFrontEndNodes();
- if (dirtyFrontEndNodes.size())
- for (QAbstractAspect *aspect : qAsConst(m_aspects))
- QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndNodes(dirtyFrontEndNodes);
-
- // TO DO: Having this done in the main thread actually means aspects could just
- // as simply read info out of the Frontend classes without risk of introducing
- // races. This could therefore be removed for Qt 6.
- m_changeArbiter->syncChanges();
-#if QT_CONFIG(qt3d_profile_jobs)
- changeArbiterStats.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
- QThreadPooler::addJobLogStatsEntry(changeArbiterStats);
-#endif
+ // Sync node / subnode relationship changes
+ const auto dirtySubNodes = m_changeArbiter->takeDirtyFrontEndSubNodes();
+ if (dirtySubNodes.size())
+ for (QAbstractAspect *aspect : qAsConst(m_aspects))
+ QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndSubNodes(dirtySubNodes);
+
+ // Sync property updates
+ const auto dirtyFrontEndNodes = m_changeArbiter->takeDirtyFrontEndNodes();
+ if (dirtyFrontEndNodes.size())
+ for (QAbstractAspect *aspect : qAsConst(m_aspects))
+ QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndNodes(dirtyFrontEndNodes);
+
+ // TO DO: Having this done in the main thread actually means aspects could just
+ // as simply read info out of the Frontend classes without risk of introducing
+ // races. This could therefore be removed for Qt 6.
+ m_changeArbiter->syncChanges();
+ }
// For each Aspect
// Ask them to launch set of jobs for the current frame
@@ -508,12 +503,10 @@ void QAspectManager::processFrame()
QElapsedTimer timer;
timer.start();
#endif
- m_scheduler->scheduleAndWaitForFrameAspectJobs(t);
+ m_jobsInLastFrame = m_scheduler->scheduleAndWaitForFrameAspectJobs(t);
#if defined(QT3D_CORE_JOB_TIMING)
qDebug() << "Jobs took" << timer.nsecsElapsed() / 1.0e6;
#endif
-
- // TODO sync backend changes to frontend
}
} // namespace Qt3DCore
diff --git a/src/core/aspects/qaspectmanager_p.h b/src/core/aspects/qaspectmanager_p.h
index ebc148324..ed04b314f 100644
--- a/src/core/aspects/qaspectmanager_p.h
+++ b/src/core/aspects/qaspectmanager_p.h
@@ -73,6 +73,7 @@ class QScheduler;
class QChangeArbiter;
class QAbstractAspect;
class QAbstractAspectJobManager;
+class QAspectEngine;
class QServiceLocator;
class NodePostConstructorInit;
struct NodeTreeChange;
@@ -81,7 +82,7 @@ class Q_3DCORE_PRIVATE_EXPORT QAspectManager : public QObject
{
Q_OBJECT
public:
- explicit QAspectManager(QObject *parent = nullptr);
+ explicit QAspectManager(QAspectEngine *parent = nullptr);
~QAspectManager();
void setRunMode(QAspectEngine::RunMode mode);
@@ -111,10 +112,13 @@ public:
QNode *lookupNode(QNodeId id) const;
QVector<QNode *> lookupNodes(const QVector<QNodeId> &ids) const;
+ int jobsInLastFrame() const { return m_jobsInLastFrame; }
+
private:
bool event(QEvent *event) override;
void requestNextFrame();
+ QAspectEngine *m_engine;
QVector<QAbstractAspect *> m_aspects;
QEntity *m_root;
QVariantMap m_data;
@@ -126,7 +130,7 @@ private:
QAspectEngine::RunMode m_driveMode;
QVector<NodeTreeChange> m_nodeTreeChanges;
NodePostConstructorInit* m_postConstructorInit;
-
+ int m_jobsInLastFrame;
};
} // namespace Qt3DCore
diff --git a/src/core/changes/qcomponentaddedchange.h b/src/core/changes/qcomponentaddedchange.h
index ef2f6a227..9e1522024 100644
--- a/src/core/changes/qcomponentaddedchange.h
+++ b/src/core/changes/qcomponentaddedchange.h
@@ -53,10 +53,10 @@ class QComponentAddedChangePrivate;
class Q_3DCORESHARED_EXPORT QComponentAddedChange : public QSceneChange
{
public:
- explicit QComponentAddedChange(const QEntity *entity,
- const QComponent *component);
- explicit QComponentAddedChange(const QComponent *component,
- const QEntity *entity);
+ Q3D_DECL_DEPRECATED explicit QComponentAddedChange(const QEntity *entity,
+ const QComponent *component);
+ Q3D_DECL_DEPRECATED explicit QComponentAddedChange(const QComponent *component,
+ const QEntity *entity);
~QComponentAddedChange();
QNodeId entityId() const Q_DECL_NOTHROW;
@@ -67,7 +67,7 @@ private:
Q_DECLARE_PRIVATE(QComponentAddedChange)
};
-typedef QSharedPointer<QComponentAddedChange> QComponentAddedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QComponentAddedChange> QComponentAddedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qcomponentremovedchange.h b/src/core/changes/qcomponentremovedchange.h
index 8108b33d5..e0b039780 100644
--- a/src/core/changes/qcomponentremovedchange.h
+++ b/src/core/changes/qcomponentremovedchange.h
@@ -53,10 +53,10 @@ class QComponentRemovedChangePrivate;
class Q_3DCORESHARED_EXPORT QComponentRemovedChange : public QSceneChange
{
public:
- explicit QComponentRemovedChange(const QEntity *entity,
- const QComponent *component);
- explicit QComponentRemovedChange(const QComponent *component,
- const QEntity *entity);
+ Q3D_DECL_DEPRECATED explicit QComponentRemovedChange(const QEntity *entity,
+ const QComponent *component);
+ Q3D_DECL_DEPRECATED explicit QComponentRemovedChange(const QComponent *component,
+ const QEntity *entity);
~QComponentRemovedChange();
QNodeId entityId() const Q_DECL_NOTHROW;
@@ -67,7 +67,7 @@ private:
Q_DECLARE_PRIVATE(QComponentRemovedChange)
};
-typedef QSharedPointer<QComponentRemovedChange> QComponentRemovedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QComponentRemovedChange> QComponentRemovedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qdynamicpropertyupdatedchange.h b/src/core/changes/qdynamicpropertyupdatedchange.h
index 0509582b0..7009e1fe7 100644
--- a/src/core/changes/qdynamicpropertyupdatedchange.h
+++ b/src/core/changes/qdynamicpropertyupdatedchange.h
@@ -51,7 +51,7 @@ class QDynamicPropertyUpdatedChangePrivate;
class Q_3DCORESHARED_EXPORT QDynamicPropertyUpdatedChange : public QPropertyUpdatedChangeBase
{
public:
- explicit QDynamicPropertyUpdatedChange(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QDynamicPropertyUpdatedChange(QNodeId subjectId);
~QDynamicPropertyUpdatedChange();
QByteArray propertyName() const;
@@ -65,7 +65,7 @@ protected:
QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd, QNodeId subjectId);
};
-typedef QSharedPointer<QDynamicPropertyUpdatedChange> QDynamicPropertyUpdatedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QDynamicPropertyUpdatedChange> QDynamicPropertyUpdatedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qnodecommand.h b/src/core/changes/qnodecommand.h
index 3622f7421..83d7caf4f 100644
--- a/src/core/changes/qnodecommand.h
+++ b/src/core/changes/qnodecommand.h
@@ -57,7 +57,7 @@ public:
typedef quint32 CommandId;
#endif
- explicit QNodeCommand(QNodeId id);
+ Q3D_DECL_DEPRECATED explicit QNodeCommand(QNodeId id);
~QNodeCommand();
CommandId commandId() const;
@@ -76,7 +76,7 @@ private:
Q_DECLARE_PRIVATE(QNodeCommand)
};
-typedef QSharedPointer<QNodeCommand> QNodeCommandPtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QNodeCommand> QNodeCommandPtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qnodecreatedchange.h b/src/core/changes/qnodecreatedchange.h
index f46e8abee..359cdb917 100644
--- a/src/core/changes/qnodecreatedchange.h
+++ b/src/core/changes/qnodecreatedchange.h
@@ -51,7 +51,7 @@ class QNodeCreatedChangeBasePrivate;
class Q_3DCORESHARED_EXPORT QNodeCreatedChangeBase : public QSceneChange
{
public:
- explicit QNodeCreatedChangeBase(const QNode *node);
+ Q3D_DECL_DEPRECATED explicit QNodeCreatedChangeBase(const QNode *node);
~QNodeCreatedChangeBase();
QNodeId parentId() const Q_DECL_NOTHROW;
@@ -65,7 +65,7 @@ private:
Q_DECLARE_PRIVATE(QNodeCreatedChangeBase)
};
-typedef QSharedPointer<QNodeCreatedChangeBase> QNodeCreatedChangeBasePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QNodeCreatedChangeBase> QNodeCreatedChangeBasePtr;
template<typename T>
class QNodeCreatedChange : public QNodeCreatedChangeBase
@@ -81,7 +81,7 @@ public:
};
template<typename T>
-using QNodeCreatedChangePtr = QSharedPointer<QNodeCreatedChange<T>>;
+using QNodeCreatedChangePtr Q3D_DECL_DEPRECATED = QSharedPointer<QNodeCreatedChange<T>>;
} // namespace Qt3DCore
diff --git a/src/core/changes/qnodedestroyedchange.h b/src/core/changes/qnodedestroyedchange.h
index c072dd412..dce6da59e 100644
--- a/src/core/changes/qnodedestroyedchange.h
+++ b/src/core/changes/qnodedestroyedchange.h
@@ -50,7 +50,7 @@ class QNodeDestroyedChangePrivate;
class Q_3DCORESHARED_EXPORT QNodeDestroyedChange : public QSceneChange
{
public:
- explicit QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes);
+ Q3D_DECL_DEPRECATED explicit QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes);
~QNodeDestroyedChange();
QVector<QNodeIdTypePair> subtreeIdsAndTypes() const;
@@ -59,7 +59,7 @@ private:
Q_DECLARE_PRIVATE(QNodeDestroyedChange)
};
-typedef QSharedPointer<QNodeDestroyedChange> QNodeDestroyedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QNodeDestroyedChange> QNodeDestroyedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertynodeaddedchange.h b/src/core/changes/qpropertynodeaddedchange.h
index ce3288a65..062244f88 100644
--- a/src/core/changes/qpropertynodeaddedchange.h
+++ b/src/core/changes/qpropertynodeaddedchange.h
@@ -53,7 +53,7 @@ class QPropertyNodeAddedChangePrivate;
class Q_3DCORESHARED_EXPORT QPropertyNodeAddedChange : public QStaticPropertyValueAddedChangeBase
{
public:
- explicit QPropertyNodeAddedChange(QNodeId subjectId, QNode *node);
+ Q3D_DECL_DEPRECATED explicit QPropertyNodeAddedChange(QNodeId subjectId, QNode *node);
~QPropertyNodeAddedChange();
QNodeId addedNodeId() const;
@@ -63,7 +63,7 @@ private:
Q_DECLARE_PRIVATE(QPropertyNodeAddedChange)
};
-typedef QSharedPointer<QPropertyNodeAddedChange> QPropertyNodeAddedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyNodeAddedChange> QPropertyNodeAddedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertynoderemovedchange.h b/src/core/changes/qpropertynoderemovedchange.h
index 1a4db8f1c..a8ea9d6c4 100644
--- a/src/core/changes/qpropertynoderemovedchange.h
+++ b/src/core/changes/qpropertynoderemovedchange.h
@@ -53,7 +53,7 @@ class QPropertyNodeRemovedChangePrivate;
class Q_3DCORESHARED_EXPORT QPropertyNodeRemovedChange : public QStaticPropertyValueRemovedChangeBase
{
public:
- explicit QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node);
+ Q3D_DECL_DEPRECATED explicit QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node);
~QPropertyNodeRemovedChange();
QNodeId removedNodeId() const;
@@ -63,7 +63,7 @@ private:
Q_DECLARE_PRIVATE(QPropertyNodeRemovedChange)
};
-typedef QSharedPointer<QPropertyNodeRemovedChange> QPropertyNodeRemovedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyNodeRemovedChange> QPropertyNodeRemovedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertyupdatedchange.h b/src/core/changes/qpropertyupdatedchange.h
index e0c12f13d..aa0dd9364 100644
--- a/src/core/changes/qpropertyupdatedchange.h
+++ b/src/core/changes/qpropertyupdatedchange.h
@@ -51,7 +51,7 @@ class QPropertyUpdatedChangePrivate;
class Q_3DCORESHARED_EXPORT QPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase
{
public:
- explicit QPropertyUpdatedChange(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyUpdatedChange(QNodeId subjectId);
virtual ~QPropertyUpdatedChange();
QVariant value() const;
@@ -62,7 +62,7 @@ protected:
QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd, QNodeId subjectId);
};
-typedef QSharedPointer<QPropertyUpdatedChange> QPropertyUpdatedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyUpdatedChange> QPropertyUpdatedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertyupdatedchangebase.h b/src/core/changes/qpropertyupdatedchangebase.h
index 800abb477..5a0f6c87f 100644
--- a/src/core/changes/qpropertyupdatedchangebase.h
+++ b/src/core/changes/qpropertyupdatedchangebase.h
@@ -56,12 +56,12 @@ public:
~QPropertyUpdatedChangeBase();
protected:
- explicit QPropertyUpdatedChangeBase(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyUpdatedChangeBase(QNodeId subjectId);
QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId);
Q_DECLARE_PRIVATE(QPropertyUpdatedChangeBase)
};
-typedef QSharedPointer<QPropertyUpdatedChangeBase> QPropertyUpdatedChangeBasePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyUpdatedChangeBase> QPropertyUpdatedChangeBasePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertyvalueaddedchange.h b/src/core/changes/qpropertyvalueaddedchange.h
index d85720246..e70d78b7e 100644
--- a/src/core/changes/qpropertyvalueaddedchange.h
+++ b/src/core/changes/qpropertyvalueaddedchange.h
@@ -53,7 +53,7 @@ class QPropertyValueAddedChangePrivate;
class Q_3DCORESHARED_EXPORT QPropertyValueAddedChange : public QStaticPropertyValueAddedChangeBase
{
public:
- explicit QPropertyValueAddedChange(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChange(QNodeId subjectId);
~QPropertyValueAddedChange();
void setAddedValue(const QVariant &value);
@@ -63,7 +63,7 @@ private:
Q_DECLARE_PRIVATE(QPropertyValueAddedChange)
};
-typedef QSharedPointer<QPropertyValueAddedChange> QPropertyValueAddedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueAddedChange> QPropertyValueAddedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertyvalueaddedchangebase.h b/src/core/changes/qpropertyvalueaddedchangebase.h
index 2be39ad47..148411de8 100644
--- a/src/core/changes/qpropertyvalueaddedchangebase.h
+++ b/src/core/changes/qpropertyvalueaddedchangebase.h
@@ -56,12 +56,12 @@ public:
~QPropertyValueAddedChangeBase();
protected:
- explicit QPropertyValueAddedChangeBase(QNodeId subjectId);
- explicit QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChangeBase(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, QNodeId subjectId);
Q_DECLARE_PRIVATE(QPropertyValueAddedChangeBase)
};
-typedef QSharedPointer<QPropertyValueAddedChangeBase> QPropertyValueAddedChangeBasePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueAddedChangeBase> QPropertyValueAddedChangeBasePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertyvalueremovedchange.h b/src/core/changes/qpropertyvalueremovedchange.h
index 2bd781ed5..70eb42db4 100644
--- a/src/core/changes/qpropertyvalueremovedchange.h
+++ b/src/core/changes/qpropertyvalueremovedchange.h
@@ -53,7 +53,7 @@ class QPropertyValueRemovedChangePrivate;
class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChange : public QStaticPropertyValueRemovedChangeBase
{
public:
- explicit QPropertyValueRemovedChange(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChange(QNodeId subjectId);
~QPropertyValueRemovedChange();
void setRemovedValue(const QVariant &value);
@@ -63,7 +63,7 @@ private:
Q_DECLARE_PRIVATE(QPropertyValueRemovedChange)
};
-typedef QSharedPointer<QPropertyValueRemovedChange> QPropertyValueRemovedChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueRemovedChange> QPropertyValueRemovedChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qpropertyvalueremovedchangebase.h b/src/core/changes/qpropertyvalueremovedchangebase.h
index 233354078..b5ead7d22 100644
--- a/src/core/changes/qpropertyvalueremovedchangebase.h
+++ b/src/core/changes/qpropertyvalueremovedchangebase.h
@@ -57,11 +57,11 @@ public:
protected:
Q_DECLARE_PRIVATE(QPropertyValueRemovedChangeBase)
- explicit QPropertyValueRemovedChangeBase(QNodeId subjectId);
- explicit QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChangeBase(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, QNodeId subjectId);
};
-typedef QSharedPointer<QPropertyValueRemovedChangeBase> QPropertyValueRemovedChangeBasePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueRemovedChangeBase> QPropertyValueRemovedChangeBasePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qscenechange.cpp b/src/core/changes/qscenechange.cpp
index 87bf06ea0..822451b5f 100644
--- a/src/core/changes/qscenechange.cpp
+++ b/src/core/changes/qscenechange.cpp
@@ -48,6 +48,7 @@ namespace Qt3DCore {
/*!
* \enum Qt3DCore::ChangeFlag
* \relates Qt3DCore::QSceneChange
+ * \obsolete
*
* The types of change that can be sent and received by Qt3D's change notification system.
*
diff --git a/src/core/changes/qscenechange.h b/src/core/changes/qscenechange.h
index 4a0740819..792c00d0a 100644
--- a/src/core/changes/qscenechange.h
+++ b/src/core/changes/qscenechange.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-enum ChangeFlag {
+enum Q3D_DECL_DEPRECATED ChangeFlag {
NodeCreated = 1 << 0,
NodeDeleted = 1 << 1,
PropertyUpdated = 1 << 2,
@@ -87,9 +87,9 @@ public:
protected:
Q_DECLARE_PRIVATE(QSceneChange)
- explicit QSceneChange(ChangeFlag type, QNodeId subjectId);
- explicit QSceneChange(QSceneChangePrivate &dd,
- ChangeFlag type, QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QSceneChange(ChangeFlag type, QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QSceneChange(QSceneChangePrivate &dd,
+ ChangeFlag type, QNodeId subjectId);
QSceneChangePrivate *d_ptr;
private:
@@ -98,7 +98,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QSceneChange::DeliveryFlags)
-typedef QSharedPointer<QSceneChange> QSceneChangePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QSceneChange> QSceneChangePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qscenechange_p.h b/src/core/changes/qscenechange_p.h
index 358beab49..32006807c 100644
--- a/src/core/changes/qscenechange_p.h
+++ b/src/core/changes/qscenechange_p.h
@@ -60,7 +60,9 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-//! internal
+class QSceneChange;
+class QNodeId;
+
struct NodeRelationshipChange {
QNode *node;
QNode *subNode;
@@ -68,9 +70,6 @@ struct NodeRelationshipChange {
const char *property;
};
-class QSceneChange;
-class QNodeId;
-
class Q_3DCORE_PRIVATE_EXPORT QSceneChangePrivate
{
public :
diff --git a/src/core/changes/qskeletoncreatedchange_p.h b/src/core/changes/qskeletoncreatedchange_p.h
index 09b37d545..c20bcae85 100644
--- a/src/core/changes/qskeletoncreatedchange_p.h
+++ b/src/core/changes/qskeletoncreatedchange_p.h
@@ -60,7 +60,7 @@ class QSkeletonCreatedChangeBasePrivate;
class Q_3DCORESHARED_EXPORT QSkeletonCreatedChangeBase : public QNodeCreatedChangeBase
{
public:
- explicit QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton);
+ Q3D_DECL_DEPRECATED explicit QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton);
~QSkeletonCreatedChangeBase();
enum SkeletonType {
@@ -74,7 +74,7 @@ private:
Q_DECLARE_PRIVATE(QSkeletonCreatedChangeBase)
};
-typedef QSharedPointer<QSkeletonCreatedChangeBase> QSkeletonCreatedChangeBasePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QSkeletonCreatedChangeBase> QSkeletonCreatedChangeBasePtr;
template<typename T>
class QSkeletonCreatedChange : public QSkeletonCreatedChangeBase
@@ -90,7 +90,7 @@ public:
};
template<typename T>
-using QSkeletonCreatedChangePtr = QSharedPointer<QSkeletonCreatedChange<T>>;
+using QSkeletonCreatedChangePtr Q3D_DECL_DEPRECATED = QSharedPointer<QSkeletonCreatedChange<T>>;
} // namespace Qt3DCore
diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.h b/src/core/changes/qstaticpropertyupdatedchangebase.h
index b698d1f06..c59a87a20 100644
--- a/src/core/changes/qstaticpropertyupdatedchangebase.h
+++ b/src/core/changes/qstaticpropertyupdatedchangebase.h
@@ -57,12 +57,12 @@ public:
void setPropertyName(const char *name);
protected:
- explicit QStaticPropertyUpdatedChangeBase(QNodeId subjectId);
- explicit QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QStaticPropertyUpdatedChangeBase(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId);
Q_DECLARE_PRIVATE(QStaticPropertyUpdatedChangeBase)
};
-typedef QSharedPointer<QStaticPropertyUpdatedChangeBase> QStaticPropertyUpdatedChangeBasePtr;
+Q3D_DECL_DEPRECATED typedef QSharedPointer<QStaticPropertyUpdatedChangeBase> QStaticPropertyUpdatedChangeBasePtr;
} // namespace Qt3DCore
diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.h b/src/core/changes/qstaticpropertyvalueaddedchangebase.h
index e56e8f18a..7e6807764 100644
--- a/src/core/changes/qstaticpropertyvalueaddedchangebase.h
+++ b/src/core/changes/qstaticpropertyvalueaddedchangebase.h
@@ -59,7 +59,7 @@ public:
protected:
Q_DECLARE_PRIVATE(QStaticPropertyValueAddedChangeBase)
- explicit QStaticPropertyValueAddedChangeBase(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QStaticPropertyValueAddedChangeBase(QNodeId subjectId);
QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd,
QNodeId subjectId);
};
diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.h b/src/core/changes/qstaticpropertyvalueremovedchangebase.h
index e9f53fb12..d1b96f83e 100644
--- a/src/core/changes/qstaticpropertyvalueremovedchangebase.h
+++ b/src/core/changes/qstaticpropertyvalueremovedchangebase.h
@@ -59,7 +59,7 @@ public:
protected:
Q_DECLARE_PRIVATE(QStaticPropertyValueRemovedChangeBase)
- explicit QStaticPropertyValueRemovedChangeBase(QNodeId subjectId);
+ Q3D_DECL_DEPRECATED explicit QStaticPropertyValueRemovedChangeBase(QNodeId subjectId);
QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd,
QNodeId subjectId);
};
diff --git a/src/core/configure.json b/src/core/configure.json
index 2ba205530..2e13d9027 100644
--- a/src/core/configure.json
+++ b/src/core/configure.json
@@ -44,7 +44,7 @@
"output": [ "privateFeature" ]
},
"qt3d-profile-jobs": {
- "label": "Output Qt3D Job traces",
+ "label": "Output Qt3D Job traces (deprecated)",
"autoDetect": false,
"output": [ "privateFeature" ]
},
@@ -112,7 +112,6 @@
"entries": [
"assimp",
"system-assimp",
- "qt3d-profile-jobs",
"qt3d-profile-gl",
"qt3d-simd-sse2",
"qt3d-simd-avx2",
diff --git a/src/core/jobs/qaspectjob.cpp b/src/core/jobs/qaspectjob.cpp
index bdb2063ba..00ad1ace8 100644
--- a/src/core/jobs/qaspectjob.cpp
+++ b/src/core/jobs/qaspectjob.cpp
@@ -66,11 +66,6 @@ QAspectJobPrivate *QAspectJobPrivate::get(QAspectJob *job)
return job->d_func();
}
-const QAspectJobPrivate *QAspectJobPrivate::get(const QAspectJob *job)
-{
- return job->d_func();
-}
-
void QAspectJobPrivate::postFrame(QAspectManager *aspectManager)
{
Q_UNUSED(aspectManager)
@@ -145,6 +140,13 @@ QVector<QWeakPointer<QAspectJob> > QAspectJob::dependencies() const
return d->m_dependencies;
}
+void QAspectJob::postFrame(QAspectManager *aspectManager)
+{
+ Q_D(QAspectJob);
+ if (aspectManager)
+ d->postFrame(aspectManager);
+}
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/jobs/qaspectjob.h b/src/core/jobs/qaspectjob.h
index bd86a61e1..7cc784e0f 100644
--- a/src/core/jobs/qaspectjob.h
+++ b/src/core/jobs/qaspectjob.h
@@ -63,14 +63,15 @@ public:
QVector<QWeakPointer<QAspectJob> > dependencies() const;
virtual void run() = 0;
+ void postFrame(QAspectManager *aspectManager);
protected:
explicit QAspectJob(QAspectJobPrivate &dd);
+ QAspectJobPrivate *d_ptr;
private:
Q_DISABLE_COPY(QAspectJob)
Q_DECLARE_PRIVATE(QAspectJob)
- QAspectJobPrivate *d_ptr;
};
typedef QSharedPointer<QAspectJob> QAspectJobPtr;
diff --git a/src/core/jobs/qaspectjob_p.h b/src/core/jobs/qaspectjob_p.h
index 5504bd936..ddad09c86 100644
--- a/src/core/jobs/qaspectjob_p.h
+++ b/src/core/jobs/qaspectjob_p.h
@@ -54,6 +54,7 @@
#include <QtCore/QWeakPointer>
#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p_p.h>
#include <Qt3DCore/qt3dcore-config.h>
QT_BEGIN_NAMESPACE
@@ -63,47 +64,6 @@ namespace Qt3DCore {
class QAspectJob;
class QAspectManager;
-#if QT_CONFIG(qt3d_profile_jobs)
-struct FrameHeader
-{
- FrameHeader()
- : frameId(0)
- , jobCount(0)
- , frameType(WorkerJob)
- {
- }
-
- enum FrameType {
- WorkerJob = 0,
- Submission
- };
-
- quint32 frameId;
- quint16 jobCount;
- quint16 frameType; // Submission or worker job
-};
-
-union JobId
-{
- quint32 typeAndInstance[2];
- quint64 id;
-};
-
-struct JobRunStats
-{
- JobRunStats()
- {
- jobId.id = 0;
- }
-
- qint64 startTime;
- qint64 endTime;
- JobId jobId;
- // QAspectJob subclasses should properly populate the jobId
- quint64 threadId;
-};
-#endif
-
class Q_3DCORE_PRIVATE_EXPORT QAspectJobPrivate
{
public:
@@ -111,37 +71,20 @@ public:
virtual ~QAspectJobPrivate();
static QAspectJobPrivate *get(QAspectJob *job);
- static const QAspectJobPrivate *get(const QAspectJob *job);
virtual void postFrame(QAspectManager *aspectManager);
QVector<QWeakPointer<QAspectJob> > m_dependencies;
-#if QT_CONFIG(qt3d_profile_jobs)
- JobRunStats m_stats;
-#endif
+ JobId m_jobId;
};
-
} // Qt3D
-#define Q_DJOB(Class) \
- Class##Private *d = static_cast<Class##Private *>(Qt3DCore::QAspectJobPrivate::get(this))
-
-#if QT_CONFIG(qt3d_profile_jobs)
-
-#include <Qt3DCore/private/qaspectjob_p.h>
-
#define SET_JOB_RUN_STAT_TYPE(job, type, instance) \
- Qt3DCore::QAspectJobPrivate::get(job)->m_stats.jobId.typeAndInstance[0] = type; \
- Qt3DCore::QAspectJobPrivate::get(job)->m_stats.jobId.typeAndInstance[1] = instance;
-
-#else
-
-#define SET_JOB_RUN_STAT_TYPE(job, type, instance) \
- Q_UNUSED(job) \
- Q_UNUSED(type) \
- Q_UNUSED(instance)
-
-#endif
+ { \
+ auto &jobId = Qt3DCore::QAspectJobPrivate::get(job)->m_jobId; \
+ jobId.typeAndInstance[0] = type; \
+ jobId.typeAndInstance[1] = instance; \
+ }
QT_END_NAMESPACE
diff --git a/src/core/jobs/qaspectjobmanager.cpp b/src/core/jobs/qaspectjobmanager.cpp
index 91394924f..be7942359 100644
--- a/src/core/jobs/qaspectjobmanager.cpp
+++ b/src/core/jobs/qaspectjobmanager.cpp
@@ -44,7 +44,7 @@
#include <QtCore/QDebug>
#include <QtCore/QThread>
#include <QtCore/QFuture>
-
+#include <Qt3DCore/private/qaspectmanager_p.h>
#include <Qt3DCore/private/qthreadpooler_p.h>
#include <Qt3DCore/private/task_p.h>
@@ -52,9 +52,10 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-QAspectJobManager::QAspectJobManager(QObject *parent)
+QAspectJobManager::QAspectJobManager(QAspectManager *parent)
: QAbstractAspectJobManager(parent)
, m_threadPooler(new QThreadPooler(this))
+ , m_aspectManager(parent)
{
}
@@ -69,12 +70,16 @@ void QAspectJobManager::initialize()
// Adds all Aspect Jobs to be processed for a frame
void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
{
+ auto systemService = m_aspectManager ? m_aspectManager->serviceLocator()->systemInformation() : nullptr;
+ if (systemService)
+ systemService->writePreviousFrameTraces();
+
// Convert QJobs to Tasks
QHash<QAspectJob *, AspectTaskRunnable *> tasksMap;
QVector<RunnableInterface *> taskList;
taskList.reserve(jobQueue.size());
for (const QAspectJobPtr &job : jobQueue) {
- AspectTaskRunnable *task = new AspectTaskRunnable();
+ AspectTaskRunnable *task = new AspectTaskRunnable(systemService);
task->m_job = job;
tasksMap.insert(job.data(), task);
@@ -99,9 +104,6 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
taskDepender->m_dependerCount += dependerCount;
}
-#if QT_CONFIG(qt3d_profile_jobs)
- QThreadPooler::writeFrameJobLogStats();
-#endif
m_threadPooler->mapDependables(taskList);
}
diff --git a/src/core/jobs/qaspectjobmanager_p.h b/src/core/jobs/qaspectjobmanager_p.h
index 77e535491..acbd0263e 100644
--- a/src/core/jobs/qaspectjobmanager_p.h
+++ b/src/core/jobs/qaspectjobmanager_p.h
@@ -63,12 +63,13 @@ namespace Qt3DCore {
class QThreadPooler;
class DependencyHandler;
+class QAspectManager;
class Q_3DCORE_PRIVATE_EXPORT QAspectJobManager : public QAbstractAspectJobManager
{
Q_OBJECT
public:
- explicit QAspectJobManager(QObject *parent = 0);
+ explicit QAspectJobManager(QAspectManager *parent = nullptr);
~QAspectJobManager();
void initialize() override;
@@ -81,6 +82,7 @@ public:
private:
QThreadPooler *m_threadPooler;
+ QAspectManager *m_aspectManager;
};
} // namespace Qt3DCore
diff --git a/src/core/jobs/qaspectjobproviderinterface_p.h b/src/core/jobs/qaspectjobproviderinterface_p.h
index f7d0f9d39..b521fea68 100644
--- a/src/core/jobs/qaspectjobproviderinterface_p.h
+++ b/src/core/jobs/qaspectjobproviderinterface_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QScheduler;
+class QAspectManager;
class QAspectJobProviderInterface
{
@@ -69,7 +70,7 @@ public:
private:
virtual QVector<QAspectJobPtr> jobsToExecute(qint64 time) = 0;
- virtual void jobsDone() = 0;
+ virtual void jobsDone(QAspectManager *manager) = 0;
friend class QScheduler;
};
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 3ab321542..f5c50062a 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -40,27 +40,10 @@
#include "qthreadpooler_p.h"
#include <QtCore/QDebug>
-#if QT_CONFIG(qt3d_profile_jobs)
-
-#ifdef Q_OS_ANDROID
-#include <QtCore/QStandardPaths>
-#endif
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFile>
-#include <QtCore/QThreadStorage>
-#include <QtCore/QDateTime>
-#include <QtCore/QCoreApplication>
-#endif
-
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-#if QT_CONFIG(qt3d_profile_jobs)
-QElapsedTimer QThreadPooler::m_jobsStatTimer;
-#endif
-
QThreadPooler::QThreadPooler(QObject *parent)
: QObject(parent)
, m_futureInterface(nullptr)
@@ -76,12 +59,8 @@ QThreadPooler::QThreadPooler(QObject *parent)
m_threadPool->setMaxThreadCount(maxThreadCountValue);
}
-
// Ensures that threads will never be recycled
m_threadPool->setExpiryTimeout(-1);
-#if QT_CONFIG(qt3d_profile_jobs)
- QThreadPooler::m_jobsStatTimer.start();
-#endif
}
QThreadPooler::~QThreadPooler()
@@ -194,102 +173,6 @@ int QThreadPooler::maxThreadCount() const
return m_threadPool->maxThreadCount();
}
-#if QT_CONFIG(qt3d_profile_jobs)
-
-QThreadStorage<QVector<JobRunStats> *> jobStatsCached;
-
-QVector<QVector<JobRunStats> *> localStorages;
-QVector<JobRunStats> *submissionStorage = nullptr;
-
-QMutex localStoragesMutex;
-
-// Called by the jobs
-void QThreadPooler::addJobLogStatsEntry(JobRunStats &stats)
-{
- if (!jobStatsCached.hasLocalData()) {
- auto jobVector = new QVector<JobRunStats>;
- jobStatsCached.setLocalData(jobVector);
- QMutexLocker lock(&localStoragesMutex);
- localStorages.push_back(jobVector);
- }
- jobStatsCached.localData()->push_back(stats);
-}
-
-// Called after jobs have been executed (MainThread QAspectJobManager::enqueueJobs)
-void QThreadPooler::writeFrameJobLogStats()
-{
- static QScopedPointer<QFile> traceFile;
- static quint32 frameId = 0;
- if (!traceFile) {
- const QString fileName = QStringLiteral("trace_") + QCoreApplication::applicationName() + QDateTime::currentDateTime().toString(QStringLiteral("_ddd_dd_MM_yy-hh_mm_ss_"))+ QSysInfo::productType() + QStringLiteral("_") + QSysInfo::buildAbi() + QStringLiteral(".qt3d");
-#ifdef Q_OS_ANDROID
- traceFile.reset(new QFile(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/") + fileName));
-#else
- traceFile.reset(new QFile(fileName));
-#endif
- if (!traceFile->open(QFile::WriteOnly|QFile::Truncate))
- qCritical("Failed to open trace file");
- }
-
- // Write Aspect + Job threads
- {
- FrameHeader header;
- header.frameId = frameId;
- header.jobCount = 0;
-
- for (const QVector<JobRunStats> *storage : qAsConst(localStorages))
- header.jobCount += storage->size();
-
- traceFile->write(reinterpret_cast<char *>(&header), sizeof(FrameHeader));
-
- for (QVector<JobRunStats> *storage : qAsConst(localStorages)) {
- for (const JobRunStats &stat : *storage)
- traceFile->write(reinterpret_cast<const char *>(&stat), sizeof(JobRunStats));
- storage->clear();
- }
- }
-
- // Write submission thread
- {
- QMutexLocker lock(&localStoragesMutex);
- const int submissionJobSize = submissionStorage != nullptr ? submissionStorage->size() : 0;
- if (submissionJobSize > 0) {
- FrameHeader header;
- header.frameId = frameId;
- header.jobCount = submissionJobSize;
- header.frameType = FrameHeader::Submission;
-
- traceFile->write(reinterpret_cast<char *>(&header), sizeof(FrameHeader));
-
- for (const JobRunStats &stat : *submissionStorage)
- traceFile->write(reinterpret_cast<const char *>(&stat), sizeof(JobRunStats));
- submissionStorage->clear();
- }
- }
-
- traceFile->flush();
- ++frameId;
-}
-
-// Called from Submission thread (which can be main thread in Manual drive mode)
-void QThreadPooler::addSubmissionLogStatsEntry(JobRunStats &stats)
-{
- QMutexLocker lock(&localStoragesMutex);
- if (!jobStatsCached.hasLocalData()) {
- submissionStorage = new QVector<JobRunStats>;
- jobStatsCached.setLocalData(submissionStorage);
- }
-
- // Handle the case where submission thread is also the main thread (Scene/Manual drive modes with no RenderThread)
- if (submissionStorage == nullptr && jobStatsCached.hasLocalData())
- submissionStorage = new QVector<JobRunStats>;
-
- // When having no submission thread this can be null
- submissionStorage->push_back(stats);
-}
-
-#endif
-
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index 3e17cbd6d..1970641b8 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -60,10 +60,6 @@
#include <Qt3DCore/private/qaspectjob_p.h>
#include <Qt3DCore/private/task_p.h>
-#if QT_CONFIG(qt3d_profile_jobs)
-#include <QtCore/QElapsedTimer>
-#endif
-
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
@@ -81,17 +77,6 @@ public:
QFuture<void> future();
int maxThreadCount() const;
-#if QT_CONFIG(qt3d_profile_jobs)
- static QElapsedTimer m_jobsStatTimer;
-
- // Aspects + Job threads
- static void addJobLogStatsEntry(JobRunStats &stats);
- static void writeFrameJobLogStats();
-
- // Submission thread
- static void addSubmissionLogStatsEntry(JobRunStats &stats);
-
-#endif
private:
void enqueueTasks(const QVector<RunnableInterface *> &tasks);
diff --git a/src/core/jobs/task.cpp b/src/core/jobs/task.cpp
index 7c3ebf6eb..1dd5712c9 100644
--- a/src/core/jobs/task.cpp
+++ b/src/core/jobs/task.cpp
@@ -44,6 +44,7 @@
#include <QtCore/QMutexLocker>
#include <Qt3DCore/private/qthreadpooler_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p_p.h>
QT_BEGIN_NAMESPACE
@@ -55,8 +56,9 @@ RunnableInterface::~RunnableInterface()
// Aspect task
-AspectTaskRunnable::AspectTaskRunnable()
- : m_pooler(nullptr)
+AspectTaskRunnable::AspectTaskRunnable(QSystemInformationService *service)
+ : m_service(service)
+ , m_pooler(nullptr)
, m_id(0)
, m_reserved(false)
{
@@ -69,21 +71,9 @@ AspectTaskRunnable::~AspectTaskRunnable()
void AspectTaskRunnable::run()
{
if (m_job) {
-#if QT_CONFIG(qt3d_profile_jobs)
QAspectJobPrivate *jobD = QAspectJobPrivate::get(m_job.data());
- if (m_pooler) {
- jobD->m_stats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
- jobD->m_stats.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
- }
-#endif
+ QTaskLogger logger(m_pooler ? m_service : nullptr, jobD->m_jobId, QTaskLogger::AspectJob);
m_job->run();
-#if QT_CONFIG(qt3d_profile_jobs)
- if (m_pooler) {
- jobD->m_stats.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
- // Add current job's stats to log output
- QThreadPooler::addJobLogStatsEntry(jobD->m_stats);
- }
-#endif
}
// We could have an append sub task or something in here
diff --git a/src/core/jobs/task_p.h b/src/core/jobs/task_p.h
index c81882719..ff411539f 100644
--- a/src/core/jobs/task_p.h
+++ b/src/core/jobs/task_p.h
@@ -65,6 +65,7 @@ namespace Qt3DCore {
class JobRunner;
class DependencyHandler;
class QThreadPooler;
+class QSystemInformationService;
class RunnableInterface : public QRunnable
{
@@ -92,7 +93,7 @@ public:
class AspectTaskRunnable : public RunnableInterface
{
public:
- AspectTaskRunnable();
+ AspectTaskRunnable(QSystemInformationService *service);
~AspectTaskRunnable();
void run() override;
@@ -113,6 +114,7 @@ public:
int m_dependerCount = 0;
private:
+ QSystemInformationService *m_service;
QThreadPooler *m_pooler;
int m_id; // For testing purposes for now
bool m_reserved;
diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp
index e5f93e96f..4138ea060 100644
--- a/src/core/nodes/qbackendnode.cpp
+++ b/src/core/nodes/qbackendnode.cpp
@@ -220,6 +220,7 @@ QBackendNode::QBackendNode(QBackendNodePrivate &dd)
/*!
* Notifies observers of scene change \a e.
+ * \obsolete
*/
void QBackendNode::notifyObservers(const QSceneChangePtr &e)
{
@@ -228,6 +229,8 @@ void QBackendNode::notifyObservers(const QSceneChangePtr &e)
}
/*!
+ \obsolete
+
Send the command named \a name with contents \a data,
and specify \a replyTo as the command id to which the
reply needs to be sent.
@@ -247,6 +250,7 @@ QNodeCommand::CommandId QBackendNode::sendCommand(const QString &name,
/*!
Send the reply to \a command.
+ \obsolete
*/
void QBackendNode::sendReply(const QNodeCommandPtr &command)
{
@@ -254,9 +258,12 @@ void QBackendNode::sendReply(const QNodeCommandPtr &command)
notifyObservers(command);
}
+/*!
+ * \obsolete
+ */
void QBackendNode::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
{
- Q_UNUSED(change);
+ Q_UNUSED(change)
qCDebug(Nodes) << Q_FUNC_INFO << change->metaObject()->className() << "does not override";
}
@@ -270,8 +277,7 @@ void QBackendNode::setEnabled(bool enabled) Q_DECL_NOTHROW
}
/*!
- * TODO
- * \a e
+ * \obsolete
*/
void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e)
{
diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h
index 550ced04f..691375999 100644
--- a/src/core/nodes/qbackendnode.h
+++ b/src/core/nodes/qbackendnode.h
@@ -90,18 +90,18 @@ public:
protected:
Q_DECLARE_PRIVATE(QBackendNode)
explicit QBackendNode(QBackendNodePrivate &dd);
- void notifyObservers(const QSceneChangePtr &e);
- QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data,
- QNodeCommand::CommandId replyTo = QNodeCommand::CommandId());
- void sendReply(const QNodeCommandPtr &command);
- virtual void sceneChangeEvent(const QSceneChangePtr &e);
+ Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &e);
+ Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data,
+ QNodeCommand::CommandId replyTo = QNodeCommand::CommandId());
+ Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command);
+ Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &e);
QBackendNodePrivate *d_ptr;
private:
Q_DISABLE_COPY(QBackendNode)
void setPeerId(QNodeId id) Q_DECL_NOEXCEPT;
- virtual void initializeFromPeer(const QNodeCreatedChangeBasePtr &change);
+ Q3D_DECL_DEPRECATED virtual void initializeFromPeer(const QNodeCreatedChangeBasePtr &change);
friend class QBackendNodePropertyChange;
friend class QAbstractAspectPrivate;
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index af16eaa21..ad084242f 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -382,7 +382,7 @@ void QNodePrivate::unregisterNotifiedProperties()
void QNodePrivate::propertyChanged(int propertyIndex)
{
- Q_UNUSED(propertyIndex);
+ Q_UNUSED(propertyIndex)
// Bail out early if we can to avoid the cost below
if (m_blockNotifications)
@@ -539,6 +539,8 @@ void QNode::notifyObservers(const QSceneChangePtr &change)
}
/*!
+ \obsolete
+
Called when one or more backend aspects sends a notification \a change to the
current Qt3DCore::QNode instance.
@@ -547,7 +549,7 @@ void QNode::notifyObservers(const QSceneChangePtr &change)
*/
void QNode::sceneChangeEvent(const QSceneChangePtr &change)
{
- Q_UNUSED(change);
+ Q_UNUSED(change)
if (change->type() == Qt3DCore::PropertyUpdated) {
// TODO: Do this more efficiently. We could pass the metaobject and property
// index to the animation aspect via the QChannelMapping. This would
@@ -594,8 +596,8 @@ QScene *QNodePrivate::scene() const
*/
void QNodePrivate::notifyPropertyChange(const char *name, const QVariant &value)
{
- Q_UNUSED(name);
- Q_UNUSED(value);
+ Q_UNUSED(name)
+ Q_UNUSED(value)
// Bail out early if we can to avoid operator new
if (m_blockNotifications)
@@ -606,8 +608,8 @@ void QNodePrivate::notifyPropertyChange(const char *name, const QVariant &value)
void QNodePrivate::notifyDynamicPropertyChange(const QByteArray &name, const QVariant &value)
{
- Q_UNUSED(name);
- Q_UNUSED(value);
+ Q_UNUSED(name)
+ Q_UNUSED(value)
// Bail out early if we can to avoid operator new
if (m_blockNotifications)
@@ -997,6 +999,9 @@ void QNode::clearPropertyTrackings()
d->updatePropertyTrackMode();
}
+/*!
+ * \obsolete
+ */
QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
{
// Uncomment this when implementing new frontend and backend types.
@@ -1049,6 +1054,7 @@ QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
*/
/*!
* \brief Sends a command message to the backend node
+ * \obsolete
*
* Creates a QNodeCommand message and dispatches it to the backend node. The
* command is given and a \a name and some \a data which can be used in the
@@ -1079,6 +1085,7 @@ QNodeCommand::CommandId QNode::sendCommand(const QString &name,
/*!
* \brief Send a \a command back to the backend node.
+ * \obsolete
*
* Assumes the command is to be to sent back in reply to itself to the backend node.
*
diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h
index 9ca817fb6..efdec8da5 100644
--- a/src/core/nodes/qnode.h
+++ b/src/core/nodes/qnode.h
@@ -99,9 +99,9 @@ public:
void clearPropertyTracking(const QString &propertyName);
void clearPropertyTrackings();
- QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data = QVariant(),
- QNodeCommand::CommandId replyTo = QNodeCommand::CommandId());
- void sendReply(const QNodeCommandPtr &command);
+ Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data = QVariant(),
+ QNodeCommand::CommandId replyTo = QNodeCommand::CommandId());
+ Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command);
public Q_SLOTS:
void setParent(QNode *parent);
@@ -116,12 +116,12 @@ Q_SIGNALS:
protected:
explicit QNode(QNodePrivate &dd, QNode *parent = nullptr);
- void notifyObservers(const QSceneChangePtr &change);
- virtual void sceneChangeEvent(const QSceneChangePtr &change);
+ Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &change);
+ Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &change);
private:
Q_DECLARE_PRIVATE(QNode)
- virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const;
+ Q3D_DECL_DEPRECATED virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const;
// We only want setParent(QNode *) to be callable
// when dealing with QNode objects
diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h
index 81f33f625..7d48c390a 100644
--- a/src/core/qchangearbiter_p.h
+++ b/src/core/qchangearbiter_p.h
@@ -53,7 +53,6 @@
#include <Qt3DCore/qnodeid.h>
#include <Qt3DCore/qscenechange.h>
-#include <Qt3DCore/private/qscenechange_p.h>
#include <QtCore/QFlags>
#include <QtCore/QMutex>
#include <QtCore/QObject>
@@ -65,6 +64,7 @@
#include <Qt3DCore/private/qlockableobserverinterface_p.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <Qt3DCore/private/qscenechange_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/qpostman_p.h b/src/core/qpostman_p.h
index 23c638239..3e5f91742 100644
--- a/src/core/qpostman_p.h
+++ b/src/core/qpostman_p.h
@@ -75,7 +75,7 @@ class Q_AUTOTEST_EXPORT QPostman final
{
Q_OBJECT
public:
- explicit QPostman(QObject *parent = 0);
+ explicit QPostman(QObject *parent = nullptr);
~QPostman();
void setScene(QScene *sceneLookup) final;
diff --git a/src/core/qscheduler.cpp b/src/core/qscheduler.cpp
index 03d5670cb..2294976ca 100644
--- a/src/core/qscheduler.cpp
+++ b/src/core/qscheduler.cpp
@@ -40,9 +40,10 @@
#include "qscheduler_p.h"
#include <Qt3DCore/qabstractaspect.h>
-#include <Qt3DCore/private/qaspectjob_p.h>
+
#include <Qt3DCore/private/qabstractaspect_p.h>
#include <Qt3DCore/private/qaspectmanager_p.h>
+#include <Qt3DCore/private/qaspectjob_p.h>
#include <Qt3DCore/private/qabstractaspectjobmanager_p.h>
QT_BEGIN_NAMESPACE
@@ -69,7 +70,7 @@ QAspectManager *QScheduler::aspectManager() const
return m_aspectManager;
}
-void QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time)
+int QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time)
{
QVector<QAspectJobPtr> jobQueue;
@@ -92,11 +93,17 @@ void QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time)
m_aspectManager->jobManager()->waitForAllJobs();
- for (auto &job : qAsConst(jobQueue))
- QAspectJobPrivate::get(job.data())->postFrame(m_aspectManager);
+ {
+ QTaskLogger logger(m_aspectManager->serviceLocator()->systemInformation(), 4097, 0);
+
+ for (auto &job : qAsConst(jobQueue))
+ QAspectJobPrivate::get(job.data())->postFrame(m_aspectManager);
+
+ for (QAbstractAspect *aspect : aspects)
+ QAbstractAspectPrivate::get(aspect)->jobsDone(m_aspectManager);
+ }
- for (QAbstractAspect *aspect : aspects)
- QAbstractAspectPrivate::get(aspect)->jobsDone();
+ return jobQueue.size();
}
} // namespace Qt3DCore
diff --git a/src/core/qscheduler_p.h b/src/core/qscheduler_p.h
index 9b1685e54..dd4101ef2 100644
--- a/src/core/qscheduler_p.h
+++ b/src/core/qscheduler_p.h
@@ -64,13 +64,13 @@ class QScheduler : public QObject
{
Q_OBJECT
public:
- explicit QScheduler(QObject *parent = 0);
+ explicit QScheduler(QObject *parent = nullptr);
~QScheduler();
void setAspectManager(QAspectManager *aspectManager);
QAspectManager *aspectManager() const;
- virtual void scheduleAndWaitForFrameAspectJobs(qint64 time);
+ virtual int scheduleAndWaitForFrameAspectJobs(qint64 time);
private:
QAspectManager *m_aspectManager;
diff --git a/src/core/qt3dcore_global.h b/src/core/qt3dcore_global.h
index b2ad787c0..e932b02ba 100644
--- a/src/core/qt3dcore_global.h
+++ b/src/core/qt3dcore_global.h
@@ -55,6 +55,12 @@ QT_BEGIN_NAMESPACE
# define Q_3DCORESHARED_EXPORT
#endif
+#ifdef BUILD_QT3D_MODULE
+#define Q3D_DECL_DEPRECATED
+#else
+#define Q3D_DECL_DEPRECATED Q_DECL_DEPRECATED
+#endif
+
#define QT3D_DECLARE_TYPEINFO(NS, Class, Flags) \
} /* NS */ \
Q_DECLARE_TYPEINFO(NS :: Class, Flags); \
diff --git a/src/core/resources/qloadgltf_p.h b/src/core/resources/qloadgltf_p.h
new file mode 100644
index 000000000..be7ee0d5f
--- /dev/null
+++ b/src/core/resources/qloadgltf_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QLOADGLTF_P_H
+#define QT3DCORE_QLOADGLTF_P_H
+
+#include <QtCore/qcborarray.h>
+#include <QtCore/qcbormap.h>
+#include <QtCore/qcborvalue.h>
+#include <QtCore/qjsonarray.h>
+#include <QtCore/qjsondocument.h>
+#include <QtCore/qjsonobject.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+inline QJsonDocument qLoadGLTF(const QByteArray &gltfData)
+{
+#if QT_CONFIG(binaryjson)
+ {
+ QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(gltfData);
+ if (!sceneDocument.isNull())
+ return sceneDocument;
+ }
+#endif
+ {
+ const QCborValue cbor = QCborValue::fromCbor(gltfData);
+ if (cbor.isMap())
+ return QJsonDocument(cbor.toMap().toJsonObject());
+ if (cbor.isArray())
+ return QJsonDocument(cbor.toArray().toJsonArray());
+ }
+ return QJsonDocument::fromJson(gltfData);
+}
+
+#endif // QT3DCORE_QLOADGLTF_P_H
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h
index b3837fb1f..ba39695a4 100644
--- a/src/core/resources/qresourcemanager_p.h
+++ b/src/core/resources/qresourcemanager_p.h
@@ -476,14 +476,14 @@ template <typename ValueType, typename KeyType,
QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager)
{
QDebugStateSaver saver(dbg);
- dbg << "Contains" << manager.count() << "items" << endl;
+ dbg << "Contains" << manager.count() << "items" << Qt::endl;
- dbg << "Key to Handle Map:" << endl;
+ dbg << "Key to Handle Map:" << Qt::endl;
const auto end = manager.m_keyToHandleMap.cend();
for (auto it = manager.m_keyToHandleMap.cbegin(); it != end; ++it)
- dbg << "QNodeId =" << it.key() << "Handle =" << it.value() << endl;
+ dbg << "QNodeId =" << it.key() << "Handle =" << it.value() << Qt::endl;
-// dbg << "Resources:" << endl;
+// dbg << "Resources:" << Qt::endl;
// dbg << manager.m_handleManager;
return dbg;
}
diff --git a/src/core/resources/resources.pri b/src/core/resources/resources.pri
index 7f3ce4bdc..89540a36d 100644
--- a/src/core/resources/resources.pri
+++ b/src/core/resources/resources.pri
@@ -1,4 +1,5 @@
HEADERS += \
+ $$PWD/qloadgltf_p.h \
$$PWD/qresourcemanager_p.h \
$$PWD/qcircularbuffer_p.h \
$$PWD/qboundedcircularbuffer_p.h \
diff --git a/src/core/services/nullservices_p.h b/src/core/services/nullservices_p.h
index 30dc2d543..6b2d1b029 100644
--- a/src/core/services/nullservices_p.h
+++ b/src/core/services/nullservices_p.h
@@ -54,25 +54,11 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <Qt3DCore/private/qopenglinformationservice_p.h>
-#include <Qt3DCore/private/qsysteminformationservice_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class NullSystemInformationService : public QSystemInformationService
-{
-public:
- NullSystemInformationService()
- : QSystemInformationService(QStringLiteral("Null System Information Service"))
- {}
- ~NullSystemInformationService() {}
-
- QStringList aspectNames() const final { return QStringList(); }
- int threadPoolThreadCount() const final { return 0; }
-};
-
-
class NullOpenGLInformationService : public QOpenGLInformationService
{
public:
diff --git a/src/core/services/qservicelocator.cpp b/src/core/services/qservicelocator.cpp
index bdcb4a521..73a40c2e4 100644
--- a/src/core/services/qservicelocator.cpp
+++ b/src/core/services/qservicelocator.cpp
@@ -46,6 +46,7 @@
#include <Qt3DCore/private/qdownloadhelperservice_p.h>
#include <Qt3DCore/private/qeventfilterservice_p.h>
#include <Qt3DCore/private/qtickclockservice_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p.h>
QT_BEGIN_NAMESPACE
@@ -85,16 +86,19 @@ QString QAbstractServiceProvider::description() const
}
+class QAspectEngine;
+
class QServiceLocatorPrivate
{
public:
- QServiceLocatorPrivate()
- : m_nonNullDefaultServices(0)
+ QServiceLocatorPrivate(QAspectEngine *aspectEngine)
+ : m_systemInfo(aspectEngine)
+ , m_nonNullDefaultServices(0)
{}
QHash<int, QAbstractServiceProvider *> m_services;
- NullSystemInformationService m_nullSystemInfo;
+ QSystemInformationService m_systemInfo;
NullOpenGLInformationService m_nullOpenGLInfo;
QTickClockService m_defaultFrameAdvanceService;
QEventFilterService m_eventFilterService;
@@ -128,8 +132,8 @@ public:
/*
Creates an instance of QServiceLocator.
*/
-QServiceLocator::QServiceLocator()
- : d_ptr(new QServiceLocatorPrivate)
+QServiceLocator::QServiceLocator(QAspectEngine *aspectEngine)
+ : d_ptr(new QServiceLocatorPrivate(aspectEngine))
{
}
@@ -196,7 +200,7 @@ int QServiceLocator::serviceCount() const
QSystemInformationService *QServiceLocator::systemInformation()
{
Q_D(QServiceLocator);
- return static_cast<QSystemInformationService *>(d->m_services.value(SystemInformation, &d->m_nullSystemInfo));
+ return static_cast<QSystemInformationService *>(d->m_services.value(SystemInformation, &d->m_systemInfo));
}
/*
diff --git a/src/core/services/qservicelocator_p.h b/src/core/services/qservicelocator_p.h
index 9111a14ab..5bf71a996 100644
--- a/src/core/services/qservicelocator_p.h
+++ b/src/core/services/qservicelocator_p.h
@@ -85,11 +85,12 @@ class QSystemInformationService;
class QServiceLocatorPrivate;
class QEventFilterService;
class QDownloadHelperService;
+class QAspectEngine;
class Q_3DCORESHARED_EXPORT QServiceLocator
{
public:
- QServiceLocator();
+ QServiceLocator(QAspectEngine *aspectEngine = nullptr);
~QServiceLocator();
enum ServiceType {
diff --git a/src/core/services/qsysteminformationservice.cpp b/src/core/services/qsysteminformationservice.cpp
index f11e0c3d1..40f3594fb 100644
--- a/src/core/services/qsysteminformationservice.cpp
+++ b/src/core/services/qsysteminformationservice.cpp
@@ -40,10 +40,220 @@
#include "qsysteminformationservice_p.h"
#include "qsysteminformationservice_p_p.h"
+#ifdef Q_OS_ANDROID
+#include <QtCore/QStandardPaths>
+#endif
+
+#include <QtCore/QThreadPool>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFile>
+#include <QtCore/QDateTime>
+#include <QtCore/QCoreApplication>
+
+#include <Qt3DCore/QAspectEngine>
+#include <Qt3DCore/QAbstractAspect>
+#include <Qt3DCore/private/qaspectengine_p.h>
+#include <Qt3DCore/private/aspectcommanddebugger_p.h>
+
QT_BEGIN_NAMESPACE
+namespace {
+
+struct FrameHeader
+{
+ FrameHeader()
+ : frameId(0)
+ , jobCount(0)
+ , frameType(WorkerJob)
+ {
+ }
+
+ enum FrameType {
+ WorkerJob = 0,
+ Submission
+ };
+
+ quint32 frameId;
+ quint16 jobCount;
+ quint16 frameType; // Submission or worker job
+};
+
+}
namespace Qt3DCore {
+QSystemInformationServicePrivate::QSystemInformationServicePrivate(QAspectEngine *aspectEngine,
+ const QString &description)
+ : QAbstractServiceProviderPrivate(QServiceLocator::SystemInformation, description)
+ , m_aspectEngine(aspectEngine)
+ , m_submissionStorage(nullptr)
+ , m_frameId(0)
+ , m_commandDebugger(nullptr)
+{
+ m_traceEnabled = qEnvironmentVariableIsSet("QT3D_TRACE_ENABLED");
+ if (m_traceEnabled)
+ m_jobsStatTimer.start();
+
+ const bool commandServerEnabled = qEnvironmentVariableIsSet("QT3D_COMMAND_SERVER_ENABLED");
+ if (commandServerEnabled) {
+ m_commandDebugger = new Debug::AspectCommandDebugger(q_func());
+ m_commandDebugger->initialize();
+ }
+}
+
+QSystemInformationServicePrivate::~QSystemInformationServicePrivate() = default;
+
+QSystemInformationServicePrivate *QSystemInformationServicePrivate::get(QSystemInformationService *q)
+{
+ return q->d_func();
+}
+
+// Called by the jobs
+void QSystemInformationServicePrivate::addJobLogStatsEntry(QSystemInformationServicePrivate::JobRunStats &stats)
+{
+ if (!m_traceEnabled)
+ return;
+
+ if (!m_jobStatsCached.hasLocalData()) {
+ auto jobVector = new QVector<JobRunStats>;
+ m_jobStatsCached.setLocalData(jobVector);
+ QMutexLocker lock(&m_localStoragesMutex);
+ m_localStorages.push_back(jobVector);
+ }
+ m_jobStatsCached.localData()->push_back(stats);
+}
+
+// Called from Submission thread (which can be main thread in Manual drive mode)
+void QSystemInformationServicePrivate::addSubmissionLogStatsEntry(QSystemInformationServicePrivate::JobRunStats &stats)
+{
+ if (!m_traceEnabled)
+ return;
+
+ QMutexLocker lock(&m_localStoragesMutex);
+ if (!m_jobStatsCached.hasLocalData()) {
+ m_submissionStorage = new QVector<JobRunStats>;
+ m_jobStatsCached.setLocalData(m_submissionStorage);
+ }
+
+ // Handle the case where submission thread is also the main thread (Scene/Manual drive modes with no RenderThread)
+ if (m_submissionStorage == nullptr && m_jobStatsCached.hasLocalData())
+ m_submissionStorage = new QVector<JobRunStats>;
+
+ // When having no submission thread this can be null
+ m_submissionStorage->push_back(stats);
+}
+
+// Called after jobs have been executed (MainThread QAspectJobManager::enqueueJobs)
+void QSystemInformationServicePrivate::writeFrameJobLogStats()
+{
+ if (!m_traceEnabled)
+ return;
+
+ using JobRunStats = QSystemInformationServicePrivate::JobRunStats;
+
+ if (!m_traceFile) {
+ const QString fileName = QStringLiteral("trace_") + QCoreApplication::applicationName() + QDateTime::currentDateTime().toString(QStringLiteral("_ddd_dd_MM_yy-hh_mm_ss_"))+ QSysInfo::productType() + QStringLiteral("_") + QSysInfo::buildAbi() + QStringLiteral(".qt3d");
+#ifdef Q_OS_ANDROID
+ m_traceFile.reset(new QFile(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/") + fileName));
+#else
+ // TODO fix for iOS
+ m_traceFile.reset(new QFile(fileName));
+#endif
+ if (!m_traceFile->open(QFile::WriteOnly|QFile::Truncate))
+ qCritical("Failed to open trace file");
+ }
+
+ // Write Aspect + Job threads
+ {
+ FrameHeader header;
+ header.frameId = m_frameId;
+ header.jobCount = 0;
+
+ for (const QVector<JobRunStats> *storage : qAsConst(m_localStorages))
+ header.jobCount += storage->size();
+
+ m_traceFile->write(reinterpret_cast<char *>(&header), sizeof(FrameHeader));
+
+ for (QVector<JobRunStats> *storage : qAsConst(m_localStorages)) {
+ for (const JobRunStats &stat : *storage)
+ m_traceFile->write(reinterpret_cast<const char *>(&stat), sizeof(JobRunStats));
+ storage->clear();
+ }
+ }
+
+ // Write submission thread
+ {
+ QMutexLocker lock(&m_localStoragesMutex);
+ const int submissionJobSize = m_submissionStorage != nullptr ? m_submissionStorage->size() : 0;
+ if (submissionJobSize > 0) {
+ FrameHeader header;
+ header.frameId = m_frameId;
+ header.jobCount = submissionJobSize;
+ header.frameType = FrameHeader::Submission;
+
+ m_traceFile->write(reinterpret_cast<char *>(&header), sizeof(FrameHeader));
+
+ for (const JobRunStats &stat : *m_submissionStorage)
+ m_traceFile->write(reinterpret_cast<const char *>(&stat), sizeof(JobRunStats));
+ m_submissionStorage->clear();
+ }
+ }
+
+ m_traceFile->flush();
+ ++m_frameId;
+}
+
+
+QTaskLogger::QTaskLogger(QSystemInformationService *service, const JobId &jobId, Type type)
+ : m_service(service && service->isTraceEnabled() ? service : nullptr)
+ , m_type(type)
+{
+ m_stats.jobId = jobId;
+ if (m_service) {
+ m_stats.startTime = QSystemInformationServicePrivate::get(m_service)->m_jobsStatTimer.nsecsElapsed();
+ m_stats.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
+ }
+}
+
+QTaskLogger::QTaskLogger(QSystemInformationService *service,
+ const quint32 jobType,
+ const quint32 instance,
+ QTaskLogger::Type type)
+ : m_service(service && service->isTraceEnabled() ? service : nullptr)
+ , m_type(type)
+{
+ m_stats.jobId.typeAndInstance[0] = jobType;
+ m_stats.jobId.typeAndInstance[1] = instance;
+ if (m_service) {
+ m_stats.startTime = QSystemInformationServicePrivate::get(m_service)->m_jobsStatTimer.nsecsElapsed();
+ m_stats.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
+ }
+}
+
+QTaskLogger::~QTaskLogger() {
+ if (m_service) {
+ auto dservice = QSystemInformationServicePrivate::get(m_service);
+ if (m_stats.endTime == 0L)
+ m_stats.endTime = dservice->m_jobsStatTimer.nsecsElapsed();
+ switch (m_type) {
+ case AspectJob: dservice->addJobLogStatsEntry(m_stats); break;
+ case Submission: dservice->addSubmissionLogStatsEntry(m_stats); break;
+ }
+ }
+}
+
+void QTaskLogger::end(qint64 t)
+{
+ m_stats.endTime = t > 0 || !m_service ? t : QSystemInformationServicePrivate::get(m_service)->m_jobsStatTimer.nsecsElapsed();
+}
+
+qint64 QTaskLogger::restart()
+{
+ if (m_service)
+ m_stats.startTime = QSystemInformationServicePrivate::get(m_service)->m_jobsStatTimer.nsecsElapsed();
+ return m_stats.startTime;
+}
+
+
/* !\internal
\class Qt3DCore::QSystemInformationService
\inmodule Qt3DCore
@@ -58,8 +268,14 @@ namespace Qt3DCore {
the new service. This constructor is protected so only subclasses can
instantiate a QSystemInformationService object.
*/
-QSystemInformationService::QSystemInformationService(const QString &description)
- : QAbstractServiceProvider(*new QSystemInformationServicePrivate(description))
+
+QSystemInformationService::QSystemInformationService(QAspectEngine *aspectEngine)
+ : QAbstractServiceProvider(*new QSystemInformationServicePrivate(aspectEngine, QLatin1String("Default System Information Service")))
+{
+}
+
+QSystemInformationService::QSystemInformationService(QAspectEngine *aspectEngine, const QString &description)
+ : QAbstractServiceProvider(*new QSystemInformationServicePrivate(aspectEngine, description))
{
}
@@ -71,19 +287,93 @@ QSystemInformationService::QSystemInformationService(QSystemInformationServicePr
{
}
+bool QSystemInformationService::isTraceEnabled() const
+{
+ Q_D(const QSystemInformationService);
+ return d->m_traceEnabled;
+}
+
+bool QSystemInformationService::isCommandServerEnabled() const
+{
+ Q_D(const QSystemInformationService);
+ return d->m_commandDebugger != nullptr;
+}
+
+void QSystemInformationService::setTraceEnabled(bool traceEnabled)
+{
+ Q_D(QSystemInformationService);
+ if (d->m_traceEnabled != traceEnabled) {
+ d->m_traceEnabled = traceEnabled;
+ emit traceEnabledChanged(d->m_traceEnabled);
+ if (d->m_traceEnabled) {
+ if (!d->m_jobsStatTimer.isValid())
+ d->m_jobsStatTimer.start();
+ } else {
+ d->m_traceFile.reset();
+ }
+ }
+}
+
/*
\fn QStringList Qt3DCore::QSystemInformationService::aspectNames() const
- Subclasses should override this function and return a string list containing the
- names of all registered aspects.
+ Returns a string list containing the names of all registered aspects.
*/
+QStringList QSystemInformationService::aspectNames() const
+{
+ Q_D(const QSystemInformationService);
+ if (!d->m_aspectEngine)
+ return {};
+
+ QStringList res;
+ const auto aspects = d->m_aspectEngine->aspects();
+ if (aspects.isEmpty())
+ return { QLatin1String("No loaded aspects") };
+
+ QAspectEnginePrivate *dengine = QAspectEnginePrivate::get(d->m_aspectEngine);
+ for (auto aspect: aspects) {
+ const QString name = dengine->m_factory.aspectName(aspect);
+ if (!name.isEmpty())
+ res << name;
+ else
+ res << QLatin1String("<unnamed>");
+ }
+
+ return res;
+}
/*
\fn int Qt3DCore::QSystemInformationService::threadPoolThreadCount() const
- Subclasses should override this function and return the number of threads in the
- Qt3D task manager's threadpool.
+ Returns the maximum number of threads in the Qt3D task manager's threadpool.
*/
+int QSystemInformationService::threadPoolThreadCount() const
+{
+ return QThreadPool::globalInstance()->maxThreadCount();
+}
+
+void QSystemInformationService::writePreviousFrameTraces()
+{
+ Q_D(QSystemInformationService);
+ d->writeFrameJobLogStats();
+}
+
+QVariant QSystemInformationService::executeCommand(const QString &command)
+{
+ Q_D(QSystemInformationService);
+
+ if (command == QLatin1String("tracing on")) {
+ setTraceEnabled(true);
+ return {isTraceEnabled()};
+ }
+
+ if (command == QLatin1String("tracing off")) {
+ setTraceEnabled(false);
+ return {isTraceEnabled()};
+ }
+
+ return d->m_aspectEngine->executeCommand(command);
+}
}
diff --git a/src/core/services/qsysteminformationservice_p.h b/src/core/services/qsysteminformationservice_p.h
index a8a83701b..64e6c779e 100644
--- a/src/core/services/qsysteminformationservice_p.h
+++ b/src/core/services/qsysteminformationservice_p.h
@@ -61,16 +61,34 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QSystemInformationServicePrivate;
+struct JobRunStats;
class Q_3DCORESHARED_EXPORT QSystemInformationService : public QAbstractServiceProvider
{
Q_OBJECT
+ Q_PROPERTY(bool traceEnabled READ isTraceEnabled WRITE setTraceEnabled NOTIFY traceEnabledChanged)
+ Q_PROPERTY(bool commandServerEnabled READ isCommandServerEnabled CONSTANT)
public:
- virtual QStringList aspectNames() const = 0;
- virtual int threadPoolThreadCount() const = 0;
+ QSystemInformationService(QAspectEngine *aspectEngine);
+
+ bool isTraceEnabled() const;
+ bool isCommandServerEnabled() const;
+
+ void setTraceEnabled(bool traceEnabled);
+
+ QStringList aspectNames() const;
+ int threadPoolThreadCount() const;
+
+ void writePreviousFrameTraces();
+
+ QVariant executeCommand(const QString &command);
+
+signals:
+ void traceEnabledChanged(bool traceEnabled);
protected:
- QSystemInformationService(const QString &description = QString());
+ Q_DECLARE_PRIVATE(QSystemInformationService)
+ QSystemInformationService(QAspectEngine *aspectEngine, const QString &description);
QSystemInformationService(QSystemInformationServicePrivate &dd);
};
diff --git a/src/core/services/qsysteminformationservice_p_p.h b/src/core/services/qsysteminformationservice_p_p.h
index e3ce9fe49..222f4e1af 100644
--- a/src/core/services/qsysteminformationservice_p_p.h
+++ b/src/core/services/qsysteminformationservice_p_p.h
@@ -51,21 +51,98 @@
// We mean it.
//
-#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/QThreadStorage>
+#include <QtCore/QElapsedTimer>
+#include <QtCore/QFile>
+#include <QtCore/QMutex>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
#include <Qt3DCore/private/qabstractserviceprovider_p.h>
#include <Qt3DCore/private/qservicelocator_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QSystemInformationServicePrivate : public QAbstractServiceProviderPrivate
+namespace Debug {
+class AspectCommandDebugger;
+} // Debug
+
+union Q_3DCORE_PRIVATE_EXPORT JobId
+{
+ JobId() : id(0L) { }
+ JobId(quint32 t, quint32 i) { typeAndInstance[0] = t; typeAndInstance[1] = i; }
+
+ quint32 typeAndInstance[2];
+ quint64 id;
+};
+
+class Q_3DCORE_PRIVATE_EXPORT QSystemInformationServicePrivate : public QAbstractServiceProviderPrivate
{
public:
- QSystemInformationServicePrivate(const QString &description)
- : QAbstractServiceProviderPrivate(QServiceLocator::SystemInformation, description)
- {}
+ struct JobRunStats
+ {
+ JobRunStats() { jobId.id = 0; startTime = 0L; endTime = 0L; }
+
+ qint64 startTime;
+ qint64 endTime;
+ JobId jobId; // QAspectJob subclasses should properly populate the jobId
+ quint64 threadId;
+ };
+
+ QSystemInformationServicePrivate(QAspectEngine *aspectEngine, const QString &description);
+ ~QSystemInformationServicePrivate();
+
+ static QSystemInformationServicePrivate *get(QSystemInformationService *q);
+
+ // Aspects + Job threads
+ void addJobLogStatsEntry(JobRunStats &stats);
+
+ // Submission thread
+ void addSubmissionLogStatsEntry(JobRunStats &stats);
+
+ void writeFrameJobLogStats();
+
+ QAspectEngine *m_aspectEngine;
+ bool m_traceEnabled;
+
+ QElapsedTimer m_jobsStatTimer;
+ QThreadStorage<QVector<JobRunStats> *> m_jobStatsCached;
+
+ QVector<QVector<JobRunStats> *> m_localStorages;
+ QVector<JobRunStats> *m_submissionStorage;
+
+ QMutex m_localStoragesMutex;
+
+ QScopedPointer<QFile> m_traceFile;
+ quint32 m_frameId;
+
+ Debug::AspectCommandDebugger *m_commandDebugger;
+
+ Q_DECLARE_PUBLIC(QSystemInformationService)
+};
+
+class Q_3DCORE_PRIVATE_EXPORT QTaskLogger {
+public:
+ enum Type {
+ AspectJob,
+ Submission
+ };
+
+ QTaskLogger(QSystemInformationService *service, const JobId &jobId, Type type);
+ QTaskLogger(QSystemInformationService *service, const quint32 jobType, const quint32 instance, Type type = Submission);
+
+ ~QTaskLogger();
+
+ void end(qint64 t = 0L);
+ qint64 restart();
+
+private:
+ QSystemInformationService *m_service;
+ QSystemInformationServicePrivate::JobRunStats m_stats;
+ Type m_type;
};
}
diff --git a/src/core/transforms/matrix4x4_avx2.cpp b/src/core/transforms/matrix4x4_avx2.cpp
index 556e778d0..a06a59a99 100644
--- a/src/core/transforms/matrix4x4_avx2.cpp
+++ b/src/core/transforms/matrix4x4_avx2.cpp
@@ -47,12 +47,12 @@ namespace Qt3DCore {
QDebug operator<<(QDebug dbg, const Matrix4x4_AVX2 &m)
{
- dbg.nospace() << "Matrix4x4_AVX2(" << endl
+ dbg.nospace() << "Matrix4x4_AVX2(" << Qt::endl
<< qSetFieldWidth(10)
- << m.m11() << m.m12() << m.m13() << m.m14() << endl
- << m.m21() << m.m22() << m.m23() << m.m24() << endl
- << m.m31() << m.m32() << m.m33() << m.m34() << endl
- << m.m41() << m.m42() << m.m43() << m.m44() << endl
+ << m.m11() << m.m12() << m.m13() << m.m14() << Qt::endl
+ << m.m21() << m.m22() << m.m23() << m.m24() << Qt::endl
+ << m.m31() << m.m32() << m.m33() << m.m34() << Qt::endl
+ << m.m41() << m.m42() << m.m43() << m.m44() << Qt::endl
<< qSetFieldWidth(0) << ')';
return dbg;
}
diff --git a/src/core/transforms/matrix4x4_sse.cpp b/src/core/transforms/matrix4x4_sse.cpp
index d35cc2e35..bc8c57b9d 100644
--- a/src/core/transforms/matrix4x4_sse.cpp
+++ b/src/core/transforms/matrix4x4_sse.cpp
@@ -47,12 +47,12 @@ namespace Qt3DCore {
QDebug operator<<(QDebug dbg, const Matrix4x4_SSE &m)
{
- dbg.nospace() << "Matrix4x4_SSE(" << endl
+ dbg.nospace() << "Matrix4x4_SSE(" << Qt::endl
<< qSetFieldWidth(10)
- << m.m11() << m.m12() << m.m13() << m.m14() << endl
- << m.m21() << m.m22() << m.m23() << m.m24() << endl
- << m.m31() << m.m32() << m.m33() << m.m34() << endl
- << m.m41() << m.m42() << m.m43() << m.m44() << endl
+ << m.m11() << m.m12() << m.m13() << m.m14() << Qt::endl
+ << m.m21() << m.m22() << m.m23() << m.m24() << Qt::endl
+ << m.m31() << m.m32() << m.m33() << m.m34() << Qt::endl
+ << m.m41() << m.m42() << m.m43() << m.m44() << Qt::endl
<< qSetFieldWidth(0) << ')';
return dbg;
}
diff --git a/src/input/backend/assignkeyboardfocusjob.cpp b/src/input/backend/assignkeyboardfocusjob.cpp
index d5947f9c9..5fe329004 100644
--- a/src/input/backend/assignkeyboardfocusjob.cpp
+++ b/src/input/backend/assignkeyboardfocusjob.cpp
@@ -77,7 +77,7 @@ void AssignKeyboardFocusJob::setInputHandler(InputHandler *handler)
void AssignKeyboardFocusJob::run()
{
- Q_DJOB(AssignKeyboardFocusJob);
+ Q_D(AssignKeyboardFocusJob);
KeyboardDevice *keyboardDevice = m_inputHandler->keyboardDeviceManager()->lookupResource(m_keyboardDevice);
const auto handles = m_inputHandler->keyboardInputManager()->activeHandles();
diff --git a/src/input/backend/assignkeyboardfocusjob_p.h b/src/input/backend/assignkeyboardfocusjob_p.h
index 87cc2fbda..200fd72f1 100644
--- a/src/input/backend/assignkeyboardfocusjob_p.h
+++ b/src/input/backend/assignkeyboardfocusjob_p.h
@@ -70,6 +70,8 @@ public:
void run() override;
private:
+ Q_DECLARE_PRIVATE(AssignKeyboardFocusJob)
+
InputHandler *m_inputHandler;
const Qt3DCore::QNodeId m_keyboardDevice;
};
diff --git a/src/input/backend/axisaccumulatorjob.cpp b/src/input/backend/axisaccumulatorjob.cpp
index b6c1c8482..16a68349e 100644
--- a/src/input/backend/axisaccumulatorjob.cpp
+++ b/src/input/backend/axisaccumulatorjob.cpp
@@ -73,7 +73,7 @@ AxisAccumulatorJob::AxisAccumulatorJob(AxisAccumulatorManager *axisAccumulatorma
void AxisAccumulatorJob::run()
{
- Q_DJOB(AxisAccumulatorJob);
+ Q_D(AxisAccumulatorJob);
// Iterate over the accumulators and ask each to step the integrations
const auto activeHandles = m_axisAccumulatorManager->activeHandles();
d->updates.reserve(activeHandles.size());
diff --git a/src/input/backend/axisaccumulatorjob_p.h b/src/input/backend/axisaccumulatorjob_p.h
index 3e8122287..702004dd2 100644
--- a/src/input/backend/axisaccumulatorjob_p.h
+++ b/src/input/backend/axisaccumulatorjob_p.h
@@ -75,6 +75,8 @@ public:
void run() override;
private:
+ Q_DECLARE_PRIVATE(AxisAccumulatorJob)
+
AxisAccumulatorManager *m_axisAccumulatorManager;
AxisManager *m_axisManager;
float m_dt;
diff --git a/src/input/backend/keyeventdispatcherjob.cpp b/src/input/backend/keyeventdispatcherjob.cpp
index 31db01e53..26a35e885 100644
--- a/src/input/backend/keyeventdispatcherjob.cpp
+++ b/src/input/backend/keyeventdispatcherjob.cpp
@@ -67,7 +67,7 @@ KeyEventDispatcherJob::KeyEventDispatcherJob(Qt3DCore::QNodeId input, const QLis
: QAspectJob(*new KeyEventDispatcherJobPrivate)
, m_inputHandler(nullptr)
{
- Q_DJOB(KeyEventDispatcherJob);
+ Q_D(KeyEventDispatcherJob);
d->m_keyboardHandler = input;
d->m_events = events;
SET_JOB_RUN_STAT_TYPE(this, JobTypes::KeyEventDispatcher, 0)
diff --git a/src/input/backend/keyeventdispatcherjob_p.h b/src/input/backend/keyeventdispatcherjob_p.h
index 975dc3d31..bd0c770d4 100644
--- a/src/input/backend/keyeventdispatcherjob_p.h
+++ b/src/input/backend/keyeventdispatcherjob_p.h
@@ -71,6 +71,8 @@ public:
void run() override;
private:
+ Q_DECLARE_PRIVATE(KeyEventDispatcherJob)
+
InputHandler *m_inputHandler;
};
diff --git a/src/input/backend/loadproxydevicejob.cpp b/src/input/backend/loadproxydevicejob.cpp
index 059d14bc0..69f14beae 100644
--- a/src/input/backend/loadproxydevicejob.cpp
+++ b/src/input/backend/loadproxydevicejob.cpp
@@ -94,7 +94,7 @@ QVector<Qt3DCore::QNodeId> LoadProxyDeviceJob::proxies() const
void LoadProxyDeviceJob::run()
{
- Q_DJOB(LoadProxyDeviceJob);
+ Q_D(LoadProxyDeviceJob);
d->updates.reserve(m_proxies.size());
Q_ASSERT(m_inputHandler);
diff --git a/src/input/backend/loadproxydevicejob_p.h b/src/input/backend/loadproxydevicejob_p.h
index 0a425f3a5..0848c8529 100644
--- a/src/input/backend/loadproxydevicejob_p.h
+++ b/src/input/backend/loadproxydevicejob_p.h
@@ -76,6 +76,8 @@ public:
void run() final;
private:
+ Q_DECLARE_PRIVATE(LoadProxyDeviceJob)
+
InputHandler *m_inputHandler;
QVector<Qt3DCore::QNodeId> m_proxies;
};
diff --git a/src/input/backend/mouseeventdispatcherjob.cpp b/src/input/backend/mouseeventdispatcherjob.cpp
index b91a7b638..0ee6862fb 100644
--- a/src/input/backend/mouseeventdispatcherjob.cpp
+++ b/src/input/backend/mouseeventdispatcherjob.cpp
@@ -75,7 +75,7 @@ MouseEventDispatcherJob::MouseEventDispatcherJob(Qt3DCore::QNodeId input,
: QAspectJob(*new MouseEventDispatcherJobPrivate)
, m_inputHandler(nullptr)
{
- Q_DJOB(MouseEventDispatcherJob);
+ Q_D(MouseEventDispatcherJob);
d->m_mouseInput = input;
d->m_mouseEvents = mouseEvents;
#if QT_CONFIG(wheelevent)
diff --git a/src/input/backend/mouseeventdispatcherjob_p.h b/src/input/backend/mouseeventdispatcherjob_p.h
index 983837446..696d60da4 100644
--- a/src/input/backend/mouseeventdispatcherjob_p.h
+++ b/src/input/backend/mouseeventdispatcherjob_p.h
@@ -76,6 +76,8 @@ public:
void run() final;
private:
+ Q_DECLARE_PRIVATE(MouseEventDispatcherJob)
+
InputHandler *m_inputHandler;
};
diff --git a/src/input/backend/updateaxisactionjob.cpp b/src/input/backend/updateaxisactionjob.cpp
index 5732c2a9b..58ed36639 100644
--- a/src/input/backend/updateaxisactionjob.cpp
+++ b/src/input/backend/updateaxisactionjob.cpp
@@ -89,7 +89,7 @@ void UpdateAxisActionJob::run()
void UpdateAxisActionJob::updateAction(LogicalDevice *device)
{
- Q_DJOB(UpdateAxisActionJob);
+ Q_D(UpdateAxisActionJob);
const auto actionIds = device->actions();
d->m_triggeredActions.reserve(actionIds.size());
@@ -117,7 +117,7 @@ bool UpdateAxisActionJob::processActionInput(const Qt3DCore::QNodeId actionInput
void UpdateAxisActionJob::updateAxis(LogicalDevice *device)
{
- Q_DJOB(UpdateAxisActionJob);
+ Q_D(UpdateAxisActionJob);
const auto axisIds = device->axes();
d->m_triggeredAxis.reserve(axisIds.size());
diff --git a/src/input/backend/updateaxisactionjob_p.h b/src/input/backend/updateaxisactionjob_p.h
index 39b5f5cf6..040ed9775 100644
--- a/src/input/backend/updateaxisactionjob_p.h
+++ b/src/input/backend/updateaxisactionjob_p.h
@@ -76,6 +76,8 @@ public:
void run() final;
private:
+ Q_DECLARE_PRIVATE(UpdateAxisActionJob)
+
void updateAction(LogicalDevice *device);
bool processActionInput(const Qt3DCore::QNodeId actionInputId);
void updateAxis(LogicalDevice *device);
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp
index 31a0f8b1e..e109461f0 100644
--- a/src/input/frontend/qinputaspect.cpp
+++ b/src/input/frontend/qinputaspect.cpp
@@ -141,33 +141,33 @@ QInputAspect::QInputAspect(QObject *parent)
QInputAspect::QInputAspect(QInputAspectPrivate &dd, QObject *parent)
: QAbstractAspect(dd, parent)
{
- Q_D(QInputAspect);
setObjectName(QStringLiteral("Input Aspect"));
qRegisterMetaType<Qt3DInput::QAbstractPhysicalDevice*>();
- d->registerBackendType<QKeyboardDevice, true>(QBackendNodeMapperPtr(new Input::KeyboardDeviceFunctor(this, d_func()->m_inputHandler.data())));
- d->registerBackendType<QKeyboardHandler, true>(QBackendNodeMapperPtr(new Input::KeyboardHandlerFunctor(d_func()->m_inputHandler.data())));
- d->registerBackendType<QMouseDevice, true>(QBackendNodeMapperPtr(new Input::MouseDeviceFunctor(this, d_func()->m_inputHandler.data())));
- d->registerBackendType<QMouseHandler, true>(QBackendNodeMapperPtr(new Input::MouseHandlerFunctor(d_func()->m_inputHandler.data())));
- d->registerBackendType<QAxis, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::Axis, Input::AxisManager>(d_func()->m_inputHandler->axisManager())));
- d->registerBackendType<QAxisAccumulator, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AxisAccumulator, Input::AxisAccumulatorManager>(d_func()->m_inputHandler->axisAccumulatorManager())));
- d->registerBackendType<QAnalogAxisInput, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AnalogAxisInput, Input::AnalogAxisInputManager>(d_func()->m_inputHandler->analogAxisInputManager())));
- d->registerBackendType<QButtonAxisInput, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ButtonAxisInput, Input::ButtonAxisInputManager>(d_func()->m_inputHandler->buttonAxisInputManager())));
- d->registerBackendType<QAxisSetting, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AxisSetting, Input::AxisSettingManager>(d_func()->m_inputHandler->axisSettingManager())));
- d->registerBackendType<Qt3DInput::QAction, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::Action, Input::ActionManager>(d_func()->m_inputHandler->actionManager())));
- d->registerBackendType<QActionInput, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ActionInput, Input::ActionInputManager>(d_func()->m_inputHandler->actionInputManager())));
- d->registerBackendType<QInputChord, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputChord, Input::InputChordManager>(d_func()->m_inputHandler->inputChordManager())));
- d->registerBackendType<QInputSequence, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputSequence, Input::InputSequenceManager>(d_func()->m_inputHandler->inputSequenceManager())));
- d->registerBackendType<QLogicalDevice, true>(QBackendNodeMapperPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager())));
- d->registerBackendType<QGenericInputDevice, true>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
- d->registerBackendType<QInputSettings, true>(QBackendNodeMapperPtr(new Input::InputSettingsFunctor(d_func()->m_inputHandler.data())));
- d->registerBackendType<QAbstractPhysicalDeviceProxy, true>(QBackendNodeMapperPtr(new Input::PhysicalDeviceProxyNodeFunctor(d_func()->m_inputHandler->physicalDeviceProxyManager())));
+ registerBackendType<QKeyboardDevice, true>(QBackendNodeMapperPtr(new Input::KeyboardDeviceFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QKeyboardHandler, true>(QBackendNodeMapperPtr(new Input::KeyboardHandlerFunctor(d_func()->m_inputHandler.data())));
+ registerBackendType<QMouseDevice, true>(QBackendNodeMapperPtr(new Input::MouseDeviceFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QMouseHandler, true>(QBackendNodeMapperPtr(new Input::MouseHandlerFunctor(d_func()->m_inputHandler.data())));
+ registerBackendType<QAxis, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::Axis, Input::AxisManager>(d_func()->m_inputHandler->axisManager())));
+ registerBackendType<QAxisAccumulator, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AxisAccumulator, Input::AxisAccumulatorManager>(d_func()->m_inputHandler->axisAccumulatorManager())));
+ registerBackendType<QAnalogAxisInput, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AnalogAxisInput, Input::AnalogAxisInputManager>(d_func()->m_inputHandler->analogAxisInputManager())));
+ registerBackendType<QButtonAxisInput, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ButtonAxisInput, Input::ButtonAxisInputManager>(d_func()->m_inputHandler->buttonAxisInputManager())));
+ registerBackendType<QAxisSetting, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AxisSetting, Input::AxisSettingManager>(d_func()->m_inputHandler->axisSettingManager())));
+ registerBackendType<Qt3DInput::QAction, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::Action, Input::ActionManager>(d_func()->m_inputHandler->actionManager())));
+ registerBackendType<QActionInput, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ActionInput, Input::ActionInputManager>(d_func()->m_inputHandler->actionInputManager())));
+ registerBackendType<QInputChord, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputChord, Input::InputChordManager>(d_func()->m_inputHandler->inputChordManager())));
+ registerBackendType<QInputSequence, true>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputSequence, Input::InputSequenceManager>(d_func()->m_inputHandler->inputSequenceManager())));
+ registerBackendType<QLogicalDevice, true>(QBackendNodeMapperPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager())));
+ registerBackendType<QGenericInputDevice, true>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QInputSettings, true>(QBackendNodeMapperPtr(new Input::InputSettingsFunctor(d_func()->m_inputHandler.data())));
+ registerBackendType<QAbstractPhysicalDeviceProxy, true>(QBackendNodeMapperPtr(new Input::PhysicalDeviceProxyNodeFunctor(d_func()->m_inputHandler->physicalDeviceProxyManager())));
#ifdef HAVE_QGAMEPAD
- d->registerBackendType<QGamepadInput, true>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QGamepadInput, true>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
#endif
+ Q_D(QInputAspect);
// Plugins are QInputDeviceIntegration instances
d->loadInputDevicePlugins();
diff --git a/src/logic/callbackjob.cpp b/src/logic/callbackjob.cpp
index 5c04d8838..5dfc74f02 100644
--- a/src/logic/callbackjob.cpp
+++ b/src/logic/callbackjob.cpp
@@ -51,7 +51,7 @@ CallbackJob::CallbackJob()
: QAspectJob()
, m_logicManager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::Callback, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::Callback, 0)
}
void CallbackJob::setManager(Manager *manager)
diff --git a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
index ab783102d..8adb70f96 100644
--- a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
+++ b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
@@ -48,6 +48,7 @@
#include <Qt3DRender/QGeometry>
#include <Qt3DRender/private/renderlogging_p.h>
+#include <Qt3DCore/private/qloadgltf_p.h>
QT_BEGIN_NAMESPACE
@@ -102,12 +103,7 @@ bool GLTFGeometryLoader::load(QIODevice *ioDev, const QString &subMesh)
{
Q_UNUSED(subMesh);
- QByteArray jsonData = ioDev->readAll();
- QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
- if (sceneDocument.isNull())
- sceneDocument = QJsonDocument::fromJson(jsonData);
-
- if (Q_UNLIKELY(!setJSON(sceneDocument))) {
+ if (Q_UNLIKELY(!setJSON(qLoadGLTF(ioDev->readAll())))) {
qCWarning(GLTFGeometryLoaderLog, "not a JSON document");
return false;
}
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index a10a83cca..860dec3e7 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -108,6 +108,7 @@
#include <Qt3DExtras/qtorusmesh.h>
#include <private/qurlhelper_p.h>
+#include <private/qloadgltf_p.h>
/**
* glTF 2.0 conformance report
@@ -410,12 +411,7 @@ void GLTFImporter::setSource(const QUrl &source)
QFile f(path);
f.open(QIODevice::ReadOnly);
- QByteArray jsonData = f.readAll();
- QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
- if (sceneDocument.isNull())
- sceneDocument = QJsonDocument::fromJson(jsonData);
-
- if (Q_UNLIKELY(!setJSON(sceneDocument))) {
+ if (Q_UNLIKELY(!setJSON(qLoadGLTF(f.readAll())))) {
qCWarning(GLTFImporterLog, "not a JSON document");
return;
}
@@ -430,11 +426,7 @@ void GLTFImporter::setSource(const QUrl &source)
*/
void GLTFImporter::setData(const QByteArray& data, const QString &basePath)
{
- QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(data);
- if (sceneDocument.isNull())
- sceneDocument = QJsonDocument::fromJson(data);
-
- if (Q_UNLIKELY(!setJSON(sceneDocument))) {
+ if (Q_UNLIKELY(!setJSON(qLoadGLTF(data)))) {
qCWarning(GLTFImporterLog, "not a JSON document");
return;
}
diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.cpp b/src/quick3d/quick3dscene2d/items/qscene2d.cpp
index 09d50a5aa..b12adb8ed 100644
--- a/src/quick3d/quick3dscene2d/items/qscene2d.cpp
+++ b/src/quick3d/quick3dscene2d/items/qscene2d.cpp
@@ -310,6 +310,15 @@ QVector<Qt3DCore::QEntity*> QScene2D::entities()
}
/*!
+ Retrieve entities associated with the QScene2D.
+ */
+QVector<Qt3DCore::QEntity*> QScene2D::entities() const
+{
+ Q_D(const QScene2D);
+ return d->m_entities;
+}
+
+/*!
Adds an \a entity to the the QScene2D object. If the entities have QObjectPicker,
the pick events from that entity are sent to QScene2D and converted to mouse events.
*/
diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.h b/src/quick3d/quick3dscene2d/items/qscene2d.h
index 45d0f26c9..38eaf7359 100644
--- a/src/quick3d/quick3dscene2d/items/qscene2d.h
+++ b/src/quick3d/quick3dscene2d/items/qscene2d.h
@@ -81,7 +81,8 @@ public:
QQuickItem *item() const;
bool isMouseEnabled() const;
- QVector<Qt3DCore::QEntity *> entities();
+ Q_DECL_DEPRECATED QVector<Qt3DCore::QEntity *> entities();
+ QVector<Qt3DCore::QEntity *> entities() const;
void addEntity(Qt3DCore::QEntity *entity);
void removeEntity(Qt3DCore::QEntity *entity);
diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp
index bfd6ce7ef..a2247705e 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d.cpp
+++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp
@@ -193,7 +193,7 @@ void Scene2D::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
if (id != m_outputId)
setOutput(id);
- auto ids = Qt3DCore::qIdsForNodes(const_cast<QScene2D *>(node)->entities());
+ auto ids = Qt3DCore::qIdsForNodes(node->entities());
std::sort(std::begin(ids), std::end(ids));
Qt3DCore::QNodeIdVector addedEntities;
Qt3DCore::QNodeIdVector removedEntities;
diff --git a/src/render/backend/abstractrenderer_p.h b/src/render/backend/abstractrenderer_p.h
index c8dd537c7..8bbfcd548 100644
--- a/src/render/backend/abstractrenderer_p.h
+++ b/src/render/backend/abstractrenderer_p.h
@@ -71,6 +71,7 @@ class QAbstractFrameAdvanceService;
class QEventFilterService;
class QAbstractAspectJobManager;
class QServiceLocator;
+class QAspectManager;
}
namespace Qt3DRender {
@@ -153,6 +154,7 @@ public:
#endif
virtual bool shouldRender() const = 0;
virtual void skipNextFrame() = 0;
+ virtual void jobsDone(Qt3DCore::QAspectManager *manager) = 0;
virtual QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() = 0;
virtual QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() = 0;
diff --git a/src/render/backend/cameralens.cpp b/src/render/backend/cameralens.cpp
index d902a08c7..e1d72efda 100644
--- a/src/render/backend/cameralens.cpp
+++ b/src/render/backend/cameralens.cpp
@@ -49,6 +49,7 @@
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qtransform.h>
+#include <Qt3DCore/private/qaspectmanager_p.h>
QT_BEGIN_NAMESPACE
@@ -63,21 +64,21 @@ namespace {
class GetBoundingVolumeWithoutCameraJob : public ComputeFilteredBoundingVolumeJob
{
public:
- GetBoundingVolumeWithoutCameraJob(CameraLens *lens,
- QNodeCommand::CommandId commandId)
- : m_lens(lens), m_commandId(commandId)
+ GetBoundingVolumeWithoutCameraJob(CameraLens *lens, QNodeId commandId)
+ : m_lens(lens), m_requestId(commandId)
{
}
protected:
- void finished(const Sphere &sphere) override
+ // called in main thread
+ void finished(Qt3DCore::QAspectManager *aspectManager, const Sphere &sphere) override
{
- m_lens->notifySceneBoundingVolume(sphere, m_commandId);
+ m_lens->processViewAllResult(aspectManager, sphere, m_requestId);
}
private:
CameraLens *m_lens;
- QNodeCommand::CommandId m_commandId;
+ QNodeId m_requestId;
};
} // namespace
@@ -135,34 +136,23 @@ void CameraLens::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTim
markDirty(AbstractRenderer::AllDirty);
}
- if (node->exposure() != m_exposure) {
+ if (!qFuzzyCompare(node->exposure(), m_exposure)) {
m_exposure = node->exposure();
markDirty(AbstractRenderer::AllDirty);
}
const QCameraLensPrivate *d = static_cast<const QCameraLensPrivate *>(QNodePrivate::get(node));
- if (d->m_pendingViewAllCommand != m_pendingViewAllCommand) {
- m_pendingViewAllCommand = d->m_pendingViewAllCommand;
-
- if (m_pendingViewAllCommand) {
- const QVariant v = m_pendingViewAllCommand.data;
- const QNodeCommand::CommandId commandId = m_pendingViewAllCommand.commandId;
-
- if (m_pendingViewAllCommand.name == QLatin1String("QueryRootBoundingVolume")) {
- const QNodeId id = v.value<QNodeId>();
- computeSceneBoundingVolume({}, id, commandId);
- } else if (m_pendingViewAllCommand.name == QLatin1String("QueryEntityBoundingVolume")) {
- const QVector<QNodeId> ids = v.value<QVector<QNodeId>>();
- if (ids.size() == 2)
- computeSceneBoundingVolume(ids[0], ids[1], commandId);
- }
- }
+ if (d->m_pendingViewAllRequest != m_pendingViewAllRequest) {
+ m_pendingViewAllRequest = d->m_pendingViewAllRequest;
+
+ if (m_pendingViewAllRequest)
+ computeSceneBoundingVolume(m_pendingViewAllRequest.entityId, m_pendingViewAllRequest.cameraId, m_pendingViewAllRequest.requestId);
}
}
void CameraLens::computeSceneBoundingVolume(QNodeId entityId,
QNodeId cameraId,
- QNodeCommand::CommandId commandId)
+ QNodeId requestId)
{
if (!m_renderer || !m_renderAspect)
return;
@@ -175,7 +165,7 @@ void CameraLens::computeSceneBoundingVolume(QNodeId entityId,
return;
Entity *camNode = nodeManagers->renderNodesManager()->lookupResource(cameraId);
- ComputeFilteredBoundingVolumeJobPtr job(new GetBoundingVolumeWithoutCameraJob(this, commandId));
+ ComputeFilteredBoundingVolumeJobPtr job(new GetBoundingVolumeWithoutCameraJob(this, requestId));
job->addDependency(m_renderer->expandBoundingVolumeJob());
job->setRoot(root);
job->setManagers(nodeManagers);
@@ -183,18 +173,18 @@ void CameraLens::computeSceneBoundingVolume(QNodeId entityId,
m_renderAspect->scheduleSingleShotJob(job);
}
-void CameraLens::notifySceneBoundingVolume(const Sphere &sphere, QNodeCommand::CommandId commandId)
+void CameraLens::processViewAllResult(QAspectManager *aspectManager, const Sphere &sphere, QNodeId commandId)
{
- if (!m_pendingViewAllCommand || m_pendingViewAllCommand.commandId != commandId)
+ if (!m_pendingViewAllRequest || m_pendingViewAllRequest.requestId != commandId)
return;
if (sphere.radius() > 0.f) {
- QVector<float> data = { sphere.center().x(), sphere.center().y(), sphere.center().z(),
- sphere.radius() };
- QVariant v;
- v.setValue(data);
- sendCommand(QLatin1String("ViewAll"), v, m_pendingViewAllCommand.commandId);
+ QCameraLens *lens = qobject_cast<QCameraLens *>(aspectManager->lookupNode(peerId()));
+ if (lens) {
+ QCameraLensPrivate *dlens = static_cast<QCameraLensPrivate *>(QCameraLensPrivate::get(lens));
+ dlens->processViewAllResult(m_pendingViewAllRequest.requestId, { sphere.center().x(), sphere.center().y(), sphere.center().z() }, sphere.radius());
+ }
}
- m_pendingViewAllCommand = {};
+ m_pendingViewAllRequest = {};
}
void CameraLens::setProjection(const Matrix4x4 &projection)
diff --git a/src/render/backend/cameralens_p.h b/src/render/backend/cameralens_p.h
index bd721d5e9..4afa38620 100644
--- a/src/render/backend/cameralens_p.h
+++ b/src/render/backend/cameralens_p.h
@@ -52,7 +52,6 @@
//
#include <Qt3DRender/private/backendnode_p.h>
-#include <Qt3DCore/private/qnodecommand_p.h>
#include <Qt3DCore/private/matrix4x4_p.h>
#include <Qt3DRender/private/qcameralens_p.h>
#include <QRectF>
@@ -99,7 +98,7 @@ public:
inline float exposure() const { return m_exposure; }
void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
- void notifySceneBoundingVolume(const Sphere &sphere, Qt3DCore::QNodeCommand::CommandId commandId);
+ void processViewAllResult(Qt3DCore::QAspectManager *aspectManager, const Sphere &sphere, Qt3DCore::QNodeId commandId);
static bool viewMatrixForCamera(EntityManager *manager, Qt3DCore::QNodeId cameraId,
Matrix4x4 &viewMatrix, Matrix4x4 &projectionMatrix);
@@ -107,10 +106,10 @@ public:
private:
void computeSceneBoundingVolume(Qt3DCore::QNodeId entityId,
Qt3DCore::QNodeId cameraId,
- Qt3DCore::QNodeCommand::CommandId commandId);
+ Qt3DCore::QNodeId requestId);
QRenderAspect *m_renderAspect;
- CameraLensCommand m_pendingViewAllCommand;
+ CameraLensRequest m_pendingViewAllRequest;
Matrix4x4 m_projection;
float m_exposure;
};
diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri
index 9510b9530..c910adfe4 100644
--- a/src/render/backend/render-backend.pri
+++ b/src/render/backend/render-backend.pri
@@ -37,7 +37,8 @@ HEADERS += \
$$PWD/resourceaccessor_p.h \
$$PWD/visitorutils_p.h \
$$PWD/segmentsvisitor_p.h \
- $$PWD/pointsvisitor_p.h
+ $$PWD/pointsvisitor_p.h \
+ $$PWD/commandexecuter_p.h
SOURCES += \
$$PWD/renderthread.cpp \
@@ -67,11 +68,5 @@ SOURCES += \
$$PWD/offscreensurfacehelper.cpp \
$$PWD/resourceaccessor.cpp \
$$PWD/segmentsvisitor.cpp \
- $$PWD/pointsvisitor.cpp
-
-include($$QT3D_BUILD_ROOT/src/core/qt3dcore-config.pri)
-QT_FOR_CONFIG += 3dcore-private
-qtConfig(qt3d-profile-jobs): {
- HEADERS += $$PWD/commandexecuter_p.h
- SOURCES += $$PWD/commandexecuter.cpp
-}
+ $$PWD/pointsvisitor.cpp \
+ $$PWD/commandexecuter.cpp
diff --git a/src/render/backend/rendersettings.cpp b/src/render/backend/rendersettings.cpp
index 8638352c4..5aeaa2563 100644
--- a/src/render/backend/rendersettings.cpp
+++ b/src/render/backend/rendersettings.cpp
@@ -42,7 +42,6 @@
#include <Qt3DRender/QFrameGraphNode>
#include <Qt3DRender/private/abstractrenderer_p.h>
#include <Qt3DRender/private/qrendersettings_p.h>
-#include <Qt3DCore/qnodecommand.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/framegraph/qbuffercapture.cpp b/src/render/framegraph/qbuffercapture.cpp
index c71c0adb7..3eaa5dfd2 100644
--- a/src/render/framegraph/qbuffercapture.cpp
+++ b/src/render/framegraph/qbuffercapture.cpp
@@ -39,8 +39,8 @@
#include <Qt3DRender/qbuffercapture.h>
#include <Qt3DRender/private/qbuffercapture_p.h>
-#include <Qt3DCore/QSceneChange>
-#include <Qt3DRender/QFrameGraphNodeCreatedChange>
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DRender/qframegraphnodecreatedchange.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp
index 2169f72dd..3c6f90c7c 100644
--- a/src/render/framegraph/qrendercapture.cpp
+++ b/src/render/framegraph/qrendercapture.cpp
@@ -36,8 +36,8 @@
#include <Qt3DRender/qrendercapture.h>
#include <Qt3DRender/private/qrendercapture_p.h>
-#include <Qt3DCore/QSceneChange>
-#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qframegraphnodecreatedchange.h>
#include <QPointer>
diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp
index 68d62b6a5..73d8770a7 100644
--- a/src/render/framegraph/rendercapture.cpp
+++ b/src/render/framegraph/rendercapture.cpp
@@ -37,6 +37,8 @@
#include <Qt3DRender/private/qrendercapture_p.h>
#include <Qt3DRender/private/rendercapture_p.h>
#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/private/qaspectmanager_p.h>
+#include <Qt3DCore/private/qaspectjobmanager_p.h>
QT_BEGIN_NAMESPACE
@@ -99,17 +101,25 @@ void RenderCapture::addRenderCapture(int captureId, const QImage &image)
m_renderCaptureData.push_back(data);
}
-// called by send render capture job thread
-void RenderCapture::sendRenderCaptures()
+// called to send render capture in main thread
+void RenderCapture::syncRenderCapturesToFrontend(Qt3DCore::QAspectManager *manager)
{
- QMutexLocker lock(&m_mutex);
+ auto *frontend = manager->lookupNode(peerId());
+ if (!frontend)
+ return;
+ QRenderCapturePrivate *dfrontend = static_cast<QRenderCapturePrivate *>(Qt3DCore::QNodePrivate::get(frontend));
+ QMutexLocker lock(&m_mutex);
for (const RenderCaptureDataPtr &data : qAsConst(m_renderCaptureData)) {
- auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
- e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
- e->setPropertyName("renderCaptureData");
- e->setValue(QVariant::fromValue(data));
- notifyObservers(e);
+ QPointer<QRenderCaptureReply> reply = dfrontend->takeReply(data.data()->captureId);
+ if (reply) {
+ dfrontend->setImage(reply, data.data()->image);
+ emit reply->completed();
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ emit reply->completeChanged(true);
+QT_WARNING_POP
+ }
}
m_renderCaptureData.clear();
}
diff --git a/src/render/framegraph/rendercapture_p.h b/src/render/framegraph/rendercapture_p.h
index 4560c525d..5714fb44d 100644
--- a/src/render/framegraph/rendercapture_p.h
+++ b/src/render/framegraph/rendercapture_p.h
@@ -66,9 +66,9 @@ public:
bool wasCaptureRequested() const;
QRenderCaptureRequest takeCaptureRequest();
void addRenderCapture(int captureId, const QImage &image);
- void sendRenderCaptures();
void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
+ void syncRenderCapturesToFrontend(Qt3DCore::QAspectManager *manager);
private:
diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp
index cf30b714a..1d8059f45 100644
--- a/src/render/frontend/qcameralens.cpp
+++ b/src/render/frontend/qcameralens.cpp
@@ -233,11 +233,7 @@ void QCameraLens::viewAll(Qt3DCore::QNodeId cameraId)
{
Q_D(QCameraLens);
if (d->m_projectionType == PerspectiveProjection) {
- QVariant v;
- v.setValue(cameraId);
- d->m_pendingViewAllCommand = {QLatin1String("QueryRootBoundingVolume"),
- v,
- id()};
+ d->m_pendingViewAllRequest = {Qt3DCore::QNodeId::createId(), cameraId, {}};
d->update();
}
}
@@ -246,30 +242,19 @@ void QCameraLens::viewEntity(Qt3DCore::QNodeId entityId, Qt3DCore::QNodeId camer
{
Q_D(QCameraLens);
if (d->m_projectionType == PerspectiveProjection) {
- QVector<Qt3DCore::QNodeId> ids = {entityId, cameraId};
- QVariant v;
- v.setValue(ids);
- d->m_pendingViewAllCommand = {QLatin1String("QueryEntityBoundingVolume"),
- v,
- id()};
+ d->m_pendingViewAllRequest = {Qt3DCore::QNodeId::createId(), cameraId, entityId};
d->update();
}
}
-void QCameraLensPrivate::processViewAllCommand(Qt3DCore::QNodeCommand::CommandId commandId,
- const QVariant &data)
+void QCameraLensPrivate::processViewAllResult(Qt3DCore::QNodeId requestId, const QVector3D &center, float radius)
{
Q_Q(QCameraLens);
- if (!m_pendingViewAllCommand || m_pendingViewAllCommand.commandId != commandId)
+ if (!m_pendingViewAllRequest || m_pendingViewAllRequest.requestId != requestId)
return;
- QVector<float> boundingVolumeData = data.value< QVector<float> >();
- if (boundingVolumeData.size() != 4)
- return;
- QVector3D center(boundingVolumeData[0], boundingVolumeData[1], boundingVolumeData[2]);
- float radius = boundingVolumeData[3];
Q_EMIT q->viewSphere(center, radius);
- m_pendingViewAllCommand = {};
+ m_pendingViewAllRequest = {};
}
/*!
@@ -643,18 +628,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QCameraLens::createNodeCreationChange() cons
void QCameraLens::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
- Q_D(QCameraLens);
- switch (change->type()) {
- case Qt3DCore::CommandRequested: {
- Qt3DCore::QNodeCommandPtr command = qSharedPointerCast<Qt3DCore::QNodeCommand>(change);
-
- if (command->name() == QLatin1String("ViewAll"))
- d->processViewAllCommand(command->inReplyTo(), command->data());
- }
- break;
- default:
- break;
- }
+ Q_UNUSED(change)
}
} // Qt3DRender
diff --git a/src/render/frontend/qcameralens_p.h b/src/render/frontend/qcameralens_p.h
index 5c5a6a42a..eca01b890 100644
--- a/src/render/frontend/qcameralens_p.h
+++ b/src/render/frontend/qcameralens_p.h
@@ -53,7 +53,6 @@
#include <Qt3DRender/private/qt3drender_global_p.h>
#include <Qt3DCore/private/qcomponent_p.h>
-#include <Qt3DCore/private/qnodecommand_p.h>
#include "qcameralens.h"
@@ -63,21 +62,21 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-struct CameraLensCommand
+struct CameraLensRequest
{
- QString name;
- QVariant data;
- Qt3DCore::QNodeCommand::CommandId commandId;
+ Qt3DCore::QNodeId requestId;
+ Qt3DCore::QNodeId cameraId;
+ Qt3DCore::QNodeId entityId;
- inline operator bool() const { return !name.isEmpty(); }
+ inline operator bool() const { return !requestId.isNull(); }
};
-inline bool operator ==(const CameraLensCommand &a, const CameraLensCommand &b) noexcept
+inline bool operator ==(const CameraLensRequest &a, const CameraLensRequest &b) noexcept
{
- return a.name == b.name && a.data == b.data && a.commandId == b.commandId;
+ return a.cameraId == b.cameraId && a.entityId == b.entityId && a.requestId == b.requestId;
}
-inline bool operator !=(const CameraLensCommand &a, const CameraLensCommand &b) noexcept
+inline bool operator !=(const CameraLensRequest &a, const CameraLensRequest &b) noexcept
{
return !(a == b);
}
@@ -123,8 +122,8 @@ public:
float m_exposure;
- CameraLensCommand m_pendingViewAllCommand;
- void processViewAllCommand(Qt3DCore::QNodeCommand::CommandId commandId, const QVariant &data);
+ CameraLensRequest m_pendingViewAllRequest;
+ void processViewAllResult(Qt3DCore::QNodeId requestId, const QVector3D &center, float radius);
private:
inline void updatePerpectiveProjection()
diff --git a/src/render/frontend/qlevelofdetail.cpp b/src/render/frontend/qlevelofdetail.cpp
index 52f5ea7c9..ced0604c7 100644
--- a/src/render/frontend/qlevelofdetail.cpp
+++ b/src/render/frontend/qlevelofdetail.cpp
@@ -39,7 +39,6 @@
#include "qlevelofdetail.h"
#include "qlevelofdetail_p.h"
-#include "qlevelofdetailswitch.h"
#include "qcamera.h"
QT_BEGIN_NAMESPACE
@@ -61,25 +60,6 @@ void QLevelOfDetailPrivate::setCurrentIndex(int currentIndex)
if (m_currentIndex != currentIndex) {
m_currentIndex = currentIndex;
emit q->currentIndexChanged(m_currentIndex);
-
- // TODO use derived pimpl
- QLevelOfDetailSwitch *qswitch = qobject_cast<QLevelOfDetailSwitch *>(q);
- if (qswitch) {
- int entityIndex = 0;
- const auto entities = q->entities();
- if (entities.size()) {
- // only work on the first entity, LOD should not be shared
- Qt3DCore::QEntity *entity = entities.front();
- const auto childNodes = entity->childNodes();
- for (Qt3DCore::QNode *childNode : childNodes) {
- Qt3DCore::QEntity *childEntity = qobject_cast<Qt3DCore::QEntity *>(childNode);
- if (childEntity) {
- childEntity->setEnabled(entityIndex == currentIndex);
- entityIndex++;
- }
- }
- }
- }
}
}
diff --git a/src/render/frontend/qlevelofdetailswitch.cpp b/src/render/frontend/qlevelofdetailswitch.cpp
index ec658b172..c07d4c4b1 100644
--- a/src/render/frontend/qlevelofdetailswitch.cpp
+++ b/src/render/frontend/qlevelofdetailswitch.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qlevelofdetailswitch.h"
+#include "qlevelofdetailswitch_p.h"
#include "qlevelofdetail_p.h"
#include "qglobal.h"
#include <Qt3DCore/QEntity>
@@ -46,6 +47,38 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+QLevelOfDetailSwitchPrivate::QLevelOfDetailSwitchPrivate()
+ : QLevelOfDetailPrivate()
+{
+
+}
+
+void QLevelOfDetailSwitchPrivate::setCurrentIndex(int currentIndex)
+{
+ Q_Q(QLevelOfDetailSwitch);
+
+ bool changed = m_currentIndex != currentIndex;
+ QLevelOfDetailPrivate::setCurrentIndex(currentIndex);
+
+ if (!changed)
+ return;
+
+ int entityIndex = 0;
+ const auto entities = q->entities();
+ for (Qt3DCore::QEntity *entity : entities) {
+ const auto childNodes = entity->childNodes();
+ for (Qt3DCore::QNode *childNode : childNodes) {
+ Qt3DCore::QEntity *childEntity = qobject_cast<Qt3DCore::QEntity *>(childNode);
+ if (childEntity) {
+ childEntity->setEnabled(entityIndex == currentIndex);
+ entityIndex++;
+ }
+ }
+
+ break; // only work on the first entity, LOD should not be shared
+ }
+}
+
/*!
\class Qt3DRender::QLevelOfDetailSwitch
\inmodule Qt3DRender
@@ -83,9 +116,9 @@ namespace Qt3DRender {
Constructs a new QLevelOfDetailSwitch with the specified \a parent.
*/
QLevelOfDetailSwitch::QLevelOfDetailSwitch(QNode *parent)
- : QLevelOfDetail(parent)
+ : QLevelOfDetail(*new QLevelOfDetailSwitchPrivate(), parent)
{
- Q_D(QLevelOfDetail);
+ Q_D(QLevelOfDetailSwitch);
d->m_currentIndex = -1;
}
diff --git a/src/render/frontend/qlevelofdetailswitch.h b/src/render/frontend/qlevelofdetailswitch.h
index a292f7eb3..325b885ed 100644
--- a/src/render/frontend/qlevelofdetailswitch.h
+++ b/src/render/frontend/qlevelofdetailswitch.h
@@ -45,6 +45,7 @@
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+class QLevelOfDetailSwitchPrivate;
class Q_3DRENDERSHARED_EXPORT QLevelOfDetailSwitch : public QLevelOfDetail
{
@@ -60,7 +61,7 @@ protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
private:
- Q_DECLARE_PRIVATE(QLevelOfDetail)
+ Q_DECLARE_PRIVATE(QLevelOfDetailSwitch)
};
} // namespace Qt3DRender
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp
index 5784b35f4..7a51fa0e7 100644
--- a/src/render/frontend/qrenderaspect.cpp
+++ b/src/render/frontend/qrenderaspect.cpp
@@ -242,8 +242,9 @@ void QRenderAspectPrivate::syncDirtyFrontEndNode(QNode *node, QBackendNode *back
renderBackend->syncFromFrontEnd(node, firstTime);
}
-void QRenderAspectPrivate::jobsDone()
+void QRenderAspectPrivate::jobsDone(QAspectManager *manager)
{
+ m_renderer->jobsDone(manager);
if (m_renderAfterJobs)
m_renderer->doRender(true);
}
@@ -261,77 +262,77 @@ void QRenderAspectPrivate::registerBackendTypes()
qRegisterMetaType<Qt3DRender::QViewport*>();
qRegisterMetaType<Qt3DCore::QJoint*>();
- registerBackendType<Qt3DCore::QEntity, true>(QSharedPointer<Render::RenderEntityFunctor>::create(m_renderer, m_nodeManagers));
- registerBackendType<Qt3DCore::QTransform, true>(QSharedPointer<Render::NodeFunctor<Render::Transform, Render::TransformManager> >::create(m_renderer));
+ q->registerBackendType<Qt3DCore::QEntity, true>(QSharedPointer<Render::RenderEntityFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<Qt3DCore::QTransform, true>(QSharedPointer<Render::NodeFunctor<Render::Transform, Render::TransformManager> >::create(m_renderer));
- registerBackendType<Qt3DRender::QCameraLens, true>(QSharedPointer<Render::CameraLensFunctor>::create(m_renderer, q));
- registerBackendType<QLayer, true>(QSharedPointer<Render::NodeFunctor<Render::Layer, Render::LayerManager> >::create(m_renderer));
- registerBackendType<QLevelOfDetail, true>(QSharedPointer<Render::NodeFunctor<Render::LevelOfDetail, Render::LevelOfDetailManager> >::create(m_renderer));
- registerBackendType<QLevelOfDetailSwitch, true>(QSharedPointer<Render::NodeFunctor<Render::LevelOfDetail, Render::LevelOfDetailManager> >::create(m_renderer));
- registerBackendType<QSceneLoader, true>(QSharedPointer<Render::RenderSceneFunctor>::create(m_renderer, m_nodeManagers->sceneManager()));
- registerBackendType<QRenderTarget, true>(QSharedPointer<Render::NodeFunctor<Render::RenderTarget, Render::RenderTargetManager> >::create(m_renderer));
- registerBackendType<QRenderTargetOutput, true>(QSharedPointer<Render::NodeFunctor<Render::RenderTargetOutput, Render::AttachmentManager> >::create(m_renderer));
- registerBackendType<QRenderSettings, true>(QSharedPointer<Render::RenderSettingsFunctor>::create(m_renderer));
- registerBackendType<QRenderState, true>(QSharedPointer<Render::NodeFunctor<Render::RenderStateNode, Render::RenderStateManager> >::create(m_renderer));
+ q->registerBackendType<Qt3DRender::QCameraLens, true>(QSharedPointer<Render::CameraLensFunctor>::create(m_renderer, q));
+ q->registerBackendType<QLayer, true>(QSharedPointer<Render::NodeFunctor<Render::Layer, Render::LayerManager> >::create(m_renderer));
+ q->registerBackendType<QLevelOfDetail, true>(QSharedPointer<Render::NodeFunctor<Render::LevelOfDetail, Render::LevelOfDetailManager> >::create(m_renderer));
+ q->registerBackendType<QLevelOfDetailSwitch, true>(QSharedPointer<Render::NodeFunctor<Render::LevelOfDetail, Render::LevelOfDetailManager> >::create(m_renderer));
+ q->registerBackendType<QSceneLoader, true>(QSharedPointer<Render::RenderSceneFunctor>::create(m_renderer, m_nodeManagers->sceneManager()));
+ q->registerBackendType<QRenderTarget, true>(QSharedPointer<Render::NodeFunctor<Render::RenderTarget, Render::RenderTargetManager> >::create(m_renderer));
+ q->registerBackendType<QRenderTargetOutput, true>(QSharedPointer<Render::NodeFunctor<Render::RenderTargetOutput, Render::AttachmentManager> >::create(m_renderer));
+ q->registerBackendType<QRenderSettings, true>(QSharedPointer<Render::RenderSettingsFunctor>::create(m_renderer));
+ q->registerBackendType<QRenderState, true>(QSharedPointer<Render::NodeFunctor<Render::RenderStateNode, Render::RenderStateManager> >::create(m_renderer));
// Geometry + Compute
- registerBackendType<QAttribute, true>(QSharedPointer<Render::NodeFunctor<Render::Attribute, Render::AttributeManager> >::create(m_renderer));
- registerBackendType<QBuffer, true>(QSharedPointer<Render::BufferFunctor>::create(m_renderer, m_nodeManagers->bufferManager()));
- registerBackendType<QComputeCommand, true>(QSharedPointer<Render::NodeFunctor<Render::ComputeCommand, Render::ComputeCommandManager> >::create(m_renderer));
- registerBackendType<QGeometry, true>(QSharedPointer<Render::NodeFunctor<Render::Geometry, Render::GeometryManager> >::create(m_renderer));
- registerBackendType<QGeometryRenderer, true>(QSharedPointer<Render::GeometryRendererFunctor>::create(m_renderer, m_nodeManagers->geometryRendererManager()));
- registerBackendType<Qt3DCore::QArmature, true>(QSharedPointer<Render::NodeFunctor<Render::Armature, Render::ArmatureManager>>::create(m_renderer));
- registerBackendType<Qt3DCore::QAbstractSkeleton, true>(QSharedPointer<Render::SkeletonFunctor>::create(m_renderer, m_nodeManagers->skeletonManager(), m_nodeManagers->jointManager()));
- registerBackendType<Qt3DCore::QJoint, true>(QSharedPointer<Render::JointFunctor>::create(m_renderer, m_nodeManagers->jointManager(), m_nodeManagers->skeletonManager()));
+ q->registerBackendType<QAttribute, true>(QSharedPointer<Render::NodeFunctor<Render::Attribute, Render::AttributeManager> >::create(m_renderer));
+ q->registerBackendType<QBuffer, true>(QSharedPointer<Render::BufferFunctor>::create(m_renderer, m_nodeManagers->bufferManager()));
+ q->registerBackendType<QComputeCommand, true>(QSharedPointer<Render::NodeFunctor<Render::ComputeCommand, Render::ComputeCommandManager> >::create(m_renderer));
+ q->registerBackendType<QGeometry, true>(QSharedPointer<Render::NodeFunctor<Render::Geometry, Render::GeometryManager> >::create(m_renderer));
+ q->registerBackendType<QGeometryRenderer, true>(QSharedPointer<Render::GeometryRendererFunctor>::create(m_renderer, m_nodeManagers->geometryRendererManager()));
+ q->registerBackendType<Qt3DCore::QArmature, true>(QSharedPointer<Render::NodeFunctor<Render::Armature, Render::ArmatureManager>>::create(m_renderer));
+ q->registerBackendType<Qt3DCore::QAbstractSkeleton, true>(QSharedPointer<Render::SkeletonFunctor>::create(m_renderer, m_nodeManagers->skeletonManager(), m_nodeManagers->jointManager()));
+ q->registerBackendType<Qt3DCore::QJoint, true>(QSharedPointer<Render::JointFunctor>::create(m_renderer, m_nodeManagers->jointManager(), m_nodeManagers->skeletonManager()));
// Textures
- registerBackendType<QAbstractTexture, true>(QSharedPointer<Render::TextureFunctor>::create(m_renderer, m_nodeManagers->textureManager()));
- registerBackendType<QAbstractTextureImage, true>(QSharedPointer<Render::TextureImageFunctor>::create(m_renderer,
+ q->registerBackendType<QAbstractTexture, true>(QSharedPointer<Render::TextureFunctor>::create(m_renderer, m_nodeManagers->textureManager()));
+ q->registerBackendType<QAbstractTextureImage, true>(QSharedPointer<Render::TextureImageFunctor>::create(m_renderer,
m_nodeManagers->textureImageManager()));
// Material system
- registerBackendType<QEffect, true>(QSharedPointer<Render::NodeFunctor<Render::Effect, Render::EffectManager> >::create(m_renderer));
- registerBackendType<QFilterKey, true>(QSharedPointer<Render::NodeFunctor<Render::FilterKey, Render::FilterKeyManager> >::create(m_renderer));
- registerBackendType<QAbstractLight, true>(QSharedPointer<Render::RenderLightFunctor>::create(m_renderer, m_nodeManagers));
- registerBackendType<QEnvironmentLight, true>(QSharedPointer<Render::NodeFunctor<Render::EnvironmentLight, Render::EnvironmentLightManager> >::create(m_renderer));
- registerBackendType<QMaterial, true>(QSharedPointer<Render::NodeFunctor<Render::Material, Render::MaterialManager> >::create(m_renderer));
- registerBackendType<QParameter, true>(QSharedPointer<Render::NodeFunctor<Render::Parameter, Render::ParameterManager> >::create(m_renderer));
- registerBackendType<QRenderPass, true>(QSharedPointer<Render::NodeFunctor<Render::RenderPass, Render::RenderPassManager> >::create(m_renderer));
- registerBackendType<QShaderData, true>(QSharedPointer<Render::RenderShaderDataFunctor>::create(m_renderer, m_nodeManagers));
- registerBackendType<QShaderProgram, true>(QSharedPointer<Render::NodeFunctor<Render::Shader, Render::ShaderManager> >::create(m_renderer));
- registerBackendType<QShaderProgramBuilder, true>(QSharedPointer<Render::NodeFunctor<Render::ShaderBuilder, Render::ShaderBuilderManager> >::create(m_renderer));
- registerBackendType<QTechnique, true>(QSharedPointer<Render::TechniqueFunctor>::create(m_renderer, m_nodeManagers));
- registerBackendType<QShaderImage, true>(QSharedPointer<Render::NodeFunctor<Render::ShaderImage, Render::ShaderImageManager>>::create(m_renderer));
+ q->registerBackendType<QEffect, true>(QSharedPointer<Render::NodeFunctor<Render::Effect, Render::EffectManager> >::create(m_renderer));
+ q->registerBackendType<QFilterKey, true>(QSharedPointer<Render::NodeFunctor<Render::FilterKey, Render::FilterKeyManager> >::create(m_renderer));
+ q->registerBackendType<QAbstractLight, true>(QSharedPointer<Render::RenderLightFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<QEnvironmentLight, true>(QSharedPointer<Render::NodeFunctor<Render::EnvironmentLight, Render::EnvironmentLightManager> >::create(m_renderer));
+ q->registerBackendType<QMaterial, true>(QSharedPointer<Render::NodeFunctor<Render::Material, Render::MaterialManager> >::create(m_renderer));
+ q->registerBackendType<QParameter, true>(QSharedPointer<Render::NodeFunctor<Render::Parameter, Render::ParameterManager> >::create(m_renderer));
+ q->registerBackendType<QRenderPass, true>(QSharedPointer<Render::NodeFunctor<Render::RenderPass, Render::RenderPassManager> >::create(m_renderer));
+ q->registerBackendType<QShaderData, true>(QSharedPointer<Render::RenderShaderDataFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<QShaderProgram, true>(QSharedPointer<Render::NodeFunctor<Render::Shader, Render::ShaderManager> >::create(m_renderer));
+ q->registerBackendType<QShaderProgramBuilder, true>(QSharedPointer<Render::NodeFunctor<Render::ShaderBuilder, Render::ShaderBuilderManager> >::create(m_renderer));
+ q->registerBackendType<QTechnique, true>(QSharedPointer<Render::TechniqueFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<QShaderImage, true>(QSharedPointer<Render::NodeFunctor<Render::ShaderImage, Render::ShaderImageManager>>::create(m_renderer));
// Framegraph
- registerBackendType<QFrameGraphNode, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::FrameGraphNode, QFrameGraphNode> >::create(m_renderer));
- registerBackendType<QCameraSelector, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::CameraSelector, QCameraSelector> >::create(m_renderer));
- registerBackendType<QClearBuffers, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ClearBuffers, QClearBuffers> >::create(m_renderer));
- registerBackendType<QDispatchCompute, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::DispatchCompute, QDispatchCompute> >::create(m_renderer));
- registerBackendType<QFrustumCulling, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::FrustumCulling, QFrustumCulling> >::create(m_renderer));
- registerBackendType<QLayerFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::LayerFilterNode, QLayerFilter> >::create(m_renderer));
- registerBackendType<QNoDraw, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::NoDraw, QNoDraw> >::create(m_renderer));
- registerBackendType<QRenderPassFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderPassFilter, QRenderPassFilter> >::create(m_renderer));
- registerBackendType<QRenderStateSet, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::StateSetNode, QRenderStateSet> >::create(m_renderer));
- registerBackendType<QRenderSurfaceSelector, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderSurfaceSelector, QRenderSurfaceSelector> >::create(m_renderer));
- registerBackendType<QRenderTargetSelector, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderTargetSelector, QRenderTargetSelector> >::create(m_renderer));
- registerBackendType<QSortPolicy, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SortPolicy, QSortPolicy> >::create(m_renderer));
- registerBackendType<QTechniqueFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::TechniqueFilter, QTechniqueFilter> >::create(m_renderer));
- registerBackendType<QViewport, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ViewportNode, QViewport> >::create(m_renderer));
- registerBackendType<QRenderCapture, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderCapture, QRenderCapture> >::create(m_renderer));
- registerBackendType<QBufferCapture, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::BufferCapture, QBufferCapture> >::create(m_renderer));
- registerBackendType<QMemoryBarrier, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::MemoryBarrier, QMemoryBarrier> >::create(m_renderer));
- registerBackendType<QProximityFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ProximityFilter, QProximityFilter> >::create(m_renderer));
- registerBackendType<QBlitFramebuffer, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::BlitFramebuffer, QBlitFramebuffer> >::create(m_renderer));
- registerBackendType<QSetFence, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SetFence, QSetFence> >::create(m_renderer));
- registerBackendType<QWaitFence, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::WaitFence, QWaitFence> >::create(m_renderer));
- registerBackendType<QNoPicking, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::NoPicking, QNoPicking> >::create(m_renderer));
- registerBackendType<QSubtreeEnabler, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SubtreeEnabler, QSubtreeEnabler> >::create(m_renderer));
+ q->registerBackendType<QFrameGraphNode, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::FrameGraphNode, QFrameGraphNode> >::create(m_renderer));
+ q->registerBackendType<QCameraSelector, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::CameraSelector, QCameraSelector> >::create(m_renderer));
+ q->registerBackendType<QClearBuffers, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ClearBuffers, QClearBuffers> >::create(m_renderer));
+ q->registerBackendType<QDispatchCompute, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::DispatchCompute, QDispatchCompute> >::create(m_renderer));
+ q->registerBackendType<QFrustumCulling, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::FrustumCulling, QFrustumCulling> >::create(m_renderer));
+ q->registerBackendType<QLayerFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::LayerFilterNode, QLayerFilter> >::create(m_renderer));
+ q->registerBackendType<QNoDraw, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::NoDraw, QNoDraw> >::create(m_renderer));
+ q->registerBackendType<QRenderPassFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderPassFilter, QRenderPassFilter> >::create(m_renderer));
+ q->registerBackendType<QRenderStateSet, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::StateSetNode, QRenderStateSet> >::create(m_renderer));
+ q->registerBackendType<QRenderSurfaceSelector, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderSurfaceSelector, QRenderSurfaceSelector> >::create(m_renderer));
+ q->registerBackendType<QRenderTargetSelector, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderTargetSelector, QRenderTargetSelector> >::create(m_renderer));
+ q->registerBackendType<QSortPolicy, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SortPolicy, QSortPolicy> >::create(m_renderer));
+ q->registerBackendType<QTechniqueFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::TechniqueFilter, QTechniqueFilter> >::create(m_renderer));
+ q->registerBackendType<QViewport, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ViewportNode, QViewport> >::create(m_renderer));
+ q->registerBackendType<QRenderCapture, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderCapture, QRenderCapture> >::create(m_renderer));
+ q->registerBackendType<QBufferCapture, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::BufferCapture, QBufferCapture> >::create(m_renderer));
+ q->registerBackendType<QMemoryBarrier, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::MemoryBarrier, QMemoryBarrier> >::create(m_renderer));
+ q->registerBackendType<QProximityFilter, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ProximityFilter, QProximityFilter> >::create(m_renderer));
+ q->registerBackendType<QBlitFramebuffer, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::BlitFramebuffer, QBlitFramebuffer> >::create(m_renderer));
+ q->registerBackendType<QSetFence, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SetFence, QSetFence> >::create(m_renderer));
+ q->registerBackendType<QWaitFence, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::WaitFence, QWaitFence> >::create(m_renderer));
+ q->registerBackendType<QNoPicking, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::NoPicking, QNoPicking> >::create(m_renderer));
+ q->registerBackendType<QSubtreeEnabler, true>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SubtreeEnabler, QSubtreeEnabler> >::create(m_renderer));
// Picking
- registerBackendType<QObjectPicker, true>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer));
- registerBackendType<QRayCaster, true>(QSharedPointer<Render::NodeFunctor<Render::RayCaster, Render::RayCasterManager> >::create(m_renderer));
- registerBackendType<QScreenRayCaster, true>(QSharedPointer<Render::NodeFunctor<Render::RayCaster, Render::RayCasterManager> >::create(m_renderer));
+ q->registerBackendType<QObjectPicker, true>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer));
+ q->registerBackendType<QRayCaster, true>(QSharedPointer<Render::NodeFunctor<Render::RayCaster, Render::RayCasterManager> >::create(m_renderer));
+ q->registerBackendType<QScreenRayCaster, true>(QSharedPointer<Render::NodeFunctor<Render::RayCaster, Render::RayCasterManager> >::create(m_renderer));
// Plugins
for (const QString &plugin : qAsConst(m_pluginConfig))
@@ -412,6 +413,13 @@ void QRenderAspectPrivate::unregisterBackendTypes()
plugin->unregisterBackendTypes(q);
}
+void QRenderAspectPrivate::registerBackendType(const QMetaObject &obj,
+ const QBackendNodeMapperPtr &functor)
+{
+ Q_Q(QRenderAspect);
+ q->registerBackendType(obj, functor);
+}
+
/*!
* The constructor creates a new QRenderAspect::QRenderAspect instance with the
* specified \a parent.
diff --git a/src/render/frontend/qrenderaspect_p.h b/src/render/frontend/qrenderaspect_p.h
index 305e58403..8723180ab 100644
--- a/src/render/frontend/qrenderaspect_p.h
+++ b/src/render/frontend/qrenderaspect_p.h
@@ -87,7 +87,7 @@ public:
static QRenderAspectPrivate* findPrivate(Qt3DCore::QAspectEngine *engine);
void syncDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QBackendNode *backend, bool firstTime) const override;
- void jobsDone() override;
+ void jobsDone(Qt3DCore::QAspectManager *manager) override;
void registerBackendTypes();
void unregisterBackendTypes();
@@ -96,6 +96,7 @@ public:
void renderInitialize(QOpenGLContext *context);
void renderSynchronous(bool swapBuffers = true);
void renderShutdown();
+ void registerBackendType(const QMetaObject &, const Qt3DCore::QBackendNodeMapperPtr &functor);
QVector<Qt3DCore::QAspectJobPtr> createGeometryRendererJobs();
Render::NodeManagers *m_nodeManagers;
diff --git a/src/render/frontend/qrenderplugin_p.h b/src/render/frontend/qrenderplugin_p.h
index 4aa0ec697..110c8295a 100644
--- a/src/render/frontend/qrenderplugin_p.h
+++ b/src/render/frontend/qrenderplugin_p.h
@@ -51,7 +51,6 @@
#include <private/qt3drender_global_p.h>
#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/private/qabstractaspect_p.h>
#include <Qt3DRender/qrenderaspect.h>
#include <QtCore/qobject.h>
@@ -78,7 +77,7 @@ protected:
}
void registerBackendType(QRenderAspect *aspect, const QMetaObject &obj, const Qt3DCore::QBackendNodeMapperPtr &functor, bool supportsSyncing)
{
- Qt3DCore::QAbstractAspectPrivate::get(aspect)->registerBackendType(obj, functor, supportsSyncing);
+ aspect->registerBackendType(obj, functor, supportsSyncing);
}
void unregisterBackendType(QRenderAspect *aspect, const QMetaObject &obj)
{
diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp
index 5916c4b73..491d3e442 100644
--- a/src/render/frontend/qrendersettings.cpp
+++ b/src/render/frontend/qrendersettings.cpp
@@ -104,25 +104,25 @@ void QRenderSettingsPrivate::invalidateFrame()
/*! \internal */
void QRenderSettingsPrivate::_q_onPickingMethodChanged(QPickingSettings::PickMethod pickMethod)
{
- notifyPropertyChange("pickMethod", pickMethod);// TODOSYNC
+ notifyPropertyChange("pickMethod", pickMethod);
}
/*! \internal */
void QRenderSettingsPrivate::_q_onPickResultModeChanged(QPickingSettings::PickResultMode pickResultMode)
{
- notifyPropertyChange("pickResultMode", pickResultMode);// TODOSYNC
+ notifyPropertyChange("pickResultMode", pickResultMode);
}
/*! \internal */
void QRenderSettingsPrivate::_q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode)
{
- notifyPropertyChange("faceOrientationPickingMode", faceOrientationPickingMode);// TODOSYNC
+ notifyPropertyChange("faceOrientationPickingMode", faceOrientationPickingMode);
}
/*! \internal */
void QRenderSettingsPrivate::_q_onWorldSpaceToleranceChanged(float worldSpaceTolerance)
{
- notifyPropertyChange("pickWorldSpaceTolerance", worldSpaceTolerance);// TODOSYNC
+ notifyPropertyChange("pickWorldSpaceTolerance", worldSpaceTolerance);
}
QRenderSettings::QRenderSettings(Qt3DCore::QNode *parent)
diff --git a/src/render/frontend/sphere.cpp b/src/render/frontend/sphere.cpp
index 470dbfe59..0caeed9f1 100644
--- a/src/render/frontend/sphere.cpp
+++ b/src/render/frontend/sphere.cpp
@@ -93,54 +93,6 @@ bool intersectRaySphere(const Qt3DRender::RayCasting::QRay3D &ray, const Qt3DRen
return true;
}
-inline QPair<int, int> findExtremePoints(const QVector<Vector3D> &points)
-{
- // Find indices of extreme points along x, y, and z axes
- int xMin = 0, xMax = 0, yMin = 0, yMax = 0, zMin = 0, zMax = 0;
- for (int i = 1; i < points.size(); ++i) {
- const Vector3D &p = points.at(i);
- if (p.x() < points[xMin].x())
- xMin = i;
- if (p.x() > points[xMax].x())
- xMax = i;
- if (p.y() < points[yMin].y())
- yMin = i;
- if (p.y() > points[yMax].y())
- yMax = i;
- if (p.z() < points[zMin].z())
- zMin = i;
- if (p.z() > points[zMax].z())
- zMax = i;
- }
-
- // Calculate squared distance for the pairs of points
- const float xDist2 = (points.at(xMax) - points.at(xMin)).lengthSquared();
- const float yDist2 = (points.at(yMax) - points.at(yMin)).lengthSquared();
- const float zDist2 = (points.at(zMax) - points.at(zMin)).lengthSquared();
-
- // Select most distant pair
- QPair<int, int> extremeIndices(xMin, xMax);
- if (yDist2 > xDist2 && yDist2 > zDist2)
- extremeIndices = qMakePair(yMin, yMax);
- if (zDist2 > xDist2 && zDist2 > yDist2)
- extremeIndices = qMakePair(zMin, zMax);
-
- return extremeIndices;
-}
-
-inline void sphereFromExtremePoints(Qt3DRender::Render::Sphere &s, const QVector<Vector3D> &points)
-{
- // Find two most separated points on any of the basis vectors
- QPair<int, int> extremeIndices = findExtremePoints(points);
-
- // Construct sphere to contain these two points
- const Vector3D &p = points.at(extremeIndices.first);
- const Vector3D &q = points.at(extremeIndices.second);
- const Vector3D c = 0.5f * (p + q);
- s.setCenter(c);
- s.setRadius((q - c).length());
-}
-
inline void constructRitterSphere(Qt3DRender::Render::Sphere &s, const QVector<Vector3D> &points)
{
//def bounding_sphere(points):
diff --git a/src/render/geometry/gltfskeletonloader.cpp b/src/render/geometry/gltfskeletonloader.cpp
index 56144747c..07789cd84 100644
--- a/src/render/geometry/gltfskeletonloader.cpp
+++ b/src/render/geometry/gltfskeletonloader.cpp
@@ -48,6 +48,7 @@
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DCore/private/qmath3d_p.h>
+#include <Qt3DCore/private/qloadgltf_p.h>
QT_BEGIN_NAMESPACE
@@ -316,12 +317,7 @@ GLTFSkeletonLoader::GLTFSkeletonLoader()
bool GLTFSkeletonLoader::load(QIODevice *ioDev)
{
- QByteArray jsonData = ioDev->readAll();
- QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
- if (sceneDocument.isNull())
- sceneDocument = QJsonDocument::fromJson(jsonData);
-
- if (Q_UNLIKELY(!setJSON(sceneDocument))) {
+ if (Q_UNLIKELY(!setJSON(qLoadGLTF(ioDev->readAll())))) {
qCWarning(Jobs, "not a JSON document");
return false;
}
diff --git a/src/render/geometry/skeleton_p.h b/src/render/geometry/skeleton_p.h
index eb9551f07..7a5299944 100644
--- a/src/render/geometry/skeleton_p.h
+++ b/src/render/geometry/skeleton_p.h
@@ -151,8 +151,8 @@ private:
inline QDebug operator<<(QDebug dbg, const Skeleton &skeleton)
{
QDebugStateSaver saver(dbg);
- dbg << "QNodeId =" << skeleton.peerId() << endl
- << "Name =" << skeleton.name() << endl;
+ dbg << "QNodeId =" << skeleton.peerId() << Qt::endl
+ << "Name =" << skeleton.name() << Qt::endl;
return dbg;
}
#endif
diff --git a/src/render/jobs/calcboundingvolumejob.cpp b/src/render/jobs/calcboundingvolumejob.cpp
index 9af2f4f38..172c4ddca 100644
--- a/src/render/jobs/calcboundingvolumejob.cpp
+++ b/src/render/jobs/calcboundingvolumejob.cpp
@@ -354,7 +354,7 @@ CalculateBoundingVolumeJob::CalculateBoundingVolumeJob()
: m_manager(nullptr)
, m_node(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcBoundingVolume, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcBoundingVolume, 0)
}
void CalculateBoundingVolumeJob::run()
diff --git a/src/render/jobs/calcgeometrytrianglevolumes.cpp b/src/render/jobs/calcgeometrytrianglevolumes.cpp
index d2b12e09c..eb31a25a6 100644
--- a/src/render/jobs/calcgeometrytrianglevolumes.cpp
+++ b/src/render/jobs/calcgeometrytrianglevolumes.cpp
@@ -53,7 +53,7 @@ CalcGeometryTriangleVolumes::CalcGeometryTriangleVolumes(const Qt3DCore::QNodeId
, m_geometryRendererId(geometryRendererId)
, m_manager(manager)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcTriangleVolume, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcTriangleVolume, 0)
}
void CalcGeometryTriangleVolumes::run()
diff --git a/src/render/jobs/computefilteredboundingvolumejob.cpp b/src/render/jobs/computefilteredboundingvolumejob.cpp
index 02852685c..0cdbc8b6d 100644
--- a/src/render/jobs/computefilteredboundingvolumejob.cpp
+++ b/src/render/jobs/computefilteredboundingvolumejob.cpp
@@ -74,12 +74,25 @@ void expandWorldBoundingVolume(NodeManagers *manager,
} // namespace
+class ComputeFilteredBoundingVolumeJobPrivate : public Qt3DCore::QAspectJobPrivate
+{
+public:
+ ComputeFilteredBoundingVolumeJobPrivate(ComputeFilteredBoundingVolumeJob *job) : Qt3DCore::QAspectJobPrivate(), m_job(job) {}
+ ~ComputeFilteredBoundingVolumeJobPrivate() {}
+
+ void postFrame(Qt3DCore::QAspectManager *aspectManager) override;
+
+ ComputeFilteredBoundingVolumeJob *m_job;
+ Qt3DRender::Render::Sphere m_sphere;
+};
+
ComputeFilteredBoundingVolumeJob::ComputeFilteredBoundingVolumeJob()
- : m_root(nullptr)
+ : Qt3DCore::QAspectJob(*new ComputeFilteredBoundingVolumeJobPrivate(this))
+ , m_root(nullptr)
, m_ignoreSubTree(nullptr)
, m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::ExpandBoundingVolume, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::ExpandBoundingVolume, 0)
}
void ComputeFilteredBoundingVolumeJob::setRoot(Entity *root)
@@ -100,11 +113,13 @@ void ComputeFilteredBoundingVolumeJob::ignoreSubTree(Entity *node)
void ComputeFilteredBoundingVolumeJob::run()
{
qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread();
+ Q_D(ComputeFilteredBoundingVolumeJob);
+ d->m_sphere = {};
if (!m_root)
return;
if (!m_ignoreSubTree) {
- finished(*m_root->worldBoundingVolumeWithChildren());
+ d->m_sphere = *m_root->worldBoundingVolumeWithChildren();
return;
}
@@ -118,20 +133,24 @@ void ComputeFilteredBoundingVolumeJob::run()
parent = parent->parent();
}
if (!isFilterChildOfRoot) {
- finished(*m_root->worldBoundingVolumeWithChildren());
+ d->m_sphere = *m_root->worldBoundingVolumeWithChildren();
return;
}
- Qt3DRender::Render::Sphere sphere;
- expandWorldBoundingVolume(m_manager, &sphere, m_root, m_ignoreSubTree);
- finished(sphere);
+ expandWorldBoundingVolume(m_manager, &d->m_sphere, m_root, m_ignoreSubTree);
qCDebug(Jobs) << "Exiting" << Q_FUNC_INFO << QThread::currentThread();
}
-void ComputeFilteredBoundingVolumeJob::finished(const Qt3DRender::Render::Sphere &sphere)
+void ComputeFilteredBoundingVolumeJob::finished(Qt3DCore::QAspectManager *aspectManager, const Qt3DRender::Render::Sphere &sphere)
+{
+ Q_UNUSED(aspectManager)
+ Q_UNUSED(sphere)
+}
+
+void ComputeFilteredBoundingVolumeJobPrivate::postFrame(Qt3DCore::QAspectManager *aspectManager)
{
- Q_UNUSED(sphere);
+ m_job->finished(aspectManager, m_sphere);
}
} // namespace Render
diff --git a/src/render/jobs/computefilteredboundingvolumejob_p.h b/src/render/jobs/computefilteredboundingvolumejob_p.h
index d2aca575c..0f804e647 100644
--- a/src/render/jobs/computefilteredboundingvolumejob_p.h
+++ b/src/render/jobs/computefilteredboundingvolumejob_p.h
@@ -64,6 +64,7 @@ namespace Render {
class Entity;
class NodeManagers;
class Sphere;
+class ComputeFilteredBoundingVolumeJobPrivate;
class Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeFilteredBoundingVolumeJob : public Qt3DCore::QAspectJob
{
@@ -76,9 +77,10 @@ public:
void run() override;
protected:
- virtual void finished(const Qt3DRender::Render::Sphere &sphere);
+ virtual void finished(Qt3DCore::QAspectManager *aspectManager, const Qt3DRender::Render::Sphere &sphere); // called in main thread
private:
+ Q_DECLARE_PRIVATE(ComputeFilteredBoundingVolumeJob)
Entity *m_root;
Entity *m_ignoreSubTree;
NodeManagers *m_manager;
diff --git a/src/render/jobs/expandboundingvolumejob.cpp b/src/render/jobs/expandboundingvolumejob.cpp
index 641a5c272..8587634cb 100644
--- a/src/render/jobs/expandboundingvolumejob.cpp
+++ b/src/render/jobs/expandboundingvolumejob.cpp
@@ -84,7 +84,7 @@ ExpandBoundingVolumeJob::ExpandBoundingVolumeJob()
: m_node(nullptr)
, m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::ExpandBoundingVolume, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::ExpandBoundingVolume, 0)
}
void ExpandBoundingVolumeJob::setRoot(Entity *root)
diff --git a/src/render/jobs/filterentitybycomponentjob_p.h b/src/render/jobs/filterentitybycomponentjob_p.h
index 75e487d7f..cefcdd296 100644
--- a/src/render/jobs/filterentitybycomponentjob_p.h
+++ b/src/render/jobs/filterentitybycomponentjob_p.h
@@ -74,7 +74,7 @@ public:
: Qt3DCore::QAspectJob()
, m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::EntityComponentTypeFiltering, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::EntityComponentTypeFiltering, 0)
}
inline void setManager(EntityManager *manager) Q_DECL_NOTHROW { m_manager = manager; }
diff --git a/src/render/jobs/filterlayerentityjob.cpp b/src/render/jobs/filterlayerentityjob.cpp
index e206ef968..032004422 100644
--- a/src/render/jobs/filterlayerentityjob.cpp
+++ b/src/render/jobs/filterlayerentityjob.cpp
@@ -58,7 +58,7 @@ FilterLayerEntityJob::FilterLayerEntityJob()
: Qt3DCore::QAspectJob()
, m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::LayerFiltering, layerFilterJobCounter++);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LayerFiltering, layerFilterJobCounter++)
}
diff --git a/src/render/jobs/framecleanupjob.cpp b/src/render/jobs/framecleanupjob.cpp
index 17ca60bff..fb63f005b 100644
--- a/src/render/jobs/framecleanupjob.cpp
+++ b/src/render/jobs/framecleanupjob.cpp
@@ -55,7 +55,7 @@ FrameCleanupJob::FrameCleanupJob()
: m_managers(nullptr)
, m_root(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrameCleanup, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrameCleanup, 0)
}
FrameCleanupJob::~FrameCleanupJob()
diff --git a/src/render/jobs/frustumcullingjob.cpp b/src/render/jobs/frustumcullingjob.cpp
index 0922fb0cb..e22d625df 100644
--- a/src/render/jobs/frustumcullingjob.cpp
+++ b/src/render/jobs/frustumcullingjob.cpp
@@ -58,7 +58,7 @@ FrustumCullingJob::FrustumCullingJob()
, m_manager(nullptr)
, m_active(false)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrustumCulling, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrustumCulling, 0)
}
void FrustumCullingJob::run()
diff --git a/src/render/jobs/genericlambdajob_p.h b/src/render/jobs/genericlambdajob_p.h
index 4d93f0f8d..8cf4276f6 100644
--- a/src/render/jobs/genericlambdajob_p.h
+++ b/src/render/jobs/genericlambdajob_p.h
@@ -68,7 +68,7 @@ public:
: Qt3DCore::QAspectJob()
, m_callable(callable)
{
- SET_JOB_RUN_STAT_TYPE(this, type, 0);
+ SET_JOB_RUN_STAT_TYPE(this, type, 0)
}
// QAspectJob interface
@@ -111,7 +111,7 @@ public:
: Qt3DCore::QAspectJob(*new GenericLambdaJobAndPostFramePrivate<T, U>(postFrameCallable))
, m_runCallable(runCallable)
{
- SET_JOB_RUN_STAT_TYPE(this, type, 0);
+ SET_JOB_RUN_STAT_TYPE(this, type, 0)
}
// QAspectJob interface
diff --git a/src/render/jobs/jobs.pri b/src/render/jobs/jobs.pri
index 2181e4a95..eb89ab35e 100644
--- a/src/render/jobs/jobs.pri
+++ b/src/render/jobs/jobs.pri
@@ -18,7 +18,6 @@ HEADERS += \
$$PWD/lightgatherer_p.h \
$$PWD/expandboundingvolumejob_p.h \
$$PWD/updateworldboundingvolumejob_p.h \
- $$PWD/sendrendercapturejob_p.h \
$$PWD/updateshaderdatatransformjob_p.h \
$$PWD/updatelevelofdetailjob_p.h \
$$PWD/updatemeshtrianglelistjob_p.h \
@@ -47,7 +46,6 @@ SOURCES += \
$$PWD/lightgatherer.cpp \
$$PWD/expandboundingvolumejob.cpp \
$$PWD/updateworldboundingvolumejob.cpp \
- $$PWD/sendrendercapturejob.cpp \
$$PWD/updateshaderdatatransformjob.cpp \
$$PWD/updatemeshtrianglelistjob.cpp \
$$PWD/updatelevelofdetailjob.cpp \
diff --git a/src/render/jobs/lightgatherer.cpp b/src/render/jobs/lightgatherer.cpp
index f4c8dfba8..b79976aef 100644
--- a/src/render/jobs/lightgatherer.cpp
+++ b/src/render/jobs/lightgatherer.cpp
@@ -53,7 +53,7 @@ LightGatherer::LightGatherer()
, m_manager(nullptr)
, m_environmentLight(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::LightGathering, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LightGathering, 0)
}
void LightGatherer::run()
diff --git a/src/render/jobs/loadbufferjob.cpp b/src/render/jobs/loadbufferjob.cpp
index 68e92cfa7..0f4feb5d4 100644
--- a/src/render/jobs/loadbufferjob.cpp
+++ b/src/render/jobs/loadbufferjob.cpp
@@ -77,7 +77,7 @@ LoadBufferJob::~LoadBufferJob()
void LoadBufferJob::run()
{
- Q_DJOB(LoadBufferJob);
+ Q_D(LoadBufferJob);
// Let's leave it for the moment until this has been properly tested
qCDebug(Jobs) << Q_FUNC_INFO;
Buffer *buffer = m_nodeManagers->data<Buffer, BufferManager>(m_handle);
diff --git a/src/render/jobs/loadbufferjob_p.h b/src/render/jobs/loadbufferjob_p.h
index 884870a62..e86e4f835 100644
--- a/src/render/jobs/loadbufferjob_p.h
+++ b/src/render/jobs/loadbufferjob_p.h
@@ -77,6 +77,9 @@ public:
protected:
HBuffer m_handle;
NodeManagers *m_nodeManagers;
+
+private:
+ Q_DECLARE_PRIVATE(LoadBufferJob)
};
typedef QSharedPointer<LoadBufferJob> LoadBufferJobPtr;
diff --git a/src/render/jobs/loadgeometryjob.cpp b/src/render/jobs/loadgeometryjob.cpp
index 3d32f7d4e..2069336cd 100644
--- a/src/render/jobs/loadgeometryjob.cpp
+++ b/src/render/jobs/loadgeometryjob.cpp
@@ -66,7 +66,7 @@ LoadGeometryJob::LoadGeometryJob(const HGeometryRenderer &handle)
, m_handle(handle)
, m_nodeManagers(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadGeometry, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadGeometry, 0)
}
LoadGeometryJob::~LoadGeometryJob()
@@ -75,7 +75,7 @@ LoadGeometryJob::~LoadGeometryJob()
void LoadGeometryJob::run()
{
- Q_DJOB(LoadGeometryJob);
+ Q_D(LoadGeometryJob);
GeometryRenderer *geometryRenderer = m_nodeManagers->geometryRendererManager()->data(m_handle);
if (geometryRenderer != nullptr)
d->m_updates.push_back({ geometryRenderer->peerId(), geometryRenderer->executeFunctor() });
diff --git a/src/render/jobs/loadgeometryjob_p.h b/src/render/jobs/loadgeometryjob_p.h
index 869abbe18..998d543ac 100644
--- a/src/render/jobs/loadgeometryjob_p.h
+++ b/src/render/jobs/loadgeometryjob_p.h
@@ -76,6 +76,9 @@ protected:
void run() override;
HGeometryRenderer m_handle;
NodeManagers *m_nodeManagers;
+
+private:
+ Q_DECLARE_PRIVATE(LoadGeometryJob)
};
typedef QSharedPointer<LoadGeometryJob> LoadGeometryJobPtr;
diff --git a/src/render/jobs/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp
index 22d5da887..be855c608 100644
--- a/src/render/jobs/loadscenejob.cpp
+++ b/src/render/jobs/loadscenejob.cpp
@@ -63,7 +63,7 @@ LoadSceneJob::LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId sceneComponent)
, m_sceneComponent(sceneComponent)
, m_managers(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadScene, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadScene, 0)
}
void LoadSceneJob::setData(const QByteArray &data)
@@ -139,7 +139,7 @@ void LoadSceneJob::run()
}
}
- Q_DJOB(LoadSceneJob);
+ Q_D(LoadSceneJob);
d->m_sceneSubtree = sceneSubTree;
d->m_status = finalStatus;
diff --git a/src/render/jobs/loadscenejob_p.h b/src/render/jobs/loadscenejob_p.h
index 79c8a2935..3675d94c1 100644
--- a/src/render/jobs/loadscenejob_p.h
+++ b/src/render/jobs/loadscenejob_p.h
@@ -113,6 +113,7 @@ private:
Qt3DCore::QEntity *tryLoadScene(QSceneLoader::Status &finalStatus,
const QStringList &extensions,
const std::function<void (QSceneImporter *)> &importerSetupFunc);
+ Q_DECLARE_PRIVATE(LoadSceneJob)
};
typedef QSharedPointer<LoadSceneJob> LoadSceneJobPtr;
diff --git a/src/render/jobs/loadskeletonjob.cpp b/src/render/jobs/loadskeletonjob.cpp
index 6f7bcd9b7..e696cc434 100644
--- a/src/render/jobs/loadskeletonjob.cpp
+++ b/src/render/jobs/loadskeletonjob.cpp
@@ -75,7 +75,7 @@ LoadSkeletonJob::LoadSkeletonJob(const HSkeleton &handle)
void LoadSkeletonJob::run()
{
- Q_DJOB(LoadSkeletonJob);
+ Q_D(LoadSkeletonJob);
d->m_backendSkeleton = nullptr;
Skeleton *skeleton = m_nodeManagers->skeletonManager()->data(m_handle);
@@ -120,7 +120,7 @@ void LoadSkeletonJob::loadSkeleton(Skeleton *skeleton)
void LoadSkeletonJob::loadSkeletonFromUrl(Skeleton *skeleton)
{
- Q_DJOB(LoadSkeletonJob);
+ Q_D(LoadSkeletonJob);
using namespace Qt3DCore;
diff --git a/src/render/jobs/loadskeletonjob_p.h b/src/render/jobs/loadskeletonjob_p.h
index 5ea4912ee..0cc09da3d 100644
--- a/src/render/jobs/loadskeletonjob_p.h
+++ b/src/render/jobs/loadskeletonjob_p.h
@@ -88,6 +88,9 @@ protected:
HSkeleton m_handle;
NodeManagers *m_nodeManagers;
+
+private:
+ Q_DECLARE_PRIVATE(LoadSkeletonJob)
};
typedef QSharedPointer<LoadSkeletonJob> LoadSkeletonJobPtr;
diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp
index ae0cb2350..2973ee100 100644
--- a/src/render/jobs/pickboundingvolumejob.cpp
+++ b/src/render/jobs/pickboundingvolumejob.cpp
@@ -380,7 +380,7 @@ void PickBoundingVolumeJob::dispatchPickEvents(const QMouseEvent &event,
bool allHitsRequested,
Qt3DCore::QNodeId viewportNodeId)
{
- Q_DJOB(PickBoundingVolumeJob);
+ Q_D(PickBoundingVolumeJob);
ObjectPicker *lastCurrentPicker = m_manager->objectPickerManager()->data(m_currentPicker);
// If we have hits
@@ -541,7 +541,7 @@ void PickBoundingVolumeJob::dispatchPickEvents(const QMouseEvent &event,
void PickBoundingVolumeJob::clearPreviouslyHoveredPickers()
{
- Q_DJOB(PickBoundingVolumeJob);
+ Q_D(PickBoundingVolumeJob);
for (const HObjectPicker &pickHandle : qAsConst(m_hoveredPickersToClear)) {
ObjectPicker *pick = m_manager->objectPickerManager()->data(pickHandle);
diff --git a/src/render/jobs/pickboundingvolumejob_p.h b/src/render/jobs/pickboundingvolumejob_p.h
index 751d0be7b..49b11b775 100644
--- a/src/render/jobs/pickboundingvolumejob_p.h
+++ b/src/render/jobs/pickboundingvolumejob_p.h
@@ -102,6 +102,8 @@ protected:
Qt3DCore::QNodeId viewportNodeId);
private:
+ Q_DECLARE_PRIVATE(PickBoundingVolumeJob)
+
void clearPreviouslyHoveredPickers();
QList<QPair<QObject*, QMouseEvent>> m_pendingMouseEvents;
diff --git a/src/render/jobs/raycastingjob.cpp b/src/render/jobs/raycastingjob.cpp
index a6f172b86..380447873 100644
--- a/src/render/jobs/raycastingjob.cpp
+++ b/src/render/jobs/raycastingjob.cpp
@@ -273,7 +273,7 @@ void RayCastingJob::dispatchHits(RayCaster *rayCaster, const PickingUtils::HitLi
};
}
- Q_DJOB(RayCastingJob);
+ Q_D(RayCastingJob);
d->dispatches.push_back({rayCaster, hits});
}
diff --git a/src/render/jobs/raycastingjob_p.h b/src/render/jobs/raycastingjob_p.h
index ba0e2f309..4b8b91ad5 100644
--- a/src/render/jobs/raycastingjob_p.h
+++ b/src/render/jobs/raycastingjob_p.h
@@ -82,6 +82,8 @@ protected:
void dispatchHits(RayCaster *rayCaster, const PickingUtils::HitList &sphereHits);
private:
+ Q_DECLARE_PRIVATE(RayCastingJob)
+
bool m_castersDirty;
bool m_oneEnabledAtLeast;
};
diff --git a/src/render/jobs/sendbuffercapturejob.cpp b/src/render/jobs/sendbuffercapturejob.cpp
index 889a86c68..2ccb72337 100644
--- a/src/render/jobs/sendbuffercapturejob.cpp
+++ b/src/render/jobs/sendbuffercapturejob.cpp
@@ -79,7 +79,7 @@ SendBufferCaptureJob::~SendBufferCaptureJob()
// Called from SubmitRenderView while rendering
void SendBufferCaptureJob::addRequest(QPair<Qt3DCore::QNodeId, QByteArray> request)
{
- Q_DJOB(SendBufferCaptureJob);
+ Q_D(SendBufferCaptureJob);
QMutexLocker locker(&d->m_mutex);
d->m_buffersToCapture.push_back(request);
}
@@ -87,7 +87,7 @@ void SendBufferCaptureJob::addRequest(QPair<Qt3DCore::QNodeId, QByteArray> reque
// Called by aspect thread jobs to execute (we may still be rendering at this point)
bool SendBufferCaptureJob::hasRequests() const
{
- Q_DJOB(const SendBufferCaptureJob);
+ Q_D(const SendBufferCaptureJob);
QMutexLocker locker(&d->m_mutex);
return d->m_buffersToCapture.size() > 0;
}
@@ -95,7 +95,7 @@ bool SendBufferCaptureJob::hasRequests() const
void SendBufferCaptureJob::run()
{
Q_ASSERT(m_nodeManagers);
- Q_DJOB(SendBufferCaptureJob);
+ Q_D(SendBufferCaptureJob);
QMutexLocker locker(&d->m_mutex);
for (const QPair<Qt3DCore::QNodeId, QByteArray> &pendingCapture : qAsConst(d->m_buffersToCapture)) {
Buffer *buffer = m_nodeManagers->bufferManager()->lookupResource(pendingCapture.first);
diff --git a/src/render/jobs/sendbuffercapturejob_p.h b/src/render/jobs/sendbuffercapturejob_p.h
index ce797f0a9..3b9f5d12b 100644
--- a/src/render/jobs/sendbuffercapturejob_p.h
+++ b/src/render/jobs/sendbuffercapturejob_p.h
@@ -83,6 +83,7 @@ public:
void run() final;
private:
+ Q_DECLARE_PRIVATE(SendBufferCaptureJob)
NodeManagers *m_nodeManagers;
};
diff --git a/src/render/jobs/sendrendercapturejob.cpp b/src/render/jobs/sendrendercapturejob.cpp
deleted file mode 100644
index f622c347a..000000000
--- a/src/render/jobs/sendrendercapturejob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sendrendercapturejob_p.h"
-
-#include "Qt3DRender/private/renderer_p.h"
-#include "Qt3DRender/private/nodemanagers_p.h"
-#include "Qt3DRender/private/rendercapture_p.h"
-#include <Qt3DRender/private/job_common_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-SendRenderCaptureJob::SendRenderCaptureJob()
- : Qt3DCore::QAspectJob()
- , m_managers(nullptr)
-{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::SendRenderCapture, 0);
-}
-
-SendRenderCaptureJob::~SendRenderCaptureJob()
-{
-
-}
-
-void SendRenderCaptureJob::setPendingCaptureRequests(const QVector<Qt3DCore::QNodeId> &requests)
-{
- m_pendingCaptures = requests;
-}
-
-void SendRenderCaptureJob::setManagers(NodeManagers *managers)
-{
- m_managers = managers;
-}
-
-void SendRenderCaptureJob::run()
-{
- for (const Qt3DCore::QNodeId id : qAsConst(m_pendingCaptures)) {
- auto *node = static_cast<Qt3DRender::Render::RenderCapture *>
- (m_managers->frameGraphManager()->lookupNode(id));
- node->sendRenderCaptures();
- }
- m_pendingCaptures.clear();
-}
-
-} // Render
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/jobs/sendrendercapturejob_p.h b/src/render/jobs/sendrendercapturejob_p.h
deleted file mode 100644
index 8bc1e2fb0..000000000
--- a/src/render/jobs/sendrendercapturejob_p.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SENDRENDERCAPTUREJOB_P_H
-#define SENDRENDERCAPTUREJOB_P_H
-
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qaspectjob.h>
-#include <Qt3DCore/qnodeid.h>
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/private/qt3drender_global_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class NodeManagers;
-class Entity;
-
-class Q_3DRENDERSHARED_PRIVATE_EXPORT SendRenderCaptureJob : public Qt3DCore::QAspectJob
-{
-public:
- SendRenderCaptureJob();
- ~SendRenderCaptureJob();
-
- void setPendingCaptureRequests(const QVector<Qt3DCore::QNodeId> &requests);
- void setManagers(NodeManagers *managers);
-
- void run() final;
-
-private:
- NodeManagers *m_managers;
- QVector<Qt3DCore::QNodeId> m_pendingCaptures;
-};
-
-typedef QSharedPointer<SendRenderCaptureJob> SendRenderCaptureJobPtr;
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // SENDRENDERCAPTUREJOB_P_H
diff --git a/src/render/jobs/updateentitylayersjob.cpp b/src/render/jobs/updateentitylayersjob.cpp
index 2c5e38364..b8c50c179 100644
--- a/src/render/jobs/updateentitylayersjob.cpp
+++ b/src/render/jobs/updateentitylayersjob.cpp
@@ -52,7 +52,7 @@ namespace Render {
UpdateEntityLayersJob::UpdateEntityLayersJob()
: m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateLayerEntity, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateLayerEntity, 0)
}
diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp
index 9ac923d8b..0a28b7628 100644
--- a/src/render/jobs/updatelevelofdetailjob.cpp
+++ b/src/render/jobs/updatelevelofdetailjob.cpp
@@ -248,7 +248,7 @@ void UpdateLevelOfDetailJob::setFrameGraphRoot(FrameGraphNode *frameGraphRoot)
void UpdateLevelOfDetailJob::run()
{
- Q_DJOB(UpdateLevelOfDetailJob);
+ Q_D(UpdateLevelOfDetailJob);
Q_ASSERT(m_frameGraphRoot && m_root && m_manager);
diff --git a/src/render/jobs/updatelevelofdetailjob_p.h b/src/render/jobs/updatelevelofdetailjob_p.h
index e0f9bd064..9ac5cf0e9 100644
--- a/src/render/jobs/updatelevelofdetailjob_p.h
+++ b/src/render/jobs/updatelevelofdetailjob_p.h
@@ -82,6 +82,8 @@ public:
Entity *root() const { return m_root; }
private:
+ Q_DECLARE_PRIVATE(UpdateLevelOfDetailJob)
+
NodeManagers *m_manager;
FrameGraphNode *m_frameGraphRoot;
Entity *m_root;
diff --git a/src/render/jobs/updatemeshtrianglelistjob.cpp b/src/render/jobs/updatemeshtrianglelistjob.cpp
index 1c61d1c90..4837dcad6 100644
--- a/src/render/jobs/updatemeshtrianglelistjob.cpp
+++ b/src/render/jobs/updatemeshtrianglelistjob.cpp
@@ -60,7 +60,7 @@ namespace Render {
UpdateMeshTriangleListJob::UpdateMeshTriangleListJob()
: m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateMeshTriangleList, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateMeshTriangleList, 0)
}
UpdateMeshTriangleListJob::~UpdateMeshTriangleListJob()
diff --git a/src/render/jobs/updateshaderdatatransformjob.cpp b/src/render/jobs/updateshaderdatatransformjob.cpp
index c29a827e3..11fe91932 100644
--- a/src/render/jobs/updateshaderdatatransformjob.cpp
+++ b/src/render/jobs/updateshaderdatatransformjob.cpp
@@ -61,7 +61,7 @@ namespace Render {
UpdateShaderDataTransformJob::UpdateShaderDataTransformJob()
: m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateShaderDataTransform, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateShaderDataTransform, 0)
}
UpdateShaderDataTransformJob::~UpdateShaderDataTransformJob()
diff --git a/src/render/jobs/updateskinningpalettejob.cpp b/src/render/jobs/updateskinningpalettejob.cpp
index 0f5d3d6d6..b77707f15 100644
--- a/src/render/jobs/updateskinningpalettejob.cpp
+++ b/src/render/jobs/updateskinningpalettejob.cpp
@@ -50,7 +50,7 @@ UpdateSkinningPaletteJob::UpdateSkinningPaletteJob()
, m_nodeManagers(nullptr)
, m_root()
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateSkinningPalette, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateSkinningPalette, 0)
}
UpdateSkinningPaletteJob::~UpdateSkinningPaletteJob()
diff --git a/src/render/jobs/updatetreeenabledjob.cpp b/src/render/jobs/updatetreeenabledjob.cpp
index 5c6f2b378..22d6f6083 100644
--- a/src/render/jobs/updatetreeenabledjob.cpp
+++ b/src/render/jobs/updatetreeenabledjob.cpp
@@ -73,7 +73,7 @@ UpdateTreeEnabledJob::UpdateTreeEnabledJob()
, m_node(nullptr)
, m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateTreeEnabled, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateTreeEnabled, 0)
}
void UpdateTreeEnabledJob::setRoot(Entity *root)
diff --git a/src/render/jobs/updateworldtransformjob.cpp b/src/render/jobs/updateworldtransformjob.cpp
index ea9aa778c..e3c8077f4 100644
--- a/src/render/jobs/updateworldtransformjob.cpp
+++ b/src/render/jobs/updateworldtransformjob.cpp
@@ -109,7 +109,7 @@ UpdateWorldTransformJob::UpdateWorldTransformJob()
, m_node(nullptr)
, m_manager(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateTransform, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateTransform, 0)
}
void UpdateWorldTransformJob::setRoot(Entity *root)
@@ -131,7 +131,7 @@ void UpdateWorldTransformJob::run()
// TODO: Parallelise this on each level using a parallel_for
// implementation.
- Q_DJOB(UpdateWorldTransformJob);
+ Q_D(UpdateWorldTransformJob);
qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread();
Matrix4x4 parentTransform;
diff --git a/src/render/jobs/updateworldtransformjob_p.h b/src/render/jobs/updateworldtransformjob_p.h
index ded501a07..e7ff592de 100644
--- a/src/render/jobs/updateworldtransformjob_p.h
+++ b/src/render/jobs/updateworldtransformjob_p.h
@@ -78,6 +78,7 @@ public:
private:
Entity *m_node;
NodeManagers *m_manager;
+ Q_DECLARE_PRIVATE(UpdateWorldTransformJob)
};
typedef QSharedPointer<UpdateWorldTransformJob> UpdateWorldTransformJobPtr;
diff --git a/src/render/materialsystem/shader_p.h b/src/render/materialsystem/shader_p.h
index 298b09c6c..4c5bc5ea1 100644
--- a/src/render/materialsystem/shader_p.h
+++ b/src/render/materialsystem/shader_p.h
@@ -202,7 +202,7 @@ private:
inline QDebug operator<<(QDebug dbg, const Shader &shader)
{
QDebugStateSaver saver(dbg);
- dbg << "QNodeId =" << shader.peerId() << "dna =" << shader.dna() << endl;
+ dbg << "QNodeId =" << shader.peerId() << "dna =" << shader.dna() << Qt::endl;
return dbg;
}
#endif
diff --git a/src/render/renderers/opengl/jobs/filtercompatibletechniquejob.cpp b/src/render/renderers/opengl/jobs/filtercompatibletechniquejob.cpp
index 342fd3dad..d2a01eef4 100644
--- a/src/render/renderers/opengl/jobs/filtercompatibletechniquejob.cpp
+++ b/src/render/renderers/opengl/jobs/filtercompatibletechniquejob.cpp
@@ -53,7 +53,7 @@ FilterCompatibleTechniqueJob::FilterCompatibleTechniqueJob()
: m_manager(nullptr)
, m_renderer(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::FilterCompatibleTechniques, 0);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::FilterCompatibleTechniques, 0)
}
void FilterCompatibleTechniqueJob::setManager(TechniqueManager *manager)
diff --git a/src/render/renderers/opengl/jobs/materialparametergathererjob.cpp b/src/render/renderers/opengl/jobs/materialparametergathererjob.cpp
index 5e56e817f..e1f8aa403 100644
--- a/src/render/renderers/opengl/jobs/materialparametergathererjob.cpp
+++ b/src/render/renderers/opengl/jobs/materialparametergathererjob.cpp
@@ -63,7 +63,7 @@ MaterialParameterGathererJob::MaterialParameterGathererJob()
, m_techniqueFilter(nullptr)
, m_renderPassFilter(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::MaterialParameterGathering, materialParameterGathererCounter++);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::MaterialParameterGathering, materialParameterGathererCounter++)
}
// TechniqueFilter / RenderPassFilter
diff --git a/src/render/renderers/opengl/jobs/renderviewcommandupdaterjob.cpp b/src/render/renderers/opengl/jobs/renderviewcommandupdaterjob.cpp
index 6cc2105dd..6772279d7 100644
--- a/src/render/renderers/opengl/jobs/renderviewcommandupdaterjob.cpp
+++ b/src/render/renderers/opengl/jobs/renderviewcommandupdaterjob.cpp
@@ -60,7 +60,7 @@ RenderViewCommandUpdaterJob::RenderViewCommandUpdaterJob()
, m_renderer(nullptr)
, m_renderables()
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::RenderCommandUpdater, renderViewInstanceCounter++);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::RenderCommandUpdater, renderViewInstanceCounter++)
}
void RenderViewCommandUpdaterJob::run()
diff --git a/src/render/renderers/opengl/jobs/renderviewinitializerjob.cpp b/src/render/renderers/opengl/jobs/renderviewinitializerjob.cpp
index 7bf55be40..f0f72803c 100644
--- a/src/render/renderers/opengl/jobs/renderviewinitializerjob.cpp
+++ b/src/render/renderers/opengl/jobs/renderviewinitializerjob.cpp
@@ -65,7 +65,7 @@ RenderViewInitializerJob::RenderViewInitializerJob()
, m_index(0)
, m_renderView(nullptr)
{
- SET_JOB_RUN_STAT_TYPE(this, JobTypes::RenderView, renderViewInstanceCounter++);
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::RenderView, renderViewInstanceCounter++)
}
RenderViewInitializerJob::~RenderViewInitializerJob()
diff --git a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp
index 0ceb188fd..39917fb58 100644
--- a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp
+++ b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp
@@ -232,6 +232,7 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
= static_cast<const Render::RenderSurfaceSelector *>(node);
rv->setSurface(surfaceSelector->surface());
rv->setSurfaceSize(surfaceSelector->renderTargetSize() * surfaceSelector->devicePixelRatio());
+ rv->setDevicePixelRatio(surfaceSelector->devicePixelRatio());
}
break;
}
diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp
index d61d1d8ac..ddf57f4fe 100644
--- a/src/render/renderers/opengl/renderer/renderer.cpp
+++ b/src/render/renderers/opengl/renderer/renderer.cpp
@@ -94,15 +94,14 @@
#include <Qt3DRender/private/qshaderprogrambuilder_p.h>
#include <Qt3DRender/private/qshaderprogram_p.h>
#include <Qt3DRender/private/filterentitybycomponentjob_p.h>
+#include <Qt3DRender/private/commandexecuter_p.h>
#include <Qt3DRender/qcameralens.h>
#include <Qt3DCore/private/qeventfilterservice_p.h>
#include <Qt3DCore/private/qabstractaspectjobmanager_p.h>
#include <Qt3DCore/private/qaspectmanager_p.h>
-
-#if QT_CONFIG(qt3d_profile_jobs)
-#include <Qt3DCore/private/aspectcommanddebugger_p.h>
-#endif
+#include <Qt3DCore/private/qsysteminformationservice_p.h>
+#include <Qt3DCore/private/qsysteminformationservice_p_p.h>
#include <QStack>
#include <QOffscreenSurface>
@@ -115,19 +114,9 @@
#include <QUrl>
#include <QOffscreenSurface>
#include <QWindow>
-
-#include <QtGui/private/qopenglcontext_p.h>
-
-// For Debug purposes only
#include <QThread>
-
-#if QT_CONFIG(qt3d_profile_jobs)
-#include <Qt3DCore/private/qthreadpooler_p.h>
-#include <Qt3DRender/private/job_common_p.h>
-#include <Qt3DRender/private/commandexecuter_p.h>
-#endif
-
+#include <QtGui/private/qopenglcontext_p.h>
#include <Qt3DRender/private/frameprofiler_p.h>
QT_BEGIN_NAMESPACE
@@ -263,7 +252,6 @@ Renderer::Renderer(QRenderAspect::RenderType type)
, m_calculateBoundingVolumeJob(Render::CalculateBoundingVolumeJobPtr::create())
, m_updateWorldBoundingVolumeJob(Render::UpdateWorldBoundingVolumeJobPtr::create())
, m_updateTreeEnabledJob(Render::UpdateTreeEnabledJobPtr::create())
- , m_sendRenderCaptureJob(Render::SendRenderCaptureJobPtr::create())
, m_sendBufferCaptureJob(Render::SendBufferCaptureJobPtr::create())
, m_updateSkinningPaletteJob(Render::UpdateSkinningPaletteJobPtr::create())
, m_updateLevelOfDetailJob(Render::UpdateLevelOfDetailJobPtr::create())
@@ -276,13 +264,7 @@ Renderer::Renderer(QRenderAspect::RenderType type)
, m_bufferGathererJob(SynchronizerJobPtr::create([this] { lookForDirtyBuffers(); }, JobTypes::DirtyBufferGathering))
, m_vaoGathererJob(SynchronizerJobPtr::create([this] { lookForAbandonedVaos(); }, JobTypes::DirtyVaoGathering))
, m_textureGathererJob(SynchronizerJobPtr::create([this] { lookForDirtyTextures(); }, JobTypes::DirtyTextureGathering))
- , m_sendTextureChangesToFrontendJob(SynchronizerPostFramePtr::create([] {},
- [this] (Qt3DCore::QAspectManager *m) { sendTextureChangesToFrontend(m); },
- JobTypes::SendTextureChangesToFrontend))
, m_sendSetFenceHandlesToFrontendJob(SynchronizerJobPtr::create([this] { sendSetFenceHandlesToFrontend(); }, JobTypes::SendSetFenceHandlesToFrontend))
- , m_sendDisablesToFrontendJob(SynchronizerPostFramePtr::create([] {},
- [this] (Qt3DCore::QAspectManager *m) { sendDisablesToFrontend(m); },
- JobTypes::SendDisablesToFrontend))
, m_introspectShaderJob(SynchronizerPostFramePtr::create([this] { reloadDirtyShaders(); },
[this] (Qt3DCore::QAspectManager *m) { sendShaderChangesToFrontend(m); },
JobTypes::DirtyShaderGathering))
@@ -295,10 +277,8 @@ Renderer::Renderer(QRenderAspect::RenderType type)
JobTypes::EntityComponentTypeFiltering))
, m_ownedContext(false)
, m_offscreenHelper(nullptr)
- , m_shouldSwapBuffers(true)
- #if QT_CONFIG(qt3d_profile_jobs)
, m_commandExecuter(new Qt3DRender::Debug::CommandExecuter(this))
- #endif
+ , m_shouldSwapBuffers(true)
{
// Set renderer as running - it will wait in the context of the
// RenderThread for RenderViews to be submitted
@@ -391,7 +371,6 @@ void Renderer::setNodeManagers(NodeManagers *managers)
m_pickBoundingVolumeJob->setManagers(m_nodesManager);
m_rayCastingJob->setManagers(m_nodesManager);
m_updateWorldBoundingVolumeJob->setManager(m_nodesManager->renderNodesManager());
- m_sendRenderCaptureJob->setManagers(m_nodesManager);
m_updateLevelOfDetailJob->setManagers(m_nodesManager);
m_updateSkinningPaletteJob->setManagers(m_nodesManager);
m_updateMeshTriangleListJob->setManagers(m_nodesManager);
@@ -434,7 +413,7 @@ QOpenGLContext *Renderer::shareContext() const
// Executed in the reloadDirtyShader job
void Renderer::loadShader(Shader *shader, HShader shaderHandle)
{
- Q_UNUSED(shader);
+ Q_UNUSED(shader)
m_dirtyShaders.push_back(shaderHandle);
}
@@ -752,19 +731,12 @@ void Renderer::doRender(bool swapBuffers)
// RenderQueue is complete (but that means it may be of size 0)
if (canSubmit && (queueIsComplete && !queueIsEmpty)) {
const QVector<Render::RenderView *> renderViews = m_renderQueue->nextFrameQueue();
-
-#if QT_CONFIG(qt3d_profile_jobs)
- // Save start of frame
- JobRunStats submissionStatsPart1;
- JobRunStats submissionStatsPart2;
- submissionStatsPart1.jobId.typeAndInstance[0] = JobTypes::FrameSubmissionPart1;
- submissionStatsPart1.jobId.typeAndInstance[1] = 0;
- submissionStatsPart1.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
- submissionStatsPart1.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
- submissionStatsPart2.jobId.typeAndInstance[0] = JobTypes::FrameSubmissionPart2;
- submissionStatsPart2.jobId.typeAndInstance[1] = 0;
- submissionStatsPart2.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
-#endif
+ QTaskLogger submissionStatsPart1(m_services->systemInformation(),
+ {JobTypes::FrameSubmissionPart1, 0},
+ QTaskLogger::Submission);
+ QTaskLogger submissionStatsPart2(m_services->systemInformation(),
+ {JobTypes::FrameSubmissionPart2, 0},
+ QTaskLogger::Submission);
if (canRender()) {
{ // Scoped to destroy surfaceLock
@@ -797,15 +769,11 @@ void Renderer::doRender(bool swapBuffers)
m_vsyncFrameAdvanceService->proceedToNextFrame();
hasCleanedQueueAndProceeded = true;
-#if QT_CONFIG(qt3d_profile_jobs)
- if (preprocessingComplete) {
- submissionStatsPart2.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
- submissionStatsPart1.endTime = submissionStatsPart2.startTime;
- }
-#endif
// Only try to submit the RenderViews if the preprocessing was successful
// This part of the submission is happening in parallel to the RV building for the next frame
if (preprocessingComplete) {
+ submissionStatsPart1.end(submissionStatsPart2.restart());
+
// 3) Submit the render commands for frame n (making sure we never reference something that could be changing)
// Render using current device state and renderer configuration
submissionData = submitRenderViews(renderViews);
@@ -815,33 +783,18 @@ void Renderer::doRender(bool swapBuffers)
}
}
-#if QT_CONFIG(qt3d_profile_jobs)
// Execute the pending shell commands
m_commandExecuter->performAsynchronousCommandExecution(renderViews);
-#endif
// Delete all the RenderViews which will clear the allocators
// that were used for their allocation
qDeleteAll(renderViews);
-
-#if QT_CONFIG(qt3d_profile_jobs)
- if (preprocessingComplete) {
- // Save submission elapsed time
- submissionStatsPart2.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
- // Note this is safe since proceedToNextFrame is the one going to trigger
- // the write to the file, and this is performed after this step
- Qt3DCore::QThreadPooler::addSubmissionLogStatsEntry(submissionStatsPart1);
- Qt3DCore::QThreadPooler::addSubmissionLogStatsEntry(submissionStatsPart2);
- Profiling::GLTimeRecorder::writeResults();
- }
-#endif
}
// If hasCleanedQueueAndProceeded isn't true this implies that something went wrong
// with the rendering and/or the renderqueue is incomplete from some reason
// or alternatively it could be complete but empty (RenderQueue of size 0)
-
if (!hasCleanedQueueAndProceeded) {
// RenderQueue was full but something bad happened when
// trying to render it and therefore proceedToNextFrame was not called
@@ -929,12 +882,7 @@ bool Renderer::isReadyToSubmit()
// Main thread
QVariant Renderer::executeCommand(const QStringList &args)
{
-#if QT_CONFIG(qt3d_profile_jobs)
return m_commandExecuter->executeCommand(args);
-#else
- Q_UNUSED(args);
-#endif
- return QVariant();
}
/*!
@@ -1138,7 +1086,7 @@ void Renderer::reloadDirtyShaders()
// If api of the renderer matches the one from the technique
if (technique->isCompatibleWithRenderer()) {
const auto passIds = technique->renderPasses();
- for (const QNodeId passId : passIds) {
+ for (const QNodeId &passId : passIds) {
RenderPass *renderPass = m_nodesManager->renderPassManager()->lookupResource(passId);
HShader shaderHandle = m_nodesManager->shaderManager()->lookupHandle(renderPass->shaderProgram());
Shader *shader = m_nodesManager->shaderManager()->data(shaderHandle);
@@ -1178,7 +1126,7 @@ void Renderer::reloadDirtyShaders()
}
}
-// Executed in job postFrame
+// Executed in job (in main thread when jobs are done)
void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
{
Q_ASSERT(isRunning());
@@ -1205,14 +1153,13 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
}
}
-// Executed in a job (as postFrame)
+// Executed in a job (in main thread when jobs are done)
void Renderer::sendTextureChangesToFrontend(Qt3DCore::QAspectManager *manager)
{
const QVector<QPair<Texture::TextureUpdateInfo, Qt3DCore::QNodeIdVector>> updateTextureProperties = std::move(m_updatedTextureProperties);
for (const auto &pair : updateTextureProperties) {
const Qt3DCore::QNodeIdVector targetIds = pair.second;
- for (const Qt3DCore::QNodeId targetId: targetIds) {
-
+ for (const Qt3DCore::QNodeId &targetId: targetIds) {
// Lookup texture
Texture *t = m_nodesManager->textureManager()->lookupResource(targetId);
// If backend texture is Dirty, some property has changed and the properties we are
@@ -1258,7 +1205,7 @@ void Renderer::sendSetFenceHandlesToFrontend()
}
}
-// Executed in a job postFrame
+// Executed in a job (in main thread when jobs done)
void Renderer::sendDisablesToFrontend(Qt3DCore::QAspectManager *manager)
{
// SubtreeEnabled
@@ -1654,7 +1601,7 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
}
// Set the Viewport
- m_submissionContext->setViewport(renderView->viewport(), renderView->surfaceSize() * renderView->devicePixelRatio());
+ m_submissionContext->setViewport(renderView->viewport(), renderView->surfaceSize());
// Execute the render commands
if (!executeCommandsSubmission(renderView))
@@ -1665,7 +1612,7 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
// renderViewStateSet or m_defaultRenderStateSet)
if (!renderView->renderCaptureNodeId().isNull()) {
const QRenderCaptureRequest request = renderView->renderCaptureRequest();
- const QSize size = m_submissionContext->renderTargetSize(renderView->surfaceSize() * renderView->devicePixelRatio());
+ const QSize size = m_submissionContext->renderTargetSize(renderView->surfaceSize());
QRect rect(QPoint(0, 0), size);
if (!request.rect.isEmpty())
rect = rect.intersected(request.rect);
@@ -1680,7 +1627,8 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
Render::RenderCapture *renderCapture =
static_cast<Render::RenderCapture*>(m_nodesManager->frameGraphManager()->lookupNode(renderView->renderCaptureNodeId()));
renderCapture->addRenderCapture(request.captureId, image);
- addRenderCaptureSendRequest(renderView->renderCaptureNodeId());
+ if (!m_pendingRenderCaptureSendRequests.contains(renderView->renderCaptureNodeId()))
+ m_pendingRenderCaptureSendRequests.push_back(renderView->renderCaptureNodeId());
}
if (renderView->isDownloadBuffersEnable())
@@ -1736,7 +1684,7 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
void Renderer::markDirty(BackendNodeDirtySet changes, BackendNode *node)
{
- Q_UNUSED(node);
+ Q_UNUSED(node)
m_dirtyBits.marked |= changes;
}
@@ -1772,24 +1720,34 @@ void Renderer::skipNextFrame()
m_submitRenderViewsSemaphore.release(1);
}
-// Jobs we may have to run even if no rendering will happen
-QVector<QAspectJobPtr> Renderer::preRenderingJobs()
+void Renderer::jobsDone(Qt3DCore::QAspectManager *manager)
{
- QVector<QAspectJobPtr> jobs;
+ // called in main thread once all jobs are done running
+
+ // sync captured renders to frontend
+ const QVector<Qt3DCore::QNodeId> pendingCaptureIds = std::move(m_pendingRenderCaptureSendRequests);
+ for (const Qt3DCore::QNodeId &id : qAsConst(pendingCaptureIds)) {
+ auto *backend = static_cast<Qt3DRender::Render::RenderCapture *>
+ (m_nodesManager->frameGraphManager()->lookupNode(id));
+ backend->syncRenderCapturesToFrontend(manager);
+ }
// Do we need to notify any texture about property changes?
if (m_updatedTextureProperties.size() > 0)
- jobs.push_back(m_sendTextureChangesToFrontendJob);
+ sendTextureChangesToFrontend(manager);
+
+ sendDisablesToFrontend(manager);
+}
+
+// Jobs we may have to run even if no rendering will happen
+QVector<QAspectJobPtr> Renderer::preRenderingJobs()
+{
+ QVector<QAspectJobPtr> jobs;
// Do we need to notify frontend about fence change?
if (m_updatedSetFences.size() > 0)
jobs.push_back(m_sendSetFenceHandlesToFrontendJob);
- const QVector<Qt3DCore::QNodeId> pendingCaptureIds = takePendingRenderCaptureSendRequests();
- if (pendingCaptureIds.size() > 0) {
- m_sendRenderCaptureJob->setPendingCaptureRequests(pendingCaptureIds);
- jobs.push_back(m_sendRenderCaptureJob);
- }
if (m_sendBufferCaptureJob->hasRequests())
jobs.push_back(m_sendBufferCaptureJob);
@@ -1820,9 +1778,9 @@ QVector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
m_updateLevelOfDetailJob->setFrameGraphRoot(frameGraphRoot());
const BackendNodeDirtySet dirtyBitsForFrame = m_dirtyBits.marked | m_dirtyBits.remaining;
- m_dirtyBits.marked = 0;
- m_dirtyBits.remaining = 0;
- BackendNodeDirtySet notCleared = 0;
+ m_dirtyBits.marked = {};
+ m_dirtyBits.remaining = {};
+ BackendNodeDirtySet notCleared = {};
// Add jobs
const bool entitiesEnabledDirty = dirtyBitsForFrame & AbstractRenderer::EntityEnabledDirty;
@@ -1856,7 +1814,6 @@ QVector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
renderBinJobs.push_back(m_updateSkinningPaletteJob);
renderBinJobs.push_back(m_updateLevelOfDetailJob);
renderBinJobs.push_back(m_cleanupJob);
- renderBinJobs.push_back(m_sendDisablesToFrontendJob);
renderBinJobs.append(bufferJobs);
// Jobs to prepare GL Resource upload
@@ -2355,17 +2312,6 @@ SubmissionContext *Renderer::submissionContext() const
return m_submissionContext.data();
}
-void Renderer::addRenderCaptureSendRequest(Qt3DCore::QNodeId nodeId)
-{
- if (!m_pendingRenderCaptureSendRequests.contains(nodeId))
- m_pendingRenderCaptureSendRequests.push_back(nodeId);
-}
-
-const QVector<Qt3DCore::QNodeId> Renderer::takePendingRenderCaptureSendRequests()
-{
- return std::move(m_pendingRenderCaptureSendRequests);
-}
-
// Returns a vector of jobs to be performed for dirty buffers
// 1 dirty buffer == 1 job, all job can be performed in parallel
QVector<Qt3DCore::QAspectJobPtr> Renderer::createRenderBufferJobs() const
diff --git a/src/render/renderers/opengl/renderer/renderer_p.h b/src/render/renderers/opengl/renderer/renderer_p.h
index ee01754d3..e770b8280 100644
--- a/src/render/renderers/opengl/renderer/renderer_p.h
+++ b/src/render/renderers/opengl/renderer/renderer_p.h
@@ -71,7 +71,6 @@
#include <Qt3DRender/private/updateworldboundingvolumejob_p.h>
#include <Qt3DRender/private/updatetreeenabledjob_p.h>
#include <Qt3DRender/private/platformsurfacefilter_p.h>
-#include <Qt3DRender/private/sendrendercapturejob_p.h>
#include <Qt3DRender/private/sendbuffercapturejob_p.h>
#include <Qt3DRender/private/genericlambdajob_p.h>
#include <Qt3DRender/private/updatemeshtrianglelistjob_p.h>
@@ -126,11 +125,9 @@ class QAbstractShapeMesh;
struct GraphicsApiFilterData;
class QSceneImporter;
-#if QT_CONFIG(qt3d_profile_jobs)
namespace Debug {
class CommandExecuter;
}
-#endif
namespace Render {
@@ -209,6 +206,7 @@ public:
#endif
bool shouldRender() const override;
void skipNextFrame() override;
+ void jobsDone(Qt3DCore::QAspectManager *manager) override;
QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() override;
QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() override;
@@ -233,7 +231,6 @@ public:
inline SynchronizerPostFramePtr introspectShadersJob() const { return m_introspectShaderJob; }
inline Qt3DCore::QAspectJobPtr bufferGathererJob() const { return m_bufferGathererJob; }
inline Qt3DCore::QAspectJobPtr textureGathererJob() const { return m_textureGathererJob; }
- inline Qt3DCore::QAspectJobPtr sendTextureChangesToFrontendJob() const { return m_sendTextureChangesToFrontendJob; }
inline UpdateEntityLayersJobPtr updateEntityLayersJob() const { return m_updateEntityLayersJob; }
inline LightGathererPtr lightGathererJob() const { return m_lightGathererJob; }
inline RenderableEntityFilterPtr renderableEntityFilterJob() const { return m_renderableEntityFilterJob; }
@@ -284,9 +281,6 @@ public:
QList<QPair<QObject*, QMouseEvent>> pendingPickingEvents() const;
QList<QKeyEvent> pendingKeyEvents() const;
- void addRenderCaptureSendRequest(Qt3DCore::QNodeId nodeId);
- const QVector<Qt3DCore::QNodeId> takePendingRenderCaptureSendRequests();
-
void enqueueRenderView(RenderView *renderView, int submitOrder);
bool isReadyToSubmit();
@@ -352,8 +346,8 @@ private:
QAtomicInt m_exposed;
struct DirtyBits {
- BackendNodeDirtySet marked = 0; // marked dirty since last job build
- BackendNodeDirtySet remaining = 0; // remaining dirty after jobs have finished
+ BackendNodeDirtySet marked; // marked dirty since last job build
+ BackendNodeDirtySet remaining; // remaining dirty after jobs have finished
};
DirtyBits m_dirtyBits;
@@ -376,7 +370,6 @@ private:
CalculateBoundingVolumeJobPtr m_calculateBoundingVolumeJob;
UpdateWorldBoundingVolumeJobPtr m_updateWorldBoundingVolumeJob;
UpdateTreeEnabledJobPtr m_updateTreeEnabledJob;
- SendRenderCaptureJobPtr m_sendRenderCaptureJob;
SendBufferCaptureJobPtr m_sendBufferCaptureJob;
UpdateSkinningPaletteJobPtr m_updateSkinningPaletteJob;
UpdateLevelOfDetailJobPtr m_updateLevelOfDetailJob;
@@ -398,9 +391,7 @@ private:
SynchronizerJobPtr m_bufferGathererJob;
SynchronizerJobPtr m_vaoGathererJob;
SynchronizerJobPtr m_textureGathererJob;
- SynchronizerPostFramePtr m_sendTextureChangesToFrontendJob;
SynchronizerJobPtr m_sendSetFenceHandlesToFrontendJob;
- SynchronizerPostFramePtr m_sendDisablesToFrontendJob;
SynchronizerPostFramePtr m_introspectShaderJob;
SynchronizerJobPtr m_syncLoadingJobs;
SynchronizerJobPtr m_cacheRenderableEntitiesJob;
@@ -435,10 +426,7 @@ private:
OffscreenSurfaceHelper *m_offscreenHelper;
QMutex m_offscreenSurfaceMutex;
-#if QT_CONFIG(qt3d_profile_jobs)
QScopedPointer<Qt3DRender::Debug::CommandExecuter> m_commandExecuter;
- friend class Qt3DRender::Debug::CommandExecuter;
-#endif
#ifdef QT_BUILD_INTERNAL
friend class ::tst_Renderer;
diff --git a/src/render/texture/texture_p.h b/src/render/texture/texture_p.h
index 9e347243e..83a05ebcc 100644
--- a/src/render/texture/texture_p.h
+++ b/src/render/texture/texture_p.h
@@ -204,7 +204,7 @@ private:
inline QDebug operator<<(QDebug dbg, const Texture &texture)
{
QDebugStateSaver saver(dbg);
- dbg << "QNodeId =" << texture.peerId() << "imageCount =" << texture.textureImageIds().size() << endl;
+ dbg << "QNodeId =" << texture.peerId() << "imageCount =" << texture.textureImageIds().size() << Qt::endl;
return dbg;
}
#endif
diff --git a/src/render/texture/textureimage_p.h b/src/render/texture/textureimage_p.h
index 57bbdea75..ced8f1ad2 100644
--- a/src/render/texture/textureimage_p.h
+++ b/src/render/texture/textureimage_p.h
@@ -117,7 +117,7 @@ inline QDebug operator<<(QDebug dbg, const TextureImage &textureImage)
<< "mip level =" << textureImage.mipLevel()
<< "layer =" << textureImage.layer()
<< "cube face =" << textureImage.face()
- << "dataGenerator =" << textureImage.dataGenerator() << endl;
+ << "dataGenerator =" << textureImage.dataGenerator() << Qt::endl;
return dbg;
}
#endif
diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp
index 385398bd1..463656557 100644
--- a/tests/auto/animation/animationutils/tst_animationutils.cpp
+++ b/tests/auto/animation/animationutils/tst_animationutils.cpp
@@ -1047,7 +1047,7 @@ private Q_SLOTS:
mapping.type = static_cast<int>(QVariant::Vector3D);
mapping.channelIndices = QVector<int>() << 0 << 1 << 2;
mapping.callback = &callback;
- mapping.callbackFlags = 0;
+ mapping.callbackFlags = {};
mappingData.push_back(mapping);
channelResults = QVector<float>() << 1.0f << 2.0f << 3.0f;
@@ -1073,7 +1073,7 @@ private Q_SLOTS:
mapping.type = static_cast<int>(QVariant::Double);
mapping.channelIndices = QVector<int>() << 0;
mapping.callback = &callback;
- mapping.callbackFlags = 0;
+ mapping.callbackFlags = {};
mappingData.push_back(mapping);
channelResults = QVector<float>() << 1.0f;
diff --git a/tests/auto/core/common/testpostmanarbiter.h b/tests/auto/core/common/testpostmanarbiter.h
index 6649c7bbe..cecc24f93 100644
--- a/tests/auto/core/common/testpostmanarbiter.h
+++ b/tests/auto/core/common/testpostmanarbiter.h
@@ -28,7 +28,6 @@
#include <Qt3DCore/private/qpostman_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
-#include <Qt3DCore/private/qscenechange_p.h>
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/core/core.pro b/tests/auto/core/core.pro
index 001b947d5..13f4a0dc7 100644
--- a/tests/auto/core/core.pro
+++ b/tests/auto/core/core.pro
@@ -25,10 +25,10 @@ qtConfig(private_tests) {
threadpooler \
qpostman \
vector4d_base \
- vector3d_base
+ vector3d_base \
+ aspectcommanddebugger
QT_FOR_CONFIG += 3dcore-private
- qtConfig(qt3d-profile-jobs): SUBDIRS += aspectcommanddebugger
qtConfig(qt3d-simd-sse2) {
SUBDIRS += \
vector4d_sse \
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp
index b5291cab7..87f66bab2 100644
--- a/tests/auto/core/nodes/tst_nodes.cpp
+++ b/tests/auto/core/nodes/tst_nodes.cpp
@@ -40,7 +40,6 @@
#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DCore/private/qaspectengine_p.h>
-#include <Qt3DCore/private/qscenechange_p.h>
#include <Qt3DCore/private/qaspectengine_p.h>
#include <private/qabstractaspect_p.h>
#include <private/qpostman_p.h>
@@ -531,7 +530,7 @@ public:
void syncDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QBackendNode *backend,
bool firstTime) const override
{
- Q_UNUSED(backend)
+ Q_UNUSED(backend);
auto q = q_func();
if (firstTime)
q->allNodes.insert(node->id(), node);
@@ -542,11 +541,10 @@ public:
TestAspect::TestAspect(QObject *parent) : TestAspect(*new TestAspectPrivate, parent)
{
- Q_D(TestAspect);
- d->registerBackendType<Qt3DCore::QEntity, true>(QSharedPointer<TestFunctor>::create(this));
- d->registerBackendType<MyQEntity, true>(QSharedPointer<TestFunctor>::create(this));
- d->registerBackendType<MyQNode, true>(QSharedPointer<TestFunctor>::create(this));
- d->registerBackendType<Qt3DCore::QNode, true>(QSharedPointer<TestFunctor>::create(this));
+ registerBackendType<Qt3DCore::QEntity, true>(QSharedPointer<TestFunctor>::create(this));
+ registerBackendType<MyQEntity, true>(QSharedPointer<TestFunctor>::create(this));
+ registerBackendType<MyQNode, true>(QSharedPointer<TestFunctor>::create(this));
+ registerBackendType<Qt3DCore::QNode, true>(QSharedPointer<TestFunctor>::create(this));
}
TestAspect::TestAspect(TestAspectPrivate &dd, QObject *parent)
diff --git a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
index 2f16bf7c6..48443a66f 100644
--- a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
+++ b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
@@ -183,7 +183,7 @@ private Q_SLOTS:
// WHEN
// we set an empty/null scene root...
engine.setRootEntity(QEntityPtr());
- QTimer::singleShot(1000, &eventLoop, SLOT(quit()));
+ QTimer::singleShot(600, &eventLoop, SLOT(quit()));
// ...and allow events to process...
eventLoop.exec();
@@ -247,21 +247,21 @@ private Q_SLOTS:
// THEN
QCOMPARE(engine.executeCommand("list aspects").toString(),
- QString("Loaded aspects:\n * fake"));
+ QString("fake"));
// WHEN
engine.registerAspect("otherfake");
// THEN
QCOMPARE(engine.executeCommand("list aspects").toString(),
- QString("Loaded aspects:\n * fake\n * otherfake"));
+ QString("fake\notherfake"));
// WHEN
engine.registerAspect(new FakeAspect3);
// THEN
QCOMPARE(engine.executeCommand("list aspects").toString(),
- QString("Loaded aspects:\n * fake\n * otherfake\n * <unnamed>"));
+ QString("fake\notherfake\n<unnamed>"));
}
void shouldDelegateCommandsToAspects()
diff --git a/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp b/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp
index 4bc04fafa..7d8f6eed6 100644
--- a/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp
+++ b/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp
@@ -166,13 +166,13 @@ void tst_QCircularBuffer::construction()
QVERIFY(circ4.size() == 2);
QVERIFY(circ4.at(0) == 10);
QVERIFY(circ4.at(1) == 10);
- QVERIFY(circ4.refCount().load() == 1);
+ QVERIFY(circ4.refCount().loadRelaxed() == 1);
// Copy construct from circ4. Both circ4 and circ5 should now have a
// refCount() of 2 since we are using implicit sharing.
QCircularBuffer<int> circ5(circ4);
- QVERIFY(circ4.refCount().load() == 2);
- QVERIFY(circ5.refCount().load() == 2);
+ QVERIFY(circ4.refCount().loadRelaxed() == 2);
+ QVERIFY(circ5.refCount().loadRelaxed() == 2);
QVERIFY(circ5.capacity() == 5);
QVERIFY(circ5.size() == 2);
QVERIFY(circ5.at(0) == 10);
@@ -199,7 +199,7 @@ void tst_QCircularBuffer::destruction()
cir->append(MyComplexType(2));
cir->append(MyComplexType(3));
cir->remove(0);
- Q_UNUSED(cir);
+ Q_UNUSED(cir)
// Check that the dtor was called 2 times fewer than the constructor.
// At this stage will still have 2 items in the circular buffer.
@@ -208,7 +208,7 @@ void tst_QCircularBuffer::destruction()
// Destroy the circular buffer and check that the active count
// is 0. (Same number of calls to dtor as have been made to the constructors)
delete cir;
- cir = 0;
+ cir = nullptr;
QVERIFY(MyComplexType::ms_activeCount == 0);
}
@@ -273,7 +273,7 @@ void tst_QCircularBuffer::clear()
circ.clear();
QVERIFY(circ.size() == 0);
QVERIFY(circ.capacity() == 3);
- QVERIFY(circ.refCount().load() == 1);
+ QVERIFY(circ.refCount().loadRelaxed() == 1);
}
void tst_QCircularBuffer::contains()
diff --git a/tests/auto/core/qservicelocator/tst_qservicelocator.cpp b/tests/auto/core/qservicelocator/tst_qservicelocator.cpp
index cde9834b4..40f0610df 100644
--- a/tests/auto/core/qservicelocator/tst_qservicelocator.cpp
+++ b/tests/auto/core/qservicelocator/tst_qservicelocator.cpp
@@ -52,11 +52,8 @@ class DummySystemInfoService : public QSystemInformationService
{
public:
DummySystemInfoService()
- : QSystemInformationService(QStringLiteral("Dummy System Information Service"))
+ : QSystemInformationService(nullptr, QStringLiteral("Dummy System Information Service"))
{}
-
- QStringList aspectNames() const final { return QStringList(); }
- int threadPoolThreadCount() const final { return 4; }
};
@@ -90,8 +87,8 @@ void tst_QServiceLocator::defaultServices()
QSystemInformationService *sysInfo = locator.systemInformation();
QVERIFY(sysInfo != nullptr);
- QVERIFY(sysInfo->description() == QStringLiteral("Null System Information Service"));
- QVERIFY(sysInfo->threadPoolThreadCount() == 0);
+ QVERIFY(sysInfo->description() == QStringLiteral("Default System Information Service"));
+ QVERIFY(sysInfo->threadPoolThreadCount() != 0);
}
void tst_QServiceLocator::addRemoveDefaultService()
@@ -105,7 +102,6 @@ void tst_QServiceLocator::addRemoveDefaultService()
// Get the service from the locator and check it works as expected
QSystemInformationService *service = locator.systemInformation();
QVERIFY(service == dummy.data());
- QVERIFY(service->threadPoolThreadCount() == 4);
// Ensure the other default services work
QOpenGLInformationService *glInfo = locator.openGLInformation();
@@ -118,7 +114,7 @@ void tst_QServiceLocator::addRemoveDefaultService()
QVERIFY(locator.serviceCount() == QServiceLocator::DefaultServiceCount);
// Check the dummy service still exists
- QVERIFY(dummy->threadPoolThreadCount() == 4);
+ QVERIFY(!dummy.isNull());
}
void tst_QServiceLocator::addRemoveUserService()
@@ -138,8 +134,8 @@ void tst_QServiceLocator::addRemoveUserService()
// Ensure the default services work
QSystemInformationService *sysInfo = locator.systemInformation();
QVERIFY(sysInfo != nullptr);
- QVERIFY(sysInfo->description() == QStringLiteral("Null System Information Service"));
- QVERIFY(sysInfo->threadPoolThreadCount() == 0);
+ QVERIFY(sysInfo->description() == QStringLiteral("Default System Information Service"));
+ QVERIFY(sysInfo->threadPoolThreadCount() != 0);
// Remove custom service
locator.unregisterServiceProvider(dummy->type());
diff --git a/tests/auto/core/threadpooler/tst_threadpooler.cpp b/tests/auto/core/threadpooler/tst_threadpooler.cpp
index a656c25c1..289f0b103 100644
--- a/tests/auto/core/threadpooler/tst_threadpooler.cpp
+++ b/tests/auto/core/threadpooler/tst_threadpooler.cpp
@@ -182,7 +182,7 @@ void massTestFunction(QVector3D *data)
void tst_ThreadPooler::initTestCase()
{
- m_jobManager = new JobManager(this);
+ m_jobManager = new JobManager(nullptr);
}
void tst_ThreadPooler::cleanupTestCase()
@@ -195,13 +195,13 @@ void tst_ThreadPooler::defaultPerThread()
// GIVEN
QAtomicInt callCounter;
int maxThreadCount = QThread::idealThreadCount();
- callCounter.store(0);
+ callCounter.storeRelaxed(0);
// WHEN
m_jobManager->waitForPerThreadFunction(perThreadFunction, &callCounter);
// THEN
- QVERIFY(maxThreadCount == callCounter.load());
+ QVERIFY(maxThreadCount == callCounter.loadRelaxed());
}
void tst_ThreadPooler::defaultAspectQueue()
@@ -210,7 +210,7 @@ void tst_ThreadPooler::defaultAspectQueue()
QAtomicInt callCounter;
int value = 0; // Not used in this test
QVector<QSharedPointer<Qt3DCore::QAspectJob> > jobList;
- callCounter.store(0);
+ callCounter.storeRelaxed(0);
const int jobCount = 5;
// WHEN
@@ -223,7 +223,7 @@ void tst_ThreadPooler::defaultAspectQueue()
m_jobManager->waitForAllJobs();
// THEN
- QVERIFY(jobCount == callCounter.load());
+ QVERIFY(jobCount == callCounter.loadRelaxed());
}
/*
@@ -236,7 +236,7 @@ void tst_ThreadPooler::doubleAspectQueue()
QAtomicInt callCounter;
int value = 0; // Not used in this test
QVector<QSharedPointer<Qt3DCore::QAspectJob> > jobList;
- callCounter.store(0);
+ callCounter.storeRelaxed(0);
const int jobCount = 3;
// WHEN
@@ -258,7 +258,7 @@ void tst_ThreadPooler::doubleAspectQueue()
m_jobManager->waitForAllJobs();
// THEN
- QVERIFY(jobCount * 2 == callCounter.load());
+ QVERIFY(jobCount * 2 == callCounter.loadRelaxed());
}
/*
@@ -335,7 +335,7 @@ public:
quint64 globalAtomicValue() const
{
- return m_globalAtomic.load();
+ return m_globalAtomic.loadRelaxed();
}
private:
diff --git a/tests/auto/render/commons/testrenderer.cpp b/tests/auto/render/commons/testrenderer.cpp
index 277b2b99b..5a36fecf2 100644
--- a/tests/auto/render/commons/testrenderer.cpp
+++ b/tests/auto/render/commons/testrenderer.cpp
@@ -30,11 +30,7 @@
QT_BEGIN_NAMESPACE
-TestRenderer::TestRenderer()
- : m_changes(0)
- , m_managers(nullptr)
-{
-}
+TestRenderer::TestRenderer() = default;
TestRenderer::~TestRenderer()
{
@@ -60,7 +56,7 @@ void TestRenderer::clearDirtyBits(Qt3DRender::Render::AbstractRenderer::BackendN
void TestRenderer::resetDirty()
{
- m_changes = 0;
+ m_changes = {};
}
QVariant TestRenderer::executeCommand(const QStringList &args)
diff --git a/tests/auto/render/commons/testrenderer.h b/tests/auto/render/commons/testrenderer.h
index e1ee329f4..05ef4c130 100644
--- a/tests/auto/render/commons/testrenderer.h
+++ b/tests/auto/render/commons/testrenderer.h
@@ -42,33 +42,34 @@ public:
void dumpInfo() const override {}
API api() const override { return AbstractRenderer::OpenGL; }
qint64 time() const override { return 0; }
- void setTime(qint64 time) override { Q_UNUSED(time); }
+ void setTime(qint64 time) override { Q_UNUSED(time) }
void setNodeManagers(Qt3DRender::Render::NodeManagers *m) override { m_managers = m; }
- void setServices(Qt3DCore::QServiceLocator *services) override { Q_UNUSED(services); }
- void setSurfaceExposed(bool exposed) override { Q_UNUSED(exposed); }
+ void setServices(Qt3DCore::QServiceLocator *services) override { Q_UNUSED(services) }
+ void setSurfaceExposed(bool exposed) override { Q_UNUSED(exposed) }
Qt3DRender::Render::NodeManagers *nodeManagers() const override { return m_managers; }
Qt3DCore::QServiceLocator *services() const override { return nullptr; }
void initialize() override {}
void shutdown() override {}
void releaseGraphicsResources() override {}
void render() override {}
- void doRender(bool swapBuffers) override { Q_UNUSED(swapBuffers); }
+ void doRender(bool swapBuffers) override { Q_UNUSED(swapBuffers) }
void cleanGraphicsResources() override {}
bool isRunning() const override { return true; }
bool shouldRender() const override { return true; }
void skipNextFrame() override {}
+ void jobsDone(Qt3DCore::QAspectManager *manager) override { Q_UNUSED(manager) }
QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() override { return QVector<Qt3DCore::QAspectJobPtr>(); }
QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() override { return QVector<Qt3DCore::QAspectJobPtr>(); }
Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() override { return Qt3DCore::QAspectJobPtr(); }
Qt3DCore::QAspectJobPtr rayCastingJob() override { return Qt3DCore::QAspectJobPtr(); }
Qt3DCore::QAspectJobPtr syncLoadingJobs() override { return Qt3DCore::QAspectJobPtr(); }
Qt3DCore::QAspectJobPtr expandBoundingVolumeJob() override { return Qt3DCore::QAspectJobPtr(); }
- void setSceneRoot(Qt3DRender::Render::Entity *root) override { Q_UNUSED(root); }
+ void setSceneRoot(Qt3DRender::Render::Entity *root) override { Q_UNUSED(root) }
Qt3DRender::Render::Entity *sceneRoot() const override { return nullptr; }
Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const override { return nullptr; }
Qt3DCore::QAbstractFrameAdvanceService *frameAdvanceService() const override { return nullptr; }
- void registerEventFilter(Qt3DCore::QEventFilterService *service) override { Q_UNUSED(service); }
- void setSettings(Qt3DRender::Render::RenderSettings *settings) override { Q_UNUSED(settings); }
+ void registerEventFilter(Qt3DCore::QEventFilterService *service) override { Q_UNUSED(service) }
+ void setSettings(Qt3DRender::Render::RenderSettings *settings) override { Q_UNUSED(settings) }
Qt3DRender::Render::RenderSettings *settings() const override { return nullptr; }
void markDirty(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes, Qt3DRender::Render::BackendNode *node) override;
@@ -90,7 +91,7 @@ public:
protected:
Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet m_changes;
- Qt3DRender::Render::NodeManagers *m_managers;
+ Qt3DRender::Render::NodeManagers *m_managers = nullptr;
};
QT_END_NAMESPACE
diff --git a/tests/auto/render/computecommand/tst_computecommand.cpp b/tests/auto/render/computecommand/tst_computecommand.cpp
index 2046ecc76..4dc6b4436 100644
--- a/tests/auto/render/computecommand/tst_computecommand.cpp
+++ b/tests/auto/render/computecommand/tst_computecommand.cpp
@@ -54,11 +54,6 @@ public:
~tst_Renderer() {
shutdown();
}
-
- Qt3DRender::Render::SynchronizerPostFramePtr sendDisablesToFrontendJob() const
- {
- return m_sendDisablesToFrontendJob;
- }
};
@@ -337,8 +332,7 @@ private Q_SLOTS:
QCOMPARE(computeCommand.isEnabled(), true);
// WHEN
- auto sendDisablesJob = renderer.sendDisablesToFrontendJob();
- Qt3DCore::QAspectJobPrivate::get(sendDisablesJob.data())->postFrame(&manager);
+ renderer.jobsDone(&manager); // so Renderer::sendDisablesToFrontend gets called
// THEN
QCOMPARE(computeCommand.isEnabled(), false);
diff --git a/tests/auto/render/entity/tst_entity.cpp b/tests/auto/render/entity/tst_entity.cpp
index e3b8e756e..93f2614b8 100644
--- a/tests/auto/render/entity/tst_entity.cpp
+++ b/tests/auto/render/entity/tst_entity.cpp
@@ -35,7 +35,6 @@
#include <Qt3DRender/private/entityaccumulator_p.h>
#include <Qt3DRender/QCameraLens>
-#include <Qt3DCore/QPropertyNodeAddedChange>
#include <Qt3DCore/QTransform>
#include <Qt3DRender/QEnvironmentLight>
@@ -151,11 +150,6 @@ private slots:
nodeManagers.renderNodesManager()->getOrCreateResource(dummyFrontendEntity.id());
nodeManagers.renderNodesManager()->getOrCreateResource(dummyFrontendEntityChild.id());
-// TODOSYNC clean up
-// // Send children added event to entity
-// const auto addEntityChange = QPropertyNodeAddedChangePtr::create(dummyFrontendEntity.id(), &dummyFrontendEntityChild);
-// entity.sceneChangeEvent(addEntityChange);
-
// THEN
QVERIFY(!entity.componentUuid<Transform>().isNull());
QVERIFY(!entity.componentUuid<CameraLens>().isNull());
diff --git a/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp b/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp
index ad12ffad0..1b65388af 100644
--- a/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp
+++ b/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp
@@ -50,7 +50,7 @@ Qt3DCore::QEntity *buildEntityAtDistance(float distance, Qt3DCore::QEntity *pare
// create geometry with a valid bounding volume - a single point is sufficient
auto geometry = new Qt3DRender::QGeometry;
- auto vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, geometry);
+ auto vertexBuffer = new Qt3DRender::QBuffer(geometry);
auto positionAttribute = new Qt3DRender::QAttribute;
positionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
diff --git a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
index 24febdac4..6116e031e 100644
--- a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
+++ b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
@@ -94,7 +94,7 @@ private Q_SLOTS:
{
Qt3DRender::QFrameGraphNode *nodeWithNestedChildren = new MyFrameGraphNode();
Qt3DRender::QFrameGraphNode *child = new MyFrameGraphNode(nodeWithNestedChildren);
- Qt3DCore::QNode *dummy = new Qt3DCore::QNode(nodeWithNestedChildren);
+ new Qt3DCore::QNode(nodeWithNestedChildren);
Qt3DRender::QFrameGraphNode *grandChild = new MyFrameGraphNode(nodeWithNestedChildren);
QVector<Qt3DCore::QNodeId> childIds = {child->id(), grandChild->id()};
QTest::newRow("nodeWithNestedChildren") << nodeWithNestedChildren << childIds << true << 4;
diff --git a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
index eaf85f5b6..1ff899936 100644
--- a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
+++ b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
@@ -285,7 +285,7 @@ private Q_SLOTS:
initializeJob(&rayCastingJob, test.data());
bool earlyReturn = !rayCastingJob.runHelper();
- Qt3DCore::QAspectJobPrivate::get(&rayCastingJob)->postFrame(test->aspectManager());
+ rayCastingJob.postFrame(test->aspectManager());
QCoreApplication::processEvents();
// THEN
@@ -345,7 +345,7 @@ private Q_SLOTS:
initializeJob(&rayCastingJob, test.data());
bool earlyReturn = !rayCastingJob.runHelper();
- Qt3DCore::QAspectJobPrivate::get(&rayCastingJob)->postFrame(test->aspectManager());
+ rayCastingJob.postFrame(test->aspectManager());
QCoreApplication::processEvents();
// THEN
diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro
index 180ff7ac1..908426570 100644
--- a/tests/auto/render/render.pro
+++ b/tests/auto/render/render.pro
@@ -137,7 +137,6 @@ qtConfig(qt3d-opengl-renderer):qtConfig(private_tests) {
renderviews \
renderqueue \
renderviewbuilder \
- sendrendercapturejob \
gltexture
qtConfig(qt3d-extras) {
diff --git a/tests/auto/render/renderer/tst_renderer.cpp b/tests/auto/render/renderer/tst_renderer.cpp
index a343d6e57..0cbc1aefc 100644
--- a/tests/auto/render/renderer/tst_renderer.cpp
+++ b/tests/auto/render/renderer/tst_renderer.cpp
@@ -78,16 +78,6 @@ private Q_SLOTS:
1); // RayCastingJob
// WHEN
- renderer.addRenderCaptureSendRequest(Qt3DCore::QNodeId::createId());
- jobs = renderer.preRenderingJobs();
-
- // THEN
- QCOMPARE(jobs.size(),
- 1 + // PickBoundingVolumeJob
- 1 + // RayCastingJob
- 1); // SendRenderCaptureJob
-
- // WHEN
renderer.m_sendBufferCaptureJob->addRequest({Qt3DCore::QNodeId(), {}});
jobs = renderer.preRenderingJobs();
@@ -110,20 +100,6 @@ private Q_SLOTS:
1); // SendSetFenceHandlesJob
// Note: pending set fence handles are only cleared when the job is run
- // WHEN
- renderer.m_updatedTextureProperties.push_back({{}, {}});
- jobs = renderer.preRenderingJobs();
-
- // THEN
- QCOMPARE(jobs.size(),
- 1 + // PickBoundingVolumeJob
- 1 + // RayCastingJob
- 1 + // SendBufferCaptureJob
- 1 + // SendSetFenceHandlesJob
- 1); // SendTextureChangesToFrontend
-
- // Note: pending texture changes are only cleared when the job is run
-
// Properly shutdown command thread
renderer.shutdown();
}
@@ -192,7 +168,6 @@ private Q_SLOTS:
1 + // SyncLoadingJobs
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendDisablesToFrontend
1 + // VAOGatherer
1 + // BufferGathererJob
1 + // TexturesGathererJob
@@ -222,7 +197,6 @@ private Q_SLOTS:
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
1 + // SyncLoadingJobs
- 1 + // sendDisablesToFrontend
singleRenderViewJobCount +
singleRenderViewCommandRebuildJobCount +
renderViewBuilderMaterialCacheJobCount +
@@ -243,7 +217,6 @@ private Q_SLOTS:
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
1 + // SyncLoadingJobs
- 1 + // sendDisablesToFrontend
singleRenderViewJobCount +
singleRenderViewCommandRebuildJobCount +
renderViewBuilderMaterialCacheJobCount +
@@ -263,7 +236,6 @@ private Q_SLOTS:
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
1 + // SyncLoadingJobs
- 1 + // sendDisablesToFrontend
1 + // EntityEnabledDirty
singleRenderViewJobCount +
layerCacheJobCount);
@@ -285,7 +257,6 @@ private Q_SLOTS:
1 + // UpdateShaderDataTransform
1 + // updateSkinningPaletteJob
1 + // SyncLoadingJobs
- 1 + // sendDisablesToFrontend
1 + // ExpandBoundingVolumeJob
singleRenderViewJobCount);
@@ -303,7 +274,6 @@ private Q_SLOTS:
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
1 + // SyncLoadingJobs
- 1 + // sendDisablesToFrontend
singleRenderViewJobCount +
singleRenderViewCommandRebuildJobCount +
renderViewBuilderMaterialCacheJobCount);
@@ -327,7 +297,6 @@ private Q_SLOTS:
1 + // ExpandBoundingVolumeJob
1 + // RenderableEntityFilterPtr
1 + // SyncRenderableEntities
- 1 + // sendDisablesToFrontend
singleRenderViewCommandRebuildJobCount +
singleRenderViewJobCount);
@@ -348,7 +317,6 @@ private Q_SLOTS:
1 + // CalculateBoundingVolumeJob
1 + // UpdateMeshTriangleListJob
1 + // BufferGathererJob
- 1 + // sendDisablesToFrontend
singleRenderViewJobCount);
renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
@@ -366,7 +334,6 @@ private Q_SLOTS:
1 + // TexturesGathererJob
1 + // updateSkinningPaletteJob
1 + // SyncTexturesGathererJob
- 1 + // sendDisablesToFrontend
singleRenderViewJobCount);
renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
diff --git a/tests/auto/render/sendrendercapturejob/sendrendercapturejob.pro b/tests/auto/render/sendrendercapturejob/sendrendercapturejob.pro
deleted file mode 100644
index 6aff0bebd..000000000
--- a/tests/auto/render/sendrendercapturejob/sendrendercapturejob.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_sendrendercapturejob
-
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_sendrendercapturejob.cpp
-
-include(../commons/commons.pri)
-include(../../core/common/common.pri)
diff --git a/tests/auto/render/sendrendercapturejob/tst_sendrendercapturejob.cpp b/tests/auto/render/sendrendercapturejob/tst_sendrendercapturejob.cpp
deleted file mode 100644
index 53a646ccd..000000000
--- a/tests/auto/render/sendrendercapturejob/tst_sendrendercapturejob.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include "Qt3DRender/QRenderAspect"
-#include "Qt3DRender/private/renderer_p.h"
-#include "Qt3DRender/private/nodemanagers_p.h"
-#include "Qt3DRender/private/rendercapture_p.h"
-#include <Qt3DRender/private/sendrendercapturejob_p.h>
-#include "testpostmanarbiter.h"
-
-class tst_SendRenderCaptureJob : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
- void testSendRenderCaptureRequest()
- {
- // GIVEN
- TestArbiter arbiter;
- Qt3DRender::Render::RenderCapture *renderCapture = new Qt3DRender::Render::RenderCapture;
- Qt3DCore::QBackendNodePrivate::get(renderCapture)->setArbiter(&arbiter);
-
- QImage image(10, 10, QImage::Format_ARGB32);
-
- Qt3DRender::Render::Renderer renderer(Qt3DRender::QRenderAspect::Synchronous);
- Qt3DRender::Render::SendRenderCaptureJob job;
-
- Qt3DRender::Render::NodeManagers nodeManagers;
- nodeManagers.frameGraphManager()->appendNode(renderCapture->peerId(), renderCapture);
- renderer.setNodeManagers(&nodeManagers);
- job.setManagers(&nodeManagers);
-
- renderCapture->requestCapture({ 42, QRect() });
- auto request = renderCapture->takeCaptureRequest();
- renderCapture->addRenderCapture(request.captureId, image);
- renderer.addRenderCaptureSendRequest(renderCapture->peerId());
- job.setPendingCaptureRequests(renderer.takePendingRenderCaptureSendRequests());
-
- //WHEN
- job.run();
-
- //THEN
- QCOMPARE(arbiter.events.count(), 1);
- Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
- QCOMPARE(change->subjectId(), renderCapture->peerId());
- QCOMPARE(change->propertyName(), "renderCaptureData");
- auto data = change->value().value<Qt3DRender::RenderCaptureDataPtr>();
- QCOMPARE(data.data()->captureId, 42);
- QCOMPARE(data.data()->image.width(), 10);
- QCOMPARE(data.data()->image.height(), 10);
- QCOMPARE(data.data()->image.format(), QImage::Format_ARGB32);
-
- // renderCapture will be deallocated by the nodeManagers destructor
- renderer.shutdown();
- }
-};
-
-QTEST_APPLESS_MAIN(tst_SendRenderCaptureJob)
-
-#include "tst_sendrendercapturejob.moc"
diff --git a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp
index 7a08fe018..24dbe514a 100644
--- a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp
+++ b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp
@@ -560,6 +560,7 @@ private slots:
QVERIFY(!Qt3DRender::Render::ShaderBuilder::getPrototypeNames().isEmpty());
QFETCH(Qt3DRender::QShaderProgram::ShaderType, type);
QFETCH(Qt3DRender::QShaderProgram::ShaderType, notificationType);
+ Q_UNUSED(notificationType)
const auto gl3Api = []{
auto api = Qt3DRender::GraphicsApiFilterData();
diff --git a/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp b/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp
index 1238f1800..aafdb36f7 100644
--- a/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp
+++ b/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp
@@ -71,7 +71,7 @@ private:
bool isReadyToSubmit()
{
m_submitSemaphore.acquire(1);
- return m_running.load() == 1;
+ return m_running.loadRelaxed() == 1;
}
Qt3DRender::Render::VSyncFrameAdvanceService *m_tickService;
diff --git a/tests/manual/rendercapture-qml/main.qml b/tests/manual/rendercapture-qml/main.qml
index 9aff1fefe..98b24e251 100644
--- a/tests/manual/rendercapture-qml/main.qml
+++ b/tests/manual/rendercapture-qml/main.qml
@@ -50,7 +50,7 @@
import QtQuick 2.2
import QtQuick.Layouts 1.3
-import QtQuick.Controls 1.4
+import QtQuick.Controls 2.12
import Qt3D.Render 2.9
import QtQuick.Scene3D 2.0
diff --git a/tools/qgltf/qgltf.cpp b/tools/qgltf/qgltf.cpp
index 562e50911..91ecd5ba2 100644
--- a/tools/qgltf/qgltf.cpp
+++ b/tools/qgltf/qgltf.cpp
@@ -216,7 +216,9 @@ static inline QVector<float> ai2qt(const aiMatrix4x4 &matrix)
struct Options {
QString outDir;
+#ifndef QT_BOOTSTRAPPED
bool genBin;
+#endif
bool compact;
bool compress;
bool genTangents;
@@ -2450,23 +2452,31 @@ void GltfExporter::save(const QString &inputFilename)
QString gltfName = opts.outDir + basename + QStringLiteral(".qgltf");
f.setFileName(gltfName);
+
+#ifndef QT_BOOTSTRAPPED
if (opts.showLog)
qDebug().noquote() << (opts.genBin ? "Writing (binary JSON)" : "Writing") << gltfName;
- if (opts.genBin) {
- if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- m_files.insert(QFileInfo(f.fileName()).fileName());
- QByteArray json = m_doc.toBinaryData();
- f.write(json);
- f.close();
- }
- } else {
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
- m_files.insert(QFileInfo(f.fileName()).fileName());
- QByteArray json = m_doc.toJson(opts.compact ? QJsonDocument::Compact : QJsonDocument::Indented);
- f.write(json);
- f.close();
- }
+ const QIODevice::OpenMode openMode = opts.genBin
+ ? (QIODevice::WriteOnly | QIODevice::Truncate)
+ : (QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
+ const QByteArray json = opts.genBin
+ ? m_doc.toBinaryData()
+ : m_doc.toJson(opts.compact ? QJsonDocument::Compact : QJsonDocument::Indented);
+#else
+ if (opts.showLog)
+ qDebug().noquote() << "Writing" << gltfName;
+
+ const QIODevice::OpenMode openMode
+ = QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text;
+ const QByteArray json
+ = m_doc.toJson(opts.compact ? QJsonDocument::Compact : QJsonDocument::Indented);
+#endif
+
+ if (f.open(openMode)) {
+ m_files.insert(QFileInfo(f.fileName()).fileName());
+ f.write(json);
+ f.close();
}
QString qrcName = opts.outDir + basename + QStringLiteral(".qrc");
@@ -2509,8 +2519,10 @@ int main(int argc, char **argv)
cmdLine.setApplicationDescription(QString::fromUtf8(description));
QCommandLineOption outDirOpt(QStringLiteral("d"), QStringLiteral("Place all output data into <dir>"), QStringLiteral("dir"));
cmdLine.addOption(outDirOpt);
+#ifndef QT_BOOTSTRAPPED
QCommandLineOption binOpt(QStringLiteral("b"), QStringLiteral("Store binary JSON data in the .qgltf file"));
cmdLine.addOption(binOpt);
+#endif
QCommandLineOption compactOpt(QStringLiteral("m"), QStringLiteral("Store compact JSON in the .qgltf file"));
cmdLine.addOption(compactOpt);
QCommandLineOption compOpt(QStringLiteral("c"), QStringLiteral("qCompress() vertex/index data in the .bin file"));
@@ -2533,7 +2545,9 @@ int main(int argc, char **argv)
cmdLine.addOption(silentOpt);
cmdLine.process(app);
opts.outDir = cmdLine.value(outDirOpt);
+#ifndef QT_BOOTSTRAPPED
opts.genBin = cmdLine.isSet(binOpt);
+#endif
opts.compact = cmdLine.isSet(compactOpt);
opts.compress = cmdLine.isSet(compOpt);
opts.genTangents = cmdLine.isSet(tangentOpt);