From 2a08f2ba84ead47bd13aae5797d0d71b2e11b612 Mon Sep 17 00:00:00 2001 From: Julien Roy Date: Sat, 2 Mar 2024 19:31:36 -0500 Subject: [PATCH] opengl: fix compilation on legacy renderer (#4928) --- src/render/OpenGL.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 64f582f2..cbe58753 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -353,7 +353,11 @@ void CHyprOpenGLImpl::end() { // check for gl errors const GLenum ERR = glGetError(); +#ifdef GLES2 + if (ERR == GL_CONTEXT_LOST_KHR) /* We don't have infra to recover from this */ +#else if (ERR == GL_CONTEXT_LOST) /* We don't have infra to recover from this */ +#endif RASSERT(false, "glGetError at Opengl::end() returned GL_CONTEXT_LOST. Cannot continue until proper GPU reset handling is implemented."); } @@ -2057,9 +2061,15 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { tex.m_vSize = IMAGESIZE * scale; // copy the data to an OpenGL texture we have - const GLint glIFormat = CAIROFORMAT == CAIRO_FORMAT_RGB96F ? GL_RGB32F : GL_RGBA; - const GLint glFormat = CAIROFORMAT == CAIRO_FORMAT_RGB96F ? GL_RGB : GL_RGBA; - const GLint glType = CAIROFORMAT == CAIRO_FORMAT_RGB96F ? GL_FLOAT : GL_UNSIGNED_BYTE; + const GLint glIFormat = CAIROFORMAT == CAIRO_FORMAT_RGB96F ? +#ifdef GLES2 + GL_RGB32F_EXT : +#else + GL_RGB32F : +#endif + GL_RGBA; + const GLint glFormat = CAIROFORMAT == CAIRO_FORMAT_RGB96F ? GL_RGB : GL_RGBA; + const GLint glType = CAIROFORMAT == CAIRO_FORMAT_RGB96F ? GL_FLOAT : GL_UNSIGNED_BYTE; const auto DATA = cairo_image_surface_get_data(CAIROSURFACE); glBindTexture(GL_TEXTURE_2D, tex.m_iTexID);