From 6ea4769b39fccec22ae2acd015511a745d378840 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Sat, 25 Oct 2025 21:36:02 +0200 Subject: [PATCH] EGL: minor egl changes (#12132) * opengl: use EGLint and we dont have to cast data use EGLint in the attrib array and we dont have to cast the resulting data. * opengl: add linear to correct vector drop empty check, what if we get mods that isnt linear. then it wont be added, also add it to the result vector that we actually return. --- src/render/OpenGL.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 90a8e679..c16cbf15 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -483,8 +483,8 @@ std::optional> CHyprOpenGLImpl::getModsForFormat(EGLint fo } // if the driver doesn't mark linear as external, add it. It's allowed unless the driver says otherwise. (e.g. nvidia) - if (!linearIsExternal && std::ranges::find(mods, DRM_FORMAT_MOD_LINEAR) == mods.end() && mods.empty()) - mods.push_back(DRM_FORMAT_MOD_LINEAR); + if (!linearIsExternal && std::ranges::find(mods, DRM_FORMAT_MOD_LINEAR) == mods.end()) + result.push_back(DRM_FORMAT_MOD_LINEAR); return result; } @@ -582,8 +582,8 @@ void CHyprOpenGLImpl::initDRMFormats() { } EGLImageKHR CHyprOpenGLImpl::createEGLImage(const Aquamarine::SDMABUFAttrs& attrs) { - std::array attribs; - size_t idx = 0; + std::array attribs; + size_t idx = 0; attribs[idx++] = EGL_WIDTH; attribs[idx++] = attrs.size.x; @@ -626,7 +626,7 @@ EGLImageKHR CHyprOpenGLImpl::createEGLImage(const Aquamarine::SDMABUFAttrs& attr RASSERT(idx <= attribs.size(), "createEglImage: attribs array out of bounds."); - EGLImageKHR image = m_proc.eglCreateImageKHR(m_eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, rc(attribs.data())); + EGLImageKHR image = m_proc.eglCreateImageKHR(m_eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, attribs.data()); if (image == EGL_NO_IMAGE_KHR) { Debug::log(ERR, "EGL: EGLCreateImageKHR failed: {}", eglGetError()); return EGL_NO_IMAGE_KHR;