aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
Commit message (Collapse)AuthorAgeFilesLines
* Store DXBC instead of HLSL source in the qsb filesLaszlo Agocs2020-05-2648-44/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the -c argument when invoking qsb. The scripts are batch files already so they imply being run on Windows. With a standard VS prompt one gets fxc in the PATH too so we can let qsb invoke it. The result is that the built-in materials' qsb files do not contain HLSL source code anymore, rather they have the intermediate format with bytecode (conceptually this is like SPIR-V). So at run time there are no calls to d3dCompile() anymore when these shaders are involved. What does this mean in practice? With a few select examples: shapes, opening the Gallery view - before: 80 ms spent on HLSL source compilation - after: 0 ms. imageparticle, opening the first 3 views - before: 166 ms spent on HLSL source compilation - after: 0 ms shadereffects - before: 77 ms spent on HLSL source compilation - after: 29 ms (because this has custom shaders that still ship HLSL source) Long term this can hopefully be folded into qsb's to-be-implemented build system integration, so that it can automatically invoke the appropriate shader compiler on Windows and macOS. But for now we just do it manually and check in the regenerated .qsb files. Fixes: QTBUG-84268 Change-Id: Ibe2f80f99b3e52d5eb5eb808ea103cc766d22c04 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* RHI implementation of compressed texture atlasingEirik Aavitsland2020-05-267-96/+94
| | | | | | | | | | | | | Automatic atlasing (which is enabled by default for normal textures) was added as an experimental, opt-in feature in 5.11. This commit redoes that implementation for RHI, and enables it by default. [ChangeLog] Enable automatic atlasing of compressed textures (can be disabled with QSG_DISABLE_COMPRESSED_ATLAS=1) Fixes: QTBUG-78582 Change-Id: Ia8344fffdc8dd8fb476bf6a77057c359e4816487 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Adapt to changes in NativeTexture in qtbaseEskil Abrahamsen Blomfeldt2020-05-254-12/+8
| | | | | | | | | | To make the API less error prone, we have changed the void pointer to the texture handle to a 64-bit in instead, since all handles are maximum 64-bit. Task-number: QTBUG-78638 Change-Id: I9d995d6a883b3377f57d7c5b19d4bc4e15aa347b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Don't detach from atlas when using qt_SubRect_fooPaul Olav Tvete2020-05-222-2/+9
| | | | | | Fixes: QTBUG-84299 Change-Id: Ib1c73ae5e7f5df8d4390d33ce0e61c06b052cd59 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Add support for grabbing non-exposed windowsLaszlo Agocs2020-05-184-6/+81
| | | | | | | | | tst_qquickwindow::grab is now expected to pass in all combinations (both direct GL and RHI with any backend). Task-number: QTBUG-78608 Change-Id: I8c1f2ff3d50144c7dd4498160818d0860b67db15 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-05-151-4/+11
|\ | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktextedit/BLACKLIST Change-Id: If1868d27ea40fdc206971c2f7a24e91c5e62b1bf
| * Merge remote-tracking branch 'origin/5.15.0' into 5.15Qt Forward Merge Bot2020-05-141-4/+11
| |\ | | | | | | | | | Change-Id: I1f653fa9586e7d1e9c23acffba4512cfe9f951b8
| | * Make no-opengl builds succeed with Vulkan or MetalLaszlo Agocs2020-04-251-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends c83ca003248a21e368ebfbf799ef9580e0f4e6ac. In Qt 5.x we do not support using Qt Quick with the QRhi-based rendering path in -no-opengl builds. (such builds default to the software backend in fact) This is due to structural difficulties, such as QSGDefaultRenderContext (the .cpp) being tied to direct OpenGL. This will only get solved properly in Qt 6 when the direct OpenGL code path gets removed. However, compilation should not break in -no-opengl builds, regardless of which other conditions (QT_CONFIG(vulkan), Q_OS_MACOS, etc.) evaluate to true. The original patch missed the case when we have Vulkan enabled or we are on macOS or iOS (which implies enabling the Metal code path). This is now corrected by extending the scope of the condition. Change-Id: I0e87d8b033aed8fdfaca826bcd32596a532380a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io>
| * | qsgrhisupport.cpp: Fix warningsFriedemann Kleint2020-05-061-2/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | scenegraph/qsgrhisupport.cpp: In member function ‘void QSGRhiSupport::applySettings()’: warning: ‘QSting::QString(const QByteArray&)’ is deprecated scenegraph/qsgrhisupport.cpp:161:102: note: in expansion of macro ‘qPrintable’ scenegraph/qsgrhisupport.cpp:585:112: warning: ‘void QAbstractSocket::error(QAbstractSocket::SocketError)’ is deprecated Change-Id: I848e089f9d6d26fcb7f44e9e83883f5f971eba3e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit e3c64aff6579f04353608d4b218f031d9137d3f4)
| * Fix warning about deprecated "end" manipulatorThiago Macieira2020-04-221-1/+1
| | | | | | | | | | Change-Id: I9709abb1c3734e10a7defffd1607e09738faee69 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | rhi: Fix crashing Controls autotests due to shadereffect lifetime issuesLaszlo Agocs2020-05-137-23/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Use QRhi by defaultLaszlo Agocs2020-05-112-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Flip it over and instead of having to do QSG_RHI=1 to enable, one can now do QSG_NO_RHI=1 to disable. (note that follow up patches are expected to break the direct GL path, so QSG_NO_RHI will likely not be useful in practice) Also clean up the unused rhi flag in the struct that is used by the C++ APIs like QQuickWindow::setSceneGraphBackend(). Disables the qquickwidget autotest since QQuickWidget is not functional at the moment. Also disables the 'zoom' case in the qqmlpreview test. No idea why the external process is crashing there. (and the infrastructure does not exactly make it easy to debug anything, hence postponing any further investigation) Task-number: QTBUG-79268 Change-Id: Ia877ebe039a1d98ce661add82a6822a313fd10e5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Check thread->isRunning before posting WMReleaseSwapchainEventLaszlo Agocs2020-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | If the window becomes "obscured" (hidden), rendering (i.e. the render thread) stops. Getting a PlatformSurfaceAboutToBeDestroyed afterwards led to sending (and blocking) the WMReleaseSwapchainEvent to the render thread. This lead to a deadlock. While this is not something that happens normally, the problem is showcased by the "headless" case of the qquickwindow autotest which has a quite aggressive destroy() call on the QQuickWindow. Change-Id: I4726b76646564162af645508e08e35e268fea7e4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Have the basic render loop notify when the renderpass desc. disappearsLaszlo Agocs2020-05-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike the threaded one, this runs into the well-known issue of referencing the QRhiRenderPassDescriptor from data structures that are tied to the rendercontext. In the 'basic' loop there is one rendercontext that is reused for all windows. With threaded there would be one rendercontext per window, because there each window gets its own render thread, and so the problem cannot arise. Fix up the basic loop accordingly. Change-Id: Iea6713c6167ead7df96ac5f01d7b92d2ec57ce71 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Allow aborting syncAndRender() when sync results in no changesLaszlo Agocs2020-05-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the behavior with direct OpenGL. With QRhi, we avoided returning early because QRhi::beginFrame() was already called, so rendering the frame seemed like a better choice, at first at least. (the SkipPresent flag was likely introduced at a later point) Now we just do an endFrame() with SkipPresent set, and then return without moving on to the rendering phase. This fixes the noUpdateWhenNothingChanges case in the qquickwindow autotest. Additionally, it is suspected that this also fixes the qquicklayout auto test failures: there we have tests that wait for the frameSwapped() signal. Until now we did not abort the update when sync resulted in no changes (with RHI), which confuses said tests because there is an unexpected frameSwapped() signal emitted. Change-Id: Id6a859d27a525ed2c16c6b331b1ad5debabfcd77 Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Only alter rhi backend on Win7 and Metalless-macOS when not explicitly requestedLaszlo Agocs2020-05-111-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | When forcing a given backend from the C++ API or QSG_RHI_BACKEND, the user/application's request must be honored. Otherwise confusing situations arise. If the requested backend fails, let's just fail. It is the "just pick a platform specific default" case where we have the flexibility of choosing between the backends. Change-Id: If30c329bc7ce8ec26abee0ae2d4bcaef53df4718 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Pre-check for Metal support to please our CI VMsLaszlo Agocs2020-05-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An attempt to have a temporary solution for not having Metal support in the CI VMs. In order to run graphical Qt Quick autotests, we need to decide upfront if we want to go with Metal or try something else. Leaving the decision to the point of initializing the scenegraph (and so creating the QRhi instance) is not acceptable as that is way too late. If this works out, we can add a private helper in gui that does a more lightweight check directly via the Metal APIs. But for now, just create a QRhi temporarily. For qtbase autotests (like tst_qrhi) the problem does not apply because those simply go through all QRhi backends and exercise all that succeed to initialize, skipping the failing ones. But a real application, and so Qt Quick, does not work like that. Task-number: QTBUG-84067 Change-Id: I52f31871eb72c8d57bc604391963f0d022a3321c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Please the broken Win 7 CI by forcing OpenGL over D3DLaszlo Agocs2020-05-112-0/+26
| | | | | | | | | | | | | | | | | | Not very interesting because Windows 7 is not supported in Qt 6, but as long as the CI for it is around, let's try to keep it functional. Task-number: QTBUG-84067 Change-Id: Ifae65355466ae6d372169974e6034b370b0e1328 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Avoid stale renderpass references in ShaderManager's pipeline listLaszlo Agocs2020-05-074-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A similar problem popped up for Quick3D before, and it seems the same applies to Qt Quick layers as well: these can get released before the (per-rendercontext) resource caches, thus leaving invalid references in the cache keys. Solve this by simply notifying the renderer to clean up the relevant cache entries. Also utilize a very handy QRhi convenience, which allows us to schedule and defer the destruction of a QRhiResource to endFrame() (i.e. until after the current frame is submitted) with a single function call. Change-Id: I6db4914555f9504a2599e6ce1b0dc03b2b4b74de Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Add forward declaration for QSurfaceSamuli Piippo2020-05-061-0/+1
| | | | | | | | | | | | | | | | | | qsgdefaultrendercontext_p.h:101:9: error: ‘QSurface’ does not name a type | QSurface *maybeSurface = nullptr; | ^~~~~~~~ Change-Id: Ie062ba5ce5bd8071f1a55f3d966649748a707b9f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Fix subpixel positioned text with Text.NativeRenderingEskil Abrahamsen Blomfeldt2020-05-051-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We would be generating subpixel positioned glyphs based on the relative positions of the glyphs, ignoring the fractional part contributed by the origin of the text. So if the text origin was inside a pixel, the subpixel antialiasing would be wrong and we would see kerning errors. This was especially visible when using AlignHCenter on text with hinting disabled and resizing the item it was aligning to. Pick-to: 5.15 Task-number: QTBUG-49646 Change-Id: I0e709ba2b5d2440e34c94c6f819befe0a65a113a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Move some QSGRenderNodePrivate membersLaszlo Agocs2020-05-044-12/+25
| | | | | | | | | | | | Task-number: QTBUG-82997 Change-Id: Icea5ebe2f76cd5714435f17374388c73a5efda6d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Remove the 'windows' render loopLaszlo Agocs2020-05-045-704/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For compatibility, QSG_RENDER_LOOP=windows shows a warning and uses basic. For OpenGL proper, threaded is the default on Windows since Qt 5.5, so this will not affect there in any way. By default the windows loop was only used with ANGLE, or a non-standard opengl32 implementation like the Mesa llvmpipe shipped with the pre-built Qt packages. (and only on Windows, as the name suggests, even though the implementation of this loop is not tied to Windows in any way) For these we default to basic now. This will make no difference in practice: The windows render loop's value is that it takes the custom animation driver (advanced per frame, assuming that vsync-based throttling is active) approach from the threaded loop, while behaving like basic otherwise, thus providing smoother animations compared to basic, in theory. But due to its relatively little use (not the default since 5.5), ANGLE being removed in the near future, and not making much sense for the software rasterizer cases (those will have bigger problems than smoothly advancing animations, often providing no vsync, so they are better off with basic anyways), it makes no sense to invest into adding QRhi support for this loop too. Task-number: QTBUG-78578 Task-number: QTBUG-82997 Change-Id: I8ccd2e5e375799df5bb5018df247aa5b8197032a Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Add beforeFrameBegin() and afterFrameEnd() to QQuickWindowLaszlo Agocs2020-04-302-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New additions to the QQuickWindow signal family. Out of the three stages of the (modern) frame generation process, only two are covered by the existing beforeRendering, beforeRenderPassRecording - afterRenderPassRecording, afterRendering pairs. With the new ones, the rendering of a simple Qt Quick scene looks like the following: emit beforeFrameBegin QRhi::beginFrame() emit beforeRendering ... (additional render passes targeting textures when layers or View3D are involved) QRhi::beginPass() emit beforeRenderPassRecording ... emit afterRenderPassRecording QRhi::endPass() emit afterRendering QRhi::endFrame() emit afterFrameEnd This fits very well the revised QQuickRenderControl API, which has explicit beginFrame-endFrame points as well. So now we can make both QQuickRenderControl and the render loops to emit these signals at the appropriate points. Task-number: QTBUG-83883 Change-Id: Ib385b29393f3b39b0700432d14ea3976cf337fa0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Temporarily restore a QSGTexturePrivate functionLaszlo Agocs2020-04-282-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | ...for source compatibility with other modules, such as Qt Quick 3D. Once the relevant patches are in in those modules, this can be reverted. It is harmless otherwise, we simply reintroduce the QSGTexturePrivate rhiTexture() function that now just calls the public equivalent. Task-number: QTBUG-82997 Change-Id: I1e102a5f96b06e4dd7108149950eedab2941f4c2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Move updateRhiTexture and co. to QSGTextureLaszlo Agocs2020-04-2818-187/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix using fonts inside .ttc with render type QtRenderingEskil Abrahamsen Blomfeldt2020-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file name of a font is not identification in itself, because the file may be a font collection (.ttc). In this case, we also have to use the index of the font inside the .ttc as part of the cache key. [ChangeLog][QtQuick][Text] Fixed a bug where we would sometimes resolve the wrong fonts inside .ttc font collections. Pick-to: 5.15 Fixes: QTBUG-81810 Change-Id: I40ded703bcdd22dce2be58c5a481f0918e6d352b Reviewed-by: Shawn Rutledge <shawn.rutledge@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>
* | Update dependencies.yaml and adapt to API changes in qtbaseSimon Hausmann2020-04-222-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The evaluation callback does not have to perform the comparison anymore and the shared pointer of the private is not used in the API anymore. Also, the versionFunctions() has been moved out of QOpenGLContext and renamed QOpenGLVersionFunctionsFactory::get(). QHash doesn't keep iterators stable under erase(), so clean up the code relying on it, and avoid an intermediate QList at the same time. Task-number: QTBUG-74409 Change-Id: I90176be1067d88c8f2b1ea07198a06d432f5be9c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-04-221-2/+13
|\| | | | | | | Change-Id: Iafb7061945e011542fbf0f6ebe776f0a4187b0a4
| * RHI: Fix build with -no-openglFriedemann Kleint2020-04-171-2/+11
| | | | | | | | | | | | | | | | It is failing with a link error (missing QSGDefaultRenderContext). Task-number: QTBUG-83169 Change-Id: I0a3009a11269a7ffb142f2f51b6a1991d8ab3978 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | rhi: Make rendercontext query safe in slots connected to invalidatedLaszlo Agocs2020-04-172-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | separateIndexBuffers() returns an incorrect value when called from a slot connected to the invalidated() signal. This is because members like m_rhi are nulled out before emitting the signal (thus making isValid() return false), and this follows the existing QOpenGLContext (m_gl) behavior. Instead of altering the logic, just decide the value of separateIndexBuffers in initialize() and keep returning that from the query from then on. This is relevant for Qt Quick 3D at least, which happens to destroy manually created QSGLayer instances (which in turn own renderer objects) in a slot connected to invalidated(). Task-number: QTBUG-83469 Change-Id: I81b34b57921242367c80f7d04331cb6bd3318ec8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.15' into dev"Qt Forward Merge Bot2020-04-171-16/+27
|\ \
| * | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-171-16/+27
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qmltyperegistrar/qmltypesclassdescription.cpp src/quick/items/qquickrendertarget.h Change-Id: I9e24d2252a35b8e74af89ad72af796df658167ca
| | * Fix clipping of text with software backendEskil Abrahamsen Blomfeldt2020-04-161-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRawFont::boundingRect() returns the bounding rect of the glyph as reported by the system. On Windows, this unfortunately does not always include the antialiasing on the edges when the ClearType renderer is used (probably for compatibility reasons, since it matches the rendered size of the 8-bit alphamap.) Therefore, we have traditionally been applying a margin around rendering for 32-bit alpha maps, since there is no way to know for certain the exact rendered size with ClearType. It is tempting to expose the alphaMapBoundingBox through QRawFont (either replace the implementation of boundingRect() or add a new function) to avoid using private APIs here, but since it is a work-around and we hope the need for it will go away when we start using DirectWrite instead, it is better to keep it locked away for now. It is also too late to do such a change in Qt 5.15, so we can revisit the idea for Qt 6.x. [ChangeLog][Software Renderer] Fixed a bug where the last column of pixels in text would sometimes be clipped away. Fixes: QTBUG-80180 Change-Id: Ic611a80aef3e0e9b9cee0f3a22c9e24f717d5dfe Reviewed-by: Andy Nichols <andy.nichols@qt.io>
| | * Deprecate QSGEngineLaszlo Agocs2020-04-144-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | ...and warn about QSGAbstractRenderer becoming private. Task-number: QTBUG-78596 Change-Id: If545e223907a90ae3bcfde235e9677e8a0a5899b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
| | * Deprecate QSGSimpleMaterial and QSGSimpleMaterialShaderLaszlo Agocs2020-04-142-0/+11
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-82988 Change-Id: I53695571641654b8a8aed990d9de6b9947bb1186 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | Get rid of Q_OPENGL_ES* macrosEskil Abrahamsen Blomfeldt2020-04-176-17/+17
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These macros are no longer defined, and we will use QT_CONFIG instead, since that is more robust (it checks against misspellings). This also removes some dead code from the WebKit code in Qt QML. The condition never resolved to true in our case since Qt QML does not depend on Qt GUI, so even before the macro would not be set. This is just a leftover anyway, as the graphical parts are not used in QML. Task-number: QTBUG-83467 Change-Id: I2c4b7f928538cc75ce408deb357f8fd92a84d8e4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Change qHash return value to size_tFabian Kosmale2020-04-167-9/+9
| | | | | | | | | | | | | | | | 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-1610-34/+18
| | | | | | | | | | | | | | | | | | | | | | ...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>
* | Make comparisonKey() a pure virtual in QSGTextureLaszlo Agocs2020-04-1619-83/+53
| | | | | | | | | | | | | | | | | | | | In Qt 5.14 this was a virtual in QSGTexturePrivate due to having had to maintain binary compatibility. In 6.0 it becomes a pure virtual in QSGTexture. Task-number: QTBUG-82997 Change-Id: I26a42169b071fe8d413f5c89ef45850fa7222006 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Undeprecate (in docs) QSGSimpleRect/TextureNodeLaszlo Agocs2020-04-142-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 5.8 the deprecated tag was added since these are not functional when using a scenegraph backend other than default or software. In 6.0 we no longer have the d3d12 backend so out of the box QSGSimpleRectNode and QSGSimpleTextureNode are functional always. The factory-style QQuickWindow::createImageNode() alternatives are still preferred, but QSGSimpleTextureNode is used in a number of examples by subclassing, and the factory function approach is no alternative to that. Same goes internally, QQuickFramebufferObject is internally enabled by subclassing QSGSimpleTextureNode. By extension, it is assumed that there are applications out there relying on these classes too. So solve the dilemma by removing the \deprecated from the docs and that's that. Task-number: QTBUG-82997 Change-Id: I30e8ee6df91fa37a370bba7a0511c95275794e33 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Remove unused, deprecated QSGNode member variableLaszlo Agocs2020-04-141-1/+0
| | | | | | | | | | | | Task-number: QTBUG-82997 Change-Id: I19a232bca8c76a08be418f81b09917b0eb006cd6 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Implement the todo for adding anisotropy virtuals to QSGImageNodeLaszlo Agocs2020-04-144-5/+20
| | | | | | | | | | | | Task-number: QTBUG-82997 Change-Id: I236f5dadd8214ed1008ef4a7c9955c6f4c6b43cf Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Allow redirecting QRhi-based rendering via QQuickRenderControlLaszlo Agocs2020-04-114-24/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement the Qt 6 TODO for using an externally-provided render target when rendering the scene via QRhi. And say hello to QQuickRenderTarget. This class exists to allow potentially extending later what a "render target" consists of. Instead of hard-coding taking a single void * in the setRenderTarget() function, it takes a (implicitly shared, d-pointered) QQuickRenderTarget, which in turn can be created via static factory functions - of which new ones can be added later on. The new version of QQuickWindow::setRenderTarget() takes a QQuickRenderTarget. QQuickRenderControl gets a new initialize() variant, and a few extra functions (beginFrame(), endFrame()). This allows it to, by using QSGRhiSupport internally, create a QRhi under the hood. As a bonus, this also fixes an existing scenegraph resource leak when destroying the QQuickRenderControl. The qquickrendercontrol autotest is extended, with a QRhi-based test case that is executed for all of the QRhi backends that succeed to initialize. This is the internal verification. In addition, there is a Vulkan-based one that creates its own VkDevice, VkImage, and friends, and then uses Qt Quick with the same Vulkan device, targeting the VkImage. This test verifies the typical application use case. (sadly, life is too short to waste it on writing Vulkan boilerplate for an on-screen version of this, but we have the D3D11 example instead) What QQuickRenderControl loses, when used in combination with QRhi, is the grab() function. This never made much sense as a public API: QQuickWindow::grabWindow() call this when the window is associated with a rendercontrol, so as a public API QQuickRenderControl::grab() is redundant, because one gets the same result via the standard QQuickWindow API. It is now made private. More importantly, reading back the content is no longer supported, unless the 'software' backend is in use. The reasoning here is that, if the client of the API manages and provides the render target (as abstracted by QQuickRenderTarget), it is then expected to be capable of reading back the content in whatever way it sees fit, because it owns and manages the resource (e.g. the texture) in the first place. Providing fragile convenience functions for this is not reasonable anymore, and was questionable even with OpenGL, given that it is not future proof - what if the target is suddenly a floating point texture, for instance? The software backend case makes sense because that relies on private APIs - and has no render target concept either - so there the same cannot be achieved by applications by relying on public APIs only. Another new class is QQuickGraphicsDevice. This is very similar to QQuickRenderTarget, it is a simple container capable of holding a set of of native objects, mostly in the form of void*s, with future extensibility thanks to the static factory functions. (examples of native object sets would be a ID3D11Device + ID3D11DeviceContext, or a QOpenGLContext, or a MTLDevice + MTLCommandQueue, or a number of Vulkan device-related objects, etc.) This allows one to specify that the QRhi created under the hood (either by QQuickRenderControl or by the render loop) should use an existing graphics device (i.e. it is basically a public wrapper for values that go into a QRhi*InitParams under the hood). QQuickRenderTarget and QQuickGraphicsDevice are both demonstrated in a new example: rendercontrol_d3d11. We choose D3D11 because it is reasonably simple to set up a renderer with a window, and, because there is known user demand for Qt Quick - external D3D engine interop. Passing in the custom engine's own ID3D11Device and ID3D11DeviceContext is essential: the texture (ID3D11Texture2D) Qt Quick is targeting would not be usable if Qt Quick's QRhi was using a different ID3D11Device. Task-number: QTBUG-78595 Change-Id: I5dfe7f6cf1540daffc2f11136be114a08e87202b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-091-2/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * rhi: Remove broken assertLaszlo Agocs2020-03-241-2/+0
| | | | | | | | | | | | | | | | | | | | The recent patch for enabling the command buffer be specified already during the sync phase changes the behavior so that the m_currentFrameCommandBuffer may already contain a non-null value when we get to the render phase. Just remove the assert. Change-Id: I7f1e0d8cd6a307f64425ac4ce9dd056a89e7eed2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Remove QSGSimpleMaterialLaszlo Agocs2020-04-075-480/+1
| | | | | | | | | | | | | | | | | | | | And port the graph example to QSGMaterial and the RHI. We will not anymore add a direct OpenGL path (that would mean using QSGMaterialShader) for the example because the upcoming purge renders that useless anyway. Task-number: QTBUG-82988 Change-Id: I137575ed5df45b6bfc34a11d73dc5100945081c5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Remove QSGEngine and move QSGAbstractRenderer back to privateLaszlo Agocs2020-04-0710-554/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSGEngine goes away. Same for the associated example, which is the only place this is used anywhere in Qt. As a consequence, the renderer base class can be moved back to private: there is no use for it to be public anymore, since that made sense only in combination with QSGEngine. With the RHI-based rendering path driving a renderer directly is more complicated than before so it is not reasonable to allow the QSGEngine-style access anymore. Instead, one has QQuickRenderControl, which allows redirecting and manually driving the rendering of a QQuickWindow, thus providing an alternative to the legacy QSGEngine approach. Task-number: QTBUG-78596 Change-Id: If57c6b657b2053da1c4e545e517026382a71d998 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-205-7/+17
|\| | | | | | | Change-Id: I6f320ea43b5837444226228c118e57c4bda8702a