mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-10 09:49:48 +01:00
opengl: only allocate offMainFB on demand
These are not used by hyprland, only potentially plugins. No need to keep the VRAM allocated all the time
This commit is contained in:
parent
5fa2594659
commit
ad64726f5d
1 changed files with 9 additions and 1 deletions
|
@ -843,7 +843,6 @@ void CHyprOpenGLImpl::begin(PHLMONITOR pMonitor, const CRegion& damage_, CFrameb
|
|||
m_RenderData.pCurrentMonData->offloadFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, pMonitor->output->state->state().drmFormat);
|
||||
m_RenderData.pCurrentMonData->mirrorFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, pMonitor->output->state->state().drmFormat);
|
||||
m_RenderData.pCurrentMonData->mirrorSwapFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, pMonitor->output->state->state().drmFormat);
|
||||
m_RenderData.pCurrentMonData->offMainFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, pMonitor->output->state->state().drmFormat);
|
||||
|
||||
m_RenderData.pCurrentMonData->offloadFB.addStencil(m_RenderData.pCurrentMonData->stencilTex);
|
||||
m_RenderData.pCurrentMonData->mirrorFB.addStencil(m_RenderData.pCurrentMonData->stencilTex);
|
||||
|
@ -954,6 +953,12 @@ void CHyprOpenGLImpl::end() {
|
|||
m_RenderData.mainFB = nullptr;
|
||||
m_RenderData.outFB = nullptr;
|
||||
|
||||
// if we dropped to offMain, release it now.
|
||||
// if there is a plugin constantly using it, this might be a bit slow,
|
||||
// but I havent seen a single plugin yet use these, so it's better to drop a bit of vram.
|
||||
if (m_RenderData.pCurrentMonData->offMainFB.isAllocated())
|
||||
m_RenderData.pCurrentMonData->offMainFB.release();
|
||||
|
||||
// check for gl errors
|
||||
const GLenum ERR = glGetError();
|
||||
|
||||
|
@ -2881,6 +2886,9 @@ void CHyprOpenGLImpl::restoreMatrix() {
|
|||
}
|
||||
|
||||
void CHyprOpenGLImpl::bindOffMain() {
|
||||
if (!m_RenderData.pCurrentMonData->offMainFB.isAllocated())
|
||||
m_RenderData.pCurrentMonData->offMainFB.alloc(m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y,
|
||||
m_RenderData.pMonitor->output->state->state().drmFormat);
|
||||
m_RenderData.pCurrentMonData->offMainFB.bind();
|
||||
clear(CHyprColor(0, 0, 0, 0));
|
||||
m_RenderData.currentFB = &m_RenderData.pCurrentMonData->offMainFB;
|
||||
|
|
Loading…
Reference in a new issue