aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
Commit message (Collapse)AuthorAgeFilesLines
* Support DXT1/3/5 in compressed texture atlasv5.14.0-beta2Michael Brasser2019-10-172-3/+21
| | | | | Change-Id: I791adbfce96481aea71bb285e48b89cb5db08e1c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-10-102-1/+7
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp tests/auto/quick/qquickpathview/tst_qquickpathview.cpp Change-Id: I117c8d62b21800329d1035021d312d9924f83a1b
| * Fix sprites leaking textures in SW and OpenVG backendsEirik Aavitsland2019-10-072-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a QSGSpriteNode is initialized with a texture, it is supposed to take ownership of the texture and delete it when the node gets deleted. In the default backend, this happens automatically: The texture gets assigned to the node's QSGMaterial object, and the node has set the OwnsMaterial flag, and so the inherited QSGGeometry destructor takes care of deleting the material, which deletes the texture. However, the Software and OpenVG backends do not have material objects, so the above mechanism does not apply, and so the texture objects are leaked. Fix by deleting the texture object directly from the SoftwareSpriteNode and OpenVGSpriteNode destructors. Fixes: QTBUG-77019 Change-Id: I503d704f66593ba6a36c969db80f74f715382b6b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Handle context loss in the basic render loopDavid Edmundson2019-10-081-0/+18
| | | | | | | | | | | | | | | | | | | | | | In the event of a graphics context loss, we need to reset the scenegraph and the GL context. As all windows share a graphics context a loss detected in one window needs to reset the scenegraph on all windows. Change-Id: I3ff1a93d5a08fa21366a6a56e94bd2185aebb2d5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Revert "Temporarily drop a debug mode check in rhi-based stenciling"Laszlo Agocs2019-10-071-3/+1
| | | | | | | | | | | | | | | | | | | | | | The qt5 submodule update is now done in qtbase, so the code here can now be migrated to follow the QRhi (private) API changes. This reverts commit 7661b142a130df54af3a5430a29e3c82da086c7b. Task-number: QTBUG-78995 Change-Id: I6995cd5e14b75622a51c9e95fb3178485d67d63d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Follow QRhi improvements and drop QVectors where applicableLaszlo Agocs2019-10-076-12/+16
| | | | | | | | | | | | Task-number: QTBUG-78883 Change-Id: Ifcf5af843b5101a35ecc762a6a3b0196b6d97782 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Temporarily drop a debug mode check in rhi-based stencilingLaszlo Agocs2019-10-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | ...to avoid blocking the next submodule update. Can be restored afterwards. There is no temporary compatibility function for the QVector-based getters in qtbase. This got overlooked probably because it is in a block that is there in debug builds only. Change-Id: I3de3f48934e6a31cc14a90f306fddfa04ac56f41 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Drop QVector for srb and shader stage descriptionsLaszlo Agocs2019-10-032-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the QRhi changes that move away from QVector in QRhiShaderResourceBindings and QRhiGraphicsPipeline. This, together with QRhi's de-d-pointering of QRhiShaderResourceBinding, is bringing significant performance improvements for scenes with a lot (thousands) of unbatched items, since a large number of allocations are now avoided due to not having to create a QVector of d-pointered classes just to do a lookup in the srb cache. Change-Id: I612ab2d9449a9e0ce79f7169b942b95d55af61ff Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Fix device pixel ratio with QRhi for native textLaszlo Agocs2019-10-035-5/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calculating values based on the dpr is not possible in the sync phase, because the strictly correct dpr (that takes redirections into textures into account) is not known until QQuickWindowPrivate::renderSceneGraph(). The text material implementation attempts to dig out something directly from the context's associated surface, but this does not match the way QQuickWindow calculates the value (although it would work without causing any trouble in many cases). This is of course incompatible with the QRhi-based abstraction since neither the context nor the associated window (if there is one even) is known to materials. To solve this, create a proper solution that makes the QQuickWindow-calculated dpr available already in the sync phase (so in updatePaintNode() implementations): have QQuickWindow calculate calculate the dpr in syncSceneGraph(), and pass it down via the rendercontext. Only the rhi-based code path is touched in this patch. The direct OpenGL path could be fixed in a similar manner (by migrating to rc->devicePixelRatio() in the sync phase and state.devicePixelRatio() in the render phase), but that is left as a future exercise. Task-number: QTBUG-78610 Change-Id: Id9d9d4b1fd5b9730a64834fbbf61c74af4a8ed07 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | QQuickWindow: Don't leak the animation controllerUlf Hermann2019-10-025-7/+9
| | | | | | | | | | | | | | | | | | There are ways to close the window without hitting the code paths in the render loops that delete the animation controller. Probably if no frame was ever rendered. Change-Id: If3e9d2051525c4ff50eda19084c967578fe4f4b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove depth-stencil buffer sizing on the rhi pathLaszlo Agocs2019-09-302-11/+11
| | | | | | | | | | | | | | | | | | ...as this will be done automatically by QRhiSwapChain after the corresponding QtGui changes. Task-number: QTBUG-78641 Change-Id: I8edeb728f3aba07bfa6bc6331966fba4bdee71f4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Add a QSG env var for QRhi::PreferSoftwareRendererLaszlo Agocs2019-09-272-5/+14
| | | | | | | | | | | | | | | | | | Also extend the docs. And while we are at it get rid of some clang warnings. Task-number: QTBUG-78669 Change-Id: I4ef15d2d066098ba7bbbd34e80d4e61efe7fba23 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Add missing QSGDynamicTexture default constructorFlorian Bruhin2019-09-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | In 341ab7708049b1a3f559b76f16393e688951a938, an internal QSGDynamicTexture::QSGDynamicTexture(QSGTexturePrivate &dd) constructor was added, which means QSGDynamicTexture now doesn't have a (formerly implicit) default constructor anymore. Fixes: QTBUG-78312 Change-Id: I34a918942d87ca522aa7131580b9e08a1445d635 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Change const ref to ref in QSGMaterialRhiShader as per API reviewLaszlo Agocs2019-09-2314-85/+88
| | | | | | | | | | | | Change-Id: I7783ed26a66f03ebe3b26bcba2f42f9fff45a417 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Add an env var to periodically kill the device on d3dLaszlo Agocs2019-09-232-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...in order to test the handling of losing the device. The D3D11 backend of QRhi provides a convenient way to test this. Hook it up to a QSG_RHI_SIMULATE_DEVICE_LOSS environment variable. The value is the number of frames to wait before breaking the ID3D11Device. We cannot currently recover from a device loss. Hence the importance of being able to test in a simple way. The rhi code path needs to be brought up to the level of the direct OpenGL path in this respect, in separate patches. Change-Id: I66d6315dc60a9673903da9bed36de0cdd115f4a7 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Recover from device lost on the rhi path in the threaded loopLaszlo Agocs2019-09-231-61/+100
| | | | | | | | | | Change-Id: I90d43d5daa75bbc52c9c10f4ef920b898bbd39d4 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Handle rhi device loss in the basic render loopLaszlo Agocs2019-09-231-5/+40
| | | | | | | | | | Change-Id: I02cee05ce7eee2ad1c458d1a934c210c12d1dea2 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Add missing doc entries for QSGGeometry::Type valuesLaszlo Agocs2019-09-181-0/+4
| | | | | | | | | | Change-Id: Iaef8dfa6a984eb709aaae35a94641c3e0183254e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add some missing since and internal doc tagsLaszlo Agocs2019-09-182-14/+23
| | | | | | | | | | Change-Id: I50c6a5c7a55cfc481ff572113c58951983671cdc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Avoid changing function signature in public headerLaszlo Agocs2019-09-184-7/+58
| | | | | | | | | | Change-Id: I0be124dfcafa2244531281ffd1ac6b559d82c604 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add missing inner struct and enum docs for rhi material shaderLaszlo Agocs2019-09-181-0/+65
| | | | | | | | | | Change-Id: Ia78012271705b3f977011a89d3156faa79a35f29 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Move qsgrhisupport to an unconditional section in the priLaszlo Agocs2019-09-121-4/+4
| | | | | | | | | | | | Change-Id: Ia53b43cb2e81053ffa8709767d84ac1e5db72d27 Fixes: QTBUG-78243 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Request correct alpha composition on the rhi code pathLaszlo Agocs2019-09-112-2/+19
| | | | | | | | | | | | Task-number: QTBUG-78089 Change-Id: I22f8bb5ec0af33397df14e064a0306bd4c5a5ef5 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Drop expendable rhi data when in release(Cached)ResourcesLaszlo Agocs2019-09-111-0/+3
| | | | | | | | | | | | | | Now that a suitable function is introduced in QRhi, call it. Change-Id: I6328a4be90418015384b472655c9b8ad34a07e12 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Make vulkanunderqml work and update docsLaszlo Agocs2019-09-082-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What we are doing for now is setting ExternalContentsInPass always. This way vulkanunderqml works as expected. For applications that do not integrate external rendering this means that there is now an additional secondary command buffer per render pass, but we can live with this for now. Later (Qt 6) there should be a way to declare this (that the application will want to issue native rendering stuff) up front in QQuickWindow or somewhere. Change-Id: I736741f9b0eee2f8295b046bacdce862e6a546f5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Expose renderpass from QSGRendererInterfaceLaszlo Agocs2019-09-085-4/+30
| | | | | | | | | | | | | | Important for Vulkan and (upcoming) examples like vulkanunderqml. Change-Id: I5b6c978f38175eca76efe059aa83bb7158724752 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Add a createTextureFromId() alternativeLaszlo Agocs2019-08-305-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | Say hello to createTextureFromNativeObject(). This is the future replaecment for createTextureFromId(), and is capable of operating on both the direct OpenGL and the RHI code paths. In practice this allows creating a QSGTexture that wraps - but does not own - an existing VkImage, ID3D11Texture2D*, MTLTexture*, or GLuint. Change-Id: I500ee4c76da67eca1a70599a30b03d7b126b570d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Add a note to QSGEngine about its incompatibility with the RHILaszlo Agocs2019-08-302-0/+6
| | | | | | | | | | Change-Id: Id9d6ce4a531d2cd1b79b3bb9224a5567ead42799 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Avoid introducing rhiTexture() in the public API of QSGTextureLaszlo Agocs2019-08-295-25/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need for this. The few internal users can get it via QSGTexturePrivate. The original thinking was based on QRhi* being a public API, but that is not the case in the near future. So avoid introducing a public API relying on QRhiTexture. This of course makes it impossible to retrieve the native object under a QSGTexture (as textureId() is not used anymore when rendering with the RHI). For that, an alternative approach will be introduced later on. Change-Id: I0099b23424cafa4958f78c03300b0c934b60d92c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Fix not printing logs with QSG_INFO when forcing rhi backend from C++Laszlo Agocs2019-08-293-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickWindow::setScenegraphBackend() may be called before QQuickWindow gets a chance to create a render loop. If QSG_INFO (the env.var.) is used instead of the logging category (qt.scenegraph.general), some logs are not printed because the code that enables the logging category is not yet run. To prevent confusion, make sure the logging category gets enabled before the first potential qCDebug. In the worst case we check twice but that's fine. Change-Id: Ibfc0af05050adc9766c30a2d15c778b2a51823fe Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Set point size in visualization vertex shaderLaszlo Agocs2019-08-292-1/+3
| | | | | | | | | | | | | | | | | | ...in order to avoid a validation layer warning with Vulkan when visualizing overdraw on a scene that includes drawing points (like some types of particles). Change-Id: Ia0a40f850ce5f7a0374c7b8779d5342f191c6973 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Remove an unused event type in the threaded render loopLaszlo Agocs2019-08-222-22/+0
| | | | | | | | | | Change-Id: I505ba09d6a0144f18bf29cda2f549c8b69ada1a5 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | rendernode example: Add support for MetalLaszlo Agocs2019-08-221-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | Plus clarify QQuickWindow::begin/endExternalCommands() in combination with QSGRenderNode in the docs. As the example demonstrates, calling these functions is not necessary within render() of a render node. Also fix an issue with resetting the scissor in the renderer after calling render() of a QSGRenderNode. Change-Id: If8c2dab38d62aa444266d37901f062a51e767f68 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Implement QSGRenderNode for the rhi pathLaszlo Agocs2019-08-223-33/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation is also refined and extended. Revise the rendernode example as well: make it possible to test and demonstrate both scissor and stencil based clipping. An implementation of the triangle for another graphics API should follow in a separate patch at a later point. For now only OpenGL is supported in combination with the RHI. Change-Id: I7ef9f6c6e0b44f1bdf44c9266ea3fa4736367a5d Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Rescale on rhi path too when NPoT textures not supportedLaszlo Agocs2019-08-172-0/+14
| | | | | | | | | | | | | | | | | | | | QRhi will not do this for us. Also handle mipmap filtering correctly in this regard. This will fix rendering on WebAssembly. Change-Id: I93a77b7c42bb43c59dfb7748f9fdbd7aa55f39bb Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | QSGDepthStencilBufferManager: don't use toStrongRef().data()Marc Mutz2019-08-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's an anti-pattern. Even though we don't expect other threads to destroy the last QSP while we use the pointer obtained from QWeakPointer, play it safe and use QWeakPointer idiomatically: as a non-owning reference, to be converted to an owning one for the duration of our use of the payload object. Add an assertion that explains why we don't expect expired weak_ptrs here. Amends 0f035c0ad79ca41a1473b64a4c0077e7085d3700. Change-Id: Ia39ef5fa243e0e73110aae13da35f4f2ada73a73 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Enable threaded render loop for d3d11Laszlo Agocs2019-08-141-10/+13
| | | | | | | | | | Change-Id: I5772b38c59b8fe3f9a30f56d3a559f6161443562 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Minor cleanup and logic fix in basic renderloopLaszlo Agocs2019-08-141-7/+10
| | | | | | | | | | | | | | | | The (gl) condition is clearly an oversight, the branch should be taken if either gl or rhi are valid. Change-Id: Ieb0a9aeec996f8940716f9fdafe90525b60fc248 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | scenegraph: fix error: 'QOffscreenSurface' does not name a typeMikko Gronoff2019-08-131-0/+1
| | | | | | | | | | Change-Id: I41a8b30b316b038ed1e3910adb0254931f385a2a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Implement QSG_VISUALIZE for RHILaszlo Agocs2019-08-0714-341/+1782
| | | | | | | | | | Change-Id: I6343f316e2ecff4e4d7454fb450a1bd0c5a917b8 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Fix 3+ level stencil clips on the rhi pathLaszlo Agocs2019-08-021-5/+5
| | | | | | | | | | Change-Id: Id1e0b904ba7273e63fb63ea53c513bde20dc9759 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Change rhi-related debug prints to categorized loggingLaszlo Agocs2019-08-023-11/+12
| | | | | | | | | | Change-Id: I4e8d3111a2f3b77e984756cc9eef49d42f0b647c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Re-enable colors with both gl and rhi glyph cachesLaszlo Agocs2019-07-313-7/+9
| | | | | | | | | | | | | | | | | | | | | | Follow up to the 5.13->dev merge where the lack of the qt5 submodule update made it impossible to use the new color argument. Also implements the color argument for the rhi variant of the glyph cache. Change-Id: Ie6c6ba3d647335eb6173d0c9f7fbe3a4ed6b1f24 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Have an autorelease pool for each frame on the render threadLaszlo Agocs2019-07-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Required with Metal. Drawables and various system resources get autoreleased and there is no pool to handle these on the SG render thread by default. This may present a slight perf hit in debug builds due to QMacAutoReleasePool doing smart but - for us - unnecessary stuff every time (so in our case, every frame) but will do for now. This complements the QRhiMetal change for not holding onto the drawable when skipping the present. The pool is essential then to prevent nextDrawable from starving and so blocking. Task-number: QTBUG-76953 Change-Id: Iaf803a0e20504d6b349d3564eda1677868fb29ef Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Avoid locking up on resize with threaded loop and the rhiLaszlo Agocs2019-07-301-4/+18
| | | | | | | | | | | | | | | | | | | | This was visible on X11 only because there beginFrame() happened to fail once or twice with out-of-date swapchain when there were a lot of resizes in a row. Handle this case correctly by waking up the main thread as appropriate. Change-Id: I67dc18522e1c05070267fd355095324f48259276 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Re-enable threaded render loop with Vulkan on LinuxLaszlo Agocs2019-07-301-8/+0
| | | | | | | | | | Change-Id: I05440c54b99ddb6aac9a47e8b33a00be41c13055 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-263-10/+30
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/handlers/qquickpointerdevicehandler.cpp src/quick/scenegraph/qsgdefaultglyphnode.cpp src/quick/scenegraph/qsgdefaultglyphnode_p.cpp src/quick/scenegraph/qsgdefaultglyphnode_p_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp Done-With: Jan Arve Sæther <jan-arve.saether@qt.io> Done-With: Laszlo Agocs <laszlo.agocs@qt.io> Change-Id: I35749152f8dce44b9af8d52b1283629879010f11
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-243-9/+30
| |\ | | | | | | | | | Change-Id: I081bcb9cc238e6cff5f8a23b684c5d6f76dba047
| | * Support text color for color fontsEskil Abrahamsen Blomfeldt2019-07-193-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support pen color for color fonts, we have to bake the color into the cache (since the cache contains actual color data and not alpha values). This is equivalent of 78caba7ae637bf4b33631c3425eb92ec3946c99e in Qt Base. [ChangeLog][Text] Added support for text color when using color fonts. Task-number: QTBUG-74761 Change-Id: I5910636c240bd4c0ec3f0b13db4e2f78d4b062ff Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-122-22/+27
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmltypeloader.cpp src/quick/scenegraph/qsgopengldistancefieldglyphcache.cpp Change-Id: I1a226d8738db2ec06e3cef240a0e040e7c144cad