summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/vkkhrdisplay
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-08-15 13:34:07 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2022-08-16 16:00:15 +0200
commite025b07c64a44e0fdf05b34bd183177d18a295a2 (patch)
tree91c57da257a16fde4af4fca5fff3bde3abeea9ea /src/plugins/platforms/vkkhrdisplay
parent2de14b81a9c76ce95c96385262467f41892a2a1c (diff)
vkkhrdisplay: Create the platform window always
No matter what the surface type was. We only support VulkanSurface, so if the type is something else, then a a qWarning is in order, but instead of returning nullptr (which will almost certainly cause a fail or crash in some form), we can just carry on normally. The resulting window will not be renderable from the application of course, but that is not always needed in fact, plus failing gracefully is nicer. The tst_qrhi autotest can now be run on the RPi4 also with -platform vkkhrdisplay. While there are some odd messages occurring from Mesa and co., the run now completes normally, with no failures. Change-Id: I77bd249096aede8e05458559458581d702054540 Pick-to: 6.4 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins/platforms/vkkhrdisplay')
-rw-r--r--src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp b/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp
index 411cda4af8..502c2518f2 100644
--- a/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp
+++ b/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp
@@ -219,7 +219,11 @@ QPlatformWindow *QVkKhrDisplayIntegration::createPlatformWindow(QWindow *window)
{
if (window->surfaceType() != QSurface::VulkanSurface) {
qWarning("vkkhrdisplay platform plugin only supports QWindow with surfaceType == VulkanSurface");
- return nullptr;
+ // Assume VulkanSurface, better than crashing. Consider e.g. an autotest
+ // creating a default QWindow just to have something to be used with
+ // QRhi's Null backend. Continuing to set up a Vulkan window (even
+ // though the request was Raster or something) is better than failing to
+ // create a platform window, and may even be sufficient in some cases.
}
QVkKhrDisplayWindow *w = new QVkKhrDisplayWindow(window);