3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2025-10-29 19:34:47 +00:00

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.
This commit is contained in:
Tom Englund 2025-10-25 21:36:02 +02:00 committed by GitHub
parent 72cbb7906a
commit 6ea4769b39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -483,8 +483,8 @@ std::optional<std::vector<uint64_t>> 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<uint32_t, 50> attribs;
size_t idx = 0;
std::array<EGLint, 50> 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<int*>(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;