From 84fe56e60ee0668290911fa017fd58ffb9e4cd3e Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 14 Oct 2019 09:42:03 +0200 Subject: [PATCH 01/13] Bump version Change-Id: I6840c8f666991a2c29a5394069266de9e8c014e2 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index b1f6099df..d9464b0c8 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -3,4 +3,4 @@ QT3D_BUILD_ROOT = $$shadowed($$PWD) load(qt_build_config) -MODULE_VERSION = 5.13.1 +MODULE_VERSION = 5.13.2 From 93361f1a59c1edd2e4eb6d2aa7e2da5b73760a18 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Mon, 14 Oct 2019 10:28:54 +0300 Subject: [PATCH 02/13] Add changes file for Qt 5.13.2 Change-Id: I94eb9efad7e331016b44d309feba62436a5bc4c3 Reviewed-by: Paul Lemire --- dist/changes-5.13.2 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 dist/changes-5.13.2 diff --git a/dist/changes-5.13.2 b/dist/changes-5.13.2 new file mode 100644 index 000000000..e3bb833f0 --- /dev/null +++ b/dist/changes-5.13.2 @@ -0,0 +1,20 @@ +Qt 5.13.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.13.0 through 5.13.1. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.13 series is binary compatible with the 5.12.x series. +Applications compiled for 5.12 will continue to run with 5.13. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + - This release contains only minor code improvements. From 1900fa29926d9b8756250b155ebf92cc4769aecd Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 29 Oct 2019 12:26:52 +0100 Subject: [PATCH 03/13] Fix the way we compute light positions We were using worldBoundingVolume->center() but this has been changed recently and a null bounding volume now cannot be transformed. Instead just use the worldMatrix transform to compute the light position. Change-Id: I2d884a4a5a3808ff812eb581f6bb631bbe6ab4c1 Reviewed-by: Paul Lemire --- src/render/renderers/opengl/renderer/renderview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp index 117aca3c7..dd394b5f7 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -1036,7 +1036,8 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, if (lightIdx == MAX_LIGHTS) break; Entity *lightEntity = lightSource.entity; - const Vector3D worldPos = lightEntity->worldBoundingVolume()->center(); + const Matrix4x4 lightWorldTransform = *(lightEntity->worldTransform()); + const Vector3D worldPos = lightWorldTransform * Vector3D(0.0f, 0.0f, 0.0f); for (Light *light : lightSource.lights) { if (!light->isEnabled()) continue; From b33b615f4a4ac4d61bbce320783d5cca6edd91d1 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 31 Oct 2019 14:21:05 +0100 Subject: [PATCH 04/13] QNode: stop using hash for bookkeeping It is totally valid to have actually the same node used for 2 distinct connections (e.g setting 2 different node properties to the same node). With the hash, the second setter call would overwrite the first connection resulting in leaving a dangling connection around potentially resulting in crashes. Instead use a QVector> and adjust code accordingly. Change-Id: I49870c409c3f7b629c8f1bdfcb8757a904db2490 Reviewed-by: Mike Krus (cherry picked from commit 906f8a62f89a7ce2343a155e6db62616e66dc14b) Reviewed-by: Paul Lemire --- src/core/nodes/qnode.cpp | 5 ++--- src/core/nodes/qnode_p.h | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index 900c3f8ce..c418e03d5 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -795,10 +795,9 @@ QNode::~QNode() { Q_D(QNode); // Disconnect each connection that was stored - for (auto it = d->m_destructionConnections.begin(), end = d->m_destructionConnections.end(); it != end; ++it) - QObject::disconnect(it.value()); + for (const auto &nodeConnectionPair : qAsConst(d->m_destructionConnections)) + QObject::disconnect(nodeConnectionPair.second); d->m_destructionConnections.clear(); - Q_EMIT nodeDestroyed(); // Notify the backend that the parent lost this node as a child and diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h index 511a0e562..86bfab85a 100644 --- a/src/core/nodes/qnode_p.h +++ b/src/core/nodes/qnode_p.h @@ -120,7 +120,7 @@ public: // If the node is destoyed, we make sure not to keep a dangling pointer to it Q_Q(QNode); auto f = [q, func]() { (static_cast(q)->*func)(nullptr); }; - m_destructionConnections.insert(node, QObject::connect(node, &QNode::nodeDestroyed, f)); + m_destructionConnections.push_back({node, QObject::connect(node, &QNode::nodeDestroyed, f)}); } template @@ -129,7 +129,7 @@ public: // If the node is destoyed, we make sure not to keep a dangling pointer to it Q_Q(QNode); auto f = [q, func, node]() { (static_cast(q)->*func)(node); }; - m_destructionConnections.insert(node, QObject::connect(node, &QNode::nodeDestroyed, f)); + m_destructionConnections.push_back({node, QObject::connect(node, &QNode::nodeDestroyed, f)}); } template @@ -142,7 +142,7 @@ public: // If the node is destoyed, we make sure not to keep a dangling pointer to it Q_Q(QNode); auto f = [q, func, resetValue]() { (static_cast(q)->*func)(resetValue); }; - m_destructionConnections.insert(node, QObject::connect(node, &QNode::nodeDestroyed, f)); + m_destructionConnections.push_back({node, QObject::connect(node, &QNode::nodeDestroyed, f)}); } template @@ -150,12 +150,21 @@ public: { // If the node is destoyed, we make sure not to keep a dangling pointer to it auto f = [this, func, node]() { (static_cast(this)->*func)(node); }; - m_destructionConnections.insert(node, QObject::connect(node, &QNode::nodeDestroyed, f)); + m_destructionConnections.push_back({node, QObject::connect(node, &QNode::nodeDestroyed, f)}); } void unregisterDestructionHelper(QNode *node) { - QObject::disconnect(m_destructionConnections.take(node)); + m_destructionConnections.erase(std::remove_if(m_destructionConnections.begin(), + m_destructionConnections.end(), + [this, node] (const QPair &nodeConnectionPair) { + if (nodeConnectionPair.first == node) { + QObject::disconnect(nodeConnectionPair.second); + return true; + } + return false; + }), + m_destructionConnections.end()); } static const QMetaObject *findStaticMetaObject(const QMetaObject *metaObject); @@ -180,7 +189,7 @@ private: friend class PropertyChangeHandler; bool m_propertyChangesSetup; PropertyChangeHandler m_signals; - QHash m_destructionConnections; + QVector> m_destructionConnections; }; class NodePostConstructorInit : public QObject From 714731b0e8bc34ebd5873c8818830a8ee89045d5 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 8 Nov 2019 10:12:19 +0100 Subject: [PATCH 05/13] ShaderParameterPack: stop calling hash.clear() in dtor Can only make the overall destruction of the object longer Change-Id: Ic5033287fb770ed4a01ffd6b315310b74e8a3797 Reviewed-by: Mike Krus --- src/render/renderers/opengl/renderer/shaderparameterpack.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/render/renderers/opengl/renderer/shaderparameterpack.cpp b/src/render/renderers/opengl/renderer/shaderparameterpack.cpp index 13d05cac1..1cfb59343 100644 --- a/src/render/renderers/opengl/renderer/shaderparameterpack.cpp +++ b/src/render/renderers/opengl/renderer/shaderparameterpack.cpp @@ -57,7 +57,6 @@ namespace Render { ShaderParameterPack::~ShaderParameterPack() { - m_uniforms.clear(); } void ShaderParameterPack::setUniform(const int glslNameId, const UniformValue &val) From 53a780960aa5245eb3e534e6bd0c268c050c52fa Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 8 Nov 2019 10:28:54 +0100 Subject: [PATCH 06/13] Uniform: use QVarLengthArray<16 ,float> instead of <4, float> This otherwise yield for lots of reallocations that could be avoided. The gains seem to be about 2/3% of cpu usage according the analysis with vTune. It does indeed mean that for smaller uniforms vec4, float, sampler we are wasting a bit of memory. The impact of this is likely to be unsignificant though. Change-Id: Id72c81a795bf9326ef48b170bb0806de9b430412 Reviewed-by: Mike Krus --- src/render/backend/uniform_p.h | 2 +- tests/auto/render/uniform/tst_uniform.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/backend/uniform_p.h b/src/render/backend/uniform_p.h index 09575a077..634c0cd96 100644 --- a/src/render/backend/uniform_p.h +++ b/src/render/backend/uniform_p.h @@ -229,7 +229,7 @@ public: private: // Allocate 4 floats on stack // For larger elements, heap allocation will be used - QVarLengthArray m_data; + QVarLengthArray m_data; ValueType m_valueType = ScalarValue; diff --git a/tests/auto/render/uniform/tst_uniform.cpp b/tests/auto/render/uniform/tst_uniform.cpp index 5f946afa3..d7775eb62 100644 --- a/tests/auto/render/uniform/tst_uniform.cpp +++ b/tests/auto/render/uniform/tst_uniform.cpp @@ -112,7 +112,7 @@ private Q_SLOTS: QCOMPARE(v.constData()[0], 572.0f); QCOMPARE(v.constData()[1], 355.0f); QCOMPARE(v.constData()[2], 383.0f); - QCOMPARE(v.constData()[4], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); } { // GIVEN From 8de836c63eb0a0e484ae4c9e02f0a5f23ef49b65 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 8 Nov 2019 11:02:03 +0100 Subject: [PATCH 07/13] FilterProximityJob: only run it if our RV requires proximity filtering Which is only very rarely required by user applications. Avoid useless memory allocations every frame Change-Id: I69ea73ebfffdbe928f99333b4d1dd90cf4ada430 Reviewed-by: Mike Krus --- src/render/jobs/filterproximitydistancejob.cpp | 2 +- .../opengl/renderer/renderviewbuilder.cpp | 3 ++- .../proximityfiltering/tst_proximityfiltering.cpp | 14 ++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/render/jobs/filterproximitydistancejob.cpp b/src/render/jobs/filterproximitydistancejob.cpp index 80a9e4777..02b712fc2 100644 --- a/src/render/jobs/filterproximitydistancejob.cpp +++ b/src/render/jobs/filterproximitydistancejob.cpp @@ -57,9 +57,9 @@ void FilterProximityDistanceJob::run() // Fill m_filteredEntities // If no filtering needs to be done, this will be the output value // otherwise it will be used as the base list of entities to filter - selectAllEntities(); if (hasProximityFilter()) { + selectAllEntities(); QVector entitiesToFilter = std::move(m_filteredEntities); FrameGraphManager *frameGraphManager = m_manager->frameGraphManager(); EntityManager *entityManager = m_manager->renderNodesManager(); diff --git a/src/render/renderers/opengl/renderer/renderviewbuilder.cpp b/src/render/renderers/opengl/renderer/renderviewbuilder.cpp index 40179fbd6..96fa55c47 100644 --- a/src/render/renderers/opengl/renderer/renderviewbuilder.cpp +++ b/src/render/renderers/opengl/renderer/renderviewbuilder.cpp @@ -310,7 +310,8 @@ public: if (rv->frustumCulling()) renderableEntities = RenderViewBuilder::entitiesInSubset(renderableEntities, m_frustumCullingJob->visibleEntities()); // Filter out entities which didn't satisfy proximity filtering - renderableEntities = RenderViewBuilder::entitiesInSubset(renderableEntities, m_filterProximityJob->filteredEntities()); + if (!rv->proximityFilterIds().empty()) + renderableEntities = RenderViewBuilder::entitiesInSubset(renderableEntities, m_filterProximityJob->filteredEntities()); } // Filter out Render commands for which the Entity wasn't selected because diff --git a/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp b/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp index 1bed9fc44..ad12ffad0 100644 --- a/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp +++ b/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp @@ -117,14 +117,20 @@ private Q_SLOTS: { Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity(); - Qt3DCore::QEntity *childEntity1 = new Qt3DCore::QEntity(rootEntity); - Qt3DCore::QEntity *childEntity2 = new Qt3DCore::QEntity(rootEntity); - Qt3DCore::QEntity *childEntity3 = new Qt3DCore::QEntity(rootEntity); + Qt3DCore::QEntity *targetEntity = new Qt3DCore::QEntity(rootEntity); + Qt3DCore::QEntity *childEntity1 = buildEntityAtDistance(50.0f, rootEntity); + Qt3DCore::QEntity *childEntity2 = buildEntityAtDistance(25.0f, rootEntity); + Qt3DCore::QEntity *childEntity3 = buildEntityAtDistance(75.0f, rootEntity); + + Qt3DRender::QProximityFilter *proximityFilter = new Qt3DRender::QProximityFilter(rootEntity); + proximityFilter->setDistanceThreshold(200.0f); + proximityFilter->setEntity(targetEntity); QTest::newRow("ShouldSelectAll") << rootEntity - << Qt3DCore::QNodeIdVector() + << (Qt3DCore::QNodeIdVector() << proximityFilter->id()) << (Qt3DCore::QNodeIdVector() << rootEntity->id() + << targetEntity->id() << childEntity1->id() << childEntity2->id() << childEntity3->id() From 0b5d01eeec9913a0bb0d545b48d13cec8dde5354 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 13 Nov 2019 09:19:05 +0100 Subject: [PATCH 08/13] Doc: Fix documentation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add (basic) documentation for Qt3DAnimation::QAnimationCallback. - Add missing namespace qualifiers for \class, \fn, \instantiates, \sa, and \property commands. - Remove linking to example file pages, as QDoc no longe treats them as linkable targets. - Fix function/QML method parameter documentation - Fix missing \qmlproperty types - Fix linking to QKeyEvent in QtGui. - Move Qt3DRender::Quick namespace documentation to where QDoc can see it. - Add enum documentation for Qt3DRender::QBlitFramebuffer::InterpolationMethod and Qt3DRender::QMesh::Status. - Other minor fixes This brings the current warning count to zero. Fixes: QTBUG-79822 Change-Id: I1154a7f9c34917a3f240e99da0e7a300be7d65a0 Reviewed-by: Topi Reiniƶ --- .../doc/src/advancedcustommaterial.qdoc | 6 +-- .../doc/src/audio-visualizer-qml.qdoc | 8 +-- .../qt3d/planets-qml/doc/src/planets-qml.qdoc | 14 ++--- .../doc/src/simplecustommaterial.qdoc | 2 +- .../frontend/qabstractanimationclip.cpp | 2 +- .../frontend/qanimationcallback.qdoc | 51 +++++++++++++++++++ src/animation/frontend/qanimationclip.cpp | 4 +- src/animation/frontend/qanimationclipdata.cpp | 2 +- src/animation/frontend/qcallbackmapping.cpp | 2 +- src/animation/frontend/qchannel.cpp | 2 +- src/animation/frontend/qchannelmapper.cpp | 2 +- src/animation/frontend/qchannelmapping.cpp | 2 +- src/animation/frontend/qclipanimator.cpp | 3 +- src/animation/frontend/qclipblendvalue.cpp | 4 +- src/animation/frontend/qmorphtarget.cpp | 4 +- src/core/nodes/qentity.cpp | 2 +- src/extras/defaults/qabstractspritesheet.cpp | 2 +- src/input/frontend/qactioninput.cpp | 2 +- src/input/frontend/qkeyevent.cpp | 6 +-- src/input/frontend/qmousehandler.cpp | 6 +-- .../frontend/qphysicaldevicecreatedchange.cpp | 2 +- src/quick3d/imports/scene3d/scene3ditem.cpp | 2 +- src/quick3d/quick3dscene2d/items/qscene2d.cpp | 6 +++ src/quick3d/quick3dscene2d/items/qscene2d.h | 5 -- src/render/framegraph/qblitframebuffer.cpp | 4 ++ src/render/framegraph/qsetfence.cpp | 9 ++-- src/render/framegraph/qwaitfence.cpp | 12 ++--- src/render/frontend/qcamera.cpp | 2 +- src/render/frontend/qcomputecommand.cpp | 6 +-- src/render/geometry/qmesh.cpp | 22 ++++---- src/render/io/qsceneloader.cpp | 2 +- src/render/materialsystem/qshaderimage.cpp | 25 +++++---- src/render/picking/qabstractraycaster.cpp | 4 -- src/render/picking/qobjectpicker.cpp | 2 +- src/render/renderstates/qrastermode.cpp | 4 +- src/render/texture/qabstracttexture.cpp | 16 +++--- src/render/texture/qabstracttextureimage.cpp | 4 +- src/render/texture/qtexturegenerator.cpp | 3 +- 38 files changed, 159 insertions(+), 97 deletions(-) create mode 100644 src/animation/frontend/qanimationcallback.qdoc diff --git a/examples/qt3d/advancedcustommaterial/doc/src/advancedcustommaterial.qdoc b/examples/qt3d/advancedcustommaterial/doc/src/advancedcustommaterial.qdoc index 377bb952c..d845fa8da 100644 --- a/examples/qt3d/advancedcustommaterial/doc/src/advancedcustommaterial.qdoc +++ b/examples/qt3d/advancedcustommaterial/doc/src/advancedcustommaterial.qdoc @@ -42,7 +42,7 @@ Advanced custom material example shows more complex shaders, and demonstrates controlling your shader properties with QtQuick user interface and Animation. Water is a 3D mesh, that is modeled and uv mapped inside Blender, and then brought into Scene 3D as an \c {.obj} file. - Shader properties that user can control, are defined in \l {advancedcustommaterial/WaterMaterial.qml}{WaterMaterial}. + Shader properties that user can control, are defined in \c {advancedcustommaterial/WaterMaterial.qml}. \section1 Controls \section2 Texture scale slider @@ -53,7 +53,7 @@ \section2 Texture speed slider Offsets values for texture coordinates which are animated in - \l {advancedcustommaterial/Water.qml}{Water.qml} and then passed to vertex shader. + \c {advancedcustommaterial/Water.qml} and then passed to vertex shader. Creates the effect of textures scrolling over the surface. \section2 Specularity @@ -80,5 +80,5 @@ \section2 Mesh rotation - Rotates the water mesh in \l {advancedcustommaterial/Water.qml}{Water.qml}. + Rotates the water mesh in \c {advancedcustommaterial/Water.qml}. */ diff --git a/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc b/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc index 5a204757e..6c0b40301 100644 --- a/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc +++ b/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc @@ -41,7 +41,7 @@ \section1 Qt Quick 2D Implementation - The Qt Quick Implementation \l{audio-visualizer-qml/main.qml}{main.qml} of the example uses + The Qt Quick Implementation in \c {audio-visualizer-qml/main.qml} of the example uses \c{MediaPlayer} to play audio content. \snippet audio-visualizer-qml/main.qml 0 @@ -57,8 +57,8 @@ \section1 Qt 3D Implementation - The 3D elements of the example are created in the - \l{audio-visualizer-qml/Visualizer.qml}{Visualizer.qml}. The camera is set to a fixed position + The 3D elements of the example are created in + \c {audio-visualizer-qml/Visualizer.qml}. The camera is set to a fixed position to show the visualized bars from a correct angle. \snippet audio-visualizer-qml/Visualizer.qml 0 @@ -73,7 +73,7 @@ \snippet audio-visualizer-qml/Visualizer.qml 2 - In \l{audio-visualizer-qml/BarEntity.qml}{BarEntity.qml} there are animations for rotating the + In \c {audio-visualizer-qml/BarEntity.qml} there are animations for rotating the bars and changing the bar color. The bars are rotated on a level following a ring form. At the same time the color of the bars is animated. diff --git a/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc b/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc index 2dae457a0..a8c89fbe2 100644 --- a/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc +++ b/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc @@ -50,14 +50,14 @@ \section1 Qt Quick 2D Implementation - The Qt Quick Implementation \l{planets-qml/PlanetsMain.qml}{PlanetsMain.qml} of the + The Qt Quick Implementation in \c {planets-qml/PlanetsMain.qml} of the example renders the 3D content using the \c Scene3D type. \snippet planets-qml/PlanetsMain.qml 0 The planet related information is stored into a \c{ListModel}. The selection buttons for the planets and the information sheet are created based on the model. The 2D elements, selection - buttons and sliders, are implemented in the \l{planets-qml/PlanetsMain.qml}{PlanetsMain.qml}. + buttons and sliders, are implemented in \c {planets-qml/PlanetsMain.qml}. The selection buttons change the \c{focusedPlanet} property of the \c{mainview}. As the property changes, the planet information is updated, and the camera is animated to the new position. @@ -65,14 +65,14 @@ \snippet planets-qml/PlanetsMain.qml 1 The camera position and the camera look at point are updated based on values that are animated - in the \l{planets-qml/SolarSystem.qml}{SolarSystem.qml}, triggered from the + in \c {planets-qml/SolarSystem.qml}, triggered from the \c{changePlanetFocus()} function. \snippet planets-qml/SolarSystem.qml 0 The sliders are used to adjust the rotation speed, the planet size, and the viewing distance. - When a slider value changes, a JavaScript function in \l{planets-qml/SolarSystem.qml} - {SolarSystem.qml} is called to adjust the given property. For example, changing the value of + When a slider value changes, a JavaScript function in \c {planets-qml/SolarSystem.qml} + is called to adjust the given property. For example, changing the value of the \e{Viewing Distance} slider calls the \c{changeCameraDistance()} method. \snippet planets-qml/PlanetsMain.qml 2 @@ -80,7 +80,7 @@ \section1 Qt 3D Implementation The main part of the implementation, including the movement and rotation maths for the planets, - is done in the \l{planets-qml/SolarSystem.qml}{SolarSystem.qml}. + is done in \c {planets-qml/SolarSystem.qml}. First, a \c Camera, a \c{Light}, and a \c Configuration are added, followed by \c{Effect}s for the planet \c{Material}s, and finally the planets themselves. For example, Earth is constructed @@ -89,7 +89,7 @@ \snippet planets-qml/SolarSystem.qml 1 Planet data, which is needed for the movement and rotation calculations, among other things, is - constructed with JavaScript in \l{planets-qml/planets.js}{planets.js} by calling + constructed with JavaScript in \c {planets-qml/planets.js} by calling \c{loadPlanetData()} as the component completes. Other initializations, such as inserting the planets into an array for easier handling, calculating the ring radii for Saturn and Uranus rings, and setting the default scale, speed, and camera offset, are done as well: diff --git a/examples/qt3d/simplecustommaterial/doc/src/simplecustommaterial.qdoc b/examples/qt3d/simplecustommaterial/doc/src/simplecustommaterial.qdoc index d10927d39..7ec7c7abb 100644 --- a/examples/qt3d/simplecustommaterial/doc/src/simplecustommaterial.qdoc +++ b/examples/qt3d/simplecustommaterial/doc/src/simplecustommaterial.qdoc @@ -48,7 +48,7 @@ \section1 Specifying the Material - The material is specified in \l{simplecustommaterial/SimpleMaterial.qml}{SimpleMaterial.qml} + The material is specified in \c {simplecustommaterial/SimpleMaterial.qml} using \l Material type. First the material specifies parameters, which are mapped to the corresponding uniforms in the shaders so that they can be changed from the qml. diff --git a/src/animation/frontend/qabstractanimationclip.cpp b/src/animation/frontend/qabstractanimationclip.cpp index 53ae46809..08133072c 100644 --- a/src/animation/frontend/qabstractanimationclip.cpp +++ b/src/animation/frontend/qabstractanimationclip.cpp @@ -121,7 +121,7 @@ void QAbstractAnimationClipPrivate::setDuration(float duration) animator->setRunning(true); \endcode - \sa QAnimationClip, QAnimationClipLoader + \sa Qt3DAnimation::QAnimationClip, Qt3DAnimation::QAnimationClipLoader */ /*! diff --git a/src/animation/frontend/qanimationcallback.qdoc b/src/animation/frontend/qanimationcallback.qdoc new file mode 100644 index 000000000..5c6e8e212 --- /dev/null +++ b/src/animation/frontend/qanimationcallback.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class Qt3DAnimation::QAnimationCallback + \inmodule Qt3DAnimation + \brief Represents an animation callback object. +*/ + +/*! + \enum Qt3DAnimation::QAnimationCallback::Flag + + Flags to indicate how the valueChanged() function is called. + + \value OnOwningThread + Callback function is called on the owning (GUI or main) thread. + \value OnThreadPool + Callback function is called on the thread pool's worker thread. +*/ + +/*! + \fn Qt3DAnimation::QAnimationCallback::valueChanged(const QVariant &value) + + Callback function that is triggered for changes in the animated \a value. + + \sa QCallbackMapping::setCallback() +*/ diff --git a/src/animation/frontend/qanimationclip.cpp b/src/animation/frontend/qanimationclip.cpp index d624a246a..74a9b8371 100644 --- a/src/animation/frontend/qanimationclip.cpp +++ b/src/animation/frontend/qanimationclip.cpp @@ -51,8 +51,8 @@ QAnimationClipPrivate::QAnimationClipPrivate() } /*! - \class QAnimationClip - \inherits QAbstractAnimationClip + \class Qt3DAnimation::QAnimationClip + \inherits Qt3dAnimation::QAbstractAnimationClip \inmodule Qt3DAnimation \brief Specifies key frame animation data. */ diff --git a/src/animation/frontend/qanimationclipdata.cpp b/src/animation/frontend/qanimationclipdata.cpp index 49de71e79..e105b7b43 100644 --- a/src/animation/frontend/qanimationclipdata.cpp +++ b/src/animation/frontend/qanimationclipdata.cpp @@ -53,7 +53,7 @@ public: }; /*! - \class QAnimationClipData + \class Qt3DAnimation::QAnimationClipData \inmodule Qt3DAnimation \brief Class containing the animation data. */ diff --git a/src/animation/frontend/qcallbackmapping.cpp b/src/animation/frontend/qcallbackmapping.cpp index 53f7a5e33..24b5d2e6e 100644 --- a/src/animation/frontend/qcallbackmapping.cpp +++ b/src/animation/frontend/qcallbackmapping.cpp @@ -57,7 +57,7 @@ QCallbackMappingPrivate::QCallbackMappingPrivate() } /*! - \class QCallbackMapping + \class Qt3DAnimation::QCallbackMapping \inherits Qt3DCore::QAbstractChannelMapping \inmodule Qt3DAnimation \brief Allows to map the channels within the clip onto an invocation diff --git a/src/animation/frontend/qchannel.cpp b/src/animation/frontend/qchannel.cpp index eab7f0df4..1e0da3c3f 100644 --- a/src/animation/frontend/qchannel.cpp +++ b/src/animation/frontend/qchannel.cpp @@ -54,7 +54,7 @@ public: }; /*! - \class QChannel + \class Qt3DAnimation::QChannel \inmodule Qt3DAnimation \brief Defines a channel for a QAnimationClipData. The animation system interpolates each channel component independently diff --git a/src/animation/frontend/qchannelmapper.cpp b/src/animation/frontend/qchannelmapper.cpp index ab98039b4..c5909adbc 100644 --- a/src/animation/frontend/qchannelmapper.cpp +++ b/src/animation/frontend/qchannelmapper.cpp @@ -49,7 +49,7 @@ QChannelMapperPrivate::QChannelMapperPrivate() } /*! - \class QChannelMapper + \class Qt3DAnimation::QChannelMapper \inmodule Qt3DAnimation \brief Allows to map the channels within the clip onto properties of objects in the application. diff --git a/src/animation/frontend/qchannelmapping.cpp b/src/animation/frontend/qchannelmapping.cpp index 59620ab49..16651afe6 100644 --- a/src/animation/frontend/qchannelmapping.cpp +++ b/src/animation/frontend/qchannelmapping.cpp @@ -161,7 +161,7 @@ void QChannelMappingPrivate::updatePropertyNameTypeAndComponentCount() } /*! - \class QChannelMapping + \class Qt3DAnimation::QChannelMapping \inherits Qt3DCore::QNode \inmodule Qt3DAnimation \brief Allows to map the channels within the clip onto properties of diff --git a/src/animation/frontend/qclipanimator.cpp b/src/animation/frontend/qclipanimator.cpp index 03510aa93..ffad588c1 100644 --- a/src/animation/frontend/qclipanimator.cpp +++ b/src/animation/frontend/qclipanimator.cpp @@ -107,7 +107,8 @@ bool QClipAnimatorPrivate::canPlay() const The properties for controlling the animator are provided by the QAbstractClipAnimator base class. - \sa QAbstractClipAnimator, QAbstractAnimationClip, QChannelMapper, QBlendedClipAnimator + \sa Qt3DAnimation::QAbstractClipAnimator, Qt3DAnimation::QAbstractAnimationClip, + Qt3DAnimation::QChannelMapper, Qt3DAnimation::QBlendedClipAnimator */ QClipAnimator::QClipAnimator(Qt3DCore::QNode *parent) diff --git a/src/animation/frontend/qclipblendvalue.cpp b/src/animation/frontend/qclipblendvalue.cpp index 72a7dd796..053453e33 100644 --- a/src/animation/frontend/qclipblendvalue.cpp +++ b/src/animation/frontend/qclipblendvalue.cpp @@ -53,14 +53,14 @@ QClipBlendValuePrivate::QClipBlendValuePrivate() } /*! - \class QClipBlendValue + \class Qt3DAnimation::QClipBlendValue \inherits Qt3DAnimation::QAbstractClipBlendNode \inmodule Qt3DAnimation \brief Class used for including a clip in a blend tree. */ /*! \qmltype ClipBlendValue - \instantiates QClipBlendValue + \instantiates Qt3DAnimation::QClipBlendValue \inqmlmodule Qt3D.Animation \brief Type used for including a clip in a blend tree. */ diff --git a/src/animation/frontend/qmorphtarget.cpp b/src/animation/frontend/qmorphtarget.cpp index 76b1a598e..da068d477 100644 --- a/src/animation/frontend/qmorphtarget.cpp +++ b/src/animation/frontend/qmorphtarget.cpp @@ -86,8 +86,8 @@ namespace Qt3DAnimation { */ /*! \qmlmethod MorphTarget Qt3D.Animation::MorphTarget::fromGeometry(geometry, stringList) - Returns a morph target based on the attributes defined by the given stringList from - the given geometry. + Returns a morph target based on the attributes defined by the given \a stringList from + the given \a geometry. */ QMorphTargetPrivate::QMorphTargetPrivate() diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp index 024991387..93601901f 100644 --- a/src/core/nodes/qentity.cpp +++ b/src/core/nodes/qentity.cpp @@ -75,7 +75,7 @@ namespace Qt3DCore { */ /*! - \fn template QVector QEntity::componentsOfType() const + \fn template QVector Qt3DCore::QEntity::componentsOfType() const Returns all the components added to this entity that can be cast to type T or an empty vector if there are no such components. diff --git a/src/extras/defaults/qabstractspritesheet.cpp b/src/extras/defaults/qabstractspritesheet.cpp index 640e600c7..2cf134f7c 100644 --- a/src/extras/defaults/qabstractspritesheet.cpp +++ b/src/extras/defaults/qabstractspritesheet.cpp @@ -100,7 +100,7 @@ QAbstractSpriteSheet::~QAbstractSpriteSheet() } /*! - \property QAbstractSpriteSheet::texture + \property Qt3DExtras::QAbstractSpriteSheet::texture Holds the current texture used by the material. */ diff --git a/src/input/frontend/qactioninput.cpp b/src/input/frontend/qactioninput.cpp index 9f32f57cc..f013147f2 100644 --- a/src/input/frontend/qactioninput.cpp +++ b/src/input/frontend/qactioninput.cpp @@ -181,7 +181,7 @@ QAbstractPhysicalDevice *QActionInput::sourceDevice() const /*! \qmlsignal Qt3D.Input::ActionInput::buttonsChanged(const QVector &buttons) - This signal is emitted when the buttons associated with the action input is changed. + This signal is emitted when the \a buttons associated with the action input is changed. The corresponding handler is \c onbuttonsChanged */ diff --git a/src/input/frontend/qkeyevent.cpp b/src/input/frontend/qkeyevent.cpp index a70a2970b..efbddc771 100644 --- a/src/input/frontend/qkeyevent.cpp +++ b/src/input/frontend/qkeyevent.cpp @@ -160,7 +160,7 @@ QKeyEvent::~QKeyEvent() /*! \qmlmethod bool Qt3D.Input::KeyEvent::matches(StandardKey key) - Returns \c true if the key event matches the given standard key; otherwise + Returns \c true if the key event matches the given standard \a key; otherwise returns \c false. \sa QKeySequence::StandardKey @@ -174,7 +174,7 @@ QKeyEvent::~QKeyEvent() See \l [CPP] {Qt::Key}{Qt.Key} for the list of keyboard codes. - \sa {QKeyEvent::key} + \b {See also} \l [QtGui] {QKeyEvent::key()}. */ /*! @@ -194,7 +194,7 @@ QKeyEvent::~QKeyEvent() This property holds the keyboard modifier flags that existed immediately before the event occurred. - \sa {QKeyEvent::modifiers} + \b {See also} \l [QtGui] {QKeyEvent::modifiers()}. */ /*! diff --git a/src/input/frontend/qmousehandler.cpp b/src/input/frontend/qmousehandler.cpp index 1d45d85b6..89d76a057 100644 --- a/src/input/frontend/qmousehandler.cpp +++ b/src/input/frontend/qmousehandler.cpp @@ -197,21 +197,21 @@ void QMouseHandlerPrivate::mouseEvent(const QMouseEventPtr &event) \qmlsignal Qt3D.Input::MouseHandler::wheel(MouseEvent mouse) This signal is emitted when the mouse wheel is used with the event details - being contained within \a wheel + being contained within \a mouse. */ /*! \fn Qt3DInput::QMouseHandler::clicked(Qt3DInput::QMouseEvent *mouse) This signal is emitted when a mouse button is clicked with the event details - being contained within \a mouse + being contained within \a mouse. */ /*! \fn Qt3DInput::QMouseHandler::doubleClicked(Qt3DInput::QMouseEvent *mouse) This signal is emitted when a mouse button is double clicked with the event - details being contained within \a mouse + details being contained within \a mouse. */ /*! diff --git a/src/input/frontend/qphysicaldevicecreatedchange.cpp b/src/input/frontend/qphysicaldevicecreatedchange.cpp index c14770d80..905633b7f 100644 --- a/src/input/frontend/qphysicaldevicecreatedchange.cpp +++ b/src/input/frontend/qphysicaldevicecreatedchange.cpp @@ -54,7 +54,7 @@ QPhysicalDeviceCreatedChangeBasePrivate::QPhysicalDeviceCreatedChangeBasePrivate } /*! - \class QPhysicalDeviceCreatedChangeBase + \class Qt3DInput::QPhysicalDeviceCreatedChangeBase \inmodule Qt3DInput \brief Base class for handling changes in physical devices. */ diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp index 0fbde1191..5a1cec495 100644 --- a/src/quick3d/imports/scene3d/scene3ditem.cpp +++ b/src/quick3d/imports/scene3d/scene3ditem.cpp @@ -558,7 +558,7 @@ void Scene3DItem::setWindowSurface(QObject *rootObject) /*! \qmlmethod void Scene3D::setItemAreaAndDevicePixelRatio(size area, real devicePixelRatio) - \brief \TODO + Sets the item area to \a area and the pixel ratio to \a devicePixelRatio. */ void Scene3DItem::setItemAreaAndDevicePixelRatio(QSize area, qreal devicePixelRatio) { diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.cpp b/src/quick3d/quick3dscene2d/items/qscene2d.cpp index dfa3f261f..09d50a5aa 100644 --- a/src/quick3d/quick3dscene2d/items/qscene2d.cpp +++ b/src/quick3d/quick3dscene2d/items/qscene2d.cpp @@ -51,6 +51,12 @@ namespace Qt3DRender { namespace Quick { +/*! + \namespace Qt3DRender::Quick + \inmodule Qt3DScene2D + \brief Internal namespace to import QML types. +*/ + /*! \class Qt3DRender::Quick::QScene2D \inheaderfile Qt3DQuickScene2D/QScene2D diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.h b/src/quick3d/quick3dscene2d/items/qscene2d.h index eab900ca4..45d0f26c9 100644 --- a/src/quick3d/quick3dscene2d/items/qscene2d.h +++ b/src/quick3d/quick3dscene2d/items/qscene2d.h @@ -51,11 +51,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { -/*! - \namespace Qt3DRender::Quick - - \brief Internal namespace to import QML types. -*/ namespace Quick { class QScene2DPrivate; diff --git a/src/render/framegraph/qblitframebuffer.cpp b/src/render/framegraph/qblitframebuffer.cpp index 3a26e3d56..252758af4 100644 --- a/src/render/framegraph/qblitframebuffer.cpp +++ b/src/render/framegraph/qblitframebuffer.cpp @@ -70,6 +70,10 @@ namespace Qt3DRender { Specifies the interpolation applied if the image is stretched. + \value Nearest + Nearest-neighbor interpolation. + \value Linear + Linear interpolation. */ /*! \property Qt3DRender::QBlitFramebuffer::destination diff --git a/src/render/framegraph/qsetfence.cpp b/src/render/framegraph/qsetfence.cpp index 5cb82f3db..262dbd4ad 100644 --- a/src/render/framegraph/qsetfence.cpp +++ b/src/render/framegraph/qsetfence.cpp @@ -54,7 +54,8 @@ QSetFencePrivate::QSetFencePrivate() } /*! - \class QSetFence + \class Qt3DRender::QSetFence + \inmodule Qt3DRender \brief FrameGraphNode used to insert a fence in the graphics command stream. Fence allow to synchronosize GPU and CPU workloads. GPU commands usually @@ -100,7 +101,7 @@ QSetFence::QSetFence(QSetFencePrivate &dd, Qt3DCore::QNode *parent) are supported. */ /*! - \property QSetFence::handleType + \property Qt3DRender::QSetFence::handleType Specifies the type of handle being used. Currently only OpenGL Fence ids are supported. @@ -123,12 +124,12 @@ void QSetFencePrivate::setHandleType(QSetFence::HandleType type) } /*! - \qmlproperty variant AbstractFence::handle + \qmlproperty variant SetFence::handle Holds the underlying fence handle wrapped in a variant. */ /*! - \property QAbstractFence::handle + \property Qt3DRender::QSetFence::handle Holds the underlying fence handle wrapped in a QVariant. */ diff --git a/src/render/framegraph/qwaitfence.cpp b/src/render/framegraph/qwaitfence.cpp index 5195653ce..737f4e54d 100644 --- a/src/render/framegraph/qwaitfence.cpp +++ b/src/render/framegraph/qwaitfence.cpp @@ -56,8 +56,8 @@ QWaitFencePrivate::QWaitFencePrivate() } /*! - \class QWaitFence - + \class Qt3DRender::QWaitFence + \inmodule Qt3DRender \brief FrameGraphNode used to wait for a fence in the graphics command stream to become signaled. @@ -98,7 +98,7 @@ QWaitFence::~QWaitFence() become signaled. This is false by default. */ /*! - \property QWaitFence::waitOnCPU + \property Qt3DRender::QWaitFence::waitOnCPU Specifies whether the CPU should be block while waiting for the fence to become signaled. This is false by default. @@ -125,7 +125,7 @@ void QWaitFence::setWaitOnCPU(bool waitOnCPU) to become signaled. */ /*! - \property QWaitFence::timeout + \property Qt3DRender::QWaitFence::timeout Specifies the maximum amount of time in nanoseconds to wait for the fence to become signaled. @@ -157,7 +157,7 @@ QWaitFence::QWaitFence(QWaitFencePrivate &dd, Qt3DCore::QNode *parent) are supported. */ /*! - \property QWaitFence::handleType + \property Qt3DRender::QWaitFence::handleType Specifies the type of handle being used. Currently only OpenGL Fence ids are supported. @@ -183,7 +183,7 @@ void QWaitFence::setHandleType(QWaitFence::HandleType type) Holds the underlying fence handle wrapped in a variant. */ /*! - \property QWaitFence::handle + \property Qt3DRender::QWaitFence::handle Holds the underlying fence handle wrapped in a QVariant. */ diff --git a/src/render/frontend/qcamera.cpp b/src/render/frontend/qcamera.cpp index 2dcec7ed6..b0fd16182 100644 --- a/src/render/frontend/qcamera.cpp +++ b/src/render/frontend/qcamera.cpp @@ -235,7 +235,7 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) * \qmlmethod void Qt3D.Render::Camera::viewEntity(Entity entity) * * Rotates and moves the camera so that it's viewCenter is the center of the entity's bounding volume - * and the entire entity fits in the view port. + * and the entire \a entity fits in the view port. * * \note Only works if the lens is in perspective projection mode. * \sa Qt3D.Render::Camera::projectionType diff --git a/src/render/frontend/qcomputecommand.cpp b/src/render/frontend/qcomputecommand.cpp index d0c9f5805..dfd9c2033 100644 --- a/src/render/frontend/qcomputecommand.cpp +++ b/src/render/frontend/qcomputecommand.cpp @@ -92,15 +92,15 @@ namespace Qt3DRender { */ /*! - \qmlproperty QComputeCommand::runType + \qmlproperty enumeration ComputeCommand::runType Specifies whether the compute command should be performed every frame or manually triggered. - \value Continuous Compute command is executed everyframe. This is the + \value ComputeCommand.Continuous Compute command is executed everyframe. This is the default. - \value Manual CompouteCommand is executed for a given number of frames and + \value ComputeCommand.Manual CompouteCommand is executed for a given number of frames and then the component disables itself. */ diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp index f5307f7a9..1f05a71f6 100644 --- a/src/render/geometry/qmesh.cpp +++ b/src/render/geometry/qmesh.cpp @@ -147,17 +147,6 @@ void QMeshPrivate::setStatus(QMesh::Status status) * \sa QRegularExpression */ -/*! - \enum QMesh::Status - - This enum identifies the status of shader used. - - \value None A source mesh hasn't been assigned a source yet - \value Loading The mesh geometry is loading - \value Ready The mesh geometry was successfully loaded - \value Error An error occurred while loading the mesh -*/ - /*! \qmlproperty enumeration Mesh::status @@ -196,6 +185,17 @@ void QMeshPrivate::setStatus(QMesh::Status status) * \sa Qt3DRender::QSceneLoader */ +/*! + \enum Qt3DRender::QMesh::Status + + This enum identifies the status of shader used. + + \value None A source mesh hasn't been assigned a source yet + \value Loading The mesh geometry is loading + \value Ready The mesh geometry was successfully loaded + \value Error An error occurred while loading the mesh +*/ + /*! * Constructs a new QMesh with \a parent. */ diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp index 7d4413bff..2d53702f6 100644 --- a/src/render/io/qsceneloader.cpp +++ b/src/render/io/qsceneloader.cpp @@ -317,7 +317,7 @@ QStringList QSceneLoader::entityNames() const /*! \qmlmethod Entity SceneLoader::component(string entityName, enumeration componentType) - Returns a component matching \a componentType of a loaded entity with an \a objectName matching + Returns a component matching \a componentType of a loaded entity with an \e objectName matching the \a entityName. If the entity has multiple matching components, the first match in the component list of the entity is returned. diff --git a/src/render/materialsystem/qshaderimage.cpp b/src/render/materialsystem/qshaderimage.cpp index f2ce04c3d..508cf44f2 100644 --- a/src/render/materialsystem/qshaderimage.cpp +++ b/src/render/materialsystem/qshaderimage.cpp @@ -342,7 +342,7 @@ QShaderImagePrivate::~QShaderImagePrivate() */ /*! - \qmlproperty Qt3DRender::QShaderImage::mipLevel + \qmlproperty int Qt3D.Render::ShaderImage::mipLevel Holds which mipLevel out of the referenced texture should be used for the ShaderImage. @@ -351,7 +351,7 @@ QShaderImagePrivate::~QShaderImagePrivate() */ /*! - \qmlproperty Qt3DRender::QShaderImage::layer + \qmlproperty int Qt3D.Render::ShaderImage::layer Holds which layer out of the referenced texture should be used for the ShaderImage. This property does nothing if \a layered is set to true or if @@ -365,11 +365,11 @@ QShaderImagePrivate::~QShaderImagePrivate() cubeMapFace = layer - (cubeMapLayer * 6) \endcode - \default 0 + Default value is 0. */ /*! - * \qmlproperty Qt3DRender::QShaderImage::layered + * \qmlproperty bool Qt3D.Render::ShaderImage::layered If set to true, if the referenced texture is a one-dimensional array, two-dimensional array, three-dimensional, cube map, cube map array, or @@ -377,21 +377,28 @@ QShaderImagePrivate::~QShaderImagePrivate() for all layers. If set to false, only the single layer specified by the \a layer property will be bound. - \default false + Default value is \c false. */ /*! - \qmlproperty Qt3DRender::QShaderImage::access + \qmlproperty enumeration Qt3D.Render::ShaderImage::access Specifies the type of access we want to allow from our shader instances to the image. If a shader tries to write or read from an image that has incompatible access, the behavior is undefined. - \default ShaderImage.ReadWrite + \value ShaderImage.ReadOnly + Read-only access. + \value ShaderImage.WriteOnly + Write-only access. + \value ShaderImage.ReadWrite + Read-write access. + + Default value is ShaderImage.ReadWrite. */ /*! - \qmlproperty Qt3DRender::QShaderImage::format + \qmlproperty enumeration Qt3D.Render::ShaderImage::format Specifies the image format, which is essentially important when storing values in the ShaderImage from a shader. @@ -407,7 +414,7 @@ QShaderImagePrivate::~QShaderImagePrivate() By default Qt3D will try to set the image format to match that of the referenced texture. - \default ShaderImage.Automatic + Default value is ShaderImage.Automatic. */ /*! diff --git a/src/render/picking/qabstractraycaster.cpp b/src/render/picking/qabstractraycaster.cpp index ab0916401..5f4c4c490 100644 --- a/src/render/picking/qabstractraycaster.cpp +++ b/src/render/picking/qabstractraycaster.cpp @@ -58,10 +58,6 @@ QAbstractRayCasterPrivate::QAbstractRayCasterPrivate() m_shareable = false; } -/*! - \property Qt3DRender::QAbstractRayCaster::Hits -*/ - QAbstractRayCasterPrivate *QAbstractRayCasterPrivate::get(QAbstractRayCaster *obj) { return obj->d_func(); diff --git a/src/render/picking/qobjectpicker.cpp b/src/render/picking/qobjectpicker.cpp index b7f2c0815..4f039b361 100644 --- a/src/render/picking/qobjectpicker.cpp +++ b/src/render/picking/qobjectpicker.cpp @@ -152,7 +152,7 @@ namespace Qt3DRender { This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse click. Intersection - information are accessible through the pick \a parameter. + information are accessible through the \a pick parameter. */ /*! diff --git a/src/render/renderstates/qrastermode.cpp b/src/render/renderstates/qrastermode.cpp index c432f1063..648872a84 100644 --- a/src/render/renderstates/qrastermode.cpp +++ b/src/render/renderstates/qrastermode.cpp @@ -48,7 +48,7 @@ namespace Qt3DRender { /*! \class Qt3DRender::QRasterMode \brief The QRasterMode render state allows to control the type of - rasterization to be performed + rasterization to be performed. \since 5.14 \inmodule Qt3DRender \ingroup renderstates @@ -65,7 +65,7 @@ namespace Qt3DRender { /*! \qmltype RasterMode \brief The RasterMode render state allows to control the type of - rasterization to be performed + rasterization to be performed. \since 5.14 \inqmlmodule Qt3D.Render \inherits RenderState diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp index 7fca2ba3f..b92576d99 100644 --- a/src/render/texture/qabstracttexture.cpp +++ b/src/render/texture/qabstracttexture.cpp @@ -977,7 +977,7 @@ float QAbstractTexture::maximumAnisotropy() const } /*! - \property Qt3DRender::QAbstractTexture::ComparisonFunction + \property Qt3DRender::QAbstractTexture::comparisonFunction Holds the comparison function of the texture provider. */ @@ -1008,7 +1008,7 @@ QAbstractTexture::ComparisonFunction QAbstractTexture::comparisonFunction() cons } /*! - \property Qt3DRender::QAbstractTexture::ComparisonMode + \property Qt3DRender::QAbstractTexture::comparisonMode Holds the comparison mode of the texture provider. */ @@ -1055,9 +1055,12 @@ QTextureGeneratorPtr QAbstractTexture::dataGenerator() const */ /*! - * \qmlproperty handleType + * \qmlproperty enumeration AbstractTexture::handleType * * Holds the current texture handle type. + * + * \value AbstractTexture.NoHandle + * \value AbstractTexture.OpenGLTextureId */ /*! @@ -1070,7 +1073,6 @@ QAbstractTexture::HandleType QAbstractTexture::handleType() const return d->m_handleType; } - /*! * \property Qt3DRender::QAbstractTexture::handle * @@ -1079,7 +1081,7 @@ QAbstractTexture::HandleType QAbstractTexture::handleType() const */ /*! - * \qmlproperty handle + * \qmlproperty var AbstractTexture::handle * * Holds the current texture handle, if Qt 3D is using the OpenGL renderer, * handle is a texture id integer. @@ -1098,8 +1100,8 @@ QVariant QAbstractTexture::handle() const } /*! - * Allow to update a sub region of the texture without having to change the data - * generator or rely on adding or removing texture images. + * Updates a sub region of the texture, defined by \a update, without having + * to change the data generator or rely on adding or removing texture images. * \since 5.14 */ void QAbstractTexture::updateData(const QTextureDataUpdate &update) diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp index 9ca4599c5..6f68221fd 100644 --- a/src/render/texture/qabstracttextureimage.cpp +++ b/src/render/texture/qabstracttextureimage.cpp @@ -131,8 +131,8 @@ QTextureImageDataGeneratorPtr QAbstractTextureImagePrivate::dataGenerator() cons /*! \fn Qt3DRender::QTextureImageDataGeneratorPtr Qt3DRender::QAbstractTextureImage::dataGenerator() const - Implement this method to return the \l QTextureImageDataGeneratorPtr, which will - provide the data for the texture image. + Implement this method to return the QTextureImageDataGeneratorPtr instance, + which will provide the data for the texture image. */ /*! diff --git a/src/render/texture/qtexturegenerator.cpp b/src/render/texture/qtexturegenerator.cpp index 5e350af2d..36b5f6498 100644 --- a/src/render/texture/qtexturegenerator.cpp +++ b/src/render/texture/qtexturegenerator.cpp @@ -52,8 +52,7 @@ QTextureGenerator::~QTextureGenerator() } /*! - \class QTextureGenerator - \inherits QAbstractFunctor + \class Qt3DRender::QTextureGenerator \inmodule Qt3DRender \brief Provides the image data for a texture. */ From 38a3ceef605fb337066e441a4afeb4e460e6a26c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Nov 2019 12:58:23 -0800 Subject: [PATCH 09/13] Remove redundant std::move Change-Id: Iad959315ad374ef288f5fffd15d6d4716cb28052 Reviewed-by: Mike Krus --- src/render/texture/qabstracttexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp index b92576d99..258ab44dc 100644 --- a/src/render/texture/qabstracttexture.cpp +++ b/src/render/texture/qabstracttexture.cpp @@ -1137,7 +1137,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTexture::createNodeCreationChange() data.dataFunctor = d->m_dataFunctor; data.sharedTextureId = d->m_sharedTextureId; data.initialDataUpdates = d->m_pendingDataUpdates; - return std::move(creationChange); + return creationChange; } /*! From 50db67eb310fba162f73ac6fdf28a8457ce50b21 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 18 Oct 2019 14:35:40 +0200 Subject: [PATCH 10/13] PackUniformHash to QVector Surprisingly it's hard to notice its effect in the speed of execution, frame preparation looks to be more or less the same with the profiler. However with vtune, the profiling traces show a huge difference with QHash, mainly in time spent allocating memory. It shows a noticeable reduction in CPU usage. On bigscene-cpp with 600 entities QHash -> On a 158s run, CPU time is 112s (70%) free accounts for 26s (23%), malloc 24s (21%) QVector -> On a 190s run, CPU time is 110s (58%) free accounts for 5s (4.5%), malloc 4.7s (4.2%) Change-Id: I880d44b1acf7f051e479ed356864c3caf407f23f Reviewed-by: Mike Krus --- src/render/backend/commandexecuter.cpp | 6 +-- src/render/backend/uniform_p.h | 2 +- src/render/materialsystem/shader.cpp | 6 +-- .../graphicshelpers/submissioncontext.cpp | 6 +-- .../renderers/opengl/renderer/renderview.cpp | 16 +++--- .../opengl/renderer/shaderparameterpack_p.h | 51 ++++++++++++++++++- .../render/renderviews/tst_renderviews.cpp | 13 ++--- 7 files changed, 72 insertions(+), 28 deletions(-) diff --git a/src/render/backend/commandexecuter.cpp b/src/render/backend/commandexecuter.cpp index 3aea56ad0..5ed0c970d 100644 --- a/src/render/backend/commandexecuter.cpp +++ b/src/render/backend/commandexecuter.cpp @@ -248,10 +248,10 @@ QJsonObject parameterPackToJson(const Render::ShaderParameterPack &pack) const Render::PackUniformHash &uniforms = pack.uniforms(); QJsonArray uniformsArray; - for (auto it = uniforms.cbegin(), end = uniforms.cend(); it != end; ++it) { + for (int i = 0, m = uniforms.keys.size(); i < m; ++i) { QJsonObject uniformObj; - uniformObj.insert(QLatin1String("name"), Render::StringToInt::lookupString(it.key())); - const Render::UniformValue::ValueType type = it.value().valueType(); + uniformObj.insert(QLatin1String("name"), Render::StringToInt::lookupString(uniforms.keys.at(i))); + const Render::UniformValue::ValueType type = uniforms.values.at(i).valueType(); uniformObj.insert(QLatin1String("type"), type == Render::UniformValue::ScalarValue ? QLatin1String("value") diff --git a/src/render/backend/uniform_p.h b/src/render/backend/uniform_p.h index 634c0cd96..c8731637c 100644 --- a/src/render/backend/uniform_p.h +++ b/src/render/backend/uniform_p.h @@ -227,7 +227,7 @@ public: return !(*this == other); } private: - // Allocate 4 floats on stack + // Allocate 16 floats on stack // For larger elements, heap allocation will be used QVarLengthArray m_data; diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp index 017deabac..300a71b84 100644 --- a/src/render/materialsystem/shader.cpp +++ b/src/render/materialsystem/shader.cpp @@ -244,13 +244,13 @@ void Shader::prepareUniforms(ShaderParameterPack &pack) { const PackUniformHash &values = pack.uniforms(); - auto it = values.cbegin(); - const auto end = values.cend(); + auto it = values.keys.cbegin(); + const auto end = values.keys.cend(); while (it != end) { // Find if there's a uniform with the same name id for (const ShaderUniform &uniform : qAsConst(m_uniforms)) { - if (uniform.m_nameId == it.key()) { + if (uniform.m_nameId == *it) { pack.setSubmissionUniform(uniform); break; } diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp index 991a8533d..47779dded 100644 --- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -1171,7 +1171,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack) if (uniformValues.contains(namedTex.glslNameId)) { GLTexture *t = manager->glTextureManager()->lookupResource(namedTex.nodeId); if (t != nullptr) { - UniformValue &texUniform = uniformValues[namedTex.glslNameId]; + UniformValue &texUniform = uniformValues.value(namedTex.glslNameId); if (texUniform.valueType() == UniformValue::TextureValue) { const int texUnit = m_textureContext.activateTexture(TextureSubmissionContext::TextureScopeMaterial, m_gl, t); texUniform.data()[namedTex.uniformArrayIndex] = texUnit; @@ -1201,7 +1201,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack) qCWarning(Backend) << "Shader Image referencing invalid texture"; continue; } else { - UniformValue &imgUniform = uniformValues[namedTex.glslNameId]; + UniformValue &imgUniform = uniformValues.value(namedTex.glslNameId); if (imgUniform.valueType() == UniformValue::ShaderImageValue) { const int imgUnit = m_imageContext.activateImage(img, t); imgUniform.data()[namedTex.uniformArrayIndex] = imgUnit; @@ -1260,7 +1260,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack) for (const ShaderUniform &uniform : activeUniforms) { // We can use [] as we are sure the the uniform wouldn't // be un activeUniforms if there wasn't a matching value - const UniformValue &v = values[uniform.m_nameId]; + const UniformValue &v = values.value(uniform.m_nameId); // skip invalid textures/images if ((v.valueType() == UniformValue::TextureValue || diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp index 97d494370..0ac4f876f 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -552,10 +552,8 @@ void RenderView::sort() // We need the reference here as we are modifying the original container // not the copy PackUniformHash &uniforms = m_commands[j].m_parameterPack.m_uniforms; - PackUniformHash::iterator it = uniforms.begin(); - const PackUniformHash::iterator end = uniforms.end(); - while (it != end) { + for (int u = 0; u < uniforms.keys.size();) { // We are comparing the values: // - raw uniform values // - the texture Node id if the uniform represents a texture @@ -563,15 +561,17 @@ void RenderView::sort() // sharing the same material (shader) are rendered, we can't have the case // where two uniforms, referencing the same texture eventually have 2 different // texture unit values - const UniformValue refValue = cachedUniforms.value(it.key()); - if (it.value() == refValue) { - it = uniforms.erase(it); + const int uniformNameId = uniforms.keys.at(u); + const UniformValue &refValue = cachedUniforms.value(uniformNameId); + const UniformValue &newValue = uniforms.values.at(u); + if (newValue == refValue) { + uniforms.erase(u); } else { // Record updated value so that subsequent comparison // for the next command will be made againts latest // uniform value - cachedUniforms.insert(it.key(), it.value()); - ++it; + cachedUniforms.insert(uniformNameId, newValue); + ++u; } } ++j; diff --git a/src/render/renderers/opengl/renderer/shaderparameterpack_p.h b/src/render/renderers/opengl/renderer/shaderparameterpack_p.h index a5aee6ac4..cb599124c 100644 --- a/src/render/renderers/opengl/renderer/shaderparameterpack_p.h +++ b/src/render/renderers/opengl/renderer/shaderparameterpack_p.h @@ -89,7 +89,56 @@ struct BlockToSSBO { QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToSSBO, Q_PRIMITIVE_TYPE) -typedef QHash PackUniformHash; +struct PackUniformHash +{ + QVector keys; + QVector values; + + PackUniformHash() + { + keys.reserve(10); + values.reserve(10); + } + + void insert(int key, const UniformValue &value) + { + const int idx = keys.indexOf(key); + if (idx != -1) { + values[idx] = value; + } else { + keys.push_back(key); + values.push_back(value); + } + } + + UniformValue value(int key) const + { + const int idx = keys.indexOf(key); + if (idx != -1) + return values.at(idx); + return UniformValue(); + } + + UniformValue& value(int key) + { + const int idx = keys.indexOf(key); + if (idx != -1) + return values[idx]; + insert(key, UniformValue()); + return value(key); + } + + void erase(int idx) + { + keys.removeAt(idx); + values.removeAt(idx); + } + + bool contains(int key) const + { + return keys.contains(key); + } +}; class Q_AUTOTEST_EXPORT ShaderParameterPack { diff --git a/tests/auto/render/renderviews/tst_renderviews.cpp b/tests/auto/render/renderviews/tst_renderviews.cpp index 17995659b..1558b68c9 100644 --- a/tests/auto/render/renderviews/tst_renderviews.cpp +++ b/tests/auto/render/renderviews/tst_renderviews.cpp @@ -51,16 +51,11 @@ void compareShaderParameterPacks(const ShaderParameterPack &t1, const PackUniformHash hash1 = t1.uniforms(); const PackUniformHash hash2 = t2.uniforms(); - QCOMPARE(hash1.size(), hash2.size()); + QCOMPARE(hash1.keys.size(), hash2.keys.size()); - auto it = hash1.constBegin(); - const auto end = hash1.constEnd(); - - while (it != end) { - const auto h2It = hash2.find(it.key()); - QVERIFY(h2It != hash2.cend()); - QCOMPARE(it.value(), h2It.value()); - ++it; + for (int i = 0, m = hash1.keys.size(); i < m; ++i) { + const int key = hash1.keys.at(i); + QCOMPARE(hash1.value(key), hash2.value(key)); } } From eaa0d0d632f258500d4b0ab9fd2ee3d3f47c1c8a Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Thu, 14 Nov 2019 16:02:30 +0000 Subject: [PATCH 11/13] Disable threaded rendering macOS 10.14 and later Making context current from background thread crashes on Catalina. In this case, we disable threaded rendering. This implies changes in the order in which initialization and rendering happens. We can't just rely on rendering type since Scene3D is not threaded but has it's own initialization logic. Ideally 5.15 should introduce proper API since currently manually setting a QWindow based app to use Synchronous rendering will hang at initialization time. Task-number: QTBUG-80049 Change-Id: Ic346a44d8e0add8232a16129e878423f4cf2f4f1 Reviewed-by: Paul Lemire --- src/core/aspects/qabstractaspect.cpp | 5 ++ src/core/aspects/qabstractaspect_p.h | 1 + src/core/jobs/qaspectjobproviderinterface_p.h | 1 + src/core/qscheduler.cpp | 3 + src/render/frontend/qrenderaspect.cpp | 73 ++++++++++++++++++- src/render/frontend/qrenderaspect_p.h | 2 + 6 files changed, 82 insertions(+), 3 deletions(-) diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp index 19b6f70c1..6e0d3bd02 100644 --- a/src/core/aspects/qabstractaspect.cpp +++ b/src/core/aspects/qabstractaspect.cpp @@ -508,6 +508,11 @@ QVector QAbstractAspectPrivate::jobsToExecute(qint64 time) return res; } +void QAbstractAspectPrivate::jobsDone() +{ + +} + /*! * Called in the context of the aspect thread once the aspect has been registered. * This provides an opportunity for the aspect to do any initialization tasks that diff --git a/src/core/aspects/qabstractaspect_p.h b/src/core/aspects/qabstractaspect_p.h index 325fca678..b4120cb20 100644 --- a/src/core/aspects/qabstractaspect_p.h +++ b/src/core/aspects/qabstractaspect_p.h @@ -127,6 +127,7 @@ public: QAbstractAspectJobManager *jobManager() const; QVector jobsToExecute(qint64 time) override; + void jobsDone() override; QBackendNode *createBackendNode(const NodeTreeChange &change) const; void clearBackendNode(const NodeTreeChange &change) const; diff --git a/src/core/jobs/qaspectjobproviderinterface_p.h b/src/core/jobs/qaspectjobproviderinterface_p.h index 29b44b3c1..f7d0f9d39 100644 --- a/src/core/jobs/qaspectjobproviderinterface_p.h +++ b/src/core/jobs/qaspectjobproviderinterface_p.h @@ -69,6 +69,7 @@ public: private: virtual QVector jobsToExecute(qint64 time) = 0; + virtual void jobsDone() = 0; friend class QScheduler; }; diff --git a/src/core/qscheduler.cpp b/src/core/qscheduler.cpp index e714e477d..03d5670cb 100644 --- a/src/core/qscheduler.cpp +++ b/src/core/qscheduler.cpp @@ -94,6 +94,9 @@ void QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time) for (auto &job : qAsConst(jobQueue)) QAspectJobPrivate::get(job.data())->postFrame(m_aspectManager); + + for (QAbstractAspect *aspect : aspects) + QAbstractAspectPrivate::get(aspect)->jobsDone(); } } // namespace Qt3DCore diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index 72f114481..bc79982ba 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -170,13 +170,53 @@ #include #include -#include -#include #include -#include + +#ifdef Q_OS_MACOS +#include +#include +#endif QT_BEGIN_NAMESPACE +#ifdef Q_OS_MACOS +namespace { + +// adapted from qcocoahelpers.mm in QtBase +typedef QPair VersionTuple; + +VersionTuple versionsForImage(const mach_header *machHeader) +{ + static auto makeVersionTuple = [](uint32_t dt, uint32_t sdk) { + return qMakePair( + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, + dt >> 16 & 0xffff, dt >> 8 & 0xff, dt & 0xff), + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, + sdk >> 16 & 0xffff, sdk >> 8 & 0xff, sdk & 0xff) + ); + }; + + auto commandCursor = uintptr_t(machHeader) + sizeof(mach_header_64); + for (uint32_t i = 0; i < machHeader->ncmds; ++i) { + load_command *loadCommand = reinterpret_cast(commandCursor); + if (loadCommand->cmd == LC_VERSION_MIN_MACOSX) { + auto versionCommand = reinterpret_cast(loadCommand); + return makeVersionTuple(versionCommand->version, versionCommand->sdk); +#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13) + } else if (loadCommand->cmd == LC_BUILD_VERSION) { + auto versionCommand = reinterpret_cast(loadCommand); + return makeVersionTuple(versionCommand->minos, versionCommand->sdk); +#endif + } + commandCursor += loadCommand->cmdsize; + } + Q_ASSERT_X(false, "QCocoaIntegration", "Could not find any version load command"); + Q_UNREACHABLE(); +} + +} +#endif + using namespace Qt3DCore; namespace Qt3DRender { @@ -202,11 +242,30 @@ QRenderAspectPrivate::QRenderAspectPrivate(QRenderAspect::RenderType type) , m_nodeManagers(nullptr) , m_renderer(nullptr) , m_initialized(false) + , m_renderAfterJobs(false) , m_renderType(type) , m_offscreenHelper(nullptr) { m_instances.append(this); loadSceneParsers(); +#ifdef Q_OS_MACOS + static VersionTuple version = []() { + const mach_header *executableHeader = nullptr; + for (uint32_t i = 0; i < _dyld_image_count(); ++i) { + auto header = _dyld_get_image_header(i); + if (header->filetype == MH_EXECUTE) { + executableHeader = header; + break; + } + } + Q_ASSERT_X(executableHeader, "QCocoaIntegration", "Failed to resolve Mach-O header of executable"); + return versionsForImage(executableHeader); + }(); + if (m_renderType == QRenderAspect::Threaded && version.second >= QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave)) { + m_renderType = QRenderAspect::Synchronous; + m_renderAfterJobs = true; + } +#endif } /*! \internal */ @@ -239,6 +298,12 @@ void QRenderAspectPrivate::syncDirtyFrontEndNode(QNode *node, QBackendNode *back renderBackend->syncFromFrontEnd(node, firstTime); } +void QRenderAspectPrivate::jobsDone() +{ + if (m_renderAfterJobs) + m_renderer->doRender(true); +} + /*! \internal */ void QRenderAspectPrivate::registerBackendTypes() { @@ -539,6 +604,8 @@ QVariant QRenderAspect::executeCommand(const QStringList &args) void QRenderAspect::onEngineStartup() { Q_D(QRenderAspect); + if (d->m_renderAfterJobs) // synchronous rendering but using QWindow + d->m_renderer->initialize(); Render::NodeManagers *managers = d->m_renderer->nodeManagers(); Render::Entity *rootEntity = managers->lookupResource(rootEntityId()); Q_ASSERT(rootEntity); diff --git a/src/render/frontend/qrenderaspect_p.h b/src/render/frontend/qrenderaspect_p.h index b4cb0812c..305e58403 100644 --- a/src/render/frontend/qrenderaspect_p.h +++ b/src/render/frontend/qrenderaspect_p.h @@ -87,6 +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 registerBackendTypes(); void unregisterBackendTypes(); @@ -101,6 +102,7 @@ public: Render::AbstractRenderer *m_renderer; bool m_initialized; + bool m_renderAfterJobs; QList m_sceneImporter; QVector m_loadedPlugins; QVector m_renderPlugins; From c0c87b0de8ea3023f4989ccf852c725e6295ffce Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Fri, 15 Nov 2019 07:15:14 +0000 Subject: [PATCH 12/13] Use builtin test to detect support for threaded GL Change-Id: Ie14d7ae597ec42e85befed87675388315edc3e6f Reviewed-by: Paul Lemire --- src/render/frontend/qrenderaspect.cpp | 60 +-------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index bc79982ba..5784b35f4 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -171,52 +171,10 @@ #include #include - -#ifdef Q_OS_MACOS -#include -#include -#endif +#include QT_BEGIN_NAMESPACE -#ifdef Q_OS_MACOS -namespace { - -// adapted from qcocoahelpers.mm in QtBase -typedef QPair VersionTuple; - -VersionTuple versionsForImage(const mach_header *machHeader) -{ - static auto makeVersionTuple = [](uint32_t dt, uint32_t sdk) { - return qMakePair( - QOperatingSystemVersion(QOperatingSystemVersion::MacOS, - dt >> 16 & 0xffff, dt >> 8 & 0xff, dt & 0xff), - QOperatingSystemVersion(QOperatingSystemVersion::MacOS, - sdk >> 16 & 0xffff, sdk >> 8 & 0xff, sdk & 0xff) - ); - }; - - auto commandCursor = uintptr_t(machHeader) + sizeof(mach_header_64); - for (uint32_t i = 0; i < machHeader->ncmds; ++i) { - load_command *loadCommand = reinterpret_cast(commandCursor); - if (loadCommand->cmd == LC_VERSION_MIN_MACOSX) { - auto versionCommand = reinterpret_cast(loadCommand); - return makeVersionTuple(versionCommand->version, versionCommand->sdk); -#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13) - } else if (loadCommand->cmd == LC_BUILD_VERSION) { - auto versionCommand = reinterpret_cast(loadCommand); - return makeVersionTuple(versionCommand->minos, versionCommand->sdk); -#endif - } - commandCursor += loadCommand->cmdsize; - } - Q_ASSERT_X(false, "QCocoaIntegration", "Could not find any version load command"); - Q_UNREACHABLE(); -} - -} -#endif - using namespace Qt3DCore; namespace Qt3DRender { @@ -248,24 +206,10 @@ QRenderAspectPrivate::QRenderAspectPrivate(QRenderAspect::RenderType type) { m_instances.append(this); loadSceneParsers(); -#ifdef Q_OS_MACOS - static VersionTuple version = []() { - const mach_header *executableHeader = nullptr; - for (uint32_t i = 0; i < _dyld_image_count(); ++i) { - auto header = _dyld_get_image_header(i); - if (header->filetype == MH_EXECUTE) { - executableHeader = header; - break; - } - } - Q_ASSERT_X(executableHeader, "QCocoaIntegration", "Failed to resolve Mach-O header of executable"); - return versionsForImage(executableHeader); - }(); - if (m_renderType == QRenderAspect::Threaded && version.second >= QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave)) { + if (m_renderType == QRenderAspect::Threaded && !QOpenGLContext::supportsThreadedOpenGL()) { m_renderType = QRenderAspect::Synchronous; m_renderAfterJobs = true; } -#endif } /*! \internal */ From 31d3ebed75387b09645fe3f1d36e3b30f686fce3 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Thu, 14 Nov 2019 16:05:38 +0000 Subject: [PATCH 13/13] Fix compile warning (again) Change-Id: Ic20d37a8bf875247c1af31fa4ded757564f953fc Reviewed-by: Paul Lemire --- src/core/nodes/qnode_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h index 208474802..61aa81c81 100644 --- a/src/core/nodes/qnode_p.h +++ b/src/core/nodes/qnode_p.h @@ -161,7 +161,7 @@ public: { m_destructionConnections.erase(std::remove_if(m_destructionConnections.begin(), m_destructionConnections.end(), - [this, node] (const QPair &nodeConnectionPair) { + [node] (const QPair &nodeConnectionPair) { if (nodeConnectionPair.first == node) { QObject::disconnect(nodeConnectionPair.second); return true;