From 38bd2bd83144e3b7e7935e3730c109358b3e5740 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 22 Jun 2020 12:26:23 +0200 Subject: Add test for rendercontrol + rendererinterface Also add support for doing QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Unknown). This becomes relevant especially in tests, where we may request a specific graphics API, but then want to switch back to the default behavior. Change-Id: Ib09c411432fc37bd4d36ce55d54d20af3f83860a Reviewed-by: Andy Nichols --- src/quick/scenegraph/qsgrhisupport.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/quick/scenegraph/qsgrhisupport.cpp') diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index aa5661fc94..4ba0cca65e 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -268,11 +268,18 @@ void QSGRhiSupport::checkEnvQSgInfo() void QSGRhiSupport::configure(QSGRendererInterface::GraphicsApi api) { - Q_ASSERT(QSGRendererInterface::isApiRhiBased(api)); - QSGRhiSupport *inst = staticInst(); - inst->m_requested.valid = true; - inst->m_requested.api = api; - inst->applySettings(); + if (api == QSGRendererInterface::Unknown) { + // behave as if nothing was explicitly requested + QSGRhiSupport *inst = staticInst(); + inst->m_requested.valid = false; + inst->applySettings(); + } else { + Q_ASSERT(QSGRendererInterface::isApiRhiBased(api)); + QSGRhiSupport *inst = staticInst(); + inst->m_requested.valid = true; + inst->m_requested.api = api; + inst->applySettings(); + } } QSGRhiSupport *QSGRhiSupport::instance() -- cgit v1.2.3