Commit Graph

24 Commits

Author SHA1 Message Date
Volker Hilsheimer 3f1a644ee3 Replace deprecated QImage::mirror(ed) with flip(ped)
Follow up on change in qtbase:577946c1f05aaaa2a3f9682001aeb4144386b26b.

Task-number: QTBUG-129575
Change-Id: I5f25e98d8991fae6ddd9cc2d875bba91cdfbdd88
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-12-02 11:36:10 +01:00
Volker Hilsheimer 8e0ae95999 Fix build of rendercontrol test on Android
Amends 8e45b822d4, which for some reason
made it through CI, presumably because we don't build for Android with
a private_tests configuration in CI.

Task-number: QTBUG-122292
Change-Id: If6f12364565f6c4aca812a09019c6decbcbdfe60
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-04-10 23:10:50 +02:00
Laszlo Agocs 8e45b822d4 Add a way to set a custom depth texture on a QQuickRenderTarget
Task-number: QTBUG-122292
Change-Id: I54efb4a8ca84b2f191169509bafadd78b2948ee7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-04-05 14:48:16 +02:00
Tor Arne Vestbø 655ff8592b Use new Qt configure feature for Metal
Change-Id: I603018d3f4c6a49c39f7daed25101c24edbbfc02
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-03-25 19:03:08 +01:00
Lucie Gérard 9c5fc88388 Correct license for test files
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-02-27 10:32:21 +01:00
Laszlo Agocs ace43e1db1 Adapt to the RHI API concept
Besides following the header naming changes, make the obvious API
changes that are based on data that is already there but was hidden
previously due to not wanting anything QRhi to shine through in the
public API.

This kind of hiding is no longer needed, even if qrhi.h and similar
still cannot be included from a public header. Forward declarations
are now perfectly fine however.

Task-number: QTBUG-113331
Change-Id: I9a114082cf9218edc487df50956f5793d6b8bdb4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-22 12:08:08 +02:00
Marc Mutz 958cd3ee10 Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:

  auto QtContainerClass = anyOf(
      expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
      expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
  makeRule(cxxMemberCallExpr(on(QtContainerClass),
                             callee(cxxMethodDecl(hasAnyName({"count", "length"),
                                                  parameterCountIs(0))))),
           changeTo(cat(access(o, cat("size"), "()"))),
           cat("use 'size()' instead of 'count()/length()'"))

a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.

Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-07 23:38:48 +02:00
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
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>
2022-06-11 08:05:15 +02:00
Andreas Buhr b7bc2c62d3 Skip flaky test tst_RenderControl::renderAndReadBackWithRhi() on Android
Pick-to: 6.2 6.3
Task-number: QTBUG-102780
Change-Id: I86ba957b9a1d9daf409a1723f53d9e18d30f89bc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-04-26 16:39:08 +02:00
Laszlo Agocs 991ca56147 Improve testing of resizing in the rendercontrol autotest
Drop the unnecessary calls to create and setRenderTarget. At the same
time, start testing that resizing really works as expected.

Pick-to: 6.3
Change-Id: I8d60219767fded8069a79abaf5ce85c1cd678974
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-02-01 15:21:27 +01:00
Mitch Curtis e310dadef7 Consolidate test helpers into private libraries
Previously each test would include and build sources from the shared
folder. Now we make those sources a library, build it once, then have
each test link to it instead.

We also take the opportunity to move some helpers that qtquickcontrols2
had added into the quicktestutils library where it makes sense, and
for the helpers that don't make sense to be there, move them into
quickcontrolstestutils.

We add the libraries to src/ so that they are internal modules built as
part of Qt, rather than tests. That way we can use them in a standalone
test outside of qtdeclarative.

Task-number: QTBUG-95621
Pick-to: 6.2
Change-Id: I0a2ab3976fdbff2e4414df7bdc0808f16453b80a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-09-13 21:17:04 +02:00
Oliver Wolff d10cc557e2 Remove Windows 7 codepaths
Pick-to: 6.2
Task-number: QTBUG-84432
Change-Id: I623b45de6db5060516c0bec30a1e4c1ecbe8374d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-02 13:31:23 +02:00
Andreas Buhr 7e029878c0 Fix some "can be marked override" warnings
Change-Id: I13da0d085901314950c4fa0afb5853e183652e67
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-02-23 16:50:07 +01:00
Laszlo Agocs 3fadfb2c3f Expose the list of preferred instance extensions to rendercontrol users
As all QRhi stuff is private, it needs to have a public counterpart in
Qt Quick in order to fully support the case of Vulkan-based
QQuickRenderControl usage.

Change-Id: Iaf9a7aa56022acd31af6ebf16de6b83a04966ff4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-21 10:19:01 +01:00
Laszlo Agocs bbb6298204 Purge renderpass refs from renderer when redirecting via QRhiRt
Pick-to: 6.0
Fixes: QTBUG-88761
Change-Id: Ia5df65a4a09a7554a7d0cca4533f766cb5abe97b
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-11-24 18:07:44 +01:00
Laszlo Agocs ccb9eb0cc1 Follow QQuickGraphicsDevice changes in QQuickRenderTarget
They are not strictly related of course, but the API pattern should be
kept. We can also move away from the QSGTexture dependency which is good
since that was never directly related.

Change-Id: I9aedff5918443bda3d6e3ee1ea389071222d1ad7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-06-26 21:08:06 +02:00
Laszlo Agocs 4e266103ad Rename setSceneGraphBackend to setGraphicsApi
...and fix up the docs.

The string-based setSceneGraphBackend() stays of course (the docs have
been enhanced, however). The GraphicsApi enum-based overload is now
renamed to setGraphicsApi().

Using the same name for both functions is a historical artifact, reflecting
the evolution (5.0 - 5.8 - 5.14). In 6.0 we can give it a more appropriate
name, since it does not have much to do with "backends" from the user's
perspective.

Change-Id: Id75dbf81f50a148797e5b5de9be4000153737473
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-06-22 16:10:52 +02:00
Laszlo Agocs f621603692 Follow QRhi create-destroy API update
Change-Id: I0bc2cbce373febcb9073f15067eebbc1723462ba
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-02 10:38:03 +02:00
Eskil Abrahamsen Blomfeldt 5d4d598354 Adapt to changes in NativeTexture in qtbase
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>
2020-05-25 13:39:32 +02:00
Eskil Abrahamsen Blomfeldt 76e6f8e997 Fix assert in tst_QQuickRenderControl
We should not call device functions after resetting them.

Change-Id: I0470792457eff070ba3aeb767f5f5be622ebda42
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-19 16:10:57 +02:00
Laszlo Agocs 1adf4a8683 rendercontrol autotest: skip D3D on Win7
Unlike other Qt Quick tests, this one has its own logic for exercising
the available QRhi backends (so similar to what tst_qrhi does in
qtbase). Adjust it according to our current understanding (that we
cannot use D3D in the Windows 7 VM of the CI).

Change-Id: Ic6d78219c7bd6b8fbbefe363534b8915e64482df
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-11 08:43:13 +02:00
Laszlo Agocs 0c2ac3f6a5 Remove direct OpenGL test case from rendercontrol autotest
Leave only the RHI compatible ones.

Change-Id: Idfac1fad24f81131208de8baa1659858767c2f3b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-05-07 20:43:41 +02:00
Laszlo Agocs 400d176760 Allow redirecting QRhi-based rendering via QQuickRenderControl
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>
2020-04-11 18:23:55 +02:00
Laszlo Agocs 8a7e8190b7 Add autotest for QQuickRenderControl
Let's celebrate the feature's 6 year anniversary with introducing an
autotest for it.

Also happens to be good sample code for generating image sequences from
animated Quick scenes driven by a custom animation driver.

Tied to (direct) OpenGL at the moment. The RHIified version will appear
eventually as the work for introducing RHI support in QQuickRenderControl
progresses.

Task-number: QTBUG-78595
Change-Id: I7294ce986dca9968407ae738afe7ed2640ecd103
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-03-23 12:18:37 +01:00