From 024752bbe30aed16fddfb3a2c86d63c3eab7e4dc Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 1 Aug 2022 20:18:26 +0200 Subject: [PATCH] fix new blur optimizations with non-full damage --- src/events/Monitors.cpp | 2 ++ src/render/OpenGL.cpp | 19 +++++++++++++++++++ src/render/OpenGL.hpp | 1 + 3 files changed, 22 insertions(+) diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index b8b5859e..6bde6f34 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -153,6 +153,8 @@ void Events::listener_monitorFrame(void* owner, void* data) { return; } + g_pHyprOpenGL->preRender(PMONITOR); + if (!wlr_output_damage_attach_render(PMONITOR->damage, &hasChanged, &damage)){ Debug::log(ERR, "Couldn't attach render to display %s ???", PMONITOR->szName.c_str()); return; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 4095099b..a6db359a 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -579,6 +579,25 @@ void CHyprOpenGLImpl::markBlurDirtyForMonitor(CMonitor* pMonitor) { m_mMonitorRenderResources[pMonitor].blurFBDirty = true; } +void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) { + static auto *const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_new_optimizations")->intValue; + + if (!*PBLURNEWOPTIMIZE || !m_mMonitorRenderResources[pMonitor].blurFBDirty) + return; + + bool has = false; + + for (auto& w : g_pCompositor->m_vWindows) { + if (w->m_iWorkspaceID == pMonitor->activeWorkspace && w->m_bIsMapped && !w->m_bHidden && !w->m_bIsFloating) { + has = true; + break; + } + } + + if (has) + g_pHyprRenderer->damageMonitor(pMonitor); +} + void CHyprOpenGLImpl::preBlurForCurrentMonitor() { // make the fake dmg diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 14995979..5e8d32e6 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -88,6 +88,7 @@ public: void markBlurDirtyForMonitor(CMonitor*); void preWindowPass(); + void preRender(CMonitor*); SCurrentRenderData m_RenderData;