summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Do direct notification of backend nodeswip/refactorMike Krus2019-08-2886-1859/+1354
| | | | | | | | | | | | | | | | | 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>
* Introduce Scene3DViewPaul Lemire2019-08-2718-17/+1049
| | | | | | | | | | Allows to render several 3D scenes using a single Scene3D. To be used when you need multiple Scene3D instances. [ChangeLog] Introduce Scene3DView to render multiple distinct 3D scenes Change-Id: I5d51c5935218cc84c15d57def3703aa0d92040ba Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Refactor Scene3D internals prior to Scene3DView introductionPaul Lemire2019-08-273-55/+68
| | | | | Change-Id: I6c9313616587c7930560a5abd962ad73d0bfff70 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Scene3D: introduce compositingMode (FBO or Underlay)Paul Lemire2019-08-2712-39/+4665
| | | | | | | | | | | | | | | | | | | | | | | | | The default compositing mode is FBO. One of the problematic aspects of Scene3D is its round trip through a FBO, which is moderately expensive on low-end hardware, although it makes it a fully fledged Qt Quick 2 item. If one wants MSAA then things are even worse, as an intermediate MS'ed FBO is needed, then resolving into the final one, whose color texture is then sampled. However, there's a significant use case for which these FBOs can be avoided, and that's the case of a 3D scene "below" other QQ2 content. In this setup, Qt3D can simply render to the screen, driven by QQ2; then QQ2 can draw on top. (It's the typical "underlay" scenario.) This can be enabled by setting the compositing mode to Underlay [ChangeLog] Scene3D add compositingMode property. Allows underlay rendering. Task-number: QTBUG-74977 Change-Id: I1ec5f5d60eab45835dbdb2596a7bf1b2ac3624e0 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* RenderSettings: only destroy the RenderSettings component that is usedPaul Lemire2019-08-131-2/+4
| | | | | | | | | | | | | | Since we only create a backend node for the first RenderSettings component that is inserted in the scene, we should only destroy that instance. Otherwise, in the case we have several QRenderSettings components in a scene, if one of them gets destroyed we might end up destroying the RenderSettings instanced actually used by the Renderer. We so far assumed there would only be a single QRenderSettings per application but introducing Scene3DView might change that. Change-Id: Ibef1328253b871f3b40a2298ccd8504130d75d86 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Renderer renderSynchronous: allow skipping swap buffer stepPaul Lemire2019-08-076-9/+19
| | | | | | | Needed for cases where Scene3D is used as an Underlay Change-Id: I13889efc146d278a6331000f886b8fcb33448f65 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Make Scene3D rendering use the Manual Qt3D drive modePaul Lemire2019-08-0717-106/+412
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This now makes Scene3D rendering fully synchronous and blocking: - All Qt3D jobs have to be executed before we can render the GL commands This makes the blocking mode that could be activated with SCENE3D_BLOCKING_RENDERMODE the default behavior now and therefore we could remove references to it in the code. This now means that Qt3D and QtQuick will be rendering at the same refresh rate, which in most cases won't be noticeable and will ensure that content from Qt3D scenes matches content from QtQuick scenes. The only downside is if the Qt3D rendering takes longer than the time expected by QtQuick, the whole QtQuick rendering will be slowed down. Previously the QtQuick rendering might have still run at 60fps while the Qt3D rendering at a lower fps. Now the QtQuick fps would be the same as the Qt3D fps. That being said, the old behavior also meant that if Qt3D didn't catch up, the delay between QtQuick and Qt3D would only increase frame after frame. This change allow to simplify the internals by making Scene3D and regular Qt3D use the same code paths internally. Please note that Scene3D relies on QQuickWindow::afterAnimating being called each frame. When using a QQuickRenderControl this means you might have to call it manually as part of your rendering code. Task-number: QTBUG-72385 Change-Id: I887daf6df632e296a892b844e738a67e973fee7f Reviewed-by: Mike Krus <mike.krus@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-0718-422/+177
| | | | | | | | | | | | | | | | | | 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>
* Merge "Merge remote-tracking branch 'qt-gerrit/dev' into wip/refactor"Paul Lemire2019-08-0764-1716/+1342
|\
| * Merge remote-tracking branch 'qt-gerrit/dev' into wip/refactorPaul Lemire2019-08-0764-1716/+1342
|/| | | | | | | Change-Id: I61324b258ed28d420c96acafd4e624655ffb40e1
| * qshaderimage_p.h: add missing We mean it warningPaul Lemire2019-08-061-0/+11
| | | | | | | | | | Change-Id: Idbf02a3852c5128e41f79d376900e6d06ba1a0c5 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * QImageTextureDataFunctor: return invalid data when url is invalidWang Chuan2019-08-052-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since QSkyboxEntity creating empty cube map first and using QTimer to delay loading real cube map, in render thread, GLTexture will use the generator function of empty cube map to generate a QTextureImageDataPtr at first, this will set the format of property of GLTexture to NoFormat, and terminate the creation of GLTexture. Although GLTexture read real real cube map next time, format will not be reset and the creation of GLTexture terminates. [ChangeLog][Qt3DRender][QImageTextureDataFunctor] return a invalid image data when url is invalid to ensure the property of GLTexture will not be set to NoFormat Fixes: QTBUG-74017 Change-Id: If48f727dba817a931d618b2b88c7ebd54c508c47 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * Merge "Merge remote-tracking branch 'origin/5.13' into dev"Liang Qi2019-07-3129-22/+1022
| |\
| | * Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-3129-22/+1022
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/manual/manual.pro Change-Id: I15d497da84d3fe684c3a598831171d6aed7534ca
| | | * Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"Qt Forward Merge Bot2019-07-306-1/+109
| | | |\
| | | | * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-306-1/+109
| | | |/| | | | | | | | | | | | | | | | Change-Id: Id2885cdbb45f8aa701e218b6201f0a3732b7ef11
| | | | * ShaderData: don't call markDirty(AllDirty)Paul Lemire2019-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | But only markDirty(ParametersDirty) as that's the only thing this is affecting. Change-Id: I450d013dc266ca70ca51cfa866b731a6e8b6499a Reviewed-by: Mike Krus <mike.krus@kdab.com>
| | | | * Add QML documentation to QSkyboxEntityPaul Lemire2019-07-241-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Id82777c111827e8db8924d2d39b5844386344b69 Task-number: QTBUG-76767 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| | | | * Provide more detail in *Light documentationMichael Brasser2019-07-234-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I8d56836f1f075c7239b262454131062c10058026 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| | | * | Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"Qt Forward Merge Bot2019-07-2324-23/+915
| | | |\ \
| | | | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-2324-23/+915
| | | |/| | | | | | |/ | | | | | | | | | | Change-Id: I2a66e9344b72524431885bdf5f59fcaedb94c718
| | | | * Silence warnings about null textures in uniformsMike Krus2019-07-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's common while textures are loading Change-Id: I360c88c72fbd0a034aff07451fd49be17b348d40 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| | | | * Renderer: use last known good surface to reset render statesPaul Lemire2019-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were instead checking against the last surface used (which could be null) instead of the last known good surface to reset the render states. This could result in not resetting the render states and keeping dangling pointers around. To know if we can render, we check find the first non null surface in the list of RV. In most cases we can safelly assume that if first RV has a surface, all following ones will likely use the same surface. If we have no good surface we skip the rendering. However in the case you have a FG where the first RV has a surface but not the last one (which wouldn't really make sense but can happen if you mess up), we could end up in the above case where surface is nullptr though we have partially rendered something for the RV which had valid surfaces. Change-Id: I902b8c7a943ad2ca7e2f487873f73990cf8db433 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| | | | * Align RenderView::buildComputeRenderCommands with buildDrawRenderCommandsPaul Lemire2019-07-191-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | State and parameter handling are the same between the two branches Change-Id: Ic8394a969184daead33253c9303c20ecf1a97484 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| | | | * RenderStates: fix override of nested RenderStatesPaul Lemire2019-07-1822-19/+894
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When merging states, make sure we don't add several states of the same types with possibly different values. We should only add states with type we don't already have. Since the FG traversal is done from leaf to root, we know that the states we already contain should override any state that may have been specified higher up in the FG branch. Change-Id: I9bd1eadd37e8addf740a4b85b2318f9be269fedb Task-number: QTBUG-76766 Reviewed-by: Sean Harmer <sean.harmer@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>
| * | | | Revert "QWheelEvent: temporarily disable deprecation warnings around x(), y()"Marc Mutz2019-07-311-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d2c52680884095238ec3859fabaad03157af3985. That was a temporary measure to get qt5 integration going. The code has since been ported, so this can now be removed again. Change-Id: I96e0470481ad8744048bef72a45f07a3bb63e2ba Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| * | | | QMouseEvent: port away from deprecated QWheelEvent::x/y()Marc Mutz2019-07-311-2/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | Inline the function's QtBase implementations into the code here. Change-Id: I9e9b8b7612f3ca5dcbff7bb8cd33d3355ea170f5 Reviewed-by: Liang Qi <liang.qi@qt.io>
| * | | 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>
| * | | QWheelEvent: temporarily disable deprecation warnings around x(), y()Marc Mutz2019-07-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... in an attempt to unblock qt5 integration. Put the warning suppression macros further apart than necessary to avoid clashing with the actual fix. Change-Id: I362712d1c6b3035966179755cdc6e631d1954255 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * | | Fix deprecation warningsMike Krus2019-07-301-11/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: Ie36f38180d7cca5d8586aec765608bb2cdfb3d4a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * | | ShaderData: don't call markDirty(AllDirty)Paul Lemire2019-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | But only markDirty(ParametersDirty) as that's the only thing this is affecting. Change-Id: I450d013dc266ca70ca51cfa866b731a6e8b6499a Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * | | Merge "Merge remote-tracking branch 'origin/5.13' into dev"Qt Forward Merge Bot2019-07-2317-50/+208
| |\ \ \
| | * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-2317-50/+208
| |/| | | | | |/ / | | | | | | | | Change-Id: I8c12142e4733d0d95fde3e673eb684c47363ff6f
| | * | Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"Qt Forward Merge Bot2019-07-1617-50/+208
| | |\ \
| | | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-1617-50/+208
| | |/| | | | | |/ | | | | | | | | Change-Id: I0f68ab1277617c32b1c31f29d8793d23d9909208
| | | * Document an example of how textureScale might be usedMichael Brasser2019-07-157-0/+51
| | | | | | | | | | | | | | | | | | | | Change-Id: Iead857526a06b104080ab843b26c49efc22f05cc Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| | | * QRay3D: normalize the direction vector internallyPaul Lemire2019-07-152-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be created with a non normalized dir vector but we should always perform the computations with a normalized dir vector for correct results. Change-Id: Ie9108de7ed2092f6b979a70ad9391267fe6c4696 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| | | * Take shortest path on quaternion slerpJuan Jose Casafranca2019-07-153-12/+38
| | | | | | | | | | | | | | | | | | | | Change-Id: I4499e945481a22adfbafcc82198f7c411d04301b Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| | | * Joints: remove removed joints from dirty listPaul Lemire2019-07-153-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case a joint is added and destroyed within the same loop of the event loop, we need to remove it from the list of dirty joints to process as this otherwise results in an assert. Change-Id: If2f4ece6e2d69a7801ce9c4ec2cb732f48895ad1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| | | * Expand documentation for CameraMichael Brasser2019-07-121-15/+88
| | | | | | | | | | | | | | | | | | | | Change-Id: Id886decd4f2bd83a2319b4ad792a15b7280cb448 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| | | * Doc: Fix typo in property namePaul Wicking2019-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | colorbuffer -> colorBuffer Fixes: QTBUG-76342 Change-Id: Ic63ac9b333710ebab17aa7c4ccd9e864f10e6fcf Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * | | assimp plugin: replace QMap with a C arrayMarc Mutz2019-07-222-35/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The keys are statically known, short, and few, so replace the QMap<QByteArray, OpenMode> with a C array of a {char[2]; OpenMode} struct, which occupies just 40B in read-only memory. We don't even need to sort the list, as binary search in a list of ten entries is slower than linear search (five comparisons each, on average, with the linear scan having a predictable memory access pattern. This is a port of dd1d8f51e67ec93031fdd7f7930d63761d1238e6 to the other copy of this code, which shows that arguments like 'this is just a tool, not a library' are ill-advised. Code _will_ be copied. Change-Id: Ie04137f94e487ce998ec077daf655b09bcbbcfc7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * | | AssimpImporter: remove unused QMapMarc Mutz2019-07-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The variable is referenced no-where else. Change-Id: Iad385c83a1fd3de260f830bf27edabeab7f17cb5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * | | Remove unused <QMap> includesMarc Mutz2019-07-222-2/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I402937171aca2eaaeaea5ced3fd9095db08a38d5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * | | Remove unused file gltfparser.cppMarc Mutz2019-07-181-1560/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Found because it's full of Q_FOREACH when the module compiles fine with QT_NO_FOREACH... Change-Id: I8e34a3f54c1070d4dcc9b5c7b578760860eab72c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * | | Fix following recent Scene3DRenderer changesPaul Lemire2019-07-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f39178a415cb41470775a86e0aa358faa3686d81 makes QtQuick redraw only when something in the 3D scene has triggered a change. A function is connected to QQuickWindow::afterSynchronizing to check whether the 3D scene needs to be drawn again and if so the corresponding SceneGraph nodes are marked as dirty. However, we need to ensure the SceneGraph picks up that we've marked a node as dirty by calling QQuickItem::update(). This forces updatePaintNode to be called at the next frame since the afterSynchronizing stage occurs after that step. This fixes rendering freezes with the Always render policy. Change-Id: I041dbe69d12a7e6e884c8ee0e29720d74ce5fa2f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * | | Merge "Merge remote-tracking branch 'origin/5.13' into dev"Qt Forward Merge Bot2019-07-162-2/+3
| |\ \ \