summaryrefslogtreecommitdiffstats
path: root/src/render
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 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>
* 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>
* Check we remove a valid node when removing from node propertiesPaul Lemire2020-02-1012-21/+40
| | | | | Change-Id: Ibcc4d9bfd9d0a9d7697151915f24a6eecc149f6d Reviewed-by: Mike Krus <mike.krus@kdab.com>
* 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 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-131-5/+0
| | | | | | | | | | | | | | | 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>
* 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>
* Merge remote-tracking branch 'origin/5.14.0' into 5.14Qt Forward Merge Bot2019-12-133-4/+3
|\ | | | | | | Change-Id: Ibf5f508eec94be4bae2df3ce2e1511de696dcd72
| * Fix OnDemand rendering with Scene3Dv5.14.0-rc2v5.14.0Paul Lemire2019-12-043-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | 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>
* | 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>
* | 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>
* 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-142-3/+72
| | | | | | | | | | | | | | | | 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>
* 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-1314-53/+62
| | | | | | | | | | | | | | | | | | | | | | | - 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>
* ShaderParameterPack: stop calling hash.clear() in dtorPaul Lemire2019-11-121-1/+0
| | | | | | | Can only make the overall destruction of the object longer Change-Id: Ic5033287fb770ed4a01ffd6b315310b74e8a3797 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Reduce allocations when building stringsMike Krus2019-11-081-7/+20
| | | | | | | | We produce A LOT of these at every frame, reduces allocations by ~ 20% (also less CPU load at creating and concatenating temp strings). Change-Id: I342c16ed3b4b8d9e1c66ddf37cb9f60496eb9de5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix compile warningsMike Krus2019-11-081-5/+3
| | | | | Change-Id: Iac18b5fddec79295dd9e4249fd16eb2f121fe771 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Buffer: make sure we force allocate before doing partial updatesPaul Lemire2019-10-301-9/+20
| | | | | Change-Id: I229f9bcd21a10c0a4cff5c4f559cd285a3e50276 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Set Loading status on QMesh when functor changesMike Krus2019-10-301-1/+9
| | | | | | | Will then be set to Ready or Error once the job runs Change-Id: I542fdce9aea08e6e49fdaec645216132a56e7474 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix status change on QTextureLoaderMike Krus2019-10-303-11/+10
| | | | | | | | | | | Now setting to Loading when the functor change is synced to the backend. Avoid creating a new functor when downloads have completed, just use the same one and mark the node as dirty. Avoid recreating the functor when the format change comes from the backend (which caused the image to be loaded again). Change-Id: Ifcbbf54db56b57a58b0b5d1ce5f1475b6587f697 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Convert EntityRenderCommandData to struct of vectorsPaul Lemire2019-10-298-43/+90
| | | | | Change-Id: Ib290491476b083e6aa4cff5c112a802c4e198987 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Compute renderables/computables/lights once instead of once per RVPaul Lemire2019-10-296-227/+149
| | | | | | | | All RV end up using exactly the same vector before filtering it down on per RV specifics. No point in compute RV times the same thing. Change-Id: Ia674095627771c8e9ada090fa47623cbbbd8a3f8 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix frame advance serviceMike Krus2019-10-281-3/+8
| | | | | | | | | | | | | | 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>
* GLTexture: fix shared texture id handlingPaul Lemire2019-10-281-11/+10
| | | | | | | | | | Returning early should only be done when not dealing with a shared texture id as all shared texture id will satisfy the early return condition initially. This must be the result of a bad manual merge. Change-Id: I475a608a942a8c178b10c2a49564aee3f464c379 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* LightGatherer: reset values before runningPaul Lemire2019-10-281-0/+3
| | | | | | | Otherwise if job is run several times, we end up with duplicate values. Change-Id: Id31867ecce41e3b756623ef9c3a6e2c5b610d08d Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix the way we compute light positionsPaul Lemire2019-10-281-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: I55d5600cdf7c58a65c27bbe59c1a620c58dbb3a3 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-261-0/+8
|\ | | | | | | Change-Id: I450f2c8e7c9887b22c5a5781f70889e6ac4e915c
| * Add BufferCapture QML documentationMats Honkamaa2019-10-171-0/+8
| | | | | | | | | | | | | | | | Copied the very basic C++ docs. Task-number: QTBUG-79109 Change-Id: Ib5803dfc06d7d10001e31f9cb0c113509cc23f0f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix skeleton loadingMike Krus2019-10-251-1/+1
| | | | | | | | | | | | | | | | 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>
* | Fix missing status change in QSceneLoaderMike Krus2019-10-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Status was only applied after the loading was completed. So when the source changed to another file, the status would not change (stay Ready). Furthermore, the Loading status was never set. Now set the status to Loading when changing the source and getting the backend ready to load. Change-Id: I997aa5c4e04d79f268cd7a793ffa3f45dc4427e8 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix crash in Scene3DViewMike Krus2019-10-251-8/+8
| | | | | | | | | | | | | | Also fix warnings in SubmissionContext Change-Id: I7c8fe353547c6819d7a0a64f4bf49ea0b005f7dc Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add manual test to check manual render loopPaul Lemire2019-10-251-0/+4
| | | | | | | | | | | | | | | | Shows that update are done before rendering takes place Change-Id: Ia3f5bcb497c023dad805609dcb1ffe9ce7947c06 Task-number: QTBUG-79375 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | ComputeCommand: add unit tests for manual trigger modePaul Lemire2019-10-241-1/+4
| | | | | | | | | | Change-Id: Ia106a235648df7232fbcaf4f61c880a9ab5491ef Reviewed-by: Mike Krus <mike.krus@kdab.com>