From 49f5fd59adbef25dc2c97364690fe747c8cc09e8 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 19 Mar 2024 02:42:30 +0000 Subject: [PATCH] opengl: minor adjustment to getPreferredReadFormat fixes #4791 --- src/protocols/ToplevelExport.cpp | 11 ----------- src/render/OpenGL.cpp | 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 88e56954..e3273f7a 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -179,17 +179,6 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou 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); if (PFRAME->shmFormat == DRM_FORMAT_INVALID) { Debug::log(ERR, "No format supported by renderer in capture toplevel"); diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index c1375ba5..d34a90b0 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -2286,10 +2286,10 @@ inline const SGLPixelFormat GLES2_FORMATS[] = { }; uint32_t CHyprOpenGLImpl::getPreferredReadFormat(CMonitor* pMonitor) { - GLint glf = -1, glt = -1, as = -1; - glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &glf); + GLint glf = -1, glt = -1, as = 0; + /*glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &glf); glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &glt); - glGetIntegerv(GL_ALPHA_BITS, &as); + glGetIntegerv(GL_ALPHA_BITS, &as);*/ if (glf == 0 || glt == 0) { glf = drmFormatToGL(pMonitor->drmFormat);