summaryrefslogtreecommitdiffstats
path: root/src/plugins/renderers/opengl
Commit message (Collapse)AuthorAgeFilesLines
* Uniform preparation: stop copying the ShaderUniforms aroundPaul Lemire2020-04-207-27/+37
| | | | | | | | | | | | Those are static and expensive to copy (especially once per RenderCommand) as they contain several QStrings. Instead we sort them by nameIds when the shader is initialized and use indices to reference them. This avoids the copies and the sorting allows to be more efficient at finding the ShaderUniforms based on a nameId. Change-Id: I50008381f1d336ab182f5ac5a08500791e2871e9 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Perform the prepareUniform step when building the commandsPaul Lemire2020-04-203-7/+4
| | | | | | | | | | | This is something we might as well parallelize rather than only doing them in the single threaded blocking rendering step. This gives a me a 3fps gain on bigscene-cpp whose bottleneck is still the submission currently. Change-Id: I4d7f3bfd395eef9fef6dc18f30445cfa7d6145ee Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Cleanup setShaderAndUniformsPaul Lemire2020-04-206-77/+142
| | | | | | | Similar to what was done for the rhi plugin Change-Id: I266a3992e21faa2633036c809e884d91d4d892da Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add missing job count to properly compute number of RenderViewCommandUpdaterPaul Lemire2020-04-201-1/+1
| | | | | | | | | The job count was added as a recent refactoring. It defaults to 1 and therefore doesn't parallelize anything. Therefore make sure we override the value by the actual amount of jobs. Change-Id: Id2bc7ca0c10b292fa537c221ad4b90894d9b47fb Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Shader: check frontend node still exists before synchingPaul Lemire2020-04-151-0/+4
| | | | | | | | | | | | | Since backend shaders might outlive their frontend counterparts when using the OpenGL renderer (we need 1 more frame to properly cleanup shaders), check they still exists before trying to send changes. Also make sure we unset the send changes flag when we cleanup a backend shader Change-Id: I3d9cee13fa66e346e040f3be35de223c9081267e Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Adjust number of jobs based on number of render pathsMike Krus2020-04-147-68/+168
| | | | | | | | | | | | | | | | | Renderer currently creates a large number of jobs, most of them doing nothing, this quickly adds up when we have lots of branches. To keep those down, we adjust the number based as estimate of branches that have work to do (no draw detection will fail if it's not the leaf node). Also make RenderViewCommandBuilder and MaterialParameterGathererJob only run if necessary (and reset instance counter on each frame). Finally, only create the right number of MaterialParameterGathererJobs for the amount of updates required. Change-Id: I2d38c72589a38445d0110fc22a472fb9482d1a03 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* setShaderAndUniforms: small improvementsPaul Lemire2020-04-141-27/+30
| | | | | | | | | - try to reuse computed results - only set either the loop or unloop uniforms, having both at the same time isn't possible Change-Id: If11eef32f42f639e6da6c9b3cc693f42c2e86cad Reviewed-by: Mike Krus <mike.krus@kdab.com>
* GLShader: store lights uniform name ids in their own vectorPaul Lemire2020-04-146-96/+538
| | | | | | | | | | | | The lights uniforms are set automatically by Qt3D. Therefore, it makes sense to to only iterate on uniforms that have been specified by the material thus reducing the amount of elements to iterate over. Reduces the amount of CPU cycles spent in setShaderAndUniforms by about 3% Change-Id: Ic758510775d0d86b19567e8345af51ce84cfc4d9 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* setShaderAndUniforms: use const ref for vectorsPaul Lemire2020-04-142-10/+10
| | | | | | | | | | This avoids the ref/deref that a copy does on const QVectors which internally results in less atomic integer operations. The gain seems significants: 2.5ms faster when iterating over 1000 iterations Change-Id: Ie09b0e2755cc1800a424bc5a446ae0a77da1733c Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Reserve the correct amount of uniforms in shaderparameterpackPaul Lemire2020-04-143-2/+15
| | | | | | | | | According to hotspot, that small changes makes setShaderAndUniforms (our biggest hotspot) drop from 45% of total sample cost down to 40% by getting rid of frequent QVector reallocs. Change-Id: Iba94eacee8f4349201acc399432c8c38f325c1d1 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add benchmark for ShaderParameterPackPaul Lemire2020-04-141-0/+6
| | | | | Change-Id: I05e42f7fdfb6b54c30299b7e6664a48f61116b28 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Disable sorting commands by textures on WindowsPaul Lemire2020-03-301-0/+2
| | | | | | | | | | As it leads to a runtime assert based on the fact that the sorting predicate might return true for (a, b) and (b, a) This disables that part until it is rewritten properly. Change-Id: I0e90d02583d402599e7a38bf0c5cca6f2460a9a8 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add ability to dump filter statesMike Krus2020-03-262-2/+10
| | | | | | | | | | | Add button in overlay UI to dump: - the details of technique and render pass filters in the render views - the details of technique and render pass keys in the scene graph This is useful to understand why some objects are not rendered. Change-Id: I57a284081ec986e49e90c979042cc0c17ee0d1cf Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Don't skip RV which have a RenderCapturePaul Lemire2020-03-231-0/+3
| | | | | | | | Even if they are no actual RenderCommands, we still want to perform the RenderCapture. Change-Id: I8219bf750d5664d2954c05722c9eb2b1562c11a0 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Make QAspectJobPrivate::isRequired() constPaul Lemire2020-03-171-4/+3
| | | | | Change-Id: I8747c5714b4a25523835d558fa96888ea0ebcfed Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Initial creation of RHI plug-in and refactoringJean-Michaël Celerier2020-03-165-192/+7
| | | | | Change-Id: Ifbb51003e15f798798040597b5f7224641e8147c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Allow Qt3DWindow to choose which graphics API to use on constructionJean-Michaël Celerier2020-03-111-1/+1
| | | | | Change-Id: Id3ff72a2eaa7f85844a546ef55dc3e1b71a14659 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge gatherer and caching jobsMike Krus2020-03-063-66/+38
| | | | | | | Avoid extra thread sync just for copying data around Change-Id: Ib119115bbb3a7a8a2aa99a3e271595caecc371f7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move common job handling out of RendererMike Krus2020-03-063-213/+43
| | | | | | | | | Should be done in aspect as it's independent of the backend. Moved some tests to separate test using an empty renderer as other backends are likely to have different jobs. Change-Id: I2bec0939045acea7b91ecb1622ba18bf9f5db3c6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix memory leaksMike Krus2020-03-041-4/+4
| | | | | | | | | | | Some jobs get skipped because they don't have anything to do. However, since the runnable does not get submitted to the pool, it would leak (along with the job it points to). Also fixed a couple of compile warnings. Change-Id: I7a25649f2f760c0593862328c0ab905da98c982a Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove GL tracing optionMike Krus2020-02-251-13/+10
| | | | | | | and reorganise the UI for consistency. Change-Id: I68070d8f2d6416c59074d85028c693a2be663608 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make sure RenderViewCommandUpdaterJobs only run when necessaryMike Krus2020-02-172-1/+31
| | | | | | | | | | | There's a large amount of those and they don't seem to have much to do, so only actually schedule them when necessary. Also reset the job instance counter to zero after each frame, helps counting how many they are in the graph dumps. Change-Id: I9bbc30f8277ed4204a4150eddd68b36396965281 Reviewed-by: Paul Lemire <paul.lemire@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>
* Fix job dependenciesMike Krus2020-02-141-0/+1
| | | | | Change-Id: Iacfa40bf887e4846450da5cc1983d35be42b8e81 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add ability to dump job graph to dot fileMike Krus2020-02-145-23/+30
| | | | | | | | | Can be triggered from the overlay API and using sending a "dump jobs" command to the aspect engine. Gets saved in the current working directory. Change-Id: I19fc94a1215187c1d7eb9d1f3b13b968939cc917 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Skip RenderView which don't need to be submittedPaul Lemire2020-02-143-0/+28
| | | | | | | | | | | | | This is when a particular set of filters/layers ... result in a renderview that has no render commands to submit. Trying to submit such renderview is just a waste of time. RenderViews that have no commands but do buffer download, back buffer clearing, setting fences .... are still submitted even if there are no commands to render. Change-Id: I4f66334b9b2170249c7c7aae1024ebccc8427750 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Show geometry renderer id in draw commandsMike Krus2020-02-142-1/+3
| | | | | | | Along with dump of scene graph, helps understand what gets drawn Change-Id: I41223b633d20d3d8ee81f5a08aab2cd8e436647e Reviewed-by: Paul Lemire <paul.lemire@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: I507b045d9b9e1088ff49f719c8846cc43c4fc8f2 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Shader fixesPaul Lemire2020-02-132-10/+17
| | | | | | | | | | | | - Make sure that shaders marked for destruction are un marked from destruction if recreated before having been destroyed. - When loading shaders, make sure the shader wasn't already loaded when loading it. This can happen is a shader is abandoned and then re adopted. Change-Id: I04597479d782bc6d31e4c7f78425c02c31217c7e Reviewed-by: Mike Krus <mike.krus@kdab.com>
* img-gui: remove non existing .h from priPaul Lemire2020-02-101-2/+1
| | | | | Change-Id: Ia861c018644d08ae6fd40bce3b476d57aa31e593 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove QtGui module path from OpenGL related pathsMike Krus2020-02-061-2/+2
| | | | | | | | Many are moving to opengl module in qt6, will make merging easier. Change-Id: I0ad08510e6999a5d887d9197fe2cb0dc21919fb9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move frame profile to GL pluginMike Krus2020-02-053-2/+276
| | | | | | | It's only used there and depends on OpenGL Change-Id: If3d93fd0b12a6f41a751beb12b89d6763107de1b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move classes in OpenGL renderer plugin into an OpenGL namespacePaul Lemire2020-02-0574-205/+423
| | | | | Change-Id: I5314da1df7fbfd1b6db4412e7bc71231525d9de2 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Make the OpenGL renderer a pluginPaul Lemire2020-02-0585-0/+25742
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>