aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
Commit message (Collapse)AuthorAgeFilesLines
* SceneGraph: Don't let QSGRenderNode::m_matrix be a dangling pointerAndy Nichols2023-03-171-2/+2
| | | | | | | | | | | | | | | | | Previously QSGRenderNode::m_matrix would be a dangling pointer most of the time. We document it as being valid during both the prepare, and render methods, but it would only be valid during the prepare phase. This was solved with the projectionMatrix by keeping a local copy instead of a pointer. No code was actually using the dangling pointer, but as a preventive measure since we document matrix as being valid also during the rhiRender we now have a local copy in QSGRenderNodePrivate, and manually set the pointer reference for the API, as well as a note to fix this non-ideal situtation in Qt 7. Fixes: QTBUG-97589 Change-Id: Idc0617de579d3d4ce5cc590534445f609adb9d61 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add the graphics api independent scenegraph portLaszlo Agocs2019-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt in via environment variables: QSG_RHI=1 -> enable using QRhi instead of GL QSG_RHI_BACKEND -> set to vulkan, metal, d3d11, gl to override the default (the default is d3d11 on Windows, metal on Mac, gl elsewhere) Or force a given rhi backend via the existing QQuickWindow::setSceneGraphBackend(). Otherwise the default behavior is the same as before, the rhi code path is never active by default. -no-opengl builds are supported in the sense that they work and default to the software backend. However, the rhi code path cannot currently be used in such builds, even though QRhi from qtbase is fully functional with Vulkan, D3D, or Metal even when qtbase was configured with -no-opengl. This cannot be utilized by Quick atm due to OpenGL usage being all over the place in the sources corresponding to the default backend, and those host the rhi code path as well. This will be cleaned up hopefully in Qt 6, with the removal all direct OpenGL usage. Other env.vars.: QSG_RHI_DEBUG_LAYER=1 -> enable D3D debug or Vulkan validation layer (assuming the system is set up for this) QSG_RHI_SHADEREFFECT_DEBUG=1 -> print stuff from ShaderEffect QSG_SAMPLES=1,2,4,... -> MSAA sample count (but QSurfaceFormat works too) QT_D3D_ADAPTER_INDEX=0,1,... -> D3D adapter index QT_VK_PHYSICAL_DEVICE_INDEX=0,1,... -> Vulkan physical device index QSG_RHI_UINT32_INDEX=1 -> always use uint index data (both merged/unmerged, convert when needed - with some rhi backends this is implicit) QSG_RENDER_LOOP -> to override the render loop as usual. The default with RHI is threaded for Metal, threaded for Vulkan on Windows, basic for Vulkan on Linux and Android (to be checked later), while the existing rules apply for OpenGL. Not supported when running with QRhi: - particles - compressed atlases (though this is transparent to the apps) - QSGRenderNode - QQuickRenderControl - QQuickFramebufferObject - certain QQuickWindow functionality that depends directly on OpenGL - anisotropic filtering for textures - native text may lack some gamma correction - QSGEngine applicability unclear - some QML profiler logs may be incorrect or irrelevant Change-Id: I7822e99ad79e342e4166275da6e9e66498d76521 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-12-201-27/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/quick/pointerhandlers/flickableinterop/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/flickableinterop/data/Slider.qml tests/auto/quick/pointerhandlers/flickableinterop/data/TapHandlerButton.qml tests/auto/quick/pointerhandlers/flickableinterop/data/flickableWithHandlers.qml tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/DragAnywhereSlider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/Slider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/multipleSliders.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/Button.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/buttons.qml tests/manual/pointer/content/FakeFlickable.qml tests/manual/pointer/content/FlashAnimation.qml tests/manual/pointer/content/MomentumAnimation.qml tests/manual/pointer/content/MouseAreaButton.qml tests/manual/pointer/content/MouseAreaSlider.qml tests/manual/pointer/content/MptaButton.qml tests/manual/pointer/content/MultiButton.qml tests/manual/pointer/content/ScrollBar.qml tests/manual/pointer/content/Slider.qml tests/manual/pointer/content/TapHandlerButton.qml tests/manual/pointer/fakeFlickable.qml tests/manual/pointer/flickableWithHandlers.qml tests/manual/pointer/flingAnimation.qml tests/manual/pointer/joystick.qml tests/manual/pointer/main.cpp tests/manual/pointer/main.qml tests/manual/pointer/map.qml tests/manual/pointer/map2.qml tests/manual/pointer/mixer.qml tests/manual/pointer/multibuttons.qml tests/manual/pointer/photosurface.qml tests/manual/pointer/pinchDragFlingMPTA.qml tests/manual/pointer/pinchHandler.qml tests/manual/pointer/singlePointHandlerProperties.qml tests/manual/pointer/tapHandler.qml tests/manual/pointer/tapWithModifiers.qml tests/manual/shapestest/main.cpp Change-Id: I4f233a521305fab1ebfecbac801da192434ed524
| * Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-beta4Liang Qi2017-11-061-27/+13
| |\ | | | | | | | | | Change-Id: I8ede7e36592cd21f3e4a0a9b30dbe26bb40fe69b
| | * Clean up handling of opaqueness in the SW rendererLars Knoll2017-11-031-26/+13
| | | | | | | | | | | | | | | | | | | | | | | | And check whether nine patch pixmaps are opaque as well. Change-Id: I23f2cb675b923eace849a1c0ad71efe1446c86c4 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Krause <volker.krause@kdab.com>
| | * Mark pixmaps without alpha channel as opaque in the SW rendererLars Knoll2017-10-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | And help avoid that we draw the same pixel multiple times. Change-Id: I56dccfeffe6865d0aaa252c84ae693380c3bbb5b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Krause <volker.krause@kdab.com>
* | | Port away from QRegion::rects()Marc Mutz2017-12-051-2/+3
|/ / | | | | | | | | | | | | | | Use begin()/end() instead. Change-Id: Iaa12726e218bfdb44be24240ca35f9526cc67440 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge branch 'wip/scenegraphng' into devLaszlo Agocs2017-06-191-7/+10
|\ \ | | | | | | | | | | | | | | | Say hello to Shape. Change-Id: I1093feee4acc375e62bae1d351db0a7969a536d0
| * \ Merge remote-tracking branch 'origin/dev' into wip/scenegraphngLaszlo Agocs2017-06-081-30/+47
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp Change-Id: Id8107cb0de0fbfe7120a90a137b49c2b915ff2d3
| * \ \ Merge remote-tracking branch 'origin/dev' into wip/scenegraphngLaszlo Agocs2017-03-011-2/+2
| |\ \ \ | | | | | | | | | | | | | | | Change-Id: Iba540adaeffb0098fc4e1923050eb611bf47287b
| * | | | software backend: Fix clipping of QSGRenderNodesLaszlo Agocs2016-12-211-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I27aa5f94165fb07807d2bb711d81eade552b9f76 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-151-2/+2
|\ \ \ \ \ | |_|_|/ / |/| | | / | | |_|/ | |/| | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp Change-Id: I3c41b9fc9ba7d41741e4dd400402ae80dd7726d9
| * | | Don't detach temporary containerSérgio Martins2017-06-071-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: I3edebdd149d901992b7db5410bb871ba1bcd454e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-071-30/+47
|\| | | | |_|/ |/| | | | | Change-Id: I61ab3d0bd8cc02f640c60c037226eace09ec09ba
| * | Improve dirty region calculation in software rendererJüri Valdmann2017-05-231-30/+47
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The software renderers dirty region calculation is done in integral logical coordinates, which leads to quite some trouble when handling scene graph elements with fractional coordinates (used by WebEngine for example). The optimal solution would probably be to either use integral physical coordinates or floating point logical coordinates, however this would seem to require substantial changes to QPainter and QBackingStore and so on. So, this patch instead changes the calculation to use something like interval arithmetic: instead of just rounding each logical coordinate to the nearest integer the renderer now uses (very carefully) both the upper and lower boundaries to make sure that the dirty regions always err on the side of caution. I expect this change to make rendering slower but only in situations where previously there would be rendering errors. Task-number: QTBUG-60393 Change-Id: I7f8e7d2739c810328c841130df9c1c7332439447 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* / dynamic_cast -> qobject_cast for QObjectDerived*Robin Burchell2017-02-141-2/+2
|/ | | | | | | | We cannot use dynamic_cast in Qt. Change-Id: Ia6aeeb2439ca8c24239dce7cff55a0c18860e43e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make Sprite a configurable featureLars Knoll2016-10-101-0/+8
| | | | | | Change-Id: Iab5c5261cb3cdce3d02fa6cd19ae6f594b6fc649 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QSG: Fix inconsistent use of 'override'Erik Verbruggen2016-08-101-5/+5
| | | | | | | | | qsgsoftwarerenderablenode.cpp:221:11: warning: 'scissorRect' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] (plus 4 more) Change-Id: Ie6b85d2eba9e3fbda8cfdc03abfece98df1bb28f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add optional flags and rect to QSGRenderNodeLaszlo Agocs2016-08-021-3/+15
| | | | | | | | | | | | Having rendernodes triggering fullscreen updates with the software backend is not ideal. Therefore, introduce the option of reporting that the rendernode is well-behaving, meaning it only writes inside the reported bounding rectangle. Similarly, the OpenGL batch renderer can keep using the depth buffer when the rendernode is known to behave like the renderer expects. Change-Id: I6acc434432c2504776f26e8917b5434b44be293d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* software: Add support for QSGRenderNodeLaszlo Agocs2016-07-191-6/+47
| | | | | | | | | | | | | | | | | Have to change getResource() a bit since it turns out it is not suitable currently for backends that do not have a per-window rendercontext and do not implement the interface on the rendercontext. Pass in the window to make sure it can always figure out which window we want the resources for. (we do not want rendererInterface() to return window-specific instances created on the fly, with ownership issues, so stick with the simple model where backends implement the interface on one of their existing classes) To support clipping, QSGRenderNode::RenderState is extended accordingly. Also updated the docs since some claims in the rendernode docs are not true since Qt 5.3. Change-Id: I34779c83926f5231b888fcab7131e873ae97964f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add QSGSpriteNode to the Scenegraph Adaptation LayerAndy Nichols2016-07-141-0/+11
| | | | | | | | | | | | Most core Qt Quick items use one of the nodes provided by the Scenegraph Adaptation Layer, however the two items that provide support for Sprites created their own custom nodes. There was significant redundancy in this, and it made it only possible to use the OpenGL adaptation. The AnimatedSprite and SpriteSequence items have been cleaned up, and now use the new QSGSpriteNode. Change-Id: Idc20b9c5da9dc1c94f6368021785382cdf7cec5a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Software Adaptation: Improve clip node handlingAndy Nichols2016-06-281-4/+10
| | | | | | | | | | | | | | | | This commit solves two issues that were coming up with nested clip nodes. The first was that determining the intersection of two or more nested clip nodes was calculated incorrectly. This was fixed by making sure the calculated clip region was in the correct coordinate space. The second issue was because there was no distinction between an empty unclipped region, and a completely clipped region. So a property was added to specify when a RenderableNode had a clipRegion so that the empty QRegion could be interpreted correctly. This makes sure that we don't end up drawing nodes that were culled. Change-Id: Id7af092f7fc6a4602b44b585b7dee14084136962 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix rendering clipped texture and image nodesAllan Sandfeld Jensen2016-06-241-2/+2
| | | | | | | | The entire texture node was always used causing scaling for any node with a source clip. Change-Id: I7c6f946cee6d59ad3ae64302f3a28782eba8f5da Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add cross-backend simple rect, texture, and ninepatch nodesLaszlo Agocs2016-06-221-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QSGSimpleRectNode is deprecated -> use QSGRectangleNode via QQuickWindow::createRectangleNode() instead. QSGSimpleTextureNode is deprecated -> use QSGImageNode via QQuickWindow::createImageNode() instead. The OpenGL version of the simple rectangle node is switched over to the vertex color material instead of flat, to allow for better batching. Use the same concept for nine patch nodes. The "style" node from Quick Controls 1 is now QSGNinePatchNode in order to provide a proper cross-backend solution which is already necessary due to the software backend, but now generalize it to apply to the accelerated backends with proper materials as well. QC can now simply call createNinePatchNode() without further ado. Also fixes a bug with the D3D12 texture material not enabling blending when needed. When it comes to the internal class names, QSGRectangleNode and QSGImageNode get the Internal prefix in the adaptation layer in order to differentiate from the public API. This involves quite a lot of renaming, but results in a nice and clean public API. Change-Id: Iddf9f9412377843ea6d652bcf25e68d1d74659ea Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* 2DRenderer: Mark all regions of deleted node as dirtyAndy Nichols2016-04-131-1/+6
| | | | | | | | | | | | Previous behavior was to always subtract the current bounding rect of items when calculating the previous dirty region. When you remove a node though, there is no current bounding rect because the item no longer exists. The last valid boundingRect was use instead, which led to the previous bounding rect to not get marked as dirty when the node was removed. Change-Id: Ic1a4f872d4d46125b06e2588aae695b8ff67d0fd Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* 2DRenderer: Allow clipping when items are rotatedAndy Nichols2016-04-061-5/+7
| | | | | | | | | | Previously clipping was only possible if items were rotated in increments of 90 degrees. Now it is possible to clip items that are rotated at any angle, but there is a performance and accuracy penalty because QRegion is terrible. Change-Id: Ibcb57b6d8718458eff718de117d113975cfe26db Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Enable building Qt Quick module with QT_NO_OPENGL definedAndy Nichols2016-03-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Currently the Qt Quick module depends on either the OpenGL or OpenGLES headers being available at build time. Since we are adding support for adaptations that do not depend on OpenGL, it should be possible to build Qt Quick in environments that do not have OpenGL development headers. This does present many challenges though because in some cases GL types, and classes that require OpenGL are part of the public APIs. However since these classes were never available when QT_NO_OPENGL was defined, it should be possible to redefine the function signatures under this scenario, since it's not possible to break binary compatibility if there never were any binaries to break compatibility with. One of the bigger changes that was necessary to facilitate this change is creating interfaces out of QSGContext and QSGRenderContext. Here the default behavior was usage of OpenGL directly, even though subclasses could override all OpenGL usage. Making them interfaces should bring QSGContext and QSGRenderContext more in line with the other classes present in the adaptation layer. Change-Id: Iaa54dc0f6cfd18d2da1d059548abf509bd71f200 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Turn the SoftwareContext plugin into the Scenegraph Software AdaptationAndy Nichols2016-03-101-0/+322
The 2D renderer will now become a built-in adaptation of scenegraph that should always be available to fallback to when there are no other renders available. So rather than be an external plugin, now it is a built in adaptation. Change-Id: Ifa02fd50f3085ad1e6f1a73c3ce1e1825b677cc7 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>