[Bf-blender-cvs] [0b2b6272039] wl_default: GHOST/EGL: store pointer to GHOST_System for downcast tests

Christian Rauch noreply at git.blender.org
Wed Jun 23 23:02:34 CEST 2021


Commit: 0b2b627203964356328dcd107824f6d2b5cbfc12
Author: Christian Rauch
Date:   Wed Jun 23 00:01:04 2021 +0100
Branches: wl_default
https://developer.blender.org/rB0b2b627203964356328dcd107824f6d2b5cbfc12

GHOST/EGL: store pointer to GHOST_System for downcast tests

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

M	intern/ghost/intern/GHOST_ContextEGL.cpp
M	intern/ghost/intern/GHOST_ContextEGL.h
M	intern/ghost/intern/GHOST_SystemWayland.cpp
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_WindowWayland.cpp
M	intern/ghost/intern/GHOST_WindowX11.cpp

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

diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 770ead5962e..0fee200ea1a 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -202,7 +202,8 @@ template<typename T> T &choose_api(EGLenum api, T &a, T &b, T &c)
   }
 }
 
-GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
+GHOST_ContextEGL::GHOST_ContextEGL(const GHOST_System *const system,
+                                   bool stereoVisual,
                                    EGLNativeWindowType nativeWindow,
                                    EGLNativeDisplayType nativeDisplay,
                                    EGLint contextProfileMask,
@@ -212,6 +213,7 @@ GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
                                    EGLint contextResetNotificationStrategy,
                                    EGLenum api)
     : GHOST_Context(stereoVisual),
+      m_system(system),
       m_nativeDisplay(nativeDisplay),
       m_nativeWindow(nativeWindow),
       m_contextProfileMask(contextProfileMask),
diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h
index 170647177c2..00c8e33ebdf 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.h
+++ b/intern/ghost/intern/GHOST_ContextEGL.h
@@ -24,6 +24,7 @@
 #pragma once
 
 #include "GHOST_Context.h"
+#include "GHOST_System.h"
 
 #include <GL/eglew.h>
 
@@ -43,7 +44,8 @@ class GHOST_ContextEGL : public GHOST_Context {
   /**
    * Constructor.
    */
-  GHOST_ContextEGL(bool stereoVisual,
+  GHOST_ContextEGL(const GHOST_System *const system,
+                   bool stereoVisual,
                    EGLNativeWindowType nativeWindow,
                    EGLNativeDisplayType nativeDisplay,
                    EGLint contextProfileMask,
@@ -112,6 +114,8 @@ class GHOST_ContextEGL : public GHOST_Context {
  private:
   bool initContextEGLEW();
 
+  const GHOST_System *const m_system;
+
   EGLNativeDisplayType m_nativeDisplay;
   EGLNativeWindowType m_nativeWindow;
 
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 16a6c93417e..f54a022f249 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1593,7 +1593,8 @@ GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*g
   GHOST_Context *context;
 
   for (int minor = 6; minor >= 0; --minor) {
-    context = new GHOST_ContextEGL(false,
+    context = new GHOST_ContextEGL(this,
+                                   false,
                                    EGLNativeWindowType(os_egl_window),
                                    EGLNativeDisplayType(d->display),
                                    EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
@@ -1609,7 +1610,8 @@ GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*g
       delete context;
   }
 
-  context = new GHOST_ContextEGL(false,
+  context = new GHOST_ContextEGL(this,
+                                 false,
                                  EGLNativeWindowType(os_egl_window),
                                  EGLNativeDisplayType(d->display),
                                  EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 34b44fde48a..c53fc779818 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -441,7 +441,8 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
 
   for (int minor = 5; minor >= 0; --minor) {
 #if defined(WITH_GL_EGL)
-    context = new GHOST_ContextEGL(false,
+    context = new GHOST_ContextEGL(this,
+                                   false,
                                    EGLNativeWindowType(nullptr),
                                    EGLNativeDisplayType(m_display),
                                    profile_mask,
@@ -471,7 +472,8 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
   }
 
 #if defined(WITH_GL_EGL)
-  context = new GHOST_ContextEGL(false,
+  context = new GHOST_ContextEGL(this,
+                                 false,
                                  EGLNativeWindowType(nullptr),
                                  EGLNativeDisplayType(m_display),
                                  profile_mask,
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 1b9c29fc2c9..5be7724fd86 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -533,7 +533,8 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
       break;
     case GHOST_kDrawingContextTypeOpenGL:
       for (int minor = 6; minor >= 0; --minor) {
-        context = new GHOST_ContextEGL(m_wantStereoVisual,
+        context = new GHOST_ContextEGL(this->m_system,
+                                       m_wantStereoVisual,
                                        EGLNativeWindowType(w->egl_window),
                                        EGLNativeDisplayType(m_system->display()),
                                        EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
@@ -548,7 +549,8 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
         else
           delete context;
       }
-      context = new GHOST_ContextEGL(m_wantStereoVisual,
+      context = new GHOST_ContextEGL(this->m_system,
+                                     m_wantStereoVisual,
                                      EGLNativeWindowType(w->egl_window),
                                      EGLNativeDisplayType(m_system->display()),
                                      EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index fc006c62803..10ef57c3a0a 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1325,6 +1325,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
     for (int minor = 5; minor >= 0; --minor) {
 #ifdef WITH_GL_EGL
       context = new GHOST_ContextEGL(
+          this->m_system,
           m_wantStereoVisual,
           EGLNativeWindowType(m_window),
           EGLNativeDisplayType(m_display),
@@ -1355,7 +1356,8 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
     }
 
 #ifdef WITH_GL_EGL
-    context = new GHOST_ContextEGL(m_wantStereoVisual,
+    context = new GHOST_ContextEGL(this->m_system,
+                                   m_wantStereoVisual,
                                    EGLNativeWindowType(m_window),
                                    EGLNativeDisplayType(m_display),
                                    profile_mask,



More information about the Bf-blender-cvs mailing list