diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2023-10-24 10:49:36 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-10-30 21:04:55 +0000 |
commit | ea31d83ff79807fa72811d29fb53696a5da2bc8d (patch) | |
tree | 2ab1afdff730e9e98a51e9ab28c2f4596a03e57e | |
parent | 79608ad27b0a79b36377cd118ff31654b84e2f98 (diff) |
Compile getAdapterLuid also with -no-opengl configs
It was not compiled in -no-opengl builds even though it should not
depend on OpenGL and was also used in non-OpenGL builds.
Pick-to: 6.5
Fixes: QTBUG-117751
Change-Id: I0bcb8496d25004573d1e00ffc276511f82e489bd
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit 751c110031fe94efec108c8f61d41eeb496a0c03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/core/web_engine_context.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 05ce9d39c..ddef165e8 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -178,31 +178,6 @@ bool usingSoftwareDynamicGL() #endif } -#if defined(Q_OS_WIN) -static QString getAdapterLuid() { - static const bool preferSoftwareDevice = qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER"); - QRhiD3D11InitParams rhiParams; - QRhi::Flags flags; - if (preferSoftwareDevice) { - flags |= QRhi::PreferSoftwareRenderer; - } - QScopedPointer<QRhi> rhi(QRhi::create(QRhi::D3D11,&rhiParams,flags,nullptr)); - // mimic what QSGRhiSupport and QBackingStoreRhi does - if (!rhi && !preferSoftwareDevice) { - flags |= QRhi::PreferSoftwareRenderer; - rhi.reset(QRhi::create(QRhi::D3D11, &rhiParams, flags)); - } - if (rhi) { - const QRhiD3D11NativeHandles *handles = - static_cast<const QRhiD3D11NativeHandles *>(rhi->nativeHandles()); - Q_ASSERT(handles); - return QString("%1,%2").arg(handles->adapterLuidHigh).arg(handles->adapterLuidLow); - } else { - return QString(); - } -} -#endif - static bool openGLPlatformSupport() { return QGuiApplicationPrivate::platformIntegration()->hasCapability( @@ -273,6 +248,31 @@ static const char *getGLType(bool /*enableGLSoftwareRendering*/, bool disableGpu } #endif // QT_CONFIG(opengl) +#if defined(Q_OS_WIN) +static QString getAdapterLuid() { + static const bool preferSoftwareDevice = qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER"); + QRhiD3D11InitParams rhiParams; + QRhi::Flags flags; + if (preferSoftwareDevice) { + flags |= QRhi::PreferSoftwareRenderer; + } + QScopedPointer<QRhi> rhi(QRhi::create(QRhi::D3D11,&rhiParams,flags,nullptr)); + // mimic what QSGRhiSupport and QBackingStoreRhi does + if (!rhi && !preferSoftwareDevice) { + flags |= QRhi::PreferSoftwareRenderer; + rhi.reset(QRhi::create(QRhi::D3D11, &rhiParams, flags)); + } + if (rhi) { + const QRhiD3D11NativeHandles *handles = + static_cast<const QRhiD3D11NativeHandles *>(rhi->nativeHandles()); + Q_ASSERT(handles); + return QString("%1,%2").arg(handles->adapterLuidHigh).arg(handles->adapterLuidLow); + } else { + return QString(); + } +} +#endif + #if QT_CONFIG(webengine_pepper_plugins) void dummyGetPluginCallback(const std::vector<content::WebPluginInfo>&) { |