opengl: minor adjustment to getPreferredReadFormat

fixes #4791
This commit is contained in:
Vaxry 2024-03-19 02:42:30 +00:00
parent 7283dde878
commit 49f5fd59ad
2 changed files with 3 additions and 14 deletions

View file

@ -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");

View file

@ -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);