aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
Commit message (Collapse)AuthorAgeFilesLines
* 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-1/+15
| | | | | | | | | 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>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-101-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Invalidate all batches potentially affected by a change.Gunnar Sletta2014-03-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Make sure we rebuild batches properly after a Blending material change.Gunnar Sletta2014-05-011-1/+8
|/ | | | | | | | | | | | | | | | 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>
* Fix rendering issue with material changes from opaque <-> alphaGunnar Sletta2014-03-131-1/+8
| | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-181-1/+2
|\ | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4functionobject.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h Change-Id: Id164f6c3b45501aa466908659ec4e3b957323753
| * Enable program binary support through QSGRenderContext API.Gunnar Sletta2014-02-131-1/+2
| | | | | | | | | | Change-Id: I4eecff3c8a2c727d38d394305d248eddeef87e8e Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-111-1/+4
|\| | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
| * Avoid renderlist rebuilds in the scene graph renderer.Gunnar Sletta2014-02-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transform, material, opacity and geometry changes all used to trigger full rebuilds, which meant that very little geometry could be retained between frames. For instance, a rotating spinner on top of a gridview this would cause a full rebuild where nothing is retained. This change introduces new concept to the renderer: partial rebuilding based on render order ranges. Since the render order of nodes is strictly defined by their position in the tree and nothing else, we should use that for the majority of rebuilds. When a change comes in for a node, we invalidate its batch and all batches which it has overlapping render orders with. Render order rebuilds only happen when nodes are added and removed. Change-Id: Ib4cb284164892b409e3fff5c492a54d60a5de2d7 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Visualization modes for rendering.Gunnar Sletta2014-01-291-1/+23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two ways of setting this right now. One is to set it on startup using an environment varible. QSG_VISUALIZE= "batches" - Visualize batchtes in the renderer. Merged batches are drawn with solid color and Unmerged batches are drawn with a diagonal line pattern. Few unique colors means good batching. Unmerged batches are bad if they contain many individual nodes. "clip" - Visualize clipping as red areas on top of the scene. "overdraw" - Visualize all items in 3D to highlight overdraws. This mode can also be used to detect geometry outside the viewport to some extent. Opaque items are rendered with a green tint while translucent items are rendered with a red tint. The bounding box for the viewport is rendered in blue. Opaque content is easier for the scenegraph to process and it can also be faster to render on some hardware. "changes" - Changes in the scenegraph are visualized with a flashing overlay with a random color. Changes on a primitive is visualized with a solid color while changes in an ancestor, such as a matrix or opacity changes is visualized with a pattern. The second way to set the visualization mode is to set it at runtime through QString QQuickWindowPrivate::customRenderMode. This "API" is string based so it is not tied to the batch renderer and in theory can support other custom renderers. The visualized elements do not respect clipping and rendering order is arbitrary. Change-Id: I31efbe53fc905145bf48080ede3e36945cb60dcf Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Revert QSGRenderNode to the old "in context" behaviorGunnar Sletta2014-01-221-5/+1
| | | | | | | | | | | | | | | | | There is already a lot of code out there that makes use of the rendernode hook and some of it is not capable of dealing with the render target being something other than 0. (Mozilla in this case). By forcing everything into the "alpha" code path, the hit on the renderer should be fairly minimal as long as render nodes are kept to a minimum, so reverting back to the ugly old behavior is acceptable. The API is still internal and highly discouraged. Change-Id: Ie35484f52da6b0420257c95710fdda07a2be2c23 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Make it possible to render without a depth buffer.Gunnar Sletta2014-01-221-0/+2
| | | | | | | | | | | | Some GL implementations (especially on embedded) will give us an OpenGL context without a depth buffer. In low memory scenarios, it might also be feasible to request a non-depth buffer context to save the depth buffer memory. The renderer deals with this by treating all nodes as translucent, by not adjusting the shaders and by not creating the extra z-order vertex attribute for merged nodes. Change-Id: I8edc92d530daa3e2628df2ba52901b47d87eaf26 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Add support for a separate index bufferLaszlo Agocs2014-01-151-1/+7
| | | | | | | | | | The renderer binds same buffer both for vertex and index data. This is allowed on desktop & ES but is forbidden in WebGL. Add a compile-time flag to disable this optimization(?) and force using a separate buffer for the index data. Change-Id: I57c17c883a55e02513a8e4427efb202cafaaf37e Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Handle boundingboxes with NaN in them.Gunnar Sletta2013-11-301-4/+0
| | | | | | | | | | | | NaN does not compare well with other floats. The result is that the bounding box is left at its initial values, FLT_MAX for top-left and FLT_MIN for bottom-right. If so, treat geometry as invalid, aka infinite. Task-number: QTBUG-35192 Change-Id: I1df6987d56a0ce1f500b0eba344a5dcbc55f80a4 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Adapt Qt Quick 2 renderer to work with OpenGL Core ProfileSean Harmer2013-11-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic approach is to have the batched renderer create and bind a vertex array object if it detects we are using an OpenGL Core profile context. The VAO is bound for the duration of the QQ2 renderer's work cycle and unbound at the end so as to not interfere with any other VAO's a user may wish to use. All shaders have been copied and ported to be compliant with the GLSL 150 core specification which is the minimum for a Core profile context (OpenGL 3.2 Core). We are not using any newer features as yet so this will work anywhere we can get a Core profile context. The QSGShaderSourceBuilder class has been extended to resolve any requests for shaders to the same basefilename with "_core" appended prior to any file extension. This could be extended in the future to allow version, or GPU or platform specific shaders. The QSGShaderSourceBuilder has also been extended to allow it to insert #define definitions in the prologue of a shader. Any such definition is inserted: * After the last #extension directive (if any are found) * Otherwise after the #version directive (if found) * Otherwise at the start of the shader source This is required by the custom particle shaders which make extensive use of such #defines. In addition the mechanism used by the distance field glyph cache to extend the cache with new glyphs has been modified to work (and work more efficiently) when using a Core profile context. Rather than using a shader program and a buffer filling quad to blit the old texture into the new cache texture, we instead use the technique of framebuffer blitting. The existing fallback implementation using glTexSubImage2D() is still available if needed. The DECLARATIVE_EXAMPLE_MAIN macro has been extended to allow easy testing of any of the QtDeclarative examples with a core profile context. Just run the example with QT_QUICK_CORE_PROFILE=1 ./text for e.g. The only ones that may not work out of the box are those that provide GLSL shader source e.g. the customparticles or shader effect examples. These work fine if the shader source is adapted to GLSL 150 core. In the future it may be a good idea to expose some context property to QML that the user can use to determine what shader source variation to provide to Qt Quick. Along these lines it would also be very nice to allow the provision of shader source to ShaderEffect or CustomParticle from a separate source file just as we now do within Qt Quick. Task-number: QTBUG-32050 Change-Id: Ia6e9f06dbb8508af9ae03c6b60fb418b4cc9e41f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix boundingbox calculation of rotated items.Gunnar Sletta2013-11-121-8/+1
| | | | | | | Task-number: QTBUG-34328 Change-Id: If0202a67d95500333a0fb6f4ca3eb19ecb027770 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid using huge floating point values in the renderer.Gunnar Sletta2013-11-091-1/+12
| | | | | | | | | | | | We pretransform vertices relative to their batch root and upload these using single-precision floats. If the offsets are huge then the floating point numbers start to get unstable and we get rendering artifacts as a result. This typically happens for lists/tables with huge models. Task-number: QTBUG-34312 Change-Id: I2516f2b4fa93f44a1288659d05458fb1af0df943 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Fix rendering bug with batched translucent elements.Gunnar Sletta2013-11-011-0/+1
| | | | | | | | | | | When one item in a batch of other translucent items would change opacity, we need to rebuild batches under the current root as all items in a batch are expected to have the same opacity. Task-number: QTBUG-34311 Change-Id: I2b9db19f05bd3a82be65cfa8a91e9398e8d58d0f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Use one render loop per QQuickWindowGunnar Sletta2013-10-301-1/+1
| | | | | | | | | | | | | | | | | | | See the task for the full reasoning behind this patch. The threaded renderloop has been refactored to have one window per thread. This is mostly a simplification of the current code path where for loops over multiple windows are turned into if (window). The QSGContext has been split into two classes, QSGRenderContext for which there is one per OpenGLContext. The rest of the patch is name changes and a couple of cleanups in the hopes of simplifying this change. Task-number: QTBUG-33993 Change-Id: I31c81f9694d7da7474a72333169be38de62613c4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* All matrices in a batch need to be 2D safe when merging.Gunnar Sletta2013-10-081-1/+1
| | | | | | | | | | | | If we merge geometry nodes that make actual use of the z-coordinate, this information becomes lost when merging and the result is that we end up with an arbitrary wrongfully applied transformation to the merged element. Task-number: QTBUG-33897 Change-Id: I6129243e9bb890949023c35dc6b7bce30d31709a Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Allow QtQuick private headers to be used with QT_NO_KEYWORDS.Jocelyn Turcotte2013-09-121-1/+1
| | | | | | | | | | | This is necessary for the QtWebEngine module. This also adds an empty nokeywords test using the same mechanism as qtbase/tests/auto/tools/moc/no-keywords.h to find conflicts at compile time. Change-Id: I9df541720797dd61f078178c2af68ead18ff8bfe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix partial rebuilds and geometry changes.Gunnar Sletta2013-09-091-1/+2
| | | | | | | | | | | | | | | When we do partial rebuilds, we need to update the render order for the entire subtree unconditionally. The previous logic was to reuse existing render orders beneath batch roots, which caused overlapping orders to be used. When geometry of an alpha batch changes, we need to rebuild everything under the current root. Otherwise, we might end up with previously batched content which incorrectly overlaps the changed geometry. Change-Id: I7b6de5ce34a02434294ac5ae29ae1b87eb3c4464 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix rendering errors in Qt Quick Controls galleryGunnar Sletta2013-09-051-1/+1
| | | | | | | | | | | | | | | | | | First, when doing a partial rebuild, we need to mark all elements for orphaning, not just those without a batch, as the renderlist should at all times contain everything that is rendered on screen. Second, we had a small bug with material changes where we would overwrite the rebuild state instead of adding to it. This led to the render lists not being rebuilt from scratch in some scenarios. Third, after the shadow nodes rewrite, we didn't mark for a full rebuild when clips were added. Change-Id: I6707ebfa2908fcedd7fb636fb25b844be15fdea1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* New scenegraph renderer and atlas textures.Gunnar Sletta2013-09-021-0/+499
The renderer tries to batch primitives together where possible, isolate non-changing subparts of the scene from changing subparts and retain vertexdata on the GPU as much as possible. Atlas textures are crucial in enabling batching. The renderer and atlas texture are described in detail in the doc page "Qt Quick Scene Graph Renderer". Change-Id: Ia476c7f0f42e1fc57a2cef528e93ee88cf8f7055 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>