summaryrefslogtreecommitdiffstats
path: root/src/render/graphicshelpers/graphicscontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GraphicsContext/Helpers: remove bindUniformPaul Lemire2016-09-141-5/+0
| | | | | | | | Replaced by applyUniform and the various glUniform*v helpers Change-Id: Ibfb2daa1268ac2eee299e774d9b5d4e2f5b6bc74 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renderer: get rid of QVariant for backend uniformsPaul Lemire2016-09-141-5/+107
| | | | | Change-Id: Ib4d6f178ec2f6bb19f26e09ad74ba77d2c752627 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsContext: add methods to use UniformValuePaul Lemire2016-09-071-0/+31
| | | | | Change-Id: I0f4062639ed901ac1fe206b940d2fb32c2feed05 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-051-0/+5
|\ | | | | | | | | | | | | Conflicts: tests/manual/manual.pro Change-Id: Ie1186d3465516d8d50b8261f72e64d8d454d377b
| * Reset bound fbo at the end of the renderingAntti Määttä2016-09-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The last bound fbo must be reset at the end of the rendering if the bound fbo was changed due to render-to-texture. Otherwise offscreen rendering(in scene3d case) might have wrong bound fbo. Also in threaded mode, if the last renderview was rtt, the current fbo remains bound, and the next frame doesn't render to the surface as expected. Change-Id: I842040766aa6010740b008a36f7f9f2c935b0561 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge branch '5.7' into devSean Harmer2016-08-141-3/+6
|\| | | | | | | Change-Id: Id62e225062a030f4864fb7af2ed6f60d6be87460
| * Introduce GraphicsHelperES3, allow multiple color attachmentsSvenn-Arne Dragly2016-08-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GraphicsHelperES2 only allows one attachment, but OpenGL ES 3.0 supports at least 4 attachments. Support for this is added by testing for ES 3.0 and using the new GraphicsHelperES3. It currently also reports reporting MRT support and propertly calls glDrawBuffers. Later more functions need to be implemented and tested to extend ES 3.0 support. Change-Id: I84f52b3de26a29b3327b99df2d1d1cf8217ab072 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * GraphicsContext: do not reset m_stateSetPaul Lemire2016-08-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | The renderer resets to the default state after rendering a frame. The GraphicsContext resetting the stateset to nullptr internally breaks the assumption the renderer made that the state was reset to the default state. In turn this would cause some states to not be properly reset when the first RenderView of a frame defines a stateset as the delta wouldn't be between the default stateset and the RV's stateset but between nullptr and the RV's stateset. Change-Id: I46cdf8983278090b067d2a67ad8a93512718a317 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Fix frame buffer binding with multiple texture targetsAntti Määttä2016-08-031-1/+1
| | | | | | | | | | | | | | Use height instead of width in the fbo size resolution. Change-Id: I030a8094e7a23c23f64033f566a19c389dffc801 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add partial data update support for QBufferOleg Evseev2016-08-131-4/+21
| | | | | | | | | | | | | | | | | | | | | | Perform upadateData through queue of replacements specified by QBufferUpdate: start position (offset) and QByteArray (replacing data) Add example based on custom-mesh-cpp to show how updating data works. Task-number: QTBUG-50720 Change-Id: I2eceb514af21209deb278d73c94773e39f300fb3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Add readFrameBuffer functionAntti Määttä2016-08-131-0/+8
| | | | | | | | | | | | | | | | Add function, which can be used to read the pixels of the current render target to image. Use exported function for now, implement own later. Change-Id: Ifb6a5ddf03f968050ba56d14b28c049a2d59e1b7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Add renderTargetSize query functionAntti Määttä2016-08-131-8/+14
|/ | | | | | | | | Implement renderTargetSize function, which queries the size of the current render target. Change setViewport to use it. Change-Id: I3e3125c9451ef3b86f91d78ceaf881e927ba48f9 Reviewed-by: Janne Koskinen <janne.p.koskinen@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add support for mat3 and mat4 attributesKevin Ottens2016-07-201-14/+31
| | | | | | | | | | Attributes don't support a vertexSize larger than 4, but it can come in handy to have bigger attributes when you want to push full matrices. mat2 already fits, so adding special handling for vertexSize == 9 (mat3) and vertexSize == 16 (mat4). Change-Id: Ic5376b1c7a87fc4225afdf756d65c924fde54996 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsContext: add method to disable a vertex attributePaul Lemire2016-07-171-0/+6
| | | | | Change-Id: Ib569336dc20f91f4e023207b1b074461a227ea01 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renderer: make submission not rely on the Shader backend nodePaul Lemire2016-07-051-22/+32
| | | | | | | | | | | | | | | Instead use the stored shaderDNA in the command. Make GraphicsContext able to activate a shader based only on the DNA. This also forced to store the uniform values slightly differently so that they can be applied without requiring a backend Shader node at submission time. Interestingly according to the Qt3DProfilter the load has shifted from the second submission part to the first one because of this. The nice things is that the load of the first part could be spread across multiple threads. Change-Id: I7c543766d3c088ab3886ca1cd3b529f8deb18a93 Task-number: QTBUG-54423 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renderer: decouple buffer/texture updates from draw commandsPaul Lemire2016-07-051-13/+17
| | | | | | | | | | | | | | | | | | This will make it easier to perform the draw command submission concurrently with the jobs preparing the next frame. 1) Update Buffers, Textures and load shaders 2) Update/Create VAO and store draw information in RenderCommand (part of this will later be moved into the RenderCommand builder jobs) 3) Submit the draw commands Later on it should be able to proceed to the next frame somewhere between 2 and 3. That does imply that everything is cached for the draw commands to be performed without conflicting if the backend node changes. Change-Id: Ic54ff85a01621579722035bd194783bc4e61e58d Task-number: QTBUG-54423 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* OpenGLVertexArrayObject: emulate VAO support if not supportedPaul Lemire2016-07-051-12/+39
| | | | | | | | This should allow to simplify the current rendering code and will help improve it later. Change-Id: Id9405485cf73aca7115ab7b175478af8e5304930 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Renderer/RenderView: store only renderTarget nodeIdPaul Lemire2016-07-041-6/+6
| | | | | | | | | | | | This avoids doing not necessary lookups to retrieve the id and will later allow to be sure that we are relying on data that is not going to change if the submission and frame processing are made in parallel. Also added small comment outlining the tasks to do in doRender Change-Id: Id1511a11e99100896f3e91ddd05ccd4b0c12524d Task-number: QTBUG-54423 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Renderer: cleanup graphics resourcesPaul Lemire2016-07-041-0/+17
| | | | | Change-Id: Iab9c75e25ed9ec09f39282aa48fe827a65fdb136 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix shader cachingSean Harmer2016-06-011-40/+83
| | | | | | | | | | | | | | | | | | | | | Introduces a specialized ShaderCache class. This is populated with shaders on demand from render command processing. Likewise for adding references to shared QOpenGLShaderPrograms from other Shader backend nodes. When a Shader backend node is destroyed, it will remove its reference from the ShaderCache. When a shared QOpenGLShaderProgram has no remaining references the cache marks it as pending deletion. If it still has no references the next time the OpenGL submission thread calls the purge() function on the cache, it will be removed. With this approach the actual QOpenGLShaderProgram objects are managed purely by the OpenGL submission thread and are owned by the cache once added to it. Task-number: QTBUG-53669 Change-Id: Ia8459b0fdb775148c83202a801ac41cbdd447bcc Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make sure baseInstance and baseVertex are passedKevin Ottens2016-05-121-15/+15
| | | | | | Change-Id: I2289ada6e9d17590c8e0891fde8dadcdb4d3e021 Task-number: QTBUG-53174 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* render: eradicate Q_FOREACH loops [remaining low-risk]Marc Mutz2016-05-051-6/+10
| | | | | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(), where needed. This is the batch with low-risk changes. They operate on local containers or the loop body clearly does not cause the container to change. Saves ~3.8KiB in text size on optimized GCC 6.0 Linux AMD64 builds. Change-Id: I9c9669dd89f44d371d7a9cd4fc83a7930a06ce17 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add firstVertex to QGeometryRenderer APIMike Krus2016-05-041-0/+9
| | | | | | | | To support glDrawArraysInstancedBaseInstance Task-number: QTBUG-51515 Change-Id: I0c95b351ff7a3668f17256d0d875c3c36537fd01 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Q_NULLPTR -> nullptrSean Harmer2016-05-011-33/+33
| | | | | | Task-number: QTBUG-52736 Change-Id: I58f9cbcdf018e7b672d33dd865067485412b79fe Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Technique/Renderer: use GraphicsShaderDataPaul Lemire2016-04-261-9/+8
| | | | | | | Instead of creating QGraphicsApiFilter objects... Change-Id: Idc723bdea9b97fef547170bd7dca386e5ca4f519 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix -Wreorder warningSean Harmer2016-04-221-1/+1
| | | | | Change-Id: I665c2bb6b4c68c3a7cc5d3f7f91799ce3f67ca9f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix comparison of enumsSean Harmer2016-04-211-1/+1
| | | | | Change-Id: Ia4a3d85737fc4540d97f4e1c58505326a98a9c87 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* If scene has more than one mesh, only the last one added can be modifiedMäättä Antti2016-04-211-7/+25
| | | | | | | | | | Remove bound check from uploadDataToGLBuffer since the buffer never released anywhere. Instead add the bound check to the render context with variable caching the last bound buffer. Task-number: QTBUG-52443 Change-Id: I75d706331a8af78e1a1057fcb2cd0fd88a5519c3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix ClearColor for Scene3D usage.Wieland Hagen2016-04-201-0/+6
| | | | | | | | | QtQuick renderer resets OpenGL state every frame. Thus we need to explicitly set the clearColor, too, every frame. Task-number: QTBUG-52712 Change-Id: I872e2e57db6d436d5754a6f5fa14588fbcc6f544 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* AntiAliasing added as RenderstateRobert Brock2016-04-201-0/+5
| | | | | | | | Adding antialiasing that can be enabled in renderstates Change-Id: I0728e69dba5896ca86e56b940682990fafd0a297 Task-number: QTBUG-52191 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove shader from cache in graphics context cache when deletedSean Harmer2016-04-171-0/+7
| | | | | | | Stops assert firing when trying to use a recycled Shader Change-Id: Ifa18143a145654fd3f9e381627406e907a9e2d48 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QClearBuffers: Add BufferTypeFlags QFlagsWieland Hagen2016-04-161-1/+1
| | | | | Change-Id: I80d0f414252ccc3f96ac3312d8ac1f08ee49fab0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Consolidate some functionality into AttachmentPack.Wieland Hagen2016-04-161-17/+3
| | | | | | | | RenderTarget attachments to DrawBuffer mapping was done in different places. For now, lets do it centrally within AttachmentPack. Change-Id: I4f6aa78a9964cd420ab67a991cb4186c15b928ee Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Simplify renderer codeWieland Hagen2016-04-161-6/+16
| | | | | | | | | | Move some caching functionality into GraphicsContext, as this has nothing to do with Rendering logic, but only reduces amount of OpenGL calls. Change-Id: I5a3c858e893da1498cb4bace9a212fec6b1de93e Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add GraphicsContext support for glClearBufferfv()Wieland Hagen2016-04-161-0/+5
| | | | | | | Task-number: QTBUG-50116 Change-Id: I78e06b0e2846897e2edaa5711b4e0d4a8057a3fc Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsContext: remove cullFace()Wieland Hagen2016-04-151-5/+0
| | | | | | | is covered by OpenGL standard functions Change-Id: Ia7f32ec27c1725247a2c1f2bce4fba4433857932 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Properly handle alpha to coverage state in non-cloning codepathSean Harmer2016-04-111-7/+2
| | | | | | | | | | | | Also improve the alpha to coverage handlign in the helpers by using a single function rather than two. This removes GL errors about bad glFace enum values (caused by bad handlign of alpha to coverage in switch statement, which led to a FrontFace state being created with bad data). Change-Id: I832d92fcb07134525f421d3a3b4d12e9f5f6428c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Prefer QVector to QListSean Harmer2016-03-311-1/+1
| | | | | | | Also make some functions inline whilst we are touching them anyway. Change-Id: If44398d56a82e42689f26f22f0e07dba229529c6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Added properties to QClearBuffersMike Krus2016-03-221-0/+10
| | | | | | | | | | - clearColor - clearDepthValue - clearStencilValue Task-number: QTBUG-51460 Change-Id: Ib31efde0b6ab97ef1f57d4ce71fb2fbca218dc85 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename QClearBuffer to QClearBuffersMike Krus2016-03-201-5/+5
| | | | | | Task-number: QTBUG-51460 Change-Id: I3f522f5eaea7bf0f94dbcdc1e7463f2827c0fe3b Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Disable GL_DITHER by defaultPaul Lemire2016-03-201-0/+2
| | | | | | Change-Id: I49e21c19deae6ec97566e33b68afa7dbaa3fe6b5 Task-number: QTBUG-51501 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Renderer/QRenderTargetSurfaceSelector: implement proper synchronizationPaul Lemire2016-03-171-0/+5
| | | | | | | This is needed to avoid rendering on a surface that has been destroyed. Change-Id: Iadc2a32e2e0113704ca4df48df6bcdd1a0d8256c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Force OpenGL texture reload on TextureImage updateMauro Persano2016-03-131-1/+1
| | | | | | | | | | | | | | After a TextureImage update, the corresponding backend texture node DNA is not updated until its OpenGL texture is reloaded. This may not happen if the previous texture DNA is the same as the one associated with a texture unit. Force a OpenGL texture/DNA update after we have new data from the load texture job. Change-Id: Id79ac9c177bb763d986354bdcd0e2736835cb94a Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QClipPlane rename and added propertiesRobert Brock2016-03-081-0/+5
| | | | | | | | | | | | | | - storing values in backend - new functions being added renamed plane to planeIndex added QVector3D normal property added float distance property As per API review Task-number: QTBUG-51435 Change-Id: Ie52804716510981af1467e96003304324fadd4d8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Use const references in foreach loops for non-trivial types.Volker Krause2016-03-051-1/+1
| | | | | | | | Found by clazy. Change-Id: I3260b06e56f49a5e18a1b0e7f60e5b1856923c18 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QBackendNode::peerUuid() renamed to peerId()Paul Lemire2016-03-051-10/+10
| | | | | Change-Id: I72471d0b22d16bbbee33610e30a06daadffedbd9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QRenderTargetOutput enumRobert Brock2016-03-031-3/+3
| | | | | | | | As per API review renamed FooAttachment to just Foo Change-Id: Ifd977b2b8bdb6706a70dd10f2ea3ee6a381c26b8 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QRenderAttachment renamed to QRenderTargetOutputRobert Brock2016-03-031-5/+5
| | | | | | | As per API review Change-Id: Icaca9797c01100402e6d103be2a0425820a717ec Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QRenderAttachment renamed RenderAttachmentType to AttachmentPointRobert Brock2016-03-021-4/+4
| | | | | | | | | As per API review New name was better fitting to the actual description/usage Renamed point to attachmentPoint Change-Id: Id14a312acabdcc9bda49a4d30efe490342105660 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Enum Profile renamed to OpenGLProfileFranck Arrecot2016-03-011-1/+1
| | | | | | Task-number: QTBUG-51465 Change-Id: I86831122ed8aab9fcb0b00d3e850be58e74bd0de Reviewed-by: Paul Lemire <paul.lemire@kdab.com>