From b90159c08901bb48a965bb682479f7717f964942 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:29:49 +0200 Subject: [PATCH] revert blur changes --- src/events/Layers.cpp | 2 -- src/render/OpenGL.cpp | 54 ++++++++++++++++++------------------------- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index 8d7c0d19..d41821a8 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -221,7 +221,6 @@ void Events::listener_commitLayerSurface(void* owner, void* data) { if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd - // TODO: only the committed area wlr_box geomFixed = {layersurface->geometry.x, layersurface->geometry.y, layersurface->geometry.width, layersurface->geometry.height}; g_pHyprRenderer->damageBox(&geomFixed); @@ -258,7 +257,6 @@ void Events::listener_commitLayerSurface(void* owner, void* data) { if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd - // TODO: only the committed area } g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID); diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 4080437e..25e45f88 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -656,59 +656,49 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, return; } - // vvv TODO: layered blur fbs? - const bool USENEWOPTIM = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating); - - const auto POUTFB = USENEWOPTIM ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque); + // vvv TODO: layered blur fbs? + const auto POUTFB = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating) ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque); pixman_region32_fini(&inverseOpaque); // bind primary m_RenderData.pCurrentMonData->primaryFB.bind(); - if (!USENEWOPTIM) { - // make a stencil for rounded corners to work with blur - scissor((wlr_box*)nullptr); // allow the entire window and stencil to render - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); + // make a stencil for rounded corners to work with blur + scissor((wlr_box*)nullptr); // allow the entire window and stencil to render + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); - glEnable(GL_STENCIL_TEST); + glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 1, -1); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + glStencilFunc(GL_ALWAYS, 1, -1); + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - renderTexture(tex, pBox, a, round, true, true); // discard opaque - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + renderTexture(tex, pBox, a, round, true, true); // discard opaque + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilFunc(GL_EQUAL, 1, -1); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - } + glStencilFunc(GL_EQUAL, 1, -1); + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); // stencil done. Render everything. wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; if (pixman_region32_not_empty(&damage)) { // render our great blurred FB static auto *const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur_ignore_opacity")->intValue; - renderTextureInternalWithDamage(POUTFB->m_cTex, USENEWOPTIM ? pBox : &MONITORBOX, *PBLURIGNOREOPACITY ? 255.f : a, &damage, USENEWOPTIM ? round : 0, false, false, false); + renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, *PBLURIGNOREOPACITY ? 255.f : a, &damage, 0, false, false, false); // render the window, but clear stencil - if (!USENEWOPTIM) { - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); - // draw window - glDisable(GL_STENCIL_TEST); - } - + // draw window + glDisable(GL_STENCIL_TEST); renderTextureInternalWithDamage(tex, pBox, a, &damage, round, false, false, true); } - - if (!USENEWOPTIM) { - glStencilMask(-1); - glStencilFunc(GL_ALWAYS, 1, 0xFF); - } - + + glStencilMask(-1); + glStencilFunc(GL_ALWAYS, 1, 0xFF); pixman_region32_fini(&damage); scissor((wlr_box*)nullptr); }