aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-07-29 14:27:05 +0200
committerVaxry <[email protected]>2024-07-29 14:27:05 +0200
commit70468857da2e64c35c7e79b7e63bff04e56e3be5 (patch)
tree79f268cac7f4d416ade711df6e5fc5d82f2b1cee /src/render
parent87699575e1663649270e9a271609b5bcd079ce70 (diff)
downloadHyprland-70468857da2e64c35c7e79b7e63bff04e56e3be5.tar.gz
Hyprland-70468857da2e64c35c7e79b7e63bff04e56e3be5.zip
egl: attempt a 3.2 egl context first
Diffstat (limited to 'src/render')
-rw-r--r--src/render/OpenGL.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index b2346e0f..43a2c3a7 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -130,11 +130,13 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
attrs.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT);
}
+ auto attrsNoVer = attrs;
+
#ifndef GLES2
attrs.push_back(EGL_CONTEXT_MAJOR_VERSION);
attrs.push_back(3);
attrs.push_back(EGL_CONTEXT_MINOR_VERSION);
- attrs.push_back(0);
+ attrs.push_back(2);
#else
attrs.push_back(EGL_CONTEXT_CLIENT_VERSION);
attrs.push_back(2);
@@ -143,8 +145,24 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
attrs.push_back(EGL_NONE);
m_pEglContext = eglCreateContext(m_pEglDisplay, EGL_NO_CONFIG_KHR, EGL_NO_CONTEXT, attrs.data());
- if (m_pEglContext == EGL_NO_CONTEXT)
- RASSERT(false, "EGL: failed to create a context");
+ if (m_pEglContext == EGL_NO_CONTEXT) {
+#ifdef GLES2
+ RASSERT(false, "EGL: failed to create a context with GLES2.0");
+#endif
+ Debug::log(WARN, "EGL: Failed to create a context with GLES3.2, retrying 3.0");
+
+ attrs = attrsNoVer;
+ attrs.push_back(EGL_CONTEXT_MAJOR_VERSION);
+ attrs.push_back(3);
+ attrs.push_back(EGL_CONTEXT_MINOR_VERSION);
+ attrs.push_back(0);
+ attrs.push_back(EGL_NONE);
+
+ m_pEglContext = eglCreateContext(m_pEglDisplay, EGL_NO_CONFIG_KHR, EGL_NO_CONTEXT, attrs.data());
+
+ if (m_pEglContext == EGL_NO_CONTEXT)
+ RASSERT(false, "EGL: failed to create a context with either GLES3.2 or 3.0");
+ }
if (m_sExts.IMG_context_priority) {
EGLint priority = EGL_CONTEXT_PRIORITY_MEDIUM_IMG;