summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl
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-173-29/+63
| | | | | | | | | | | | | | 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-133-0/+16
| | | | | | | | 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>
* Fix usage of C++14 featuresMike Krus2020-01-141-2/+2
| | | | | Change-Id: Ibd460eceafdd29d7d88ac2418496dc7002de1095 Reviewed-by: Paul Lemire <paul.lemire@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-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>
* | 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>
* | 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>
* 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>
* Merge remote-tracking branch '5.13' into 5.14Paul Lemire2019-10-172-1/+25
|\ | | | | | | Change-Id: I39797b5e48cb627638443e20eed207af6ae86c9c
| * Add light_0/7 as uniformsJuan Jose Casafranca2019-10-161-0/+23
| | | | | | | | | | | | | | | | | | Some ES2/3 drivers dont support structure arrays This patch uploads also light_0/7 uniforms in addition to light[0]/[7] so the shader can be unrolled for those devices that need it Change-Id: I9356e7624c1c0593e7803914f0ecf2d84de48681 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * 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-152-0/+18
|\| | | | | | | Change-Id: I44133fbc9b93e96918463b0b0891ee5ab7db9f2c
| * Make sure right screen is set on QOpenGLContext and QOffscreenSurfaceAndy Shaw2019-10-103-0/+19
| | | | | | | | | | | | | | | | | | | | 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>
| * Fix blitting to also blit depth and stencil buffersPaul Lemire2019-10-091-1/+2
| | | | | | | | | | Change-Id: Ib7b491c638508cfcdfbd523fd4e6a3d757c2c832 Reviewed-by: Sean Harmer <sean.harmer@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>
* | renderviewjobutils.cpp: Remove unnecessary string conversionFriedemann Kleint2019-10-141-1/+1
| | | | | | | | | | | | | | | | | | Remove call to toLatin1(), fixing: enderers/opengl/jobs/renderviewjobutils.cpp: In member function 'void Qt3DRender::Render::UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(Qt3DRender::Render::ShaderData*, const QString&, const QString&, const QVariant&)': renderers/opengl/jobs/renderviewjobutils.cpp:516:126: warning: 'QString::QString(const QByteArray&)' is deprecated: Use fromUtf8, QStringLiteral, or QLatin1String [-Wdeprecated-declarations] Change-Id: I71afa2b29e7af6cb3acad008822b369acc66bed3 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Convert Shader/ShaderBuilder jobs to use direct syncPaul Lemire2019-10-143-53/+64
| | | | | | | | | | Change-Id: Ia56ba6176c86e34904611ae57e682ac9d52c79f7 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Fix blitting to also blit depth and stencil buffersPaul Lemire2019-10-101-1/+2
| | | | | | | | | | Change-Id: Ib7b491c638508cfcdfbd523fd4e6a3d757c2c832 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>
* | Update QShaderData to use direct syncPaul Lemire2019-10-082-59/+6
| | | | | | | | | | | | | | Also a bit of cleanup Change-Id: I317fa2dbaa62a55fe371e982ed23976e65696d79 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Remove CommandThread/GLCommandsPaul Lemire2019-10-087-502/+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-072-11/+29
| | | | | | | | | | Change-Id: I9356186ca27518c32ae189d7e432969b767612e9 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Clean up includesMike Krus2019-10-011-3/+0
| | | | | | | | | | | | | | | | | | Remove include statements for classes that are no longer used. Makes it easier to find remaining use cases that need addressed before complete removal in Qt 6. Change-Id: I60529ba1929ad64b162d3847d5df47cde2a60dad Reviewed-by: Paul Lemire <paul.lemire@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-302-17/+20
| | | | | | | | | | | | | | 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-303-59/+10
| | | | | | | | | | | | | | | | 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-242-0/+27
| | | | | | | | | | Change-Id: I422cf0fb0991319b0f54e5a26b9b3694cb093454 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>