Sync rhi backingstore prefer-software env.var with Quick

Behaving differently in QQuickWindow vs. a QRhi-based widget
window is not great for WebEngine. The env.var naming is not
the best (QSG prefix) but we already have some precedent for
this (recognizing QSG_INFO in QRhi), and there is no other
choice anyway.

Task-number: QTBUG-116445
Change-Id: Ibfd495cbd1d42502441d6629325bdeb033e813f3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ffb857e9d0745fdd31bca091333f1120c5857d7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 69c0ca3174e2484a241dcfbeb786084eca3c57e5)
This commit is contained in:
Laszlo Agocs 2023-09-14 15:56:08 +02:00 committed by Qt Cherry-pick Bot
parent 6378d98e01
commit 1048b43ef9

View File

@ -56,6 +56,11 @@ bool QBackingStoreRhiSupport::create()
QOffscreenSurface *surface = nullptr;
QRhi::Flags flags;
// This must be the same env.var. Qt Quick uses, to ensure symmetry in the
// behavior between a QQuickWindow and a (QRhi-based) widget top-level window.
if (qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER"))
flags |= QRhi::PreferSoftwareRenderer;
if (m_config.api() == QPlatformBackingStoreRhiConfig::Null) {
QRhiNullInitParams params;
rhi = QRhi::create(QRhi::Null, &params, flags);