summaryrefslogtreecommitdiffstats
path: root/src/render/graphicshelpers/graphicscontext_p.h
Commit message (Collapse)AuthorAgeFilesLines
* GraphicsContext: add indirect draw methodsPaul Lemire2017-01-131-0/+2
| | | | | Change-Id: Ibcb7f629ede86d3808451ee09c0b7f5016492a00 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Ignore RenderCommand for current frame, if shader not loaded yetWieland Hagen2017-01-091-1/+1
| | | | | | | | | | Renderer::m_shaderGathererJob might not have finished yet, so the shader wasn't marked as dirty yet, so it wasn't loaded in Renderer::updateGLResources(). Next frame everything will be alright. Task-number: QTBUG-55093 Change-Id: Ia60ed1dff4cb0495efbd7f70f87d227007ef560d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsContext: add an isInitialized() getterPaul Lemire2016-11-231-0/+1
| | | | | | | Allows to determine if the graphics context has been initialized. Change-Id: I2710e62658aae86a9a0de2532cc1acbdab983abc Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Export GraphicsContext for unit testsPaul Lemire2016-11-231-1/+1
| | | | | Change-Id: I474f90809d253e3707b9fe18baa4a7c19ae77f47 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* GraphicsContext::applyUniform: take uniform size into accountPaul Lemire2016-11-231-4/+4
| | | | | | | Needed when specifying arrays of floats... Change-Id: I80418af7bc38379ec1a6d3b52354f152b4445fe1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Texture backend refactoring: Update node managersWieland Hagen2016-11-141-5/+5
| | | | | Change-Id: Ieacdf3115d5a823060b513bf28c5ec9bb4f44b43 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Implement readFramebufferAntti Määttä2016-10-211-0/+2
| | | | | | | | | Add readFramebuffer function to GraphicsContext to avoid using imported qt_gl_read_framebuffer function. Change-Id: If620960fc828e46152915234c57c432d57c6e989 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* GraphicsContext: simplify active texture handlingWieland Hagen2016-10-111-7/+7
| | | | | | | | | | | Used to be split up into multiple vectors, bitarrays, even hashtables. In fact, all operations that have to do with active textures are identified by the respective texture unit. So there should be exactly one entry for each texture unit that encapsulates all important information. Change-Id: Ib1a0502f5b5f05a24516183b7eedf96a418c43be Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Renamed files quniformvalue* to shaderparameterpackPaul Lemire2016-09-161-1/+1
| | | | | | | | | These files contains a class named ShaderParameterPack so filenames needed to be adjusted. Change-Id: I8735c753e2a741a6238780b40fb42143d4439e09 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsContext/Helpers: remove bindUniformPaul Lemire2016-09-141-1/+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-0/+2
| | | | | Change-Id: Ib4d6f178ec2f6bb19f26e09ad74ba77d2c752627 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsContext: add methods to use UniformValuePaul Lemire2016-09-071-0/+50
| | | | | 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/+1
|\ | | | | | | | | | | | | Conflicts: tests/manual/manual.pro Change-Id: Ie1186d3465516d8d50b8261f72e64d8d454d377b
| * Reset bound fbo at the end of the renderingAntti Määttä2016-09-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add readFrameBuffer functionAntti Määttä2016-08-131-0/+3
| | | | | | | | | | | | | | | | 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-0/+2
|/ | | | | | | | | 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>
* GraphicsContext: add method to disable a vertex attributePaul Lemire2016-07-171-0/+1
| | | | | Change-Id: Ib569336dc20f91f4e023207b1b074461a227ea01 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renderer: make submission not rely on the Shader backend nodePaul Lemire2016-07-051-3/+6
| | | | | | | | | | | | | | | 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-1/+2
| | | | | | | | | | | | | | | | | | 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-0/+19
| | | | | | | | 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-1/+1
| | | | | | | | | | | | 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/+1
| | | | | Change-Id: Iab9c75e25ed9ec09f39282aa48fe827a65fdb136 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix shader cachingSean Harmer2016-06-011-3/+4
| | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | Change-Id: I2289ada6e9d17590c8e0891fde8dadcdb4d3e021 Task-number: QTBUG-53174 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add firstVertex to QGeometryRenderer APIMike Krus2016-05-041-0/+1
| | | | | | | | To support glDrawArraysInstancedBaseInstance Task-number: QTBUG-51515 Change-Id: I0c95b351ff7a3668f17256d0d875c3c36537fd01 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Technique/Renderer: use GraphicsShaderDataPaul Lemire2016-04-261-4/+3
| | | | | | | Instead of creating QGraphicsApiFilter objects... Change-Id: Idc723bdea9b97fef547170bd7dca386e5ca4f519 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* If scene has more than one mesh, only the last one added can be modifiedMäättä Antti2016-04-211-1/+4
| | | | | | | | | | 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>
* AntiAliasing added as RenderstateRobert Brock2016-04-201-0/+1
| | | | | | | | 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/+1
| | | | | | | 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>
* Simplify renderer codeWieland Hagen2016-04-161-1/+6
| | | | | | | | | | 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/+1
| | | | | | | 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-1/+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-2/+1
| | | | | | | | | | | | 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>
* Added properties to QClearBuffersMike Krus2016-03-221-0/+2
| | | | | | | | | | - 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-2/+2
| | | | | | Task-number: QTBUG-51460 Change-Id: I3f522f5eaea7bf0f94dbcdc1e7463f2827c0fe3b Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renderer/QRenderTargetSurfaceSelector: implement proper synchronizationPaul Lemire2016-03-171-0/+1
| | | | | | | This is needed to avoid rendering on a surface that has been destroyed. Change-Id: Iadc2a32e2e0113704ca4df48df6bcdd1a0d8256c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QClipPlane rename and added propertiesRobert Brock2016-03-081-0/+1
| | | | | | | | | | | | | | - 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>
* QAttribute API changesPaul Lemire2016-02-291-1/+1
| | | | | | | | - rename dataType to vertexBaseType - rename dataSize to vertexSize Change-Id: I0eca7054dd69e8aac69bc1d7d5023a7ca6ca9da2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add QRenderState for GL_TEXTURE_CUBE_MAP_SEAMLESSWieland Hagen2016-02-051-0/+1
| | | | | Change-Id: I339d19966c2dd850d01f5a0737fea566ca23a96d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unify license header usageAntti Kokko2016-01-261-12/+15
| | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I8eac0cd6bbc276a56df487249cc459c0d4fab165 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* QAspectEngine/QAbstractAspects: get rid of setDataPaul Lemire2016-01-221-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Getting rid of set data and the refactoring on setting the surface implies that: - Given the FrameGraph configuration, there may be several RenderViews each having a different RenderSurfaceSelector/Window - This means that the Renderer/QRenderAspect can't know about the surface before reading the scene - This means that the Renderer may be dealing with more than 1 window - This means that initialization, render and shutdown procedures will have to be updated accordingly Therefore the Renderer was refactored to: - Be initialized without knowing about a surface - For each RenderView, check the surface and if different from the previous one: * Make the context current with it * Create the appropriate glHelpers (as Surfaces may have != formats) TO DO: - Fix picking - Fix windows exposition - Fix shutdown / detection of all windows beging closed Change-Id: I49d070b05f46be4b26cfb57e494feba145d1da9c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Renderer/Scene3D: fixes to make it work without setDataPaul Lemire2016-01-221-0/+1
| | | | | Change-Id: Iec1d3bab2e3a5a25d1cbb5129addebd83b225580 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Updated picking-qml examplePaul Lemire2016-01-211-1/+1
| | | | | | | handle device pixel ratio and none full-window Scene3D Change-Id: Iadc504a00816d9363847bf9ec1e09d4b7c631666 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add GraphicsContext::supportsDrawBuffersBlend()Wieland Hagen2016-01-141-1/+1
| | | | | | | | | To check for availability of ARB_draw_buffers_blend Task-number: QTBUG-50005 Change-Id: I8f4e11ff401a9e1e3751f61421572cb1fc323979 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Added glEnablei, glDisablei, glBlendFuncSeparateiWieland Hagen2016-01-141-1/+4
| | | | | | | | | | Added glEnablei, glDisablei, glBlendFuncSeparate to GraphicsHelpers and GraphicsContext Task-number: QTBUG-50005 Change-Id: I01c3a6e26fde9756d62694235ba0c1a0fe5155ae Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* GraphicsHelper: add dispatch compute functionPaul Lemire2016-01-131-0/+1
| | | | | Change-Id: I3c2614f0fc484d6f492d9302a3ec9335e827f741 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* RenderView/GraphicsContext: support SSBO/UBO with buffer used as ParametersPaul Lemire2016-01-131-1/+2
| | | | | Change-Id: I347aa5deea6521b43b9033e2200ab2f8b272f671 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Rename QUniformPack to ShaderParameterPackPaul Lemire2016-01-131-1/+1
| | | | | | | | This will make it more clear that it also contains other things like UBO/SSBO which are pure Uniform values. Change-Id: I641246798b8c868d7bfdfde381221d9a97ed2d35 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* GraphicsContext: use GLBuffer instead of QOpenGLBufferPaul Lemire2016-01-131-4/+6
| | | | | | | | This will be needed to simplify the process of binding SSBO/UBO buffers. Change-Id: Ice3bb97381328c5bddf1c9e46af30b4814ff2572 Note: ShaderData UBO handling temporarly disabled. Reviewed-by: Paul Lemire <paul.lemire@kdab.com>