Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Rauch <Rauch.Christian@gmx.de>2021-06-23 00:46:28 +0300
committerChristian Rauch <Rauch.Christian@gmx.de>2021-06-24 20:40:05 +0300
commitb801db11811ddd5c9639ff8e701cf5462dde4139 (patch)
tree008d1840ef563dde4d3fef350b48d853de0b8f2c
parentb5840f9b5ba912f016db01dfcd5b28f32195c147 (diff)
GHOST/Wayland: auto-select highest supported OpenGL version
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp37
-rw-r--r--intern/ghost/intern/GHOST_WindowWayland.cpp17
2 files changed, 44 insertions, 10 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 83b9b2ba36b..16a6c93417e 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1590,15 +1590,34 @@ GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*g
d->os_surfaces.push_back(os_surface);
d->os_egl_windows.push_back(os_egl_window);
- GHOST_Context *context = new GHOST_ContextEGL(false,
- EGLNativeWindowType(os_egl_window),
- EGLNativeDisplayType(d->display),
- EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
- 3,
- 3,
- GHOST_OPENGL_EGL_CONTEXT_FLAGS,
- GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
- EGL_OPENGL_API);
+ GHOST_Context *context;
+
+ for (int minor = 6; minor >= 0; --minor) {
+ context = new GHOST_ContextEGL(false,
+ EGLNativeWindowType(os_egl_window),
+ EGLNativeDisplayType(d->display),
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ 4,
+ minor,
+ GHOST_OPENGL_EGL_CONTEXT_FLAGS,
+ GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
+ EGL_OPENGL_API);
+
+ if (context->initializeDrawingContext())
+ return context;
+ else
+ delete context;
+ }
+
+ context = new GHOST_ContextEGL(false,
+ EGLNativeWindowType(os_egl_window),
+ EGLNativeDisplayType(d->display),
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ 3,
+ 3,
+ GHOST_OPENGL_EGL_CONTEXT_FLAGS,
+ GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
+ EGL_OPENGL_API);
if (context->initializeDrawingContext()) {
return context;
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index cbac2d6eaa1..1b9c29fc2c9 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -532,6 +532,22 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
context = new GHOST_ContextNone(m_wantStereoVisual);
break;
case GHOST_kDrawingContextTypeOpenGL:
+ for (int minor = 6; minor >= 0; --minor) {
+ context = new GHOST_ContextEGL(m_wantStereoVisual,
+ EGLNativeWindowType(w->egl_window),
+ EGLNativeDisplayType(m_system->display()),
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ 4,
+ minor,
+ GHOST_OPENGL_EGL_CONTEXT_FLAGS,
+ GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
+ EGL_OPENGL_API);
+
+ if (context->initializeDrawingContext())
+ return context;
+ else
+ delete context;
+ }
context = new GHOST_ContextEGL(m_wantStereoVisual,
EGLNativeWindowType(w->egl_window),
EGLNativeDisplayType(m_system->display()),
@@ -541,7 +557,6 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
- break;
}
return (context->initializeDrawingContext() == GHOST_kSuccess) ? context : nullptr;