summaryrefslogtreecommitdiffstats
path: root/src/quick3d/imports/scene3d/scene3drenderer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Scene3DRenderer: ensure window pointer stays the same while renderingv5.9.4Paul Lemire2018-01-101-9/+17
| | | | | | | | | | | | | | | | | It appears that the pointer value for the window could in some cases be updated meanwhile we were rendering, which resulted in random crashes. We now save the window pointer to a member variable on startup or whenever the windowChanged signal is fired and use a mutex to ensure the pointer won't change while we are rendering. This also covers the case where the item is destroyed but the cross-thread signals are not received before rendering happens. Task-number: QTBUG-63897 Task-number: QTBUG-65407 Change-Id: I5f2797e2210b532f9086ed186959fce27ea9f514 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Set devicePixelRatio on item size changeMorten Johan Sørvig2017-12-141-4/+5
| | | | | | | | | Propagate the dpr to the QRenderSurfaceSelector in addition to the the item size. Task-number: QTBUG-62235 Change-Id: I6555685392334b8edf2327fae97d5d531cffeaae Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Make sure Qt3D gets a clean OpenGL state in Scene3D itemWieland Hagen2017-06-291-0/+4
| | | | | | | | | We need to reset the state before and after rendering, because it may have been dirty before and it might be dirty afterwards. Change-Id: Iaa32243aa5721d3e2319b2a58987624f30d6482d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Scene3DRenderer: fix race conditionv5.9.0-beta4Paul Lemire2017-05-061-2/+16
| | | | | | | | | | | | When the window geometry changes, the Scene3DRenderer was updating a Qt3D frontend node's property from the QSGRenderThread. This resulted in the QPostman::notifyBackend being called from possibly two threads at the same time, resulting in a race condition where the changes would never be submitted again to the backend. Change-Id: I842aaa54637d85d4d45eb54620749efb36168e2a Task-number: QTBUG-54900 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Oleg Evseev <ev.mipt@gmail.com>
* Hook Scene3D cleanup on scenegraphInvalidated tooLaszlo Agocs2017-04-051-9/+21
| | | | | | | | | | | | | The invalidated signal is nice since it works in all cases, both with real QQuickWindows and ones driven via QQuickRenderControl (e.g. QQuickWidget). With QQuickWidget just relying on windowChanged is pretty bad since the window change comes way too late due to the diffeerences in widget handling internals. Task-number: QTBUG-52132 Change-Id: I8639e4d60514eeeb00fa9dda2329de6088f2a44d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Merge branch '5.8' into 5.9Sean Harmer2017-04-021-11/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/core/jobs/qthreadpooler.cpp src/core/nodes/qcomponent.cpp src/core/qpostman.cpp src/core/qscene_p.h src/core/services/qservicelocator_p.h src/input/frontend/qinputaspect.cpp src/plugins/sceneparsers/assimp/assimpimporter.cpp src/plugins/sceneparsers/assimp/assimpimporter.h src/plugins/sceneparsers/gltf/gltfimporter.h src/plugins/sceneparsers/gltf/gltfio.cpp src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp src/quick3d/imports/render/qt3dquick3drenderplugin.cpp src/quick3d/quick3dextras/qt3dquickwindow.cpp Change-Id: I3566708c6f74a34959e7bb64b64e93647ca3f699
| * Coding convention fix for Src/importscore, importsextras,5.8Robert Brock2017-04-011-11/+9
| | | | | | | | | | | | | | | | | | importsinput, importsrender, importsscene3d Reordering the header includes to comply with Qt coding conventions Task-number: QTBUG-56185 Change-Id: I3b2b3ee60e397772bbcebac09b07c059fbd922db Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Initialize members in Scene3DRendererSean Harmer2017-02-121-0/+2
|/ | | | | | Change-Id: Ifd2015207346987be498a63302ec6f352a489fb1 Coverity-Id: 154585 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* ContextSaver dtor: call make current only when neededPaul Lemire2016-11-231-1/+1
| | | | | | Change-Id: I630cc923f5cb45b36b2fff194ffd721c0e518acc Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Scene3DRenderer::render: simplified code pathsPaul Lemire2016-11-231-28/+19
| | | | | Change-Id: Ibff5d4798430ef239f0d38ac106fc05e95a70350 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Fix crash in Scene3DRenderer::shutdown caused by nullptr m_aspectEngineFredrik Orderud2016-11-021-2/+4
| | | | | | | | | | | | | Crash occurs at teardown when using Qt3D inside an ActiveQt application. This triggers the following call sequence: 1: Scene3DCleaner::cleanup is called from the QWindow destructor. This causes m_aspectEngine to be deleted. 2: Scene3DRenderer::shutdown is later called when processing DeferredDelete events. This method crashes when attempting to dereference the now nullptr m_aspectEngine member. Change-Id: I03bd85f2b7ad3e298b23396284624cbccf88b4e0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use QSurfaceFormat::defaultFormat for sample countSvenn-Arne Dragly2016-06-081-1/+4
| | | | | | | | | Enabling multisample in Scene3D currently uses a hardcoded number of 4 samples. This change uses QSurfaceFormat::defaultFormat().samples() if this is different from -1, and 4 otherwise. Change-Id: I9c0ab8beb056b435c9d1a80c5f35a44dc67d66e6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Replace Q_DECL_NOEXCEPT by Q_DECL_NOTHROWPaul Lemire2016-05-231-1/+1
| | | | | | Change-Id: Ia991da557483704055e0ccf17b4a6b273568a1ba Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Allow the QtQuick + Scene3D case to shutdown cleanlySean Harmer2016-05-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | ...by having the Scene3D item exit the simulation loop before asking the renderer to shutdown. This is necessary because if we let the simulation loop keep running then the render aspect keeps creating and executing jobs as we pull the rug out form under it by shutting down the renderer. This exhibited quite regularly as a crash caused by a race in the Shader::cleanup() function which tried to access the GraphicsContext that was destroyed by the renderer shutdown. This approach sequences things very similarly to the pure Qt 3D shutdown method. The main difference is that we explicitly stop the simulation loop whereas in the pure Qt 3D case, that is done for us by the QAspectEngine::setRootEntity(null) call. This is still done in the QAspectEngine dtor but by that time, the simulation loop is already stopped. The exit simulation logic has been adapted to handle this case. Task-number: QTBUG-51035 Task-number: QTBUG-42353 Change-Id: I08d16e301eab421fa6eb99e558f38e832534c151 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Q_NULLPTR -> nullptrSean Harmer2016-05-011-7/+7
| | | | | | Task-number: QTBUG-52736 Change-Id: I58f9cbcdf018e7b672d33dd865067485412b79fe Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QRenderAspect: move some code to pimplMike Krus2016-03-131-4/+5
| | | | | | Change-Id: Ie54d6bab2b22088f3b857b19e9df5a03371eff61 Task-number: QTBUG-51510 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix picking with Scene3DMäättä Antti2016-03-111-1/+5
| | | | | | | | | Pass the correct picking area to pick job using rendersurfaceselector Task-number: QTBUG-49271 Change-Id: I30511199b9b35c0e70d03f31165eb35c8c015cd1 Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Avoid huge cost of restoring previously bound framebufferSean Harmer2016-02-191-1/+8
| | | | | Change-Id: I2dbf01ea4ec330268198af6f9404f736812cf4c2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Unify license header usageAntti Kokko2016-01-261-11/+14
| | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I8eac0cd6bbc276a56df487249cc459c0d4fab165 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* QAspectEngine/QAbstractAspects: get rid of setDataPaul Lemire2016-01-221-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Getting rid of set data and the refactoring on setting the surface implies that: - Given the FrameGraph configuration, there may be several RenderViews each having a different RenderSurfaceSelector/Window - This means that the Renderer/QRenderAspect can't know about the surface before reading the scene - This means that the Renderer may be dealing with more than 1 window - This means that initialization, render and shutdown procedures will have to be updated accordingly Therefore the Renderer was refactored to: - Be initialized without knowing about a surface - For each RenderView, check the surface and if different from the previous one: * Make the context current with it * Create the appropriate glHelpers (as Surfaces may have != formats) TO DO: - Fix picking - Fix windows exposition - Fix shutdown / detection of all windows beging closed Change-Id: I49d070b05f46be4b26cfb57e494feba145d1da9c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Refactor the scene3d classes into one class per pair of filesSean Harmer2016-01-181-0/+294
No functional changes. Change-Id: I5895e3bcaf65fb7524e6adb10bca1f8c6fdb6c44 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>