From 5489f9f07a73c6b5b97702731a5092463a01fb5b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 6 Dec 2023 20:17:40 +0000 Subject: renderer: use xray for background blur on small() surfaces ref #4050 --- src/render/OpenGL.cpp | 7 +++++-- src/render/OpenGL.hpp | 5 ++--- src/render/Renderer.cpp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index fde04c5f..845b3caa 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -583,14 +583,14 @@ void CHyprOpenGLImpl::renderRect(CBox* box, const CColor& col, int round) { renderRectWithDamage(box, col, &m_RenderData.damage, round); } -void CHyprOpenGLImpl::renderRectWithBlur(CBox* box, const CColor& col, int round, float blurA) { +void CHyprOpenGLImpl::renderRectWithBlur(CBox* box, const CColor& col, int round, float blurA, bool xray) { if (m_RenderData.damage.empty()) return; CRegion damage{m_RenderData.damage}; damage.intersect(*box); - CFramebuffer* POUTFB = blurMainFramebufferWithDamage(blurA, &damage); + CFramebuffer* POUTFB = xray ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(blurA, &damage); m_RenderData.currentFB->bind(); @@ -1233,6 +1233,9 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) { if (pWindow->m_sAdditionalConfigData.forceNoBlur) return false; + if (pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall) + return true; + const auto PSURFACE = pWindow->m_pWLSurface.wlr(); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index efccaad4..01e05af1 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -120,7 +120,7 @@ class CHyprOpenGLImpl { void end(); void renderRect(CBox*, const CColor&, int round = 0); - void renderRectWithBlur(CBox*, const CColor&, int round = 0, float blurA = 1.f); + void renderRectWithBlur(CBox*, const CColor&, int round = 0, float blurA = 1.f, bool xray = false); void renderRectWithDamage(CBox*, const CColor&, CRegion* damage, int round = 0); void renderTexture(wlr_texture*, CBox*, float a, int round = 0, bool allowCustomUV = false); void renderTexture(const CTexture&, CBox*, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false); @@ -142,6 +142,7 @@ class CHyprOpenGLImpl { void makeLayerSnapshot(SLayerSurface*); void renderSnapshot(CWindow**); void renderSnapshot(SLayerSurface**); + bool shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWindow* pWindow); void clear(const CColor&); void clearWithTex(); @@ -223,8 +224,6 @@ class CHyprOpenGLImpl { void preBlurForCurrentMonitor(); - bool shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWindow* pWindow); - bool passRequiresIntrospection(CMonitor* pMonitor); friend class CHyprRenderer; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 8206dc2b..d20e10b8 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -502,7 +502,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* if (pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && *PBLUR) { CBox wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h}; wb.scale(pMonitor->scale).round(); - g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha); + g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha, + g_pHyprOpenGL->shouldUseNewBlurOptimizations(nullptr, pWindow)); renderdata.blur = false; } -- cgit v1.2.3