From 108ec0752f37d3eececf6dd8b8837b4b9f7cb9a2 Mon Sep 17 00:00:00 2001 From: zhangkun2 Date: Tue, 15 Sep 2026 17:15:29 +0800 Subject: [PATCH] fix: add RHI backend check for InWindowBlur blur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: InWindowBlur.qml blitterEnabled only checked isSoftwareRender and hasInWindowBlur, not RHI backend type; on SW architecture non-OpenGLES2 backends silently skip blur rendering 2. Fix: add isBlurBackendSupported() to check sceneGraphBackend is empty or opengl, gate blitterEnabled with this new condition 3. Impact: non-OpenGL backends fall back to opaque background; OpenGL/default backends unaffected (new condition returns true) Log: Fix semi-transparent blur background on non-OpenGL RHI backends Influence: 1. Test FloatingPanel blur on x86/ARM (OpenGL) — no regression 2. Test FloatingPanel background on SW architecture — should be opaque 3. Verify control center, file manager, album dialogs render correctly fix: 修复非OpenGL后端下窗口模糊背景半透明问题 1. 根因:InWindowBlur.qml 的 blitterEnabled 仅检查 isSoftwareRender 和 hasInWindowBlur,未检测 RHI 后端类型;SW 架构上非 OpenGLES2 后端静默跳过模糊渲染但 blitterEnabled 仍为 true 2. 方案:新增 isBlurBackendSupported() 检测 sceneGraphBackend 是否 为空或 opengl,在 blitterEnabled 中增加此条件 3. 影响:非 OpenGL 后端回退到不透明背景;OpenGL/默认后端不受影响 Log: 修复非OpenGL后端下窗口模糊背景半透明问题 Influence: 1. 测试 x86/ARM 架构(OpenGL)FloatingPanel 模糊效果——无回归 2. 测试 SW 架构 FloatingPanel 背景——应为不透明 3. 验证控制中心、文件管理器、相册弹窗背景显示正确 PMS: BUG-362545 --- qt6/src/qml/overridable/InWindowBlur.qml | 2 +- src/private/dqmlglobalobject.cpp | 15 +++++++++++++++ src/private/dqmlglobalobject_p.h | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/qt6/src/qml/overridable/InWindowBlur.qml b/qt6/src/qml/overridable/InWindowBlur.qml index a6eab580a..73f8498a5 100644 --- a/qt6/src/qml/overridable/InWindowBlur.qml +++ b/qt6/src/qml/overridable/InWindowBlur.qml @@ -18,7 +18,7 @@ Item { D.BackdropBlitter { id: blitter anchors.fill: parent - blitterEnabled: !D.DTK.isSoftwareRender && D.DTK.hasInWindowBlur + blitterEnabled: !D.DTK.isSoftwareRender && D.DTK.hasInWindowBlur && D.DTK.isBlurBackendSupported MultiEffect { id: blur diff --git a/src/private/dqmlglobalobject.cpp b/src/private/dqmlglobalobject.cpp index a63d5bd24..5bb623232 100644 --- a/src/private/dqmlglobalobject.cpp +++ b/src/private/dqmlglobalobject.cpp @@ -237,6 +237,21 @@ bool DQMLGlobalObject::isSoftwareRender() return isSoftware; } +// Check whether the current scene graph backend supports InWindowBlur rendering. +// The blur effect requires the OpenGL RHI backend; other backends (e.g. Vulkan, +// Metal, D3D11) are not supported by DBackdropNode's RHI render path and would +// silently fall back to a no-op (reset), leaving a semi-transparent background +// without actual blur. This is distinct from isSoftwareRender(), which only +// detects the explicit "software" backend string. +bool DQMLGlobalObject::isBlurBackendSupported() +{ + static bool supported = []() { + const QString backend = QQuickWindow::sceneGraphBackend(); + return backend.isEmpty() || backend == QLatin1String("opengl"); + }(); + return supported; +} + QString DQMLGlobalObject::windowManagerNameString() const { return DWindowManagerHelper::instance()->windowManagerNameString(); diff --git a/src/private/dqmlglobalobject_p.h b/src/private/dqmlglobalobject_p.h index e2d24d55b..bc7a14eb5 100644 --- a/src/private/dqmlglobalobject_p.h +++ b/src/private/dqmlglobalobject_p.h @@ -122,6 +122,7 @@ class DQMLGlobalObject : public QObject, public DTK_CORE_NAMESPACE::DObject Q_PROPERTY(bool hasAnimation READ hasAnimation NOTIFY hasAnimationChanged) Q_PROPERTY(bool hasInWindowBlur READ hasInWindowBlur NOTIFY hasInWindowBlurChanged) Q_PROPERTY(bool isSoftwareRender READ isSoftwareRender FINAL CONSTANT) + Q_PROPERTY(bool isBlurBackendSupported READ isBlurBackendSupported FINAL CONSTANT) Q_PROPERTY(DTK_GUI_NAMESPACE::DWindowManagerHelper::WMName windowManagerName READ windowManagerName CONSTANT) Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType READ themeType NOTIFY themeTypeChanged) Q_PROPERTY(QString windowManagerNameString READ windowManagerNameString CONSTANT) @@ -188,6 +189,7 @@ class DQMLGlobalObject : public QObject, public DTK_CORE_NAMESPACE::DObject static bool hasAnimation(); static bool hasInWindowBlur(); static bool isSoftwareRender(); + static bool isBlurBackendSupported(); DWindowManagerHelper::WMName windowManagerName() const; QString windowManagerNameString() const;