fixes to the new blur system

This commit is contained in:
vaxerski 2022-08-01 12:23:09 +02:00
parent 070d7699a7
commit 6378990bc3
3 changed files with 26 additions and 6 deletions

View file

@ -600,6 +600,27 @@ void CHyprOpenGLImpl::preBlurForCurrentMonitor() {
m_RenderData.pCurrentMonData->blurFBDirty = false; 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) { 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()!"); 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; 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? // vvv TODO: layered blur fbs?
const auto POUTFB = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating) ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque); const auto POUTFB = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating) ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque);

View file

@ -87,6 +87,8 @@ public:
void markBlurDirtyForMonitor(CMonitor*); void markBlurDirtyForMonitor(CMonitor*);
void preWindowPass();
SCurrentRenderData m_RenderData; SCurrentRenderData m_RenderData;
GLint m_iCurrentOutputFb = 0; GLint m_iCurrentOutputFb = 0;

View file

@ -320,6 +320,9 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
renderLayer(ls.get(), PMONITOR, time); renderLayer(ls.get(), PMONITOR, time);
} }
// pre window pass
g_pHyprOpenGL->preWindowPass();
// if there is a fullscreen window, render it and then do not render anymore. // if there is a fullscreen window, render it and then do not render anymore.
// fullscreen window will hide other windows and top layers // fullscreen window will hide other windows and top layers
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);