From 91a6c53197887a15ca3914f6488850da8bb305f6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 9 Apr 2022 17:06:09 +0200 Subject: [PATCH] Added blur_passes config --- example/hyprland.conf | 3 +++ src/config/ConfigManager.cpp | 1 + src/render/OpenGL.cpp | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/example/hyprland.conf b/example/hyprland.conf index db239c18..59dc6b07 100644 --- a/example/hyprland.conf +++ b/example/hyprland.conf @@ -30,6 +30,9 @@ decoration { rounding=10 blur=1 blur_size=8 # minimum 2 + blur_passes=1 # minimum 1, more passes = more resource intensive. + # Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 30-ish) will produce artifacts. + # if you want heavy blur, you need to up the blur_passes. } animations { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 8af72425..4d54406d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -25,6 +25,7 @@ CConfigManager::CConfigManager() { configValues["decoration:rounding"].intValue = 1; configValues["decoration:blur"].intValue = 1; configValues["decoration:blur_size"].intValue = 8; + configValues["decoration:blur_passes"].intValue = 1; configValues["dwindle:pseudotile"].intValue = 0; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index b8bacd05..31934d98 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -324,6 +324,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, float matrix[9] wlr_matrix_transpose(glMatrix, glMatrix); const auto RADIUS = g_pConfigManager->getInt("decoration:blur_size") + 2; + const auto BLURPASSES = g_pConfigManager->getInt("decoration:blur_passes"); const auto PFRAMEBUFFER = &m_mMonitorFramebuffers[m_RenderData.pMonitor]; auto drawWithShader = [&](CShader* pShader) { @@ -352,8 +353,10 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, float matrix[9] glDisableVertexAttribArray(pShader->texAttrib); }; - drawWithShader(&m_shBLUR1); // horizontal pass - drawWithShader(&m_shBLUR2); // vertical pass + for (int i = 0; i < BLURPASSES; ++i) { + drawWithShader(&m_shBLUR1); // horizontal pass + drawWithShader(&m_shBLUR2); // vertical pass + } glBindTexture(tex.m_iTarget, 0);