aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhishadereffectnode.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Call commitTextureOperations for small atlas texturesRoman Genkhel2021-03-231-1/+3
| | | | | | | | | | | | Atlas textures with size not greater than QSG_ATLAS_TRANSIENT_IMAGE_THRESHOLD are not visible Fixes: QTBUG-91182 Change-Id: I4e72e1c32c15b9e1a21cdb07262f219cc641bb5f Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a7b32a3e893892fc96d58af110af568043f09e72) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use a single code path to load a QShader in QSGRhiShaderEffectNodeLaszlo Agocs2020-11-231-13/+4
| | | | | | Pick-to: 6.0 Change-Id: I8fec25df83768883896d195c09489aeb23abdafd Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Match new qHash() signatureEskil Abrahamsen Blomfeldt2020-09-171-1/+1
| | | | | | | | As documented in Qt 6 porting guide, qHash() should now also accept a size_t as seed in addition to returning it. Change-Id: I2b3ea26f631203468c071fa6ff65f95d82566132 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* ShaderEffect: vertexShader and fragmentShader are now URLsLaszlo Agocs2020-06-181-4/+3
| | | | | | | | | | | | | | | | ..and so fully compatible in behavior with properties like Image.source. The main improvement here is that unlike with the old code, which incorrectly handled local file URLs, one can now write fragmentShader: "myshader.frag.qsb" which leads to picking up the file relative to the component (the .qml file), as expected. Existing code (that uses file: or qrc: URLs) will continue to work as-is. Change-Id: I89dd84b998b59ae6d5b6cb3d8a6353961ee8bb4a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Anisotropic antialiasing for distance field textEskil Abrahamsen Blomfeldt2020-06-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Update qtbase dependencyJonas Karlsson2020-06-051-3/+4
| | | | | | | | | | | | - Adapt to uniform name type change. - Fix compiler warnings from deprecated QChar constructor. Use string literal prefix 'u' to avoid run-time conversion. Follow up on 1b33ee95e5c6e5e27f732fd273920861fdae486a in qtbase. Change-Id: I2322a630ba2dd394576cd65bd7d6eac937a545f2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make QSGMaterialRhiShader become QSGMaterialShaderLaszlo Agocs2020-06-021-4/+3
| | | | | | | | | | | | | | | | After a symbiotic relationship in Qt 5.14 and 5.15, it is time for QSGMaterialRhiShader to devour its older sibling and take its place. This makes the direct OpenGL rendering path disfunctional. All QSGMaterial Qt 6 TODOs are solved, the API is clean and straightforward again: a QSGMaterial creates a QSGMaterialShader, no special flags and options needed. (it's just that QSGMaterialShader now has a slightly different API) Task-number: QTBUG-79268 Task-number: QTBUG-82997 Change-Id: I545ca8d796c5535e81957c706e7832133be15b7d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid truncating in QSGMaterial::compare() implementationsLaszlo Agocs2020-05-271-2/+3
| | | | | | | | | | | | The Qt 5.0 pattern of subtracting pointers and returning them is not suitable (on 64-bit archs) since the return type is an int. There is also QSGTexture::comparisonKey() now which is a qint64. Just return -1 and 1 as appropriate. Change-Id: Iaf3377b484a8c4b19b0960f1e8def05e4fa68ce7 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Adjust QSGTexture comparisonKey typeLaszlo Agocs2020-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | The original choice was int, simply following textureId(). This was later deemed insufficient: instead of a GLuint, the value is now often a 64-bit value (on 64 bit systems), based on a pointer, since the identity of a texture in the RHI world is the QRhiTexture* itself. In a custom texture implementation it is likely that the value here is the value of a native object handle, either a pointer or some 32 or 64 bit integer. Inspired by the recent QSGTexture::NativeTexture struct change (void* -> quint64), switch to a qint64 which is big enough to hold all these without truncation. We choose a signed value here, in order to allow for the following pattern that is widespread in material compare() implementations: if (qint64 diff = m_texture->comparisonKey() - other->texture()->comparisonKey()) return diff; Fixes: QTBUG-83769 Change-Id: I8bdae8cd835282358ded53b3703142b8f26e4400 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Don't detach from atlas when using qt_SubRect_fooPaul Olav Tvete2020-05-221-2/+6
| | | | | | Fixes: QTBUG-84299 Change-Id: Ib1c73ae5e7f5df8d4390d33ce0e61c06b052cd59 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Fix crashing Controls autotests due to shadereffect lifetime issuesLaszlo Agocs2020-05-131-5/+3
| | | | | | | | | | | | | | | | | | | | | Make the QSGShaderEffectNode base class a QObject, the subclass (QSGRhiShaderEffectNode) is already a QObject so we lose nothing. This way we can get rid of the textureChanged() signal from the shadereffectmanager (the object living on the gui thread), and so the node (living on the render thread) does not need to do emit m_mgr->textureChanged() on the render thread. The signal emission in itself was perfectly fine, except when m_mgr happened to be destroyed already in case the node outlived the gui thread's item (and m_mgr). After the change we have something that is closer to what the direct OpenGL implementation did - and some of the interfaces in QSGContext get a lot cleaner in fact because the node can be instantiated on its own, without the involving the shadereffectmanager object that does not even live on the render thread. Change-Id: Ibb918cc3eaa08faddb8b8e5dfa3e34b212161703 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Move updateRhiTexture and co. to QSGTextureLaszlo Agocs2020-04-281-2/+2
| | | | | | | | | | | | | | | | | | | Use a more descriptive name, commitTextureOperations() in order to avoid confusion with QSGDynamicTexture::updateTexture() which has nothing to do with this. With this the QSGTexture interface has all 5.14 pending changes done (changes that were plumbed via ugly hacks due to having had to deal with binary compatibility). The awful enforcing of subclassing QSGTexturePrivate for each and every QSGTexture subclass is now eliminated. Purging the direct OpenGL code path will involve removing QSGTexture functions like textureId(), bind(), updateBindOptions(). With this patch we now we have all the equivalents (or, in some cases, spiritual successors) in place. Task-number: QTBUG-82997 Change-Id: I7a831f982070c52abc7a36604130a1110d14ff9c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Don't truncate the hashesEskil Abrahamsen Blomfeldt2020-04-221-1/+1
| | | | | | | | Fixes a compile warning on MSVC because we were truncating the 64-bit qHash() return value to 32-bit. Change-Id: I8cf568d0352efdb07471f5b758dc781cfb855253 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change qHash return value to size_tFabian Kosmale2020-04-161-1/+1
| | | | | | | | Else on Windows there's a warning: conversion from 'size_t' to 'uint', possible loss of data Change-Id: Ifed4899409a13fed31c206ae1e0f195280ee2925 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add argument to QSGTexture::removedFromAtlas()Laszlo Agocs2020-04-161-3/+1
| | | | | | | | | | | ...as requested by the Qt 6 TODO. To preserve binary (and source) compatibility in 5.14, the argument was changed into a variable in QSGTexturePrivate, with a public setter. This can now go away and the signature of removedFromAtlas() can get updated. Task-number: QTBUG-82997 Change-Id: I930c0014712c78e140b778b6e9a4d8b92c5bdc8c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-2/+2
| | | | | | | | | | | as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change const ref to ref in QSGMaterialRhiShader as per API reviewLaszlo Agocs2019-09-231-6/+6
| | | | | | Change-Id: I7783ed26a66f03ebe3b26bcba2f42f9fff45a417 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Add the graphics api independent scenegraph portLaszlo Agocs2019-07-041-0/+886
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>