aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhisupport.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-24 17:30:56 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-04-25 06:33:01 +0000
commit3249ad6deff70eadf998faaac04bd2be5b6674f6 (patch)
tree18f17091b1cde7b4b084c796e04bee64bc626075 /src/quick/scenegraph/qsgrhisupport.cpp
parent7b9b44d8f45c57df1393960807497bd7286d3471 (diff)
Make no-opengl builds succeed with Vulkan or Metal
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>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 2bf70ddec6..f25bbe2d26 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -389,12 +389,13 @@ static const void *qsgrhi_mtl_rifResource(QSGRendererInterface::Resource res, co
const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res,
const QSGDefaultRenderContext *rc)
{
+// ### This condition is a temporary workaround to allow compilation
+// with -no-opengl, but Vulkan or Metal enabled, to succeed. Full
+// support for RHI-capable -no-opengl builds will be available in
+// Qt 6 once the direct OpenGL code path gets removed.
#if QT_CONFIG(opengl)
+
QRhi *rhi = rc->rhi();
-#else
- Q_UNUSED(rc)
- QRhi *rhi = nullptr;
-#endif
if (res == QSGRendererInterface::RhiResource || !rhi)
return rhi;
@@ -431,6 +432,12 @@ const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res,
default:
return nullptr;
}
+
+#else
+ Q_UNUSED(res);
+ Q_UNUSED(rc);
+ return nullptr;
+#endif
}
int QSGRhiSupport::chooseSampleCountForWindowWithRhi(QWindow *window, QRhi *rhi)