summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/graphicshelpers
Commit message (Collapse)AuthorAgeFilesLines
* 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: I99b3df95b821670aa3bbd63209ff9bcc21afbf79 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>
* PackUniformHash to QVectorPaul Lemire2019-11-141-3/+3
| | | | | | | | | | | | | | | | | | | 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>
* 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>
* Fix Coverity warningsMike Krus2019-10-211-3/+3
| | | | | Change-Id: I00c875b48d838170fddf0b92f0ac5592828c6f0f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Convert Shader/ShaderBuilder jobs to use direct syncPaul Lemire2019-10-141-2/+3
| | | | | 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>
* Fix compile warning in imagesubmissioncontext.cppPaul Lemire2019-09-241-1/+3
| | | | | Change-Id: I34f1dac63a31aadfeb893aca17b15d80184a24e4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-211-1/+1
|\ | | | | | | Change-Id: I27ff0470d3447ce6fab28f21e8f32286e3a66ac1
| * Fix potential memory leakMichael Brasser2019-09-171-1/+1
| | | | | | | | | | Change-Id: I91a41154ad4acb0f1f7497a2616d219770640ca6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge remote-tracking branch 'origin/5.13' into devPaul Lemire2019-08-201-1/+1
|\| | | | | | | Change-Id: I53aa6c3f61b1f624ec553079a9332c96486abf3f
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-131-1/+1
| |\ | | | | | | | | | Change-Id: I359b15d87622515ee4f05db1f01d4b476027378e
| | * submissioncontext fix: devicePixelRatio is not an integerPaul Lemire2019-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Converting it to int would cause the viewport not to take the whole expected size as the interger conversion would essentially floor the value. Change-Id: Ic608b0e1a0910aadb8b98c3225f999cba6326535 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | Renderer: Image support addedPaul Lemire2019-06-057-6/+459
| | | | | | | | | | | | | | | Change-Id: I5b2764f0ae5184c2097d6da5e7a6e24b5c6a5d1b Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | | Uniform: add handling of uniform of Image based typesPaul Lemire2019-06-055-1/+264
| | | | | | | | | | | | | | | Change-Id: I94adc182a0f744b022fb13f4e2dbd16e47e2ba71 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | | GraphicsHelpers: add bindImageTexture supportPaul Lemire2019-06-0415-1/+110
| | | | | | | | | | | | | | | | | | | | | Since GL 4.2 and ES 3.1 Change-Id: I3feaaa6e34b3031121771017763d51ac6ef07687 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | | Merge remote-tracking branch origin/5.13 into devPaul Lemire2019-04-157-227/+365
|\| | | | | | | | | | | Change-Id: Ib5c04e9941aeea1a4cd27519b94b9a53e8349ea3
| * | Merge branch '5.12' into 5.13Paul Lemire2019-04-027-227/+365
| |\| | | | | | | | | | Change-Id: If17511da64dd666a536408aa3cb3178ef6db0403
| | * Don't reset texture units at every frameMike Krus2019-03-185-189/+342
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resetting texture to unit assignment at every frame seems to trigger constant shader recompilation on macOS. Maybe GL driver is implemented on top of Metal which has more restrictions. Not resetting the assignment means the same texture units are used for consecutive frames and fixes excessive recompilation. Refactored the code to move the texture handling to separate class. Change-Id: I480f76e7e7b0ea669c6acb039cc3d079937ff97f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| | * Fix member overloadsMike Krus2019-03-144-26/+10
| | | | | | | | | | | | | | | | | | | | | | | | m_currentVAO and m_glHelper were hiding members in parent class. Removed overloads and cleaned up initialization. Change-Id: I174dffc63c812e0b4241018c86e560de48a31a0b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Add QRasterMode render stateJuan Jose Casafranca2019-02-1214-1/+54
| | | | | | | | | | | | | | | | | | | | | QRasterMode allows a user to change the raster mode from fill to lines or points Change-Id: If96848e38ac4b5a615040b3bae2dec38a03cb031 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* | | Add support for glDepthRangeJim Albamont2019-02-1114-0/+51
|/ / | | | | | | | | | | | | | | Added a new QRenderState to provide access to glDepthRange. Task-number: QTBUG-73059 Change-Id: I434b73e6e499307bfa58b2a1001e4c48328e9d5b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge remote-tracking branch 'origin/5.12' into devMike Krus2019-01-232-10/+152
|\| | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/render/renderers/opengl/textures/gltexture.cpp Done-with: Liang Qi <liang.qi@qt.io> Change-Id: I2b419458913a2e3cb2064b934b07b1f6ff05e3cd
| * Avoid repeated warningsMike Krus2019-01-181-2/+143
| | | | | | | | | | | | | | | | | | ES2 helper will sometimes flood with warnings. Same with textures that take several frames to load. Just make sure message appear again if functor changes. Change-Id: Id5d8a8a3fa1ab88b2b40d4f71bf91c26724654a2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Fix issue with invalid texturesMike Krus2019-01-181-8/+9
| | | | | | | | | | | | | | Previous fix for missing env map triggers some corner cases Change-Id: Icfa5657973b4050fed0681bb929091e7659012fc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-031-2/+5
|\| | | | | | | Change-Id: I95431b48ee9828be602c088cdd798fabbd1723ef
| * Don't trigger Q_UNREACHABLE if passed invalid render buffer formatsChristian Andersen2018-10-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | Adds warning printout of the format that triggered the error. The graphics card may produce a proper image, but readFrameBuffer doesn't know how to interpret it. Additionally adds printout of the format when the code doesn't know the equivalent OpenGL ES 2.0 format. Fixes: QTBUG-66515 Change-Id: I65559f7d397a9297521ae0b1ebaf120629be3873 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Implement WaitFence/SetFence handling into the rendererPaul Lemire2018-10-1217-2/+361
| | | | | | | | | | | | | | | | Slightly reorganize jobs between jobs needed for rendering and jobs that should run even when no rendering is required. Change-Id: I02d262efd8cb46c71c40ac6dbcd4d1b25bb725e1 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge "Merge branch '5.12' into dev" into refs/staging/devSean Harmer2018-10-114-0/+23
|\|
| * Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-10-054-0/+23
| |\ | | | | | | | | | Change-Id: I2a92242b0d6be4f4e7f07f0f020fa6751ada9bc3
| | * Further complete missing functions on ES3 helpersPaul Lemire2018-10-044-0/+23
| | | | | | | | | | | | | | | | | | Change-Id: I62e83c360619a2e096401330a61a6f2602b743d2 Task-number: QTBUG-70660 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | | Renderer: implement using OpenGL textures from a texture idPaul Lemire2018-10-111-4/+16
|/ / | | | | | | | | | | Change-Id: Ifc65966c50cb6fc8780206852f92bf1d4a6b4d5b Task-number: QTBUG-69918 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-225-3/+206
|\| | | | | | | Change-Id: I1a1c178055502b1cd37ad1be30dcb2f5409ed7a8
| * Complete ES 3.1 and 3.2 helpersPaul Lemire2018-09-215-3/+206
| | | | | | | | | | | | | | | | | | | | | | Which didn't handle indirect drawing, compute and tessellation Since ES 3.1/3.2 don't provide API for glShaderStorageBlockBinding, code was adjusted to use the default binding points and not require that API. Change-Id: Ie4dcd05f0a1d72e4a25f49b5fae138dc605ba5e3 Task-number: QTBUG-70660 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Fix warning about ignored qualifiersThiago Macieira2018-09-051-1/+1
|/ | | | | | | graphicscontext.cpp:229:90: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers] Change-Id: I495bc19409f348069f5bfffd15516b6a1d58d150 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix: remove compile warning in graphicscontext.cppPaul Lemire2018-08-211-1/+1
| | | | | Change-Id: I3f1b5cca75973abf8970b3f1929a3a0ea385d8f1 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Avoid initializing GraphicsContext on every frameLaszlo Agocs2018-08-142-4/+1
| | | | | | | | | m_initialized is inherited from GraphicsContext, having another m_initialized in SubmissionContext is wrong. Change-Id: I431ba67c671b8854fafce769c8bfd90ba71e7441 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Properly update properties from Backend to Frontend texturesPaul Lemire2018-08-081-1/+1
| | | | | | | | | | | | | | | | | | | Taking into account we have texture sharing in the backend, we can only update frontend texture properties once we have created the shared backend texture. Code was adjusted to retrieve these properties when creating the GLTexture. Such changes are stored and sent on the next run loop from a job where they are distributed to all referenced frontend Texture. The status property handling has also been updated to send status changes to all shared textures instead of just the texture whose data generator is used to gather the data. A manual test checking texture property updates, sharing and remote url sharing has also been added. Change-Id: I8ed2449fe57c9d7337580b0f7561f974cbd5006d Task-number: QTBUG-65775 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Don't abort rendering when env light textures are not setPaul Lemire2018-06-271-2/+10
| | | | | | | | | | | | | | | | | | The MetalRoughMaterial provides parameters for the env light textures even though they are optional but are needed to avoid issues with unbound textures on some drivers. In practice, when an env light is present, the values would be overridden. However if no env light is present, when setting the texture values on the shader, they would actually reference invalid textures and Qt3D would not render. We want to keep the behavior for the general case but make an exception for MetalRoughMaterial, therefore we are checking if the missing textures are the ones for env light or not before aborting. Ideally, we should shortly be able to remove the QParameters altogether with the Shader Builder. Change-Id: Id54436ff9e328c390eacceb3e63809c757b28b2a Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Add a GLES 3.1 graphics helperLaszlo Agocs2018-05-297-2/+314
| | | | | | | | | | | | | ...to enable sampler2DMS uniforms. Also fixes the ES3 helper when it comes to uniformByteSize. [ChangeLog] 2D samplers for multisample textures are now supported on OpenGL ES 3.1 and newer Task-number: QTBUG-68403 Change-Id: Iee1bd8baf097e19d89f651845938c681fb2a4df9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix BlitFramebuffer on GLESLaszlo Agocs2018-05-293-2/+16
| | | | | | Task-number: QTBUG-68395 Change-Id: I216f32bd22d12c6fa6f2efd09765ad95754326b4 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix flashing and crashing of scene2dMäättä Antti2018-05-291-0/+42
| | | | | | | | | Prevent simultanious usage of the GLTexture being rendered to by scene2d. Task-number: QTBUG-68511 Task-number: QT3DS-1792 Change-Id: I88de12cba68ef7af2c7afb1f6e9d6143028efc86 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Merge remote-tracking branch 'origin/5.11.0' into 5.11Qt Forward Merge Bot2018-05-091-1/+2
|\ | | | | | | Change-Id: I666d4ca1ad39f81e41a9b47a8828d1689ff2b33e
| * Remove race in texture data uploadPaul Lemire2018-05-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | In the non locked submission phase of the renderer, the GLTextures must have had their content/properties already updated as this is too late to actually create or upload texture based on references which may be invalid or outdated. This wasn't properly handled. We now perfom the GLTexture creation and data upload when both the RenderThread and AspectThread are locked. Task-number: QTBUG-67989 Change-Id: I07ac23120e8d37a86e60d2b892d1437b8cb0b3dc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Fix compile warningsMike Krus2018-04-201-0/+2
|/ | | | | Change-Id: I4aceeeb455aedc3c84e3a17983a894f1f84bdc09 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* ES2: Ignore mode when calling bindFrameBufferObjectAndy Nichols2018-04-123-21/+29
| | | | | | | | When using bindFrameBufferObject with ES2 the only available target is GL_FRAMEBUFFER. Change-Id: Ie8fd50a57deeae3e8e02885e954ff73d85712c14 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* ES2: Enable Renderbuffer usage with either Depth or StencilAndy Nichols2018-04-123-6/+24
| | | | | | | | | | Current we require a combined DepthStencil RenderBuffer, however this is an extension in ES2 so it's not a given that it will be available. It is still possible to setup separate Depth and Stencil buffers for those devices that only support that (similar to what Scenegraph does). Change-Id: Ia112b30e229bfc553cd0cdc0f8dd8b57290c7081 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix compilation with QT3D_RENDER_ASPECT_OPENGL_DEBUG defineAndy Nichols2018-04-121-1/+1
| | | | | Change-Id: If89cc9d4be85ad36dfd7549e58327d8a525210e9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* SubmissionContext: improve specifyAttributePaul Lemire2018-03-201-8/+9
| | | | | | | By reusing existing VAOVertexAttribute instance Change-Id: I78554a5849f76a01e901371e4dcb363779906f86 Reviewed-by: Mike Krus <mike.krus@kdab.com>