aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Add some timing breakdown to QSG_RENDERER_DEBUG=renderGunnar Sletta2015-04-281-1/+29
| | | | | | | | | | Change-Id: Ic7ffb48c1a148036bdb14a912d3407e9a1b3b4fd Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Restore depth buffer usage when last render node is removedMikko Harju2015-03-181-0/+3
|/ | | | | | | | | Adding a QSGRenderNode to the scene permanently disabled opaque batches by disabling depth buffer usage. Reset the depth buffer usage to the default value once last QSGRenderNode has been removed from the scene. Change-Id: I760afde83ae9eaaf1b5571c37fd0081eb23b1f20 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-03-031-2/+2
|\ | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4numberobject.cpp Change-Id: I4e66a03ef4d99cec192c9da30c028fd8c1f4ac0d
| * Fix crash in overdraw and change visualizersDaiwei Li2015-02-251-2/+2
| | | | | | | | | | | | | | | | It appears to be possible for node->element()->batch to be NULL Task-number: QTBUG-43129 Change-Id: If6e4e265a02ee305bf3aa9cad387b7a73648367a Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Cleanup math function includes and usageAllan Sandfeld Jensen2015-02-191-1/+1
| | | | | | | | | | | | | | | | Use std::math on floats and doubles, and qMath on qreals, and only include the math headers actually needed. Change-Id: I1d511d7b1bac0050eaa947c7baee760b736858bf Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* | Remove unnecessary calls to initializeOpenGLFunctionsLaszlo Agocs2015-02-111-5/+2
| | | | | | | | | | | | | | | | We now have a change in QtGui that guarantees that the returned versionfunctions object is initialized as long as the context is current. Change-Id: I2e76e91bb4265a95fae657f6cacd92a789d56782 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Use correct QOpenGLFunctions objectBerthold Krevert2015-02-041-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | If core profile is used, QOpenGLContext::versionFunctions returns 0 if a legacy or a non-core profile version is requested. That means, when using core profile we have to request a QOpenGLFunctions_3_2_Core object (which is the lowest OpenGL version that comes with profiles). Otherwise the application would run into a segfault. Change-Id: I8119e5fbeafccf14d59680617172c71e60e188ce Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Move VAO binding to Renderer::render()Berthold Krevert2015-02-041-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Amongst other things, QSGRenderer::preprocess() triggers the rendering of QQuickShaderEffectSource items into framebuffer objects. The renderers responsible for these QQuickShaderEffectSource items bind and unbind their own VAOs, which messes up the VAO state set in QSGRenderer::preprocess(). Scenegraph nodes must not depend on the vao state set by the renderer anyway as the binding has to be considered as an implementation detail. Change-Id: Idec34c65397394e12e7f8419a1c9633d5f70a22e Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Drop trailing vertices in GL_LINES and GL_TRIANGLES drawing modes.Ulf Hermann2015-01-161-7/+28
| | | | | | | | | | | | | | | | This results in more correct behavior if you create nodes with a number of vertices that doesn't match the drawing mode. Change-Id: Ic0f59a4019a6b4087b527b7c9b38c35a9e02ece8 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2015-01-161-1/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4debugging.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject_p.h src/qml/jsruntime/qv4qobjectwrapper.cpp src/quick/scenegraph/shaders/visualization.frag tests/auto/qml/qjsengine/tst_qjsengine.cpp Change-Id: I492e8546c278f80a300a2129e9a29d861e144a30
| * Fix the visualization of unmerged batch geometries without indexJocelyn Turcotte2014-12-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | indexData() is null for most QSGGeometryNodes subclasses in QtQuick, make sure that we draw using vertex array data in that case. The patch also increases the contrast of the line pattern, since it is almost invisible with brighter hue values, to make it easier to see which batches aren't merged. Change-Id: Ife7b26692ee318feb0810ee0e787289eb151ea8a Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Clean up renderer visualization a bit.Gunnar Sletta2015-01-121-17/+13
| | | | | | | | | | | | | | | | | | viewport was currently unused and adreno 305 was confused by the tweak.w > 0.0 when the input was 0.0f, so write it in a slightly more straightforward manner. Change-Id: I101ff71dcb04ca531e91cc5522876d71f368cdc8 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Fix the vertex ordering of merged triangle stripsJocelyn Turcotte2015-01-061-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Culling and gl_FrontFacing depend on the vertex order matching the value set through glFrontFace. To match the default counter-clockwise order we need to preserve the parity of triangles relatively to the start of the indices argument of glDrawElements, but we break this parity because of the degenerate triangles between merged strips. Fix the issue by skipping the first degenerate triangle, the parity of following strips will be preserved since they are then separated by two triangles. This fixes a regression of tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml triggered by 38cab579a0c5398b7621221fd8609bc43cf1f3c5. Change-Id: Iefa7eaab68112d31be9d8646bd288eb000528cd5 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Reuse the memory we use for vertex uploads.Gunnar Sletta2015-01-061-10/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every batch would have its own buffer with its own memory and the original idea was that it would stabilize so that the same batch would be used over and over, so the memory allocatd for each batch's buffer would be reused. In practice batches get discarded and recycled in somewhat arbitrary order so we always end up reallocating. Instead, use a single buffer for all uploads. This saves us several reallocations per frame, and also prevents pooling of several potentially large allocated blocks inside the renderer. The exception is when using visualization or for drivers which have broken index buffer support (nouveau only currently), where we keep the existing behavior as the buffer data is needed during rendering and visualization. Change-Id: Id29095e00128ec1ee6d4ac3caa8f2c17cc7bbd27 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | Allow batching of GL_LINES and GL_POINTS geometryUlf Hermann2014-12-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is analogous to GL_TRIANGLES and GL_TRIANGLE_STRIP. There is no reason why we shouldn't batch it. In the case of GL_LINES this means a slight behavior change, though: If you provided geometry with an uneven number of vertices, it would draw lines the way opengl specifies it and drop the last vertex. Now, with batching, it will draw a line from the last vertex of an "uneven" node to the first vertex of the next node. This, however, is exactly like it already works for GL_TRIANGLES if you specify a number of vertices not divisible by 3. We assume the user should specify a number of vertices that matches the drawing mode. Change-Id: I372b9c15a19f065d3aeb3727688cca408ce9608e Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-11-041-6/+12
|\| | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4errorobject_p.h Change-Id: I7fc1211295738a9fae32b783a9f001f1613785e4
| * Fix disappearing nodes when adding in two levels of batch rootEskil Abrahamsen Blomfeldt2014-11-041-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When having e.g. a clip node inside another clip node and adding children to the innermost, we would get into the situation where we did a partial rebuild for the outermost root, but its available render order count would not be updated to reflect the change deeper down in the tree. Since the z range would be based on the outermost batch root's knowledge of the maximum render order in the tree, what would happen is that the z of the rendered nodes would increase steadily until they went outside of the viewing volume and disappeared. When decreasing the available order count of a batch root, we need to also decrease the available order count of its parents. If any of them drop below zero, we need to rebuild the render lists. [ChangeLog][QtQuick] Fixed nodes sometimes disappearing when adding many new nodes to the tree. Change-Id: I39c34acf0e1e0e87601f0fcd983f8da38cee029f Task-number: QTBUG-42096 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Use an allocator for QSGBatchRenderer::Node and Element instances.Gunnar Sletta2014-11-021-9/+11
| | | | | | | | | | | | | | | | Cuts down quite a bit on the time spent on the render thread during the sync phase. Change-Id: Ide8c4348141c84ed8abd9a869607a022652c2828 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-291-5/+13
|\| | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickaccessibleattached_p.h src/quick/items/qquickwindow.cpp src/quick/scenegraph/qsgthreadedrenderloop.cpp Change-Id: I8bf07487a75f9d1b0d6efa5914dd06875fc9654d
| * Fix build with QT_NO_DEBUG_OUTPUT definedSamuel Gaist2014-10-241-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | The use of the qDebug() macro to construct a QDebug object fails when QT_NO_DEBUG_OUTPUT is defined when building Qt. This patch aims to fix this. [ChangeLog][General][Build] Can now build with QT_NO_DEBUG_OUTPUT defined Change-Id: If807ee3439db2a98b4d146f75860a98f40c247ec Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-091-38/+45
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/context2d/qquickcanvasitem.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp src/quick/scenegraph/coreapi/qsgrenderer.cpp src/quick/scenegraph/qsgadaptationlayer.cpp src/quick/scenegraph/qsgrenderloop.cpp src/quick/scenegraph/qsgthreadedrenderloop.cpp src/quick/scenegraph/qsgwindowsrenderloop.cpp src/quick/scenegraph/util/qsgatlastexture.cpp src/quick/scenegraph/util/qsgtexture.cpp src/quick/util/qquickprofiler_p.h Change-Id: Ie274c3baf72a8a0711c87d67238d68e2b2887429
| * Don't do qgetenv on library loadThiago Macieira2014-09-221-35/+39
| | | | | | | | | | | | | | | | | | | | Bad for two reasons: first, it increases the load time of the application and second, it makes it impossible to to setenv/putenv from main(). The latter is useful if you need to work on an embedded device that doesn't allow setting environment variables. Change-Id: Id543f77336d7ac2e4ea820b51f55ce5a40a33b4e Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
| * Select specific features to be recorded when profiling QMLUlf Hermann2014-09-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Some features, like the memory profiler, create huge amounts of data. Often enough, we're not actually interested in all the data available from the profiler and collecting it all can lead to excessive memory consumption. This change enables us to optionally turn various aspects of QML profiling off. Task-number: QTBUG-41118 Change-Id: I7bb223414e24eb903124ffa6e0896af6ce974e49 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
| * Fix debug output from renderer.Gunnar Sletta2014-09-111-3/+6
| | | | | | | | | | | | | | | | It was wrong when we ran without depth buffer or when we used the separate ibo code path. Change-Id: Ie6e4bfc99ee2a4a593e45be7d9af9af17896bcba Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Use QQuickProfiler's own timer to sample eventsUlf Hermann2014-09-121-6/+6
|/ | | | | | | | Like that the timings are more accurate. Task-number: QTBUG-39876 Change-Id: Ia6bdce9c8089417e88797ec3a98c8a3e367f73f2 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Move QSGRenderer::updateStencilClip down to QSGBatchRendererJocelyn Turcotte2014-07-291-2/+131
| | | | | | | | | This convenience method is currently only used by the batch renderer. Moving it allows removing the QOpenGLFunction inheritance of QSGRenderer and unbinding it slightly from the rendering implementation. Change-Id: I4322952f843de8d950ced32885feee8d6c4a2730 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Leave the depth mask on after rendering.Gunnar Sletta2014-07-291-0/+1
| | | | | | | Try to be compatible with raw GL when possible. Change-Id: Id6e17da2d8c134362a5428de970cd5e562f57143 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Verbose fatal instead of crash when the scene graph state is invalid.Gunnar Sletta2014-07-041-0/+24
| | | | | Change-Id: I9a55bcbf9e94084c0cadac561e4707d47f5f8744 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Properly collect polish timings from all render loopsUlf Hermann2014-07-021-2/+2
| | | | | | | | | | | Previously the polish timings were collected incorrectly from the windows render loop and not at all from the basic render loop. By collecting the polish times at the right places we can get rid of the 2-argument profile macro as well. Task-number: QTBUG-39876 Change-Id: I0b4aaf87162c652b8dcea6cd4f54db053f8312fe Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Use categorized logging for all things scenegraph.Gunnar Sletta2014-07-011-18/+4
| | | | | Change-Id: I865ee838b0fd6c257b7189f24130012b98206fd1 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devSimon Hausmann2014-06-131-1/+3
|\ | | | | | | | | | | | | Conflicts: src/quickwidgets/qquickwidget.cpp Change-Id: Id4b080aea713df68608847bb82570231e37ce536
| * Fix opacity issue in the renderer.Gunnar Sletta2014-06-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following tree: OpacityNode | TransformNode (which is a batch root) | GeometryNode If both opacity and transform nodes were changed this frame, we would hit the optimized "scrolling" path while traversing the tree and abort updating that subtree. As a result the opacity change was not propegated to the geometry node and it would be rendered incorrectly. Fix this by skipping the optimized path when there are opacity changes in an ancestor. Task-number: QTBUG-39190 Change-Id: Ieaebfe3de62b961204bd3103fe9913d60e75e412 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Avoid direct GL calls in QuickLaszlo Agocs2014-05-231-7/+7
| | | | | | | | | | Change-Id: I9b8673fb3292c9d5ad2f9e8e63f56dc661699be6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-101-5/+12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/accessible/quick/quick.pro src/quick/items/qquickpincharea.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp src/quick/scenegraph/qsgthreadedrenderloop.cpp Manually adjusted for TestHTTPServer constructor change: tests/auto/quick/qquickimage/tst_qquickimage.cpp Change-Id: I5e58a7c08ea92d6fc5e3bce98571c54f7b2ce08f
| * Follow QOpenGLContext API renamingLaszlo Agocs2014-04-251-1/+1
| | | | | | | | | | | | Task-number: QTBUG-38564 Change-Id: Ice1170339f7d650fcb6accfccf325471629343d6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Don't crash when render node doesn't have a batchrootGunnar Sletta2014-03-311-1/+3
| | | | | | | | | | Change-Id: Ib8f70414eb477b4ec45097c8784a5fe1375cf012 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
| * Invalidate all batches potentially affected by a change.Gunnar Sletta2014-03-191-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | When two separate changes have occurred, we need to not only invalidate the batches directly overlapping those, but also any batch which has render orders between the two. So, keep track of the range of invalidated render orders and invalidate everything in between. Task-number: QTBUG-37422 Change-Id: Ie5a289d5c569b84917ec9ac52671173c566e69b3 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
| * Dynamic GL in QuickLaszlo Agocs2014-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | The counterpart to I716fdebb. Implements the dynamic path in scenegraph. Task-number: QTBUG-36483 Change-Id: I2dc613ba84560b7b8e36d3cd1da61c050ab08db0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
| * Use stable sort when cleaning batches.Michael Brasser2014-03-151-1/+1
| | | | | | | | | | | | | | | | | | Ensure valid batches do not change order. This was causing rendering issues when m_rebuild was 0, as we would not re-sort the list in correct render order after cleanup. Change-Id: I912fb313d4029f96e263fad24d68462f252003df Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* | Use correct matrix for render nodes.Gunnar Sletta2014-05-071-2/+7
| | | | | | | | | | Change-Id: I8c137383fa32a64ba64ffb4ed48aa123d0ebf000 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Make sure we rebuild batches properly after a Blending material change.Gunnar Sletta2014-05-011-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a node sent DirtyGeometry and DirtyMaterial in the same round and DirtyGeometry triggered its batch to be invalidated, we would take the no-batch code path which did set the rebuild state to BuildBatches. This looks ok on screen, but if the node changed from alpha to opaque, it would not be put into an opaque batch. For things like full screen rectangles, this can potentially hurt performance. To prevent doing a full rebuild on any material change on batchless items (aka all Rectangle nodes), we store the blend state of the material in the element and do a full rebuild only when blend state changes. Change-Id: Ifdf06fb72ef02ca47a135c821ddbcbe0d164ca29 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Support shutting down the render thread without an OpenGL context.Gunnar Sletta2014-04-231-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQuick][SceneGraph] There might not be an OpenGL context bound when QQuickWindow::sceneGraphInvalidated() is emitted if an error occurs while cleaning up the scene graph (such as EGL_CONTEXT_LOST). This is according to the documentation, but has never occurred in practice before. Change-Id: I13dbfbb4b6d0d27fa42fcb8b54df16ea02284807 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Skip nodes with no vertices when preparing batches.Gunnar Sletta2014-03-271-2/+7
|/ | | | | | | | | | Nodes with no veritces end up overlapping with everything so they tend to lead to poor batching. In my specific case, the empty nodes came from the QQuickTextNode, but it is a valid usecase so better to handle it gracefully in the renderer. Change-Id: Ic09c202a2675f806f2124cd436027afcd2654452 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix rendering issue with material changes from opaque <-> alphaGunnar Sletta2014-03-131-5/+10
| | | | | | | | | | | | When I introduced the invalidation of z ranges, I forgot that we need to rebuild render lists when nodes move from opaque to alpha batches or vice versa as that sorting happens in buildRenderLists(). To remedy this, make Batch::isMaterialCompatible report blending changes separately and trigger a full rebuild in this case. Task-number: QTBUG-37422 Change-Id: I020813cb531ed58353f8340fcad58dec8d7856dd Reviewed-by: Michael Brasser <michael.brasser@live.com>
* QSGBatchRenderer: return when a shader is not returned by the managerAndrew Knight2014-03-061-0/+4
| | | | | | | | | | If a shader can't be found from the manager (e.g., if it failed to link), return from rendering. This prevents the renderer from crashing on a null pointer. Task-number: QTBUG-37290 Change-Id: I44d0bbb721854c0bc6da681ff55f71140a5cb0bc Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Fix MSVC2012 compiler warnings.Erik Verbruggen2014-03-051-4/+4
| | | | | | | | Tested on both win32 and win64. Change-Id: I47755e2da51829e61e1452eaaf84a057224b478b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Don't sort batches when there are no changes.Gunnar Sletta2014-03-051-8/+11
| | | | | | | | | | | | | On node removal we change the batch, but don't set rebuild as everything else should be drawn as is. A sort after such a removal could result on the order of batches being changed without the other nodes being updated. This would then result in incorrect ordering and nodes could be obscured. Task-number: QTBUG-37222 Change-Id: I57dd2fbc945e8c10c949743f59315b3372a4b6f4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix some typosSergio Ahumada2014-03-031-1/+1
| | | | | Change-Id: Iea540b768232ea423ea7f04e41655198931cf36d Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>