summaryrefslogtreecommitdiffstats
path: root/src/core
Commit message (Collapse)AuthorAgeFilesLines
* QNode: stop using hash<node,connection> for bookkeepingv5.14.0-beta3Paul Lemire2019-11-042-9/+17
| | | | | | | | | | | | | 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<pair<node, connection>> and adjust code accordingly. Change-Id: I49870c409c3f7b629c8f1bdfcb8757a904db2490 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix frame advance serviceMike Krus2019-10-281-1/+5
| | | | | | | | | | | | | | on macOS, blocking the main thread waiting for current frame to finish can lead to events flooding the event queue. In particular, moving the mouse over the window causes the QBasicTimer used by the uniform timer that drives (qtquick) animations to no longer fire. Use tryAcquire to get the resources, waiting a short while to avoid busy main thread. Task-number: QTBUG-79379 Change-Id: I930aa8ad7d5a15600d7ac7af93e6e72321457089 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QNode::updateNode: ensure postConstructorInit of node is calledPaul Lemire2019-10-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | When a QNode subclass is created doing Subclass(parent) with parent != nullptr QNodePrivate::_q_postContrustorInit is called through a queued invocation due to the fact that the QNode ctor is called before the subclass ctor is (and we need the class to be fully constructed to do proper initialization). When adding a QNode subclass created as described above, and immediately referencing it as a property of another QNode, we can end up in cases where the backend gets aware of the node being referenced in the relationship and tries to create its backend. Unfortunately due to the queued invocation of _q_postConstructorInit, the frontend node has yet to be fully initialized, resulting in the creation of the backend node to assert/crash. Therefore, when updateNode is called (whenever a subnode is referenced in a relationship) we now ensure that postConstructorInit gets (or has already been) called. Change-Id: Iea6e0b5a59c676f5db2946bec2f8c345accc32b0 Task-number: QTBUG-79350 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix skeleton loadingMike Krus2019-10-252-16/+23
| | | | | | | | Set the nodes created on the backend properly (assigning parent) so that the backend nodes get created before the second round of updates. Change-Id: Ia8ac9aacfc6bdb8938d07dbf714d471b5ddc4999 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Revert removal of more sceneChanged methodsMike Krus2019-10-242-0/+9
| | | | | | | Removal breaks BC Change-Id: I8c324253c3a39c8fd74bf4cc14462f76cd2e4f5e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update jobs to remove post FF changesMike Krus2019-10-223-1/+10
| | | | | | | Made the d_ptr private again. Change-Id: Ia5ba23b03cd22290d5c922e9a1c657a67ff98977 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix post FF API changesMike Krus2019-10-2210-54/+33
| | | | | Change-Id: I347f6df41c0a4f2295831e78248669b4a2d6b5ef Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Restore sceneChangeEvent overload that were removedPaul Lemire2019-10-222-0/+2
| | | | | | | | Not BIC compatible so they must stay until Qt6. Added TODO above them to make it easier to track for Qt6. Change-Id: Ia1adba25be5d55d3fa836727877c7c1f7346b668 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove remaining messaging code in QSkeletonLoaderMike Krus2019-10-221-12/+0
| | | | | | | And matching unit tests Change-Id: Iff0b13b2ad9ff07d08c767f4b20de2a1685a5570 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove old code from animation classes & update testsMike Krus2019-10-212-12/+0
| | | | | Change-Id: Ic91a4f168172d6f34d858488e6fc170e8ed875f9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix Coverity warningsMike Krus2019-10-216-1/+7
| | | | | Change-Id: I00c875b48d838170fddf0b92f0ac5592828c6f0f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update QScene2D to use direct syncMike Krus2019-10-141-1/+1
| | | | | | Change-Id: Iba2fa5ce9d295706fc50f904cac68f00bd8f02b7 Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Clean QJoint message handlingMike Krus2019-10-111-3/+2
| | | | | Change-Id: Ib09024017a2d213e50b3acc89d7c411728eb1869 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update LoadSkeletonJob to use direct syncMike Krus2019-10-081-0/+1
| | | | | Change-Id: I5622f9784628b7217f6e37c700ac314b7264f439 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update animation evaluation jobs to use direct syncMike Krus2019-10-082-0/+11
| | | | | | | | | | | | | | Animation data is now stored in the job which propagates them to the frontend at the end of the frame. Animated properties are passed using Qt's property system. Animated poses are passed via the frontend skeleton node. Syncing on new frame will take care of propagating both for use in other aspects. Callbacks are called by the job directly or stored and invoked on the main thread depending on the callback setting. Change-Id: I78675715799300bc1b27f854f1a445c00a2ac734 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QChangeArbiter: emit receivedChange when frontend node is dirtyPaul Lemire2019-10-071-3/+4
| | | | | | | | Otherwise when using Scene3D rendering, we might not renderer when using the OnDemand policy. Change-Id: I32b840751ed10661acef1fb37c827a9ad6f0ff49 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove use of node/components added/removed messagesMike Krus2019-10-0413-22/+185
| | | | | | | | | | | | | Introduce mechanism to notify backend nodes of changes in relationship between nodes. If a component is added or removed from an entity, or if a node is added or removed from a property of another node, then just rely on the node being marked as dirty when syncing takes place. For nodes that do not support syncing, messages are delivered as before but allocated on the stack rather than the heap. Change-Id: I06affac77e42a9998d9c7f44e231c7724c52b320 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add accessor to retrieve frontend node from an idMike Krus2019-10-022-0/+22
| | | | | | | Useful later to sync backend changes back to the frontend. Change-Id: I874d140fc97462b8e186b66c882647db26d5678e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix missing exportsMike Krus2019-10-026-6/+6
| | | | | Change-Id: Ibf24099223bd35948f50a492e0d754f6f680a3db Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add callback on aspect job when all jobs are completev5.14.0-beta1Mike Krus2019-10-014-1/+24
| | | | | | | | This gets called in the main so it's safe for jobs to propagate results from the run at this point. Change-Id: I7d2f31472ec1fcd1801dcb9ded735f9f1e5214f9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Clean up includesMike Krus2019-10-014-7/+3
| | | | | | | | | Remove include statements for classes that are no longer used. Makes it easier to find remaining use cases that need addressed before complete removal in Qt 6. Change-Id: I60529ba1929ad64b162d3847d5df47cde2a60dad Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update QCameraLens to use direct syncPaul Lemire2019-09-241-0/+3
| | | | | Change-Id: I5b1af685c640c218d3720d5339b14dfc913e01c5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update mapping classes to use direct syncMike Krus2019-09-232-0/+6
| | | | | | | QChannelMapping, QSkeletonMapping and QCallbackMapping updated. Change-Id: I10b78d86856f6ad01fbb313fdcbe9f87f6d926ac Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix deprecation warnings related to QBasicAtomicIntegerFriedemann Kleint2019-09-192-2/+2
| | | | | | | | | Use loadRelaxed(), storeRelaxed(), fixing warnings like: renderers/opengl/renderer/renderer.cpp:451:22: warning: ‘void QBasicAtomicInteger<T>::store(T) [with T = int]’ is deprecated: Use storeRelaxed [-Wdeprecated-declarations] qt3d/src/render/renderers/opengl/renderer/renderer_p.h:188:61: warning: ‘T QBasicAtomicInteger<T>::load() const [with T = int]’ is deprecated: Use loadRelaxed [-Wdeprecated-declarations] Change-Id: Ica946808969e7f311c98e30d1a61c1b4fa22f66a Reviewed-by: Liang Qi <liang.qi@qt.io>
* QTransform: move setWorldMatrix to private classPaul Lemire2019-09-193-7/+9
| | | | | | Change-Id: Ifc8b172414e01cebcaf42c30773376c43aaae9a9 Task-number: QTBUG-77859 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Process pending nodes needing _q_postConstructorInit at start of frameJim Albamont2019-09-184-1/+15
| | | | | | | | | | | | | | NodePostConstructorInit::processNodes and QAspectManager::processFrame are both triggered by the event loop which means the frame can happen before the processNodes call. We want to ensure processNodes is called first so those pending nodes can be created during the processFrame call otherwise they will get deferred until the next frame. Created a test to show this and removed the now unnecessary double calls to processEvents in several other tests. Change-Id: I7a3f7b34be2858b4acdb9275804b458f9366ec67 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update QJoint to use direct syncMike Krus2019-09-181-10/+4
| | | | | Change-Id: I2b86f182a61c18cb6608f2f89938ab342160c924 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update QEntity to use direct sync modeMike Krus2019-09-171-7/+1
| | | | | | Change-Id: I9fa6e67607baa66250789b8bf618f30bd45aad98 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Use direct access to remove backend nodesPaul Lemire2019-09-1612-237/+162
| | | | | | | | | - Stop using messages - Remove QSceneObserverInterface - Ensure backend node creation/destruction is done at the right time Change-Id: I470825af344ab65bf05e93fc149b61d1b9eefc96 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-113-18/+14
|\ | | | | | | Change-Id: I4e73060c1941773efcc568f010f5b073ebb10d4a
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-242-16/+12
| |\ | | | | | | | | | Change-Id: I7d7274866129a3c8a3ed3788680a46368120d20d
| | * Matrix_SSE/Matrix_AVX2: fix mapVectorPaul Lemire2019-08-202-16/+12
| | | | | | | | | | | | | | | | | | Change-Id: I4584d2c879a72eccbaf273d0e84b3b6f6bb55295 Task-number: QTBUG-77675 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * | Fix a -Werror=shadow in EntityLiang Qi2019-08-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Triggered by gcc version 4.8.5 (SUSE Linux): src/core/nodes/qentity.h: In member function ‘QVector<T*> Qt3DCore::QEntity::componentsOfType() const’: src/core/nodes/qentity.h:69:32: error: declaration of ‘components’ shadows a member of 'this' [-Werror=shadow] const QComponentVector components = this->components(); ^ Change-Id: I02507b3ff75b0f21d958955f3ce9a8b01f471d05 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* | | Remove QBackendNodeFactory since it's no longer neededMike Krus2019-09-055-140/+1
| | | | | | | | | | | | | | | | | | | | | | | | (wasn't really needed before) Change-Id: I213da50ec995015e7a70f2ea1e5c5557f038be0e Reviewed-by: Jim Albamont <jim.albamont@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | Use sync method when initializing new backend nodesMike Krus2019-08-2913-66/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the node type supports syncing, use that rather than the creation message. The message is still needed since that is passed to the instantiation functor (none of qt3d's classes appear to use anything but the node id, but can't be sure no other classes do, and can't add other virtual method without breaking BC). Change-Id: Id99f448070b8722a7809b968798772c9eb3c8397 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | Merge remote-tracking branch 'qt-gerrit/wip/refactor' into HEADPaul Lemire2019-08-2822-455/+421
|\ \ \ | | | | | | | | | | | | Change-Id: Id73bbecd18edaf46ba481aa018e837a336860223
| * | | Do direct notification of backend nodeswip/refactorMike Krus2019-08-2815-81/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since aspect manager is now on main thread, we can directly update backend nodes safely. Track nodes which have changed properties and notify the backend nodes as part of the frame loop. This avoid allocating and delivering many change messages. To follow: - implement on all nodes - look at backend to frontend syncing - figure out what to do with non property messages (components added/removed, commands, ...) Change-Id: Ia0c442b0528e728c4324d168200bae021bc29266 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * | | Fix QThreadPoolerPaul Lemire2019-08-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle Manual Drive mode / Scene3D changes jobs stats Change-Id: Iadd7dd64580ce88145b264df5adcfc8bcb36b66a Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * | | QAspectEngine: add run loop driving modesPaul Lemire2019-08-075-6/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Can be either Automatic (Qt3D is in charge or driving it) or manual where the user has to call QAspectManager::processFrame() manually. Change-Id: I3e41d24aea0ddc5cce61328d9731b23f91b54215 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * | | Remove the Aspect ThreadPaul Lemire2019-08-079-372/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This now makes the Qt3D simulation loop run in the Main Thread. In theory having the Aspect Thread allowed Qt3D to continue rendering even if the main thread got locked. In practice however this leads to a large amount of complexities in the Qt3D implementations and provides little value as in most cases blocking the main thread would block animations driven by frontend nodes. Removing the Aspect Thread will allow to remove the backend tree copies each aspect had to make which will allow to reduce memory. In addition, getting direct access to frontend nodes, will now be possible without introducing races which should allow to make more optimizations and reduce latencies on some operations. Change-Id: I80e4cd6427de06ddedfa1bb50d40710b91867b24 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | | QTransform: add worldMatrix propertyPaul Lemire2019-08-133-1/+72
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Will make it more convenient to retrieve the world transform of a given QEntity as well as monitor it for changes without having to traverse the parent hierarchy of QEntity/QTransform [ChangeLog] Add worldMatrix property on QTransform Change-Id: Ie9ffb70c03b365850ed08693df2746701ca9a1fb Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | Port from QMutex::Recursive to QRecursiveMutexMarc Mutz2019-07-312-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | Also port from QMutexLocker to std::lock_guard, as the former will not support QRecursiveMutex going forward. Change-Id: I65e14492fc0583e5d0018aef64e18db8a6023dc8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QEventFilterService: these aren't the algorithms you're looking forMarc Mutz2019-07-311-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The event filters are ordered by priority, so don't use a linear scan in order to find whether one with the same position already exists, use lower_bound, whose result at the same time gives the position of an existing filter (if any), as well as the insertion position for the new element. So no need to do a full sort afterwards, either. Change the exisitng op< into an aptly-named lambda, and don't depend on transitive includes. Also, since this code does not need the CoW feature of QVector, port to std::vector, which is faster and produces more compact code. Altogether saves ~2KiB (0.47%) in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: Ie46ca2fbb2dcbea23a0098a72336604776dcc296 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | Remove unused <QMap> includesMarc Mutz2019-07-221-1/+0
| | | | | | | | | | | | | | | Change-Id: I402937171aca2eaaeaea5ced3fd9095db08a38d5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-184-2/+34
|\| | | | | | | | | | | Change-Id: I942a33e63084b346702577e28c70f2111e40a4d5
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-154-2/+34
| |\| | | | | | | | | | Change-Id: I903f92a7b910eee165a2dd708a2d5fb25192ab14
| | * Fix removal of components when they are destroyedMike Krus2019-05-284-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Automatic removal of components when they are destroyed is based on connecting to the destroyed() signal. This however means that by the time removeComponent() is called, the pointer is no longer a valid QComponent (just a QNode). While accessing member data of derived classes such as nodeId is fine, emitting signals from derived class does nothing, and in some cases asserts. Fix this by: - doing the QComponent clean up from it's destructor - implementing a separate method on QEntity to simply clear the now partly invalid pointer from the list. Change-Id: Id7632ee2ceaff6548c44c7a43ae40a0372febde9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Replace QLatin1Literal with QLatin1StringGiuseppe D'Angelo2019-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | QLatin1Literal is an undocumented and deprecated typedef for QLatin1String, just use the original. Change-Id: Id6a813ed5c0a457f003dbd118b64f77d9d82cb13 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Fix some deprecation warningsFriedemann Kleint2019-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | jobs/qaspectjobmanager.cpp:90:72: warning: 'T* QWeakPointer<T>::data() const [with T = Qt3DCore::QAspectJob]' is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations] defaults/qtexturematerial.cpp:66:431: warning: 'QVariant qVariantFromValue(const T&) [with T = QGenericMatrix<3, 3, float>]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] ... testpostmanarbiter.cpp:75:51: warning: 'static QVector<T> QVector<T>::fromStdVector(const std::vector<T>&) [with T = QSharedPointer<Qt3DCore::QSceneChange>]' is deprecated: Use QVector<T>(vector.begin(), vector.end()) instead. [-Wdeprecated-declarations] tst_qray3d.cpp:510:100: warning: 'QVariant qVariantFromValue(const T&) [with T = Qt3DRender::RayCasting::QRay3D]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] tst_renderviewbuilder.cpp:331:120: warning: 'T* QWeakPointer<T>::data() const [with T = Qt3DCore::QAspectJob]' is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations] ... Change-Id: I446f3ddeb7aa2c5698d2a976fa163b443e01cc0c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Scene3D: Revise render loop and synchronizationAnton Kreuzkamp2019-05-282-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, the Scene3DRenderer marked the sg-node dirty in render, which would then already mark it dirty for the next frame. This only works as long as we always render, which is undesireble in some cases. fa12f14b2 changed rendering to not always happen anymore. Thus, that commit broke rendering under certain circumstances. Now, Scene3DRenderer listens on a signal from the QChangeArbiter about new pending changes. In reaction to this signal, we set an internal dirty-flag in Scene3DRenderer. Only if this flag is set, synchronization and rendering will happen on the Qt3D side. Change-Id: I3b33faa5d60c270bd9b903b0e34c8fa24e2e29fd Task-number: QTBUG-69985 Task-number: QTBUG-72923 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>