mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 21:06:01 +01:00
render: avoid allocating mirrorfb for no reason
This commit is contained in:
parent
89b87158db
commit
88c2a02773
1 changed files with 8 additions and 2 deletions
|
@ -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->primaryFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
||||||
m_RenderData.pCurrentMonData->mirrorFB.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->mirrorSwapFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
||||||
m_RenderData.pCurrentMonData->monitorMirrorFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
|
||||||
|
|
||||||
createBGTextureForMonitor(pMonitor);
|
createBGTextureForMonitor(pMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_RenderData.pCurrentMonData->monitorMirrorFB.isAllocated() && m_RenderData.pMonitor->mirrors.empty())
|
||||||
|
m_RenderData.pCurrentMonData->monitorMirrorFB.release();
|
||||||
|
|
||||||
if (!m_RenderData.pCurrentMonData->m_bShadersInitialized)
|
if (!m_RenderData.pCurrentMonData->m_bShadersInitialized)
|
||||||
initShaders();
|
initShaders();
|
||||||
|
|
||||||
|
@ -1441,6 +1443,10 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::saveBufferForMirror() {
|
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();
|
m_RenderData.pCurrentMonData->monitorMirrorFB.bind();
|
||||||
|
|
||||||
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
|
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;
|
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;
|
return;
|
||||||
|
|
||||||
renderTexture(PFB->m_cTex, &monbox, 1.f, 0, false, false);
|
renderTexture(PFB->m_cTex, &monbox, 1.f, 0, false, false);
|
||||||
|
|
Loading…
Reference in a new issue