[Bf-blender-cvs] [b801db11811] master: GHOST/Wayland: auto-select highest supported OpenGL version

Christian Rauch noreply at git.blender.org
Thu Jun 24 19:47:09 CEST 2021


Commit: b801db11811ddd5c9639ff8e701cf5462dde4139
Author: Christian Rauch
Date:   Tue Jun 22 22:46:28 2021 +0100
Branches: master
https://developer.blender.org/rBb801db11811ddd5c9639ff8e701cf5462dde4139

GHOST/Wayland: auto-select highest supported OpenGL version

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp
M	intern/ghost/intern/GHOST_WindowWayland.cpp

===================================================================

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;



More information about the Bf-blender-cvs mailing list