summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl
Commit message (Collapse)AuthorAgeFilesLines
* Make the OpenGL renderer a pluginPaul Lemire2020-02-0578-24714/+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-032-0/+46
| | | | | | | 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-033-15/+11
| | | | | | | 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-0318-130/+660
| | | | | | | | | | | | | | | | 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-0316-59/+278
| | | | | | | | | | | 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-272-1/+6
| | | | | | | | | | - 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>
* Merge remote-tracking branch 5.14 into 5.15Mike Krus2020-01-251-2/+2
|\ | | | | | | | | | | | | | | | | | | * origin/5.14: Fix usage of C++14 features Use animation rather than event to drive simulation Fix for incorrect QML property names in GeometryRenderer doc Add viewAll support for orthographic projection mode Change-Id: I397bdee907389a6f5cabb8390a805fa9a89ed4ca
| * Fix usage of C++14 featuresMike Krus2020-01-141-2/+2
| | | | | | | | | | Change-Id: Ibd460eceafdd29d7d88ac2418496dc7002de1095 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add QRenderCapabilities to query GL about what is supportedMike Krus2020-01-203-20/+14
| | | | | | | | | | Change-Id: I7981e7e4b514e5d15d66c82351f1ab2fe160d20d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add Profiling OverlayMike Krus2020-01-179-29/+925
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QSortPolicy: add Uniform sorting modePaul Lemire2019-12-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | We used to perform uniform minization between adjacent render commands all the time. Since this can yield to a higher CPU usages (but more efficient rendering submission), we now make this step optional. [ChangeLog] QSortPolicy add Uniform mode (to control whether uniform minization should be performed) Change-Id: I5c0e0dba22400a9884ee1d75426fd76b073fdcb5 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge "Merge branch '5.14' into 5.15"Paul Lemire2019-12-184-26/+14
|\ \
| * | Merge branch '5.14' into 5.15Paul Lemire2019-12-184-26/+14
| |\| | | | | | | | | | Change-Id: Iee3ca407250b942208f3beaf21d0e58a632f1095
| | * 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>
* | | Make GL profiling a runtime optionMike Krus2019-12-182-16/+42
|/ / | | | | | | | | Change-Id: I6cf9007132aa9867fd7046e7e641d849ee141e28 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Move AspectCommandDebugger to system service, activate command executerMike Krus2019-12-172-30/+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-162-22/+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-143-7/+5
|\| | | | | | | Change-Id: I5a5b1d497430afdd0fe11933832a2477a7efbe30
| * 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-132-3/+2
| |\ | | | | | | | | | Change-Id: Ibf5f508eec94be4bae2df3ce2e1511de696dcd72
| | * Fix OnDemand rendering with Scene3Dv5.14.0-rc2v5.14.0Paul Lemire2019-12-042-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | 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>
* | | Use jobsDone to sync render capture back to frontendMike Krus2019-12-132-24/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-132-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-135-36/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-079-160/+203
|\| | | | | | | | | | | Change-Id: I6682d27cc7c4f54158fa6813b1de6edce77bea33
| * | Shader: record standard uniform at loading timePaul Lemire2019-12-041-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-301-1/+1
|\| | | | | | | | | | | Change-Id: I106d44d52c45e4b6ef38dc4df9a0363a51d18b94
| * | 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>
* / Avoid initializing QFlags with 0 or nullptrFriedemann Kleint2019-11-252-5/+5
|/ | | | | | | It is being deprecated. Change-Id: Idb6e794be1a26a3ca7c1d19ac1f47e4a0125f11b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* PackUniformHash to QVectorPaul Lemire2019-11-143-12/+61
| | | | | | | | | | | | | | | | | | | 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>
* FilterProximityJob: only run it if our RV requires proximity filteringPaul Lemire2019-11-131-1/+2
| | | | | | | | 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>
* 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>
* Fix status change on QTextureLoaderMike Krus2019-10-301-1/+0
| | | | | | | | | | | 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-295-223/+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>
* 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>
* 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>
* 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>
* 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-223-23/+24
| | | | | Change-Id: I773955df33f0b4dcdaa0953633761ff82f3d0da4 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Convent SendBufferCaptureJob to direct syncPaul Lemire2019-10-212-8/+19
| | | | | Change-Id: I8d5bc69cb75d73e628f08d70b2e40d665c39802b Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Split RenderCommand generation and uniform updatePaul Lemire2019-10-2114-517/+877
| | | | | | | | | | | | | | | | 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>
* Fix Coverity warningsMike Krus2019-10-214-7/+13
| | | | | Change-Id: I00c875b48d838170fddf0b92f0ac5592828c6f0f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>