screencopy: attempt binding framebuffer before gathering format

This commit is contained in:
Vaxry 2024-02-15 00:58:58 +00:00
parent b7ab15dc80
commit ef490965a2
2 changed files with 24 additions and 0 deletions

View file

@ -211,6 +211,18 @@ void CScreencopyProtocolManager::captureOutput(wl_client* client, wl_resource* r
PCLIENT->ref++; PCLIENT->ref++;
g_pHyprRenderer->makeEGLCurrent(); g_pHyprRenderer->makeEGLCurrent();
if (g_pHyprOpenGL->m_mMonitorRenderResources.contains(PFRAME->pMonitor)) {
const auto RDATA = g_pHyprOpenGL->m_mMonitorRenderResources.at(PFRAME->pMonitor);
// bind the fb for its format. Suppress gl errors.
#ifndef GLES2
glBindFramebuffer(GL_READ_FRAMEBUFFER, RDATA.offloadFB.m_iFb);
#else
glBindFramebuffer(GL_FRAMEBUFFER, RDATA.offloadFB.m_iFb);
#endif
} else
Debug::log(ERR, "No RDATA in screencopy???");
PFRAME->shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PFRAME->pMonitor); PFRAME->shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PFRAME->pMonitor);
if (PFRAME->shmFormat == DRM_FORMAT_INVALID) { if (PFRAME->shmFormat == DRM_FORMAT_INVALID) {
Debug::log(ERR, "No format supported by renderer in capture output"); Debug::log(ERR, "No format supported by renderer in capture output");

View file

@ -178,6 +178,18 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
const auto PMONITOR = g_pCompositor->getMonitorFromID(PFRAME->pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PFRAME->pWindow->m_iMonitorID);
g_pHyprRenderer->makeEGLCurrent(); g_pHyprRenderer->makeEGLCurrent();
if (g_pHyprOpenGL->m_mMonitorRenderResources.contains(PMONITOR)) {
const auto RDATA = g_pHyprOpenGL->m_mMonitorRenderResources.at(PMONITOR);
// bind the fb for its format. Suppress gl errors.
#ifndef GLES2
glBindFramebuffer(GL_READ_FRAMEBUFFER, RDATA.offloadFB.m_iFb);
#else
glBindFramebuffer(GL_FRAMEBUFFER, RDATA.offloadFB.m_iFb);
#endif
} else
Debug::log(ERR, "No RDATA in toplevelexport???");
PFRAME->shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR); PFRAME->shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR);
if (PFRAME->shmFormat == DRM_FORMAT_INVALID) { if (PFRAME->shmFormat == DRM_FORMAT_INVALID) {
Debug::log(ERR, "No format supported by renderer in capture toplevel"); Debug::log(ERR, "No format supported by renderer in capture toplevel");