diff options
author | vaxerski <[email protected]> | 2023-07-19 21:04:45 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-07-19 21:04:45 +0200 |
commit | 88c2a027738ac7712b0d7d33ab4e57725463bfbe (patch) | |
tree | 7b8fa6b97c97810816b468c4e1892e0152f0c5d0 | |
parent | 89b87158dbf100e4177f4a010190ba5f80252eb2 (diff) | |
download | Hyprland-88c2a027738ac7712b0d7d33ab4e57725463bfbe.tar.gz Hyprland-88c2a027738ac7712b0d7d33ab4e57725463bfbe.zip |
render: avoid allocating mirrorfb for no reason
-rw-r--r-- | src/render/OpenGL.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 00204cdd..db9b136d 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -122,11 +122,13 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, bool fake) { m_RenderData.pCurrentMonData->primaryFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); m_RenderData.pCurrentMonData->mirrorFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); m_RenderData.pCurrentMonData->mirrorSwapFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); - m_RenderData.pCurrentMonData->monitorMirrorFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); createBGTextureForMonitor(pMonitor); } + if (m_RenderData.pCurrentMonData->monitorMirrorFB.isAllocated() && m_RenderData.pMonitor->mirrors.empty()) + m_RenderData.pCurrentMonData->monitorMirrorFB.release(); + if (!m_RenderData.pCurrentMonData->m_bShadersInitialized) initShaders(); @@ -1441,6 +1443,10 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl } void CHyprOpenGLImpl::saveBufferForMirror() { + + if (!m_RenderData.pCurrentMonData->monitorMirrorFB.isAllocated()) + m_RenderData.pCurrentMonData->monitorMirrorFB.alloc(m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y); + m_RenderData.pCurrentMonData->monitorMirrorFB.bind(); wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; @@ -1455,7 +1461,7 @@ void CHyprOpenGLImpl::renderMirrored() { const auto PFB = &m_mMonitorRenderResources[m_RenderData.pMonitor->pMirrorOf].monitorMirrorFB; - if (PFB->m_cTex.m_iTexID <= 0) + if (!PFB->isAllocated() || PFB->m_cTex.m_iTexID <= 0) return; renderTexture(PFB->m_cTex, &monbox, 1.f, 0, false, false); |