summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Workaround for some odd crashesJoni Poikelin2020-03-061-0/+3
| | | | | | | | | Sometimes there seem to be null Geometry pointers that are somehow related to quickly swapping QGeometry. This can be worked around by skipping those null pointers. Change-Id: Id2ffbd0eb08f205a7739825932b6d3f0afeab4af Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix OnDemand rendering crash when using QQuickWidgetMauro Persano2020-02-181-0/+1
| | | | | | | | | Restore the original GL context when handling the QQuickWindow::beforeSynchronizing signal to prevent crashes. Fixes: QTBUG-82152 Change-Id: Ibcf3f7fbc1d9ec7b83a76fd617d7aa77ab82ba14 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Revert "Allow for when a Scene3D item switches screens"Paul Lemire2020-02-187-124/+218
| | | | | | | | | This reverts commit 648b7459e8a6ce8ce1f115a14da63d546b743439. Reason for revert: Introduces QTBUG-82275 Change-Id: I5514ad58707c086eaaab3203773614c939e461e8 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Revert "Add in a call to applyAspects() that accidently got missed"Paul Lemire2020-02-181-1/+0
| | | | | | | | | This reverts commit 42c0dbc377af4d307747a32ca1c1fd267ce4337f. Reason for revert: Introduces QTBUG-82275 Change-Id: Ibf3cc3ea29260b57734517d984ef7a5d3244216a Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix and improve FBO handlingPaul Lemire2020-02-175-29/+95
| | | | | | | | | | | | | | FBO need to be rebuild when one of the attachments directly or indirectly changes. By direct change we mean one of the FBO attachment texture being resized or the list of attachments changing. By indirect we mean when texture resource is recreated internally by the engine. Failure to handle this cases resulted in FBO referencing invalid attachments. Change-Id: I8dd4c08e464eed7fb0eeefd61a4158304ab4245f Task-number: QTBUG-64757 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add in a call to applyAspects() that accidently got missedAndy Shaw2020-02-161-0/+1
| | | | | | | | | This amends 648b7459e8a6ce8ce1f115a14da63d546b743439 which had moved the code into applyAspects() call but it was missed from the original setAspects() call. Change-Id: I431c07f260e6c91cbee155c052000d6e5081c4e7 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Destroy FBOs when RenderTarget node is destroyedPaul Lemire2020-02-137-1/+89
| | | | | | | | It appears we never destroyed FBOs which lead to bugs when destroying and recreating a RenderTarget Change-Id: I99b3df95b821670aa3bbd63209ff9bcc21afbf79 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QMetalRoughMaterial: only remove parameters if addedPaul Lemire2020-02-101-8/+21
| | | | | Change-Id: I2542334d004ae389238cdb08dd9d41f4014efccf Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Check we remove a valid node when removing from node propertiesPaul Lemire2020-02-1013-22/+42
| | | | | Change-Id: Ibcc4d9bfd9d0a9d7697151915f24a6eecc149f6d Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Allow for when a Scene3D item switches screensAndy Shaw2020-02-077-218/+124
| | | | | | | | | | | | | | | When a Scene3D item switches screens then it will need to be reinitalized so that the supporting contexts, offscreen surfaces are set to use the same screen and not the original one. This ensures that the item is still rendered correctly on the new screen. This includes a manual test using QQuickWidget in separate windows that enables it going from one screen to the other. Fixes: QTBUG-79192 Change-Id: Id5bbc0d30d04ea4a945463238868b68283df0543 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Fix stale Entity cachesPaul Lemire2020-01-311-0/+4
| | | | | | | | | | Make sure we mark the internal state as dirty when Entities get cleaned up. We could otherwise end up with stale caches referencing Entity's that have been cleaned up (referencing null bounding volumes ...) Change-Id: Ia2d2c67f8635e28690f33c0a7d4c9ff1de0eb471 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix potential crash when logic aspect exitsMike Krus2020-01-272-1/+4
| | | | | | | | | Logic aspect does work in response to posted event. By that time the aspect may be gone (due to normal shutdown) and the scene pointer be invalid. Change-Id: Ia9454532a7c95cd3c00e8b225b8d95c178471a67 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix usage of C++14 featuresMike Krus2020-01-142-4/+4
| | | | | Change-Id: Ibd460eceafdd29d7d88ac2418496dc7002de1095 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use animation rather than event to drive simulationMike Krus2020-01-133-9/+53
| | | | | | | | | | | | | | | Using events can be problematic as they contribute to flooding of the event queue leading to issues with running animations. So we now use an actual animation which runs in a loop and triggers every 1ms (rendering still vsync locked though). If animation have not been enabled for the qt build, we fall back to using events as before. Tests were changes since frame progress is no longer driven by events, so processEvents does not trigger a frame update. Change-Id: I89b11862ef432dffae0c3dfb140eedd61754697e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix for incorrect QML property names in GeometryRenderer docVolker Enderlein2020-01-131-2/+2
| | | | | | | | | restartIndex property has been renamed to restartIndexValue primitiveRestart property has been renamed to primitiveRestartEnabled Fixes: QTBUG-70433 Change-Id: Ide5d01407d76bed752fb0bcaa8258e58871fafb1 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add viewAll support for orthographic projection modeVolker Enderlein2020-01-102-10/+26
| | | | | | | | | | | - viewAll was not supported for orthographic projection mode - Fix viewAll for perspective projection mode - the bounding volume was not fully visible in the render view after applying viewAll Task-number: QTBUG-80078 Change-Id: Ibf7486e41b02997b6b7426bde9a86b2d6c0d2e06 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QDistanceFieldMaterial: Use a smaller Z offsetMartin Andersson2019-12-181-1/+1
| | | | | | | | The previous Z offset was too large because it sometimes caused the text to be placed on top of objects it was supposed to be under. Change-Id: I99bde5a93ea8c6443b1195d818075cebf3d082a4 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* RenderViewBuilder: fix leak with EntityRenderCommandDataPaul Lemire2019-12-164-26/+14
| | | | | | | | | | | | | EntityRenderCommandData would only be released in a separate job than the one it was allocated in. However this would only happen if there was at least a single renderable objects after filtering. In case there was no renderable following filtering, the EntityRenderCommandData was leaked. To fix the issue and make it less error prone, we now switch to using shared pointers to avoid having to handle all possible leak cases with raw pointers. Change-Id: I842d50d2b35ebba8303f6d6c4e72a2427ce31da3 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* RenderView: fix leak with m_statesetPaul Lemire2019-12-131-0/+1
| | | | | Change-Id: I368935178c285b9beb609083b93ae4621c70e28e Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QText2DEntity: Support display of empty stringsVolker Enderlein2019-12-131-8/+5
| | | | | | | | | | | | | The DistantFieldTextRenderer of a QText2DEntity was not properly updated for empty strings. The dereferencing of previous QGlyphRuns needs to be done before the number of DistantFieldTextRenderers is adjusted as a DistandFieldTextRenderer may be the parent of a QTextureAtlas that is referenced by a Glyph. Task-number: QTBUG-80569 Change-Id: I0dba8b749148bef088864dc7200ae0513965745a Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.14.0' into 5.14Qt Forward Merge Bot2019-12-136-11/+41
|\ | | | | | | Change-Id: Ibf5f508eec94be4bae2df3ce2e1511de696dcd72
| * Fix OnDemand rendering with Scene3Dv5.14.0-rc2v5.14.0Paul Lemire2019-12-046-11/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using OnDemand rendering, Scene3D would lock if nothing in the scene were to change. By being blocked, it would also not process jobs for other aspects (input, logics). That would prevent things like a CameraController from running, which in turn would make it impossible to move the camera and trigger a change in the scene to request rendering. Additionally, Scene3D would ignore whether the Qt3D renderer actually needed rendering or not as it was watching on its own the changeArbiter for changes to decide whether rendering was required or not. This would ignore the case where Qt3D needs multiple frames to render a correct frame (e.g loading buffers, shaders at frame n, rebuilding commands at frame n+1) Scene3D now asks the Qt3D renderer by calling the shouldRender() function to decide whether rendering is needed or not, in addition to watching the changeArbiter. Regardless of whether rendering is needed, it now let each aspect process jobs. This ensures things like FrameAction/Input are processed. Then, Scene3D decides whether full rendering is required or whether it only has to be called to allow the Qt3D simulation loop to proceed for the next frame. If the latter, it does it so as not to have QtQuick trigger a redraw. Change-Id: I870f773c224286d6b7ec0f6045319e51e09cbf8e Task-number: QTBUG-80521 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Fix picking with primitive restart for line loopsMike Krus2019-12-131-26/+31
| | | | | | | | | | | | | | | | | | | | Previous fix was not closing the loop on every primitive, just the last one. Task-number: QTBUG-71919 Change-Id: I22d52258477b0c4777118ee36a0b3868da982885 Reviewed-by: Volker Enderlein <volker.enderlein@ifm-chemnitz.de> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Always get the estimate primitive count from the attributeMike Krus2019-12-131-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously were checking that the attribute was actually but due to refactoring the shader is not yet examined at this point. With this change, we always get the estimated number of points from the attributes. Potentially it means we're getting it from an attribute that is not being used but the user should then set the correct number on the geometry renderer anyway. Task-number: QTBUG-80697 Change-Id: Ie34131fe3ff41b34609a2f2eb95c4ff678424036 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | qquaternionanimation.cpp: Fix warning suppressionFriedemann Kleint2019-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Quote the option, fixing g++ 8.3 warning about: qquaternionanimation.cpp: In member function ‘void Qt3DCore::Quick::QQuaternionAnimation::setType(Qt3DCore::Quick::QQuaternionAnimation::Type)’: qquaternionanimation.cpp:147:44: warning: missing option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] QT_WARNING_DISABLE_GCC(-Wcast-function-type) ^ qquaternionanimation.cpp:148:107: warning: cast between incompatible function types from ‘QVariant (*)(const QQuaternion&, const QQuaternion&, qreal)’ {aka ‘QVariant (*)(const QQuaternion&, const QQuaternion&, double)’} to ‘QVariantAnimation::Interpolator’ {aka ‘QVariant (*)(const void*, const void*, double)’} [-Wcast-function-type] d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&q_quaternionNlerpInterpolator); Amends 698bd5f22c79ecf777a0abe57a36676dc49fa8f3. Change-Id: Ia68e2b5b198e658ef7ce9e930d8f3d4bd77fd2d2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Doc: Add note about implementation specific property meaningPaul Wicking2019-12-104-18/+84
| | | | | | | | | | | | Fixes: QTBUG-73095 Change-Id: I843b0376ed0e4ece6ef949acb596a0303aac977d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | QDistanceFieldMaterial: Don't scale rgb colors with distance field alphaMartin Andersson2019-12-092-2/+2
| | | | | | | | | | | | | | | | | | | | Scaling the rbg colors with the calculated distance field alpha value can result in faint text and different colors across the same text. These issues are most obvious when the text is small. Change-Id: Ia12e54e3f344cb918575739a15e519e34d67e0f1 Reviewed-by: Wieland Hagen <wieland.hagen@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix picking with primitive restartMike Krus2019-12-094-2/+22
| | | | | | | | | | | | Task-number: QTBUG-71919 Change-Id: If7923fab6c43f5d7139d1bbdceb73c17bf489099 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Shader: record standard uniform at loading timePaul Lemire2019-12-044-44/+139
| | | | | | | | | | | | | | | | Avoids having to check for each uniform (for each frame, each geometry) whether it is a standard uniform or a user defined one. Change-Id: I76cff7869aacc1343a9acf991f8035b8118581ed Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | GraphicsContext: remove left overs from GL command threadPaul Lemire2019-12-031-6/+4
| | | | | | | | | | | | | | Was needlessly creating a second glHelper instance Change-Id: Id2e7f4a7be77b52cef628ba84ae4a1ff4a3d3b2e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Fill as much as what we can when building the RCPaul Lemire2019-12-032-69/+75
| | | | | | | | | | | | | | | | Avoids repeating that process over and over again in the submission phase. Change-Id: Ie2fa36842cd7280f7c966381238e90dd2dbaa821 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Adequately split work among RenderViewCommandBuilderPaul Lemire2019-12-036-37/+69
| | | | | | | | | | | | | | | | | | Try to give at least 100 entities per worker. Ideally we'd find a way to only add the required number of jobs but ThreadPooler doesn't easily allow that. Change-Id: Ieaf21b66eefd6c3e3b85b949917ea93b73834838 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | RenderViewCommandUpdaterJob: stop copying renderables dataPaul Lemire2019-12-025-30/+37
| | | | | | | | | | | | | | | | This makes the post command update synchronization job a lot faster. Change-Id: I845c39cd4e2c0e56e8eefa05bbdd20d0bc3d2454 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Make QThreadPooler use the global thread poolPaul Lemire2019-12-022-6/+9
| | | | | | | | | | | | | | This should ensure we don't have too many idling threads Change-Id: Ia533fc07140a4944a1149aca1565b0d8ae3cda22 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Restore default rendering behavior of Scene3DMike Krus2019-11-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent change in Scene3D was made to stop it rendering when it was hidden. However this means it no longer can be used as a hidden item in combination with an OpacityMask. Revert default behavior to always draw and introduce an environment variable to let the user stop rendering. 5.15 will add a property to control this properly. Change-Id: I30f95b2704cc7c1c0a4467677c8a9e4e1dbb9962 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Check nodes are enabled when update BVH and world transformsMike Krus2019-11-283-3/+8
| | | | | | | | | | Change-Id: I83f8083bd0759e596f7c51ad25bb076a208a81df Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix a crash in RenderView when the surface has no heightJean-Michaël Celerier2019-11-261-1/+1
| | | | | | | | | | Change-Id: Ia675f81a3e58e6c4d6fd80be55ea7001aa5e1d10 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix a crash in Qt3DWindow when the window has no heightJean-Michaël Celerier2019-11-261-1/+1
| | | | | | | | | | Change-Id: Iaf09d3ada0db25794ec6e517301d054641cb41a0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix a crash in Qt3DQuickWindow when the window has no heightJean-Michaël Celerier2019-11-261-1/+1
|/ | | | | Change-Id: I74722f690b0b174b631e923f6760cbc1af396518 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix compile warning (again)Mike Krus2019-11-151-1/+1
| | | | | Change-Id: Ic20d37a8bf875247c1af31fa4ded757564f953fc Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use builtin test to detect support for threaded GLMike Krus2019-11-151-58/+2
| | | | | Change-Id: Ie14d7ae597ec42e85befed87675388315edc3e6f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Disable threaded rendering macOS 10.14 and laterMike Krus2019-11-146-3/+82
| | | | | | | | | | | | | | | | 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 <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-11-141-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/core/nodes/qnode_p.h src/render/renderers/opengl/renderer/renderview.cpp Change-Id: I24483612f9f395e9ffc0bd6163bbfa092b13b7cb
| * QNode: stop using hash<node,connection> for bookkeeping5.13Paul 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> (cherry picked from commit 906f8a62f89a7ce2343a155e6db62616e66dc14b) Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * Fix the way we compute light positionsPaul Lemire2019-10-291-1/+2
| | | | | | | | | | | | | | | | | | | | 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 <paul.lemire@kdab.com>
* | PackUniformHash to QVectorPaul Lemire2019-11-146-19/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <mike.krus@kdab.com>
* | Remove redundant std::moveThiago Macieira2019-11-131-1/+1
| | | | | | | | | | Change-Id: Iad959315ad374ef288f5fffd15d6d4716cb28052 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Doc: Fix documentation warningsTopi Reinio2019-11-1334-82/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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ö <topi.reinio@qt.io>
* | FilterProximityJob: only run it if our RV requires proximity filteringPaul Lemire2019-11-132-2/+3
| | | | | | | | | | | | | | | | Which is only very rarely required by user applications. Avoid useless memory allocations every frame Change-Id: I69ea73ebfffdbe928f99333b4d1dd90cf4ada430 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Uniform: use QVarLengthArray<16 ,float> instead of <4, float>Paul Lemire2019-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <mike.krus@kdab.com>