diff options
author | Vaxry <[email protected]> | 2023-12-04 01:44:06 +0000 |
---|---|---|
committer | Vaxry <[email protected]> | 2023-12-04 01:44:16 +0000 |
commit | 45d3fbb8d8409b2def531a9315916606165875cf (patch) | |
tree | a776851afaa40df47cb41a8092f3efebe7e8552c | |
parent | 9a9528d09375e6017088af354799ac381b939c1f (diff) | |
download | Hyprland-45d3fbb8d8409b2def531a9315916606165875cf.tar.gz Hyprland-45d3fbb8d8409b2def531a9315916606165875cf.zip |
opengl: free window framebuffers in ~dtor
ref #4036
-rw-r--r-- | src/Compositor.cpp | 3 | ||||
-rw-r--r-- | src/Window.cpp | 3 | ||||
-rw-r--r-- | src/protocols/Screencopy.cpp | 2 | ||||
-rw-r--r-- | src/protocols/ToplevelExport.cpp | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index a12fabf1..3020b96d 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1395,14 +1395,11 @@ void CCompositor::cleanupFadingOut(const int& monid) { if (valid && !w->m_bReadyToDelete) continue; - std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return other.first == w; }); w->m_bFadingOut = false; removeWindowFromVectorSafe(w); std::erase(m_vWindowsFadingOut, w); Debug::log(LOG, "Cleanup: destroyed a window"); - - glFlush(); // to free mem NOW. return; } } diff --git a/src/Window.cpp b/src/Window.cpp index 7569c869..bcb819a8 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -21,6 +21,9 @@ CWindow::~CWindow() { g_pCompositor->m_pLastFocus = nullptr; g_pCompositor->m_pLastWindow = nullptr; } + + g_pHyprRenderer->makeEGLCurrent(); + std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return other.first == this; }); } SWindowDecorationExtents CWindow::getFullWindowExtents() { diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index 19744ac5..65f50893 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -442,7 +442,7 @@ bool CScreencopyProtocolManager::copyFrameShm(SScreencopyFrame* frame, timespec* g_pHyprRenderer->makeEGLCurrent(); CFramebuffer fb; - fb.alloc(frame->box.w, frame->box.h, frame->pMonitor->drmFormat); + fb.alloc(frame->box.w, frame->box.h, g_pHyprRenderer->isNvidia() ? DRM_FORMAT_XBGR8888 : frame->pMonitor->drmFormat); if (!g_pHyprRenderer->beginRender(frame->pMonitor, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &fb)) { wlr_texture_destroy(sourceTex); diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 73c3ab06..6a001c02 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -367,7 +367,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times g_pHyprRenderer->makeEGLCurrent(); CFramebuffer outFB; - outFB.alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, PMONITOR->drmFormat); + outFB.alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, g_pHyprRenderer->isNvidia() ? DRM_FORMAT_XBGR8888 : PMONITOR->drmFormat); if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &outFB)) { wlr_buffer_end_data_ptr_access(frame->buffer); |