[Bf-blender-cvs] [b35ba22d843] master: GHOST/EGL: getters for display, config and context

Christian Rauch noreply at git.blender.org
Tue Jun 22 21:17:52 CEST 2021


Commit: b35ba22d8439df35056957b9f1519e9150cc900b
Author: Christian Rauch
Date:   Wed Jun 16 22:13:36 2021 +0100
Branches: master
https://developer.blender.org/rBb35ba22d8439df35056957b9f1519e9150cc900b

GHOST/EGL: getters for display, config and context

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

M	intern/ghost/intern/GHOST_ContextEGL.cpp
M	intern/ghost/intern/GHOST_ContextEGL.h

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

diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 6ec79aad045..770ead5962e 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -288,6 +288,21 @@ GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
   return GHOST_kSuccess;
 }
 
+EGLDisplay GHOST_ContextEGL::getDisplay() const
+{
+  return m_display;
+}
+
+EGLConfig GHOST_ContextEGL::getConfig() const
+{
+  return m_config;
+}
+
+EGLContext GHOST_ContextEGL::getContext() const
+{
+  return m_context;
+}
+
 GHOST_TSuccess GHOST_ContextEGL::activateDrawingContext()
 {
   if (m_display) {
@@ -459,9 +474,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
 
   attrib_list.push_back(EGL_NONE);
 
-  EGLConfig config;
-
-  if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &config, 1, &num_config)))
+  if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &m_config, 1, &num_config)))
     goto error;
 
   // A common error is to assume that ChooseConfig worked because it returned EGL_TRUE
@@ -469,7 +482,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
     goto error;
 
   if (m_nativeWindow != 0) {
-    m_surface = ::eglCreateWindowSurface(m_display, config, m_nativeWindow, NULL);
+    m_surface = ::eglCreateWindowSurface(m_display, m_config, m_nativeWindow, NULL);
   }
   else {
     static const EGLint pb_attrib_list[] = {
@@ -479,7 +492,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
         1,
         EGL_NONE,
     };
-    m_surface = ::eglCreatePbufferSurface(m_display, config, pb_attrib_list);
+    m_surface = ::eglCreatePbufferSurface(m_display, m_config, pb_attrib_list);
   }
 
   if (!EGL_CHK(m_surface != EGL_NO_SURFACE))
@@ -580,7 +593,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
 
   attrib_list.push_back(EGL_NONE);
 
-  m_context = ::eglCreateContext(m_display, config, m_sharedContext, &(attrib_list[0]));
+  m_context = ::eglCreateContext(m_display, m_config, m_sharedContext, &(attrib_list[0]));
 
   if (!EGL_CHK(m_context != EGL_NO_CONTEXT))
     goto error;
diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h
index f828271d88d..88d78b159b9 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.h
+++ b/intern/ghost/intern/GHOST_ContextEGL.h
@@ -100,6 +100,12 @@ class GHOST_ContextEGL : public GHOST_Context {
    */
   GHOST_TSuccess getSwapInterval(int &intervalOut);
 
+  EGLDisplay getDisplay() const;
+
+  EGLConfig getConfig() const;
+
+  EGLContext getContext() const;
+
  private:
   bool initContextEGLEW();
 
@@ -117,6 +123,7 @@ class GHOST_ContextEGL : public GHOST_Context {
   EGLContext m_context;
   EGLSurface m_surface;
   EGLDisplay m_display;
+  EGLConfig m_config;
 
   EGLint m_swap_interval;



More information about the Bf-blender-cvs mailing list