aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Anisotropic antialiasing for distance field textEskil Abrahamsen Blomfeldt2020-06-1543-76/+374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For perspective transforms, we need to find the sample range in the glyph cache per pixel. We can do this by getting the gradient of the distance field at the specific pixel. This will ensure proper antialiasing with any projection, but has the limitation that when glyph contours become thinner than a pixel, they may disappear or become too emphasized, because the hardware-gradient - based on neighbouring fragments - is not reliable at that scale. So we should only default to this when we detect that the text is child of a 3D scene. To make this smooth, we need to know the mode of the renderer when creating the shader. So QSGMaterial::createShader() now takes a render mode that we can use to customize behavior based on whether it is rendering into a 2D or 3D scene. [ChangeLog][QtQuick] The QSGMaterial::createShader() virtual function has been extended to take a render mode argument, which can be used for any customizations needed in the case where the shader will be used in combination with 3D perspective transformations. Fixes: QTBUG-84695 Change-Id: I5a18a4edbdfa07e8f9d506c42bb20e8eb580927d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Speed up rendering huge static scenesEskil Abrahamsen Blomfeldt2020-06-152-0/+11
| | | | | | | | | | | | | | | | With really big, static scenes, traversal of the geometry list is expensive enough that it becomes a limitation on the frame rate if we do it in the inner loop of every frame. And going through the whole list of geometry every frame just to verify that nothing has been removed is a waste of time. In a test with two million opaque items in a single draw call, I can hit 144 fps with this small optimization versus 50 fps on the same machine without the patch. Pick-to: 5.15 Change-Id: Id11c1d96456e79a62c33b89e5f115bdaacceeacd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Get rid of preprocess in QQuickTextEskil Abrahamsen Blomfeldt2020-06-156-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preprocessing in the scene graph is actually pretty expensive, so we want to avoid using it for something like text, where you can often have a lot of nodes in a UI. For text it was previously used for two purposes: 1. To make sure the distance field glyph cache was updated with potential new glyphs before the frame was rendered, but *after* all new glyph nodes had been created (this is an optimization to avoid having to resize the cache multiple times in one frame, but rather wait until we know the exact amount of new glyphs that need to be added) 2. Update the coordinates of the glyph based on their position in the glyph cache if the glyph cache says they have moved (or if they have just been added for the first time). Point #1 can actually be handled a lot simpler, by having a separate loop for the existing glyph caches where we ask them to preprocess. There is typically only a few glyph caches, but can be hundreds of glyph nodes in a scene, so in the previous code we would be calling the update() functions on the same glyph cache over and over again every frame. Point #2 does not need preprocessing every frame, but can be reduced to only preprocess when the geometry is marked as dirty. We then do a pass on the glyph node in question to update its geometry and turn the flag off again so that we don't pay the cost every frame. Pick-to: 5.15 Fixes: QTBUG-84351 Change-Id: If8c492acaef9c512c2db61b64bcab2103db2d997 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix up QQuickRenderControl class docsLaszlo Agocs2020-06-121-17/+20
| | | | | | | | This was not updated together with the Qt 6 changes (the function docs are up-to-date already), do it now. Change-Id: I93c59df141a69d9943d1a3d88fe3a56fe6c096df Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QQuickTextInputPrivate: refactor getImplicitWidth() to calculateImplicitWidth()Mitch Curtis2020-06-122-23/+28
| | | | | | | | | | | | This patch moves the implicit width calculation in getImplicitWidth() into calculateImplicitWidth(const QString &text). This allows QQuickComboBox in qtquickcontrols2 to get the implicit width of a TextInput (TextField) item, as QQuickTextInput does some extra layouting and accounting for padding that QFontMetrics does not. Change-Id: I81e6c2627e21ca4d89ea9502abbb6aec79068793 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Doc: Improve documentation for DateKai Koehne2020-06-121-12/+36
| | | | | | | | | | | | | | | Structure the overview more by adding section titles. Also be more elaborate on what the enum's mean for the different parts/methods. Finally, make it explicit that NarrowFormat for date and time is the same as ShortFormat. Pick-to: 5.15 Fixes: QTBUG-83841 Change-Id: I0a93361fcc8e30f1080938976d8e0b2d5a55e563 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move resetOpenGLState() to QQuickFboLaszlo Agocs2020-06-125-121/+83
| | | | | | | | | | | | | | | | | | | | | | | | | QQuickWindow should not have OpenGL specifics in its API in Qt 6. However, resetOpenGLState() is used by applications commonly in combination with QQuickFramebufferObject (not the least because the documentation recommends it!). This is no problem in practice because QQuickFramebufferObject remains an OpenGL-only feature. So to minimize the breaks, move the function into QQuickFramebufferObject::Renderer so any application that calls the function can continue to do so by just calling it on 'this' instead. The rendercontrol_opengl example used to call this function as well, but unnecessarily, it will still function the same way without it. Note that there is a chance that there are applications that call resetOpenGLState() in other contexts, for example in slots connected to before or afterRendering(). For these it will need to be determined if the call is necessary at all, and if it is, should be replaced by (re)setting the appropriate OpenGL state manually instead. Task-number: QTBUG-84523 Change-Id: I335599f77e8a84e347a44427eb1a1bf917796ee8 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Port distancefield debugging code from OpenGL to RHIEirik Aavitsland2020-06-124-159/+42
| | | | | | Task-number: QTBUG-84623 Change-Id: I26941eacf5ad97ed3c7c6e7d7ad3beec7f0c6fa3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Add documentation for zScalePaul Wicking2020-06-121-0/+8
| | | | | | | Pick-to: 5.15 Fixes: QTBUG-84750 Change-Id: I2a2480abf3c6d81e103869975d68c69adbe5b81e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Prevent items from being deleted while removingElvis Lee2020-06-121-0/+7
| | | | | | | | | | | Delegate items can be deleted when remove them from cache list. That may cause a crash. So call referenceObject to keep the item from being deleted. Task-number: QTBUG-83352 Pick-to: 5.15 Change-Id: Id5d7ab6dbf21682940f5393ea4e843c2448f7d81 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QQuickKeyNavigationAttached issueValery Volgutov2020-06-121-6/+6
| | | | | | | | | | | | | | | | | | | | When Repeater used for Item creation, we have following issue: When Repeater creates a new item and this item tries to set keyboard.left or keyboard.right to another Repeater-created sibling, these items haven't been created yet, and we have issue with navigation keys. Set rightSet to true if right really changed. When object calls KeyboardNavigation::setRight(null), rightSet = true, but right field did not change (null). After that, navigation keys work incorrectly. The same for other cases. Task-number: QTBUG-83356 Pick-to: 5.15 Change-Id: I9ea6d6a7d13ff989aac3d9e2d22467b48080de13 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Adapt to metaobject changesFabian Kosmale2020-06-123-48/+8
| | | | | Change-Id: I31dd544e80b8b2f8745463450a05fa7effafa8cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix lexer line number if code contains continuation stringsChristian Stenger2020-06-121-1/+4
| | | | | | | | | | | Follow-up lines of continuations strings that directly end with an unescaped line feed still broke the line numbers of code following the string. Fix by explicitly handling the first character inside a string differently. Amends 126ee5c901a9675a9ab61d4c6f2961c95b8bceac. Change-Id: Ia945546d35db844114064ae34d6189704ceefe3b Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* Doc: Update example of QML int valueYuya Nishihara2020-06-121-1/+1
| | | | | | | | | Item width and height are real numbers. Let's pick other property of int type. Pick-to: 5.15 Change-Id: I43e74e4005681d570047648e2c141994a075150e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Clarify exact range of QML int valueYuya Nishihara2020-06-121-1/+1
| | | | | | | | | The original definition "around -2000000000 to around 2000000000" was unscientific and would make a false impression that full 32bit integer range wouldn't be supported. Change-Id: I712eb35dee05410f50572a12af98365013efeb62 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make openglContext getter in QQuickWindow privateLaszlo Agocs2020-06-116-33/+16
| | | | | | | | | | | | Fix up the scenegraph and qquickwindow autotests as well. (direct OpenGL specifics are now completely removed from both, i.e. the remaning OpenGL specific tests are now run (and not skipped) with OpenGL-on-RHI) [ChangeLog][Qt Quick][QQuickWindow] openglContext() has been removed from QQuickWindow. Use QSGRendererInterface to query the QOpenGLContext. Change-Id: If5c9802b71ac5f9cffc695827e286eb2a2d03580 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Move QSGRenderContext::RenderMode to QSGRendererInterfaceEskil Abrahamsen Blomfeldt2020-06-1111-27/+37
| | | | | | | | | We want to be able to use this enum from the public API, so we move it out to a suitable public class. Task-number: QTBUG-84695 Change-Id: I8a3860ecfd0da7990941540bcf39fb0c2bf0ff83 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove FBO path from painternode/context2dPaul Olav Tvete2020-06-119-759/+22
| | | | | | Task-number: QTBUG-84623 Change-Id: Icef7ab7460799b989f4e122be3f8d5cab98382e4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-1114-151/+151
| | | | | | | | | | | | | | | | | | | | Several event accessors were deprecated in qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5. Replacements were generated by clazy using the new qevent-accessors check: $ export CLAZY_CHECKS=qevent-accessors $ export CLAZY_EXPORT_FIXES=1 $ ../qt6/configure -platform linux-clang -developer-build -debug -no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy $ make $ cd ../../qt6/qtdeclarative $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: I1be5819506fd5039e86b4494223acbe193e6b0c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Modernize QSGMaterialShader class docsLaszlo Agocs2020-06-111-81/+121
| | | | | | Task-number: QTBUG-84623 Change-Id: I7577c2da02936295793bac23f7cb66107a65c462 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QML: Fix precedence of module importsUlf Hermann2020-06-116-39/+71
| | | | | | | | Types imported transitively via a qmldir import statement should not shadow types available from the module itself. Change-Id: Id34edc5c5e2fff4ba37009f4bab9039b7ed18dff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Update dependencies on 'dev' in qt/qtdeclarativeQt Submodule Update Bot2020-06-111-3/+1
| | | | | | | | And workaround hash issue for now by using qHashMulti Also, fix test build failure Change-Id: Ia6b696b2531149206c73e7a5a958d7fba74a0f19 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove remaining OpenGL dependency in QSGDefaultInternalImageNodeEirik Aavitsland2020-06-112-19/+2
| | | | | | | | | As a driveby, remove an unused opengl #include from qsgdefaultspritenode.cpp Task-number: QTBUG-84623 Change-Id: I6e901a0ac0a23a2d21029b5337c204835e29026a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rename setPersistentOpenGLContext and revise related docsLaszlo Agocs2020-06-115-45/+50
| | | | | | | | | | | | | | | | | | These persistent hints are still taken into account by the threaded render loop, so keep them, but get rid of "OpenGL Context" from the function names. The qquickwindow autotest has been updated accordingly, and with a few OpenGL-related cleanups it now runs without any warnings or skips with OpenGL-on-RHI, while it skips only 1 case when running with some other API, and 2 with the software backend. [ChangeLog][Qt Quick][QQuickWindow] The setPersistentOpenGLContext() and isPersistentOpenGLContext() functions are renamed to setPersistentGraphics() and isPersistentGraphics(). Change-Id: Ifc4cc7c4b94fe9f7e402b39ca4f28952dcafd588 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QQuickFbo: remove direct GL checkLaszlo Agocs2020-06-101-7/+3
| | | | | | | | This is always used in combination with OpenGL-on-RHI now, no point in checking for direct OpenGL anymore. Change-Id: I0f137d7c5f6248d9d9790949186e4830ffd7dc7f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove the unused shadersourcebuilderLaszlo Agocs2020-06-104-497/+0
| | | | | | Task-number: QTBUG-84623 Change-Id: I994f1078399788566108e8605213f18e0ba722f5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Skip all clipping when render mode is 3DLaszlo Agocs2020-06-101-10/+13
| | | | | | | | The current assumption is that setting clip: true will have no effect in a scene rendered with RenderMode3D. (2D item tree under a 3D node) Change-Id: I81ca1fcc04c7f4af37a03fd48dc95ea307989e98 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Clarify QQuickWindow::releaseResources docsLaszlo Agocs2020-06-101-6/+10
| | | | | | | | | It sort of has a double purpose for some time now, make the docs reflect both (a simple release-cached-resources request vs. or a full-blown scene graph + QRhi invalidation) Change-Id: I38ab560a4c2f7d3e7ae5427af4d1fb26d8c036d3 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QQmlImport: Parse resource paths from QML2_IMPORT_PATHUlf Hermann2020-06-101-6/+22
| | | | | | | | | We can interpret double colons as start of resource paths. Task-number: QTBUG-69435 Change-Id: If2b4412c28c7c59f160ddfcfe04ec293af437660 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Deduplicate the import resolution algorithmUlf Hermann2020-06-108-55/+200
| | | | | | | We will need it in various other places, too. Change-Id: I61c55f88b66ab85448ae8fff125fe34108532fc4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove openGLContextCreated signalLaszlo Agocs2020-06-103-30/+0
| | | | | | | | | | | | | | | | No reason to have this in the API in 6.0, and it's already not emitted at all in dev (because the direct OpenGL code path is now gone from the render loops) Some simple GL string printing has been removed from qml/qmlscene. This opt-in feature has not been useful in practice anyway since QSG_INFO=1 prints the same things. [ChangeLog][Qt Quick][QQuickWindow] The openGLContextCreated signal has been removed from QQuickWindow. Change-Id: Ifb647bbd1e828ebad2b775e8ce5c38723a0cda13 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix shifted text styles on RHIEskil Abrahamsen Blomfeldt2020-06-101-2/+2
| | | | | | | | | QPointF is only 8 bytes if qreal is a float. Use QVector2D instead, which always contains floats. Change-Id: I342a88bd5f1cd8b0aa54308291852418cfbd0009 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Warn circular dependency when loading typesJaeyoon Jung2020-06-101-0/+6
| | | | | | | | | | Detect a circular dependency between two QML types and print a warning message if found. Task-number: QTBUG-83354 Pick-to: 5.15 Change-Id: I826b28775ba3212ccccaeb56d50b64fec6f38ea9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix baseUrl returning an empty urlJaeyoon Jung2020-06-101-1/+3
| | | | | | | | | | | Do not append the directory separator if the current path is the root directory. Otherwise it is treated as a remote path incorrectly and an empty url is returned as a result. Change-Id: Icc62114702265e9e1b247624370a78999e564d5f Task-number: QTBUG-83121 Pick-to: 5.15 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Lock the mutex when accessing QQmlTypeModule::m_importsUlf Hermann2020-06-101-0/+3
| | | | | | | The type modules are passed around in various places. Change-Id: I59b2fec80a3ae25799116533635545229d3841da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Un-pimpl QQmlModuleImportUlf Hermann2020-06-108-170/+61
| | | | | | | There is no point in having that pimpl'd. Change-Id: I9e3f6671ca178ea3f58fd0488dbb291a38656685 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Quick: Use unicode character literalsUlf Hermann2020-06-101-1/+1
| | | | | | | This avoid warnings on conversion to QChar. Change-Id: Idad6a35bb47b029688c5752a03ef83cb5b63373e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQmlTypeModule: Clean up remove loopUlf Hermann2020-06-101-11/+1
| | | | | Change-Id: I0f7808e84ca295560eca9bca99db9b44737210d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid including removed header in particlesLaszlo Agocs2020-06-101-1/+0
| | | | | Change-Id: I3ffc6cd37fa001cc8b39700f176e64b7538db536 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QSGRhiShaderEffectNode is available only with openglSamuli Piippo2020-06-101-2/+3
| | | | | | | Fixes build without opengl Change-Id: Ica5752c21567b730065ec6276a9016b3989f9d02 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove OpenGL dependency from QSGTextMaskMaterial & friendsEirik Aavitsland2020-06-102-43/+7
| | | | | | Task-number: QTBUG-84623 Change-Id: Ia665b789bbc875c26672abd7e0f8b0d9fe45d22b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Remove compat. leftover in QSGTexturePrivateLaszlo Agocs2020-06-102-9/+0
| | | | | Change-Id: Ic23a944ec273ddf7834a6add128c9c0413d865ff Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove QSGDepthStencilBufferPaul Olav Tvete2020-06-104-366/+0
| | | | | | Task-number: QTBUG-84623 Change-Id: Ia08376a8547110993bd39bcff17a49e059d40fde Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove OpenGL dependency from QSGGeometryPaul Olav Tvete2020-06-101-14/+0
| | | | | | Task-number: QTBUG-84623 Change-Id: I150867f256a1e9f30d66e8b6d8cde047d7b6dbdf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove QQuickGenericShaderEffectPaul Olav Tvete2020-06-106-901/+782
| | | | | | | | | | | | Keep it as an internal class for now, with the name QQuickShaderEffectImpl, and move it to qquickshadereffect.cpp. In the long term, we want to get rid of the extra QObject, but that requires careful untangling of the connections and the timing of cleanup at destruction. Task-number: QTBUG-83977 Change-Id: I6513bd0d8fc8522a15049b70ab43fc222088e7d0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove QOpenGL dependency from QSGCompressedTexturePaul Olav Tvete2020-06-101-56/+216
| | | | | | Task-number: QTBUG-84623 Change-Id: I89e0154447b6b82b22c90faa60cfc5262cf3d658 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Make QQuickWindow compile by adding a QOpenGL include for nowLaszlo Agocs2020-06-091-0/+1
| | | | | Change-Id: I56efe518855658bbbee2b61e41ef2715f7f28267 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Do not depend on removed openglContext getterLaszlo Agocs2020-06-092-13/+7
| | | | | | | | ...and remove Angle special case. Task-number: QTBUG-84623 Change-Id: Icf3eb4ef4508519aa2144b667220d33155569b7f Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Make rendercontext OpenGL cleanLaszlo Agocs2020-06-097-118/+9
| | | | | | Task-number: QTBUG-84623 Change-Id: I5cf3c0db01b0c519f803fd49be820a910881dcff Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove unused leftovers in batch renderer headerLaszlo Agocs2020-06-091-9/+0
| | | | | | | | Also remove a misleading comment. Task-number: QTBUG-84623 Change-Id: Ia3f88e3af80f0d5de95f951cb637550c0b14381f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>