qt6-bb10/tests/manual
Laszlo Agocs 68a4c5da9a Compose render-to-texture widgets through QRhi
QPlatformTextureList holds a QRhiTexture instead of GLuint. A
QPlatformBackingStore now optionally can own a QRhi and a
QRhiSwapChain for the associated window.  Non-GL rendering must use
this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still
rely on resource sharing between contexts. A widget tells that it
wants QRhi and the desired configuration in a new virtual function in
QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is
evaluated (among a top-level's all children) upon create() before
creating the repaint manager and the QWidgetWindow.

In QOpenGLWidget what do request is obvious: it will request an
OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget)
will be more interesting: it needs to honor the standard Qt Quick
env.vars. and QQuickWindow APIs (or, in whatever way the user
configured the QRhiWidget), and so will set up the config struct
accordingly.

In addition, the rhiconfig and surface type is (re)evaluated when
(re)parenting a widget to a new tlw. If needed, this will now trigger
a destroy - create on the tlw. This should be be safe to do in
setParent. When multiple child widgets report an enabled rhiconfig,
the first one (the first child encountered) wins. So e.g. attempting
to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same
top-level window will fail one of the widgets (it likely won't
render).

RasterGLSurface is no longer used by widgets. Rather, the appropriate
surface type is chosen.

The rhi support in the backingstore is usable without widgets as well.
To make rhiFlush() functional, one needs to call setRhiConfig() after
creating the QBackingStore. (like QWidget does to top-level windows)

Most of the QT_NO_OPENGL ifdefs are eliminated all over the place.
Everything with QRhi is unconditional code at compile time, except the
actual initialization.

Having to plumb the widget tlw's shareContext (or, now, the QRhi)
through QWindowPrivate is no longer needed.  The old approach does not
scale: to implement composeAndFlush (now rhiFlush) we need more than
just a QRhi object, and this way we no longer pollute everything
starting from the widget level (QWidget's topextra -> QWidgetWindow ->
QWindowPrivate) just to send data around.

The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split
is all gone. Instead, there is a QBackingStoreDefaultCompositor in
QtGui which is what the default implementations of composeAndFlush and
toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs
should continue working mostly as-is, apart from adapting to the
texture list changes and getting the native OpenGL texture id out of
the QRhiTexture)

As QQuickWidget is way too complicated to just port as-is, an rhi
manual test (rhiwidget) is introduced as a first step, in ordewr to
exercise a simple, custom render-to-texture widget that does something
using a (not necessarily OpenGL-backed) QRhi and acts as fully
functional QWidget (modeled after QOpenGLWidget). This can also form
the foundation of a potential future QRhiWidget.

It is also possible to force the QRhi-based flushing always,
regardless of the presence of render-to-texture widgets. To exercise
this, set the env.var. QT_WIDGETS_RHI=1. This picks a
platform-specific default, and can be overridden with
QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be
extended to query the platform plugin as well to check if the platform
plugin prefers to always do flushes with a 3D API.

QOpenGLWidget should work like before from the user's perspective, while
internally it has to do some things differently to play nice and prevent
regressions with the new rendering architecture. To exercise this
better, the qopenglwidget example gets a new tab-based view (that could
perhaps replace the example's main window later on?). The openglwidget
manual test is made compatible with Qt 6, and gets a counterpart in form
of the dockedopenglwidget manual test, which is a modified version of
the cube example that features dock widgets. This is relevant in
particular because render-to-texture widgets within a QDockWidget has
its own specific quirks, with logic taking this into account, hence
testing is essential.

For existing applications there are two important consequences with
this patch in place:

- Once the rhi-based composition is enabled, it stays active for the
lifetime of the top-level window.

- Dynamically creating and parenting the first render-to-texture
widget to an already created tlw will destroy and recreate the tlw
(and the underlying window). The visible effects of this depend on the
platform.  (e.g. the window may disappear and reappear on some,
whereas with other windowing systems it is not noticeable at all -
this is not really different from similar situtions with reparenting
or when moving windows between screens, so should be acceptable in
practice)

- On iOS raster windows are flushed with Metal (and rhi) from now on
(previously this was through OpenGL by making flush() call
composeAndFlush().

Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-11 21:25:00 +01:00
..
cmake/test_copy_file_if_different_command Use 'copy' but not 'copy_if_different' on Windows platforms 2022-02-10 02:31:05 +01:00
cocoa macOS: Add debug keyboard layout for manual testing 2021-08-23 17:30:18 +02:00
corelib/tools
diaglib Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
dialogs Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
embeddedintoforeignwindow
filetest Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
foreignwindows
gestures Fix deprecations in manual tests 2020-12-01 20:20:11 +01:00
highdpi Tests: Use REQUIRED COMPONENTS in find_package(Qt6...) 2021-12-13 14:16:26 +00:00
inputmethodhints
keypadnavigation
lance Baseline: Move the paintcommands code into the shared directory 2022-01-20 22:56:11 +01:00
markdown
mkspecs
network_remote_stresstest Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
network_stresstest Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
qcursor Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
qdesktopservices Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
qgraphicsitem
qgraphicsitemgroup
qgraphicslayout/flicker Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
qhttpnetworkconnection Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
qimagereader
qlayout
qlocale Add the "Territory" enumerated type for QLocale 2021-04-15 20:17:49 +08:00
qmetatype
qmimedatabase
qnetconmonitor QNetworkInformation: Rename parameter-less load() to loadDefaultBackend 2022-02-09 15:17:54 +01:00
qnetworkaccessmanager/qget
qnetworkinformation QNetworkInformation: Rename parameter-less load() to loadDefaultBackend 2022-02-09 15:17:54 +01:00
qnetworkreply Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
qopenglcontext
qopengltextureblitter Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
qopenglwidget Compose render-to-texture widgets through QRhi 2022-03-11 21:25:00 +01:00
qopenglwindow/multiwindow
qprintdevice_dump
qscreen
qscreen_xrandr xcb: Correctly update primary screen status with RandR 1.5 2022-01-12 03:17:47 +01:00
qssloptions
qsslsocket Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
qstorageinfo
qsysinfo
qt_poll Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
qtabbar
qtabletevent Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
qtbug-8933
qtbug-52641
qtexteditlist
qtexttableborders
qtouchevent Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
qvulkaninstance vulkan: Update legacy tests and examples to the modern validation layer 2021-05-31 17:16:49 +02:00
qwidget_zorder
repaint
rhi Compose render-to-texture widgets through QRhi 2022-03-11 21:25:00 +01:00
shortcuts
socketengine Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
startsystemmove tests: update startsystemmove manual test with latest api 2021-06-16 15:53:22 +02:00
textrendering
touch Rejig native interface plumbing 2021-05-12 22:02:05 +02:00
touchGraphicsItem
transientwindow
triangulator
unc
wasm wasm: add secondary thread exec manual test 2022-01-05 21:25:42 +01:00
widgetgrab Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
widgets Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
windowactivation Add manual test for window activation 2021-09-30 20:51:52 +02:00
windowchildgeometry Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
windowflags Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
windowgeometry Remove fatuously true or false QT_VERSION checks 2021-09-23 16:57:03 +02:00
windowmodality
windowtransparency
xcb_gl_integration
xembed-raster
xembed-widgets
CMakeLists.txt xcb: support xrandr(1.5) monitor setup 2021-09-01 20:32:04 +02:00
manual.pro xcb: support xrandr(1.5) monitor setup 2021-09-01 20:32:04 +02:00