summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/renderer/renderer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make the OpenGL renderer a pluginPaul Lemire2020-02-051-2458/+0
| | | | | | | | By default the QRenderAspect will try to load this plugin Change-Id: Ie55e207fb8e6d0b64f717bbb99699eb669eaa3f2 Task-number: QTBUG-61151 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* ResourceAccessor: make it work with the modular renderer architecturePaul Lemire2020-02-031-0/+36
| | | | | | | This makes Scene2D work again. Tests restored as well. Change-Id: I4082d362c999a674be2debc297d59075f4b7c9e9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Renderer: stop passing buffer type aroundPaul Lemire2020-02-031-2/+2
| | | | | | | It only make sense to pass it for the bind call Change-Id: I8f0cd204c109b2ff24f4eec320811b6cecaf3873 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Introduce a GLShader classPaul Lemire2020-02-031-18/+46
| | | | | | | | | | | | | | | | GLShader is renderer specific shader implementation for OpenGL. Shader now contains only backend information for a QShaderProgram frontend node. - Similar to the GLTexture handling, a generic adopt/abandon manager for shaders was introduced (regardless of the actually GraphicsAPIShader class). - The renderer and renderviews were adapted to the new changes. This was the last major thing preventing the modularisation of the QRenderAspect and renderers Change-Id: If671d60928b433977e9d6e5c58199827f9408a3f Task-number: QTBUG-61151 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add dedicated managers holder for GL ResourcesPaul Lemire2020-02-031-19/+29
| | | | | | | | | | | That way NodeManagers only refers to managers holding nodes (so can be used by aspect and all renderer) and GLResourceManagers refers to renderer specific resources. Note: the Scene2D resourceaccessor was making direct access to GL resource through the managers, this has been commented and will be restored later. Change-Id: Ic32784f60eac35aab8c066d1769f078639fa25b8 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Clean up tracing codeMike Krus2020-01-271-1/+5
| | | | | | | | | | - Removed some old optional timing code. - Separated jobsDone into 2 parts since, on single threaded rendering mode (ie macOS), the render aspect blocks until the next vsync which confuses tracing Change-Id: Icb641e3f8079da2cb9af0416b0f7c4dc4dd36c3c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add QRenderCapabilities to query GL about what is supportedMike Krus2020-01-201-1/+4
| | | | | Change-Id: I7981e7e4b514e5d15d66c82351f1ab2fe160d20d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add Profiling OverlayMike Krus2020-01-171-26/+45
| | | | | | | | | | | | | | | | | Can be activated at adding a QDebugOverlay in the frame graph to identify which surface it should be renderer one (renders only once on first branch that contains such a node). Can be also activated on the forward renderer from Qt3DExtras. - Shows information about FPS and number of jobs/renderviews/commands/vertices/entities/geometries/textures... - Allows to toggle job and gl call tracing and open folder where trace files are stored - Windows to show and dump glinfo and renderview/command details to the console Change-Id: I286ff85760e8f8f0604a23458883ff22229bda94 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make GL profiling a runtime optionMike Krus2019-12-181-16/+35
| | | | | Change-Id: I6cf9007132aa9867fd7046e7e641d849ee141e28 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move AspectCommandDebugger to system service, activate command executerMike Krus2019-12-171-25/+3
| | | | | | | | | | | - Always compile in AspectCommandDebugger and CommandExecuter - AspectCommandDebugger start when QT3D_COMMAND_SERVER_ENABLED is set - System information service becomes entry point for commands from the debugger - Added commands to enable and disable tracing Change-Id: Ic0d7fe72fa8a118a43ca348ca4284595a71827a4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update textures and disables in postJobsMike Krus2019-12-161-19/+13
| | | | | | | | Work was done in postFrame() in main thread anyway, so reduce amount of jobs slightly Change-Id: I8bbb3efcaf9246eb8df1033bde133bc16233f889 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-141-2/+1
|\ | | | | | | Change-Id: I5a5b1d497430afdd0fe11933832a2477a7efbe30
| * Merge remote-tracking branch 'origin/5.14.0' into 5.14Qt Forward Merge Bot2019-12-131-2/+1
| |\ | | | | | | | | | Change-Id: Ibf5f508eec94be4bae2df3ce2e1511de696dcd72
| | * Fix OnDemand rendering with Scene3Dv5.14.0-rc2v5.14.0Paul Lemire2019-12-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Use jobsDone to sync render capture back to frontendMike Krus2019-12-131-19/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the jobs who's only purpose was to send a message to the frontend. Now added a jobsDone() call to render which is called from main thread when jobs are completed, so it's safe to sync data to frontend. Added a task trace for the backend to front end synching. Change-Id: I587462bea353c5d5a0065b542adcacef4dedb05f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Remove device pixel ratio adjustmentsMike Krus2019-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Device pixel ratio was not set on the renderview, so it was always 1. Setting it reveal a bug where the surface size was being adjusted using the pixel ratio. However, the surface size is already in actual pixels. Change-Id: Ia00b2adedb547ec4fa493e1731794d1d8b6a6a18 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Make tracing a runtime optionMike Krus2019-12-131-32/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Moved most of the code QSystemInformationService (private class for now) - Tracing can be enabled by setting QT3D_TRACE_ENABLED or calling QSystemInformationService::setTraceEnabled(bool) - Introduced QTaskLogger class to easy logging (RAII) Change-Id: I2a3e08e4371fcee3e9ef3cf575725f13f57d1a94 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-071-68/+0
|\| | | | | | | | | | | Change-Id: I6682d27cc7c4f54158fa6813b1de6edce77bea33
| * | Fill as much as what we can when building the RCPaul Lemire2019-12-031-68/+0
| |/ | | | | | | | | | | | | | | Avoids repeating that process over and over again in the submission phase. Change-Id: Ie2fa36842cd7280f7c966381238e90dd2dbaa821 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* / Avoid initializing QFlags with 0 or nullptrFriedemann Kleint2019-11-251-3/+3
|/ | | | | | | It is being deprecated. Change-Id: Idb6e794be1a26a3ca7c1d19ac1f47e4a0125f11b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Compute renderables/computables/lights once instead of once per RVPaul Lemire2019-10-291-4/+108
| | | | | | | | 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>
* Renderer: build cache data for new RenderViewsPaul Lemire2019-10-221-8/+11
| | | | | Change-Id: I95690444badaf573b9e2775b50c61113de8d1c77 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* ComputeCommand/SubtreeEnabler use direct sync job to update frontendPaul Lemire2019-10-221-15/+21
| | | | | Change-Id: I773955df33f0b4dcdaa0953633761ff82f3d0da4 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Convent SendBufferCaptureJob to direct syncPaul Lemire2019-10-211-7/+18
| | | | | Change-Id: I8d5bc69cb75d73e628f08d70b2e40d665c39802b Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Split RenderCommand generation and uniform updatePaul Lemire2019-10-211-49/+54
| | | | | | | | | | | | | | | | In most cases, we can generate the RenderCommands once and reuse them in subsequent frames only updating the uniforms. We still have to copy the RenderCommands as the renderer renders while we start preparing the next frame. This is still faster than regenerating them entirely. Regenerating the entire commands will happen only when FrameGraph or Scene structure changes. That should rarely be happening on a per frame basis. Next step could be to look at how to only update commands for Entity with Parameters that have changed. Change-Id: I202870850a46fcd3946f81bffddb7027d192f374 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch '5.13' into 5.14Paul Lemire2019-10-171-1/+2
|\ | | | | | | Change-Id: I39797b5e48cb627638443e20eed207af6ae86c9c
| * Renderer: check context thread before destroying resourcesPaul Lemire2019-10-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only try to cleanup the resources if we know we are called from the right thread. releaseGraphicsResources can be called from 2 places: - Scene3DCleaner when using Scene3D (when closing the window) - AspectThread when the RenderAspect gets unregistered In configurations where the context lives in the main thread (Scene3D + single threaded render loop / ANGLE), the RenderAspect gets unregistered before the Scene3DCleaner has had time to call releaseGraphicsResources. This means that we won't release the resources ourselved and that the driver will have to do that for us. This has been fixed properly in 5.14 with the AspectThread removal. Task-number: QTBUG-60971 Change-Id: I49c1c2f74ad09e7162b988f87bac65863f8490d8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Paul Lemire2019-10-151-0/+14
|\| | | | | | | Change-Id: I44133fbc9b93e96918463b0b0891ee5ab7db9f2c
| * Make sure right screen is set on QOpenGLContext and QOffscreenSurfaceAndy Shaw2019-10-101-0/+14
| | | | | | | | | | | | | | | | | | | | When the Qt3D window is on a specific screen, then it needs to ensure that any supporting QOpenGLContexts and QOffscreenSurfaces are set to be using that same screen or it will fail to render the content. Change-Id: Ief4f3e88bf6f71862bc5dace0cb0bddcdf3a98b5 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | ShaderBuilder: ensure no old updates are left overPaul Lemire2019-10-141-2/+2
| | | | | | | | | | | | | | Could result in trying to send updates to nodes which have been destroyed. Change-Id: I3709277e5005f25ec8cb9efe0a2152f879bea89f Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Convert Shader/ShaderBuilder jobs to use direct syncPaul Lemire2019-10-141-41/+49
| | | | | | | | | | Change-Id: Ia56ba6176c86e34904611ae57e682ac9d52c79f7 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Rebuild Material Caches when Shaders are dirtyPaul Lemire2019-10-101-1/+2
| | | | | | | | | | | | | | As the cache depends on both Material/FrameGraph and Shaders. Change-Id: I87c8ab20f37f111aa24c83401ee689f9e96681eb Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Remove CommandThread/GLCommandsPaul Lemire2019-10-081-21/+1
| | | | | | | | | | | | | | | | This has always been disabled, no point in keeping something we don't use. Can always be reverted later if we find it's actually required. Change-Id: Icc488b986cee90911a8b46cc88152938e786c1da Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Update sendTextureChangesToFrontend to use direct syncPaul Lemire2019-10-071-9/+27
| | | | | | | | | | Change-Id: I9356186ca27518c32ae189d7e432969b767612e9 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Renderer: remove redundant setter callPaul Lemire2019-09-301-2/+0
| | | | | | | | | | Change-Id: I3829f621958d98b50563a2a8ed782aec1a7ceb65 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Renderer: cache traversal of FrameGraphPaul Lemire2019-09-301-17/+18
| | | | | | | | | | | | | | Will be retraversed only when something in the FrameGraph has changed Change-Id: Ibb43f8f2928b10a584f468fb13f1d4773c7fcebb Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | RenderView:buildDrawRenderCommands: only set Command members that matterPaul Lemire2019-09-301-6/+5
| | | | | | | | | | | | | | | | Some values where overridden in Renderer::prepareSubmission so no point in spending time setting them in the first place Change-Id: Iceea0cbe044b883d0797aebd7487f8f6b29ac542 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Support transient enablement in QSubtreeEnablerMichael Brasser2019-09-241-0/+24
| | | | | | | | | | Change-Id: I422cf0fb0991319b0f54e5a26b9b3694cb093454 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Remove backend entity hierarchy rebuilding jobsJim Albamont2019-09-201-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | We no longer need to have a special job to rebuild the entity hierarchy as parent nodes can now always be resolved on the backend either at creation time or while reparenting. The NodePostConstructorInit ensure that all backend nodes are created from the top down so a node can always find it's parent. Change-Id: I9dcfb64b62e2e02b89b1ae59efb41f25dfc09eae Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix deprecation warnings related to QBasicAtomicIntegerFriedemann Kleint2019-09-191-10/+10
| | | | | | | | | | | | | | | | | | 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>
* | Remove QBackendNodeFactory since it's no longer neededMike Krus2019-09-051-2/+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-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Renderer renderSynchronous: allow skipping swap buffer stepPaul Lemire2019-08-071-3/+12
| | | | | | | | | | | | | | 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-071-39/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-311-1/+1
|\| | | | | | | | | | | | | Conflicts: tests/manual/manual.pro Change-Id: I15d497da84d3fe684c3a598831171d6aed7534ca
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-231-1/+1
| |\ | | | | | | | | | Change-Id: I2a66e9344b72524431885bdf5f59fcaedb94c718
| | * 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>
* | | Merge remote-tracking branch 'origin/5.13' into devPaul Lemire2019-06-031-1/+4
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/render/renderers/opengl/renderer/renderer.cpp tests/auto/render/textures/tst_textures.cpp Change-Id: I4da0eafe7ddd4dd822c3dcb5f5fa826653a335b4
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-05-291-1/+1
| |\| | | | | | | | | | Change-Id: I9e9214906c5cda56d0bcc98678c77be69189699d
| | * Clean up warningsMike Krus2019-05-281-1/+1
| | | | | | | | | | | | | | | Change-Id: I1ddad305359586481021e85f6e4a470d3a6521b0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>