summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-01 12:23:09 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-01 12:23:09 +0200
commit6378990bc3e80fed74b30dc0e82fb051e2dbe1fa (patch)
tree214d35e259e56017d90077de44445c2749f8067c /src/render/OpenGL.cpp
parent070d7699a71cf5fd00379daea4442db3852a747c (diff)
fixes to the new blur system
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 83ced53d..25e45f88 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -600,6 +600,27 @@ void CHyprOpenGLImpl::preBlurForCurrentMonitor() {
m_RenderData.pCurrentMonData->blurFBDirty = false;
}
+void CHyprOpenGLImpl::preWindowPass() {
+ static auto* const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_new_optimizations")->intValue;
+
+ if (!m_RenderData.pCurrentMonData->blurFBDirty || !*PBLURNEWOPTIMIZE)
+ return;
+
+ bool hasWindows = false;
+ for (auto& w : g_pCompositor->m_vWindows) {
+ if (w->m_iWorkspaceID == m_RenderData.pMonitor->activeWorkspace && !w->m_bHidden && w->m_bIsMapped) {
+ hasWindows = true;
+ break;
+ }
+ }
+
+ if (!hasWindows)
+ return;
+
+ // blur the main FB, it will be rendered onto the mirror
+ preBlurForCurrentMonitor();
+}
+
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, float a, wlr_surface* pSurface, int round) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!");
@@ -635,12 +656,6 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
return;
}
- // blur the main FB, it will be rendered onto the mirror
- if (*PBLURNEWOPTIMIZE && m_RenderData.pCurrentMonData->blurFBDirty) {
- // redraw the blur. Since this resets the dirty flag, it will be drawn before the first window.
- preBlurForCurrentMonitor();
- }
-
// vvv TODO: layered blur fbs?
const auto POUTFB = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating) ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque);