aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhisupport.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2020-06-16 17:03:47 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2020-06-17 17:42:01 +0200
commit83fb4f6743860bfb746e6243aad00513d498db4f (patch)
tree816bf1a1d509124c6bfb4fc34cce2a4ed885f40e /src/quick/scenegraph/qsgrhisupport.cpp
parent48e919e9647fd07351be37e1ad7efdda9c550be9 (diff)
Clean up QT_CONFIG(opengl)
Accelerated graphics is now possible without OpenGL support. With this change, a Qt build with -no-opengl can still run Qt Quick with a Vulkan, Metal, or Direct3D backend. Fixes: QTBUG-84027 Change-Id: Ib63c733d28cfdf7de16b138df136fa7628e1747b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 07730a5d2b..86c2ea7806 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -39,9 +39,7 @@
#include "qsgrhisupport_p.h"
#include "qsgcontext_p.h"
-#if QT_CONFIG(opengl)
# include "qsgdefaultrendercontext_p.h"
-#endif
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickwindow_p.h>
@@ -177,10 +175,11 @@ void QSGRhiSupport::applySettings()
m_rhiBackend = QRhi::D3D11;
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
m_rhiBackend = QRhi::Metal;
-#else
+#elif QT_CONFIG(opengl)
m_rhiBackend = QRhi::OpenGLES2;
+#else
+ m_rhiBackend = QRhi::Vulkan;
#endif
- // Vulkan has to be requested explicitly
// Now that we established our initial choice, we may want to opt
// for another backend under certain special circumstances.
@@ -439,12 +438,6 @@ const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res,
const QSGDefaultRenderContext *rc,
const QQuickWindow *w)
{
-// ### 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();
if (res == QSGRendererInterface::RhiResource || !rhi)
return rhi;
@@ -484,12 +477,6 @@ 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)
@@ -703,18 +690,13 @@ QImage QSGRhiSupport::grabOffscreen(QQuickWindow *window)
wd->rhi = rhi.data();
-// ### 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)
QSGDefaultRenderContext::InitParams params;
params.rhi = rhi.data();
params.sampleCount = 1;
params.initialSurfacePixelSize = pixelSize;
params.maybeSurface = window;
wd->context->initialize(&params);
-#endif
+
// There was no rendercontrol which means a custom render target
// should not be set either. Set our own, temporarily.
window->setRenderTarget(QQuickRenderTarget::fromRhiRenderTarget(rt.data()));