summaryrefslogtreecommitdiffstats
path: root/src/plugins/renderers/opengl/graphicshelpers
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.12' into ↵v5.15.12-lts-lgplTarja Sundqvist2023-10-117-9/+26
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: If1ce1579db02b74dde74731fcf6163614961841f
| * OpenGL SubmissionContext: reset defaultFBO every time we begin drawingPaul Lemire2022-11-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We wrongly assumed that the default FBO id would remain constant over time once the submission context had been initialized. However it appears that when using Qt3D with a QQuickWidget/QQuickRender control with offscreen surfaces, the default FBO might change over time as the offscreen surface might get recreated. To compute the proper render target size, we rely on comparing the default FBO id against the active FBO id being used at various times in the rendering process. If the default FBO has changed since initialization (due to an offscreen windows recreation on a resize for example), we run the risk of having invalid comparisons between the default FBO and current active FBO. This results in possible erronous render size values when going through SubmissionContext::renderTargetSize. This can lead to occasional flickering or the scene not rendering (getting a reported size of 1x1) when resizing a QQuickWidget holding a Scene3D. Change-Id: I18371e8e19213c472bdb64a6f339ee0941e5cb3d Reviewed-by: Sean Harmer <sean.harmer@kdab.com> (cherry picked from commit 0e5099cc5afaef043058a6b3b459aa7e815ddf9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * Unpin previously used image units during render command parameter setupOle Wegen2022-11-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | Image units are not unpinned after executing a render/compute command and before executing the next one. This can lead to failure during binding of textures to image units if the number of required image units of subsequent commands exceeds the overall number of image units. Therefore, the image units are now unpinned during parameter setup of each command. Change-Id: I9ae7be0bf8c2efe33aca836ef9e81db7c8f5b654 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 51aa6ab005e86c6a1c5d4c91671bd8c68dde0dea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * OpenGL graphics helpers fixesPaul Lemire2022-11-026-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | - Adjust warning message to match GL version they are used against - Correctly call glDrawElementsInstancedBaseVertexBaseInstance on GL 4 - Overload glDrawArraysInstancedBaseInstance to call glDrawArraysInstanced on ES 3 Change-Id: I54e054cc636327e424e4732362dfa2d79562d958 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 7678db1b8ac5a75950b70daf60baa7b42fd826d1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.6' into ↵v5.15.6-lts-lgplTarja Sundqvist2022-08-161-0/+11
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I78ddafff7a563a17c7e9ce31249faf05dc6cda69
| * Add missing sampler types and sizes to gl4 helpersJim Albamont2021-08-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In particular the CubeMapArray and CubeMapArrayShadow were missing from the call to get uniform size causing a crash when these sampler types were used. While fixing this, I double-checked the samplers types in uniformByteSize uniformTypeFromGLType buildUniformBuffer and made sure they were consistent Change-Id: Ief91952fd7727945ba1c4156fe053587a4060684 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit e09188f773ab287dd8c4569a1996d89113bfd5d7)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into ↵v5.15.5-lts-lgplTarja Sundqvist2022-05-161-1/+1
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I944b4bd889244483ec8d8cc7bafe1fb27b5d00db
| * Fix call to drawBuffers in SubmissionContextMauro Persano2021-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Implementations of GraphicsHelperInterface::drawBuffers expect an array of zero-based attachment point indexes (GL_COLOR_ATTACHMENT0 is added to the indexes internally), so we can't convert the attachment index to an OpenGL enum before calling drawBuffers. Change-Id: Ibc8af9f7c402b055c5391ad673b815c1fb65a40a Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 0157b93098fb5339cfe8fe99a111cf6e6f047565) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Revert "Update commercial license headers"v5.15.3-lts-lgplTarja Sundqvist2021-03-2326-519/+519
|/ | | | | | | | | | | This reverts commit 03e5f60e585701608c1181365faee484d7a1f14c. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: I359e89ed77b1b2750607617d138ebb6c316f0296 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Update commercial license headersTarja Sundqvist2021-02-0226-519/+519
| | | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qt3d. Examples, documentation files or tests are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4155 Change-Id: I139c8ad72c042b0900239decc36cfed4bc1c4951 Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Print warning about using primitive restart on ES2Mike Krus2020-12-221-0/+5
| | | | | | | Change-Id: I6007f1e152e38948b619cdeada84a86f7f4db4e4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 492c976b05256b29aac0df861c4be77e1eb65906) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix binding of CubeMapArray texturesJim Albamont2020-12-113-6/+6
| | | | | | | | | | | | | | | To bind to a specific face: use glFramebufferTextureLayer and calculate the layer as 6 * layer + face. To bind to a specific cubemap: There is no way in OpenGL to directly bind to an entire cubemap within the array. Instead bind to the entire texture as for a CubeMap with AllFaces. It is up to the drawing code to select the right cubemap and face, 6 * layer + face Change-Id: Ib9e1a598503eeba1fa729677944aba6d799f90b2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 94ab90f93dc5338338f30e6d78854b55353d3cb8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Only use surfaceSize if m_surfaceSize is not validAndy Shaw2020-09-301-1/+1
| | | | | | | | | | | | This amends 2e3607aa120324f60832ca1cd42aaeaf22cc148d which made it always use surfaceSize. But if m_surfaceSize->size() is valid then this should be used as it will account for HighDPI setups. Fixes: QTBUG-86721 Change-Id: I634b6c3257ac2dcf8042acbbeb999960f68bb266 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 010d2456d8bc02d1c8ce8e0f16f0ecd59ac08803) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* opengl: add envlight texture alias to texture unit checkPaul Lemire2020-08-271-4/+8
| | | | | | | | | | | Since those uniforms are injected by Qt3D, them not being used by a shader is valid and shouldn't result in the function return false. This could otherwise prevent valid draw calls from being made Change-Id: I562cc40d758a174bf9d315a9ab0919ae55a0b04f Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit f9920b285767bceb7b771df000742c277ac9da91) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ES2: Clarify warnings about MSAAPaul Lemire2020-07-101-2/+4
| | | | | | | | | | | ES2 supports multisampling, it just doesn't support explicitly disabling multisample like we could do on desktop with glDisable(GL_MULTISAMPLE); Change-Id: I4a070e8fec60b038e141a656ddb359f0dbed441d Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit c3fa82cdcfdddf16efba7cebd0fecd4630a3c20e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Blit: Fix attachment binding pointPaul Lemire2020-06-161-2/+19
| | | | | | | | | | | We assumed we would only have 15 color attachments at most. In cases you have more or less, if request Depth or Stencil binding points, we would have used an invalid value. Change-Id: I2ecfefbff043fc80efff4b5ad777f3d365f424c2 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 8a9c37b3e7d57e1275706be035f588ddd27f8c53) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ShaderParameterPack: use std::vectorPaul Lemire2020-06-041-2/+2
| | | | | | | | | Leads to a massive gain on bigscene-cpp (increase of 10 fps, frame preparation time reduced by 2ms) Change-Id: Ie2d1f0816fef8c28f316bb9cc8c7daf417c7f8fd Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 735fe47dab436727dc5ab6d66ba7feb7a868f4c3)
* Use surfaceSize as this will always be validAndy Shaw2020-05-291-1/+1
| | | | | | | | | | | | This fixes an issue when resizing a Scene3D that is inside a QQuickWidget to ensure that it has something rendered in each frame. Fixes: QTBUG-83095 Change-Id: Ic6c8b1b2efd0757f9f88768aafb331c4c1a1f9f2 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 2e3607aa120324f60832ca1cd42aaeaf22cc148d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Reduce uniform copiesJean-Michaël Celerier2020-05-271-10/+9
| | | | | | Change-Id: I322e97d9d0da185a98ced5e782a801b3474a892a Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 897b6cd5de7042edcdaf610f80d97d2b422c73c2)
* Release rendertargets on destructionPaul Lemire2020-05-182-0/+8
| | | | | | | | | | We were only releasing them at runtime if they changed, but we should also clean them up before we are destroyed. Change-Id: Ibc3f37fba92e8be8381fd869af7f5747da87038a Task-number: QTBUG-84204 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit cfd8c4d06bc81028b055e6c3343d0d4b50793219)
* Uniform preparation: stop copying the ShaderUniforms aroundPaul Lemire2020-04-202-9/+9
| | | | | | | | | | | | 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>
* Fix and improve FBO handlingPaul Lemire2020-02-172-27/+54
| | | | | | | | | | | | | | 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-132-0/+9
| | | | | | | | 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-131-9/+12
| | | | | | | | | | | | - 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>
* Move classes in OpenGL renderer plugin into an OpenGL namespacePaul Lemire2020-02-0526-81/+144
| | | | | Change-Id: I5314da1df7fbfd1b6db4412e7bc71231525d9de2 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Make the OpenGL renderer a pluginPaul Lemire2020-02-0527-0/+12898
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>