[Bf-blender-cvs] [64982a7cb2f] epoxy: port GLX from GLEW to epoxy

Christian Rauch noreply at git.blender.org
Sat Jun 25 01:38:02 CEST 2022


Commit: 64982a7cb2f3441bc6230b77252b92b8d7039daf
Author: Christian Rauch
Date:   Sat Jun 25 00:19:35 2022 +0100
Branches: epoxy
https://developer.blender.org/rB64982a7cb2f3441bc6230b77252b92b8d7039daf

port GLX from GLEW to epoxy

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

M	intern/ghost/intern/GHOST_ContextGLX.cpp
M	intern/ghost/intern/GHOST_ContextGLX.h

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

diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index b4a076e4598..ed1c874c236 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -95,11 +95,6 @@ GHOST_TSuccess GHOST_ContextGLX::releaseDrawingContext()
   return ::glXMakeCurrent(m_display, None, nullptr) ? GHOST_kSuccess : GHOST_kFailure;
 }
 
-void GHOST_ContextGLX::initContextGLXEW()
-{
-  initContextGLEW();
-}
-
 GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 {
   GHOST_X11_ERROR_HANDLERS_OVERRIDE(handler_store);
@@ -278,18 +273,11 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 
     glXMakeCurrent(m_display, m_window, m_context);
 
-    /* Seems that this has to be called after #glXMakeCurrent,
-     * which means we cannot use `glX` extensions until after we create a context. */
-    initContextGLXEW();
-
     if (m_window) {
       initClearGL();
       ::glXSwapBuffers(m_display, m_window);
     }
 
-    /* re initialize to get the extensions properly */
-    initContextGLXEW();
-
     version = glGetString(GL_VERSION);
 
     if (!version || version[0] < '3' || ((version[0] == '3') && (version[2] < '3'))) {
@@ -318,7 +306,7 @@ GHOST_TSuccess GHOST_ContextGLX::releaseNativeHandles()
 
 GHOST_TSuccess GHOST_ContextGLX::setSwapInterval(int interval)
 {
-  if (!GLXEW_EXT_swap_control) {
+  if (!epoxy_has_glx_extension(m_display, DefaultScreen(m_display), "GLX_EXT_swap_control")) {
     ::glXSwapIntervalEXT(m_display, m_window, interval);
     return GHOST_kSuccess;
   }
@@ -327,7 +315,7 @@ GHOST_TSuccess GHOST_ContextGLX::setSwapInterval(int interval)
 
 GHOST_TSuccess GHOST_ContextGLX::getSwapInterval(int &intervalOut)
 {
-  if (GLXEW_EXT_swap_control) {
+  if (epoxy_has_glx_extension(m_display, DefaultScreen(m_display), "GLX_EXT_swap_control")) {
     unsigned int interval = 0;
 
     ::glXQueryDrawable(m_display, m_window, GLX_SWAP_INTERVAL_EXT, &interval);
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h
index c6184bbd3da..d526e6b1b32 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -9,7 +9,7 @@
 
 #include "GHOST_Context.h"
 
-#include <GL/glxew.h>
+#include <epoxy/glx.h>
 
 #ifndef GHOST_OPENGL_GLX_CONTEXT_FLAGS
 /* leave as convenience define for the future */
@@ -89,8 +89,6 @@ class GHOST_ContextGLX : public GHOST_Context {
   GHOST_TSuccess getSwapInterval(int &intervalOut);
 
  private:
-  void initContextGLXEW();
-
   Display *m_display;
   GLXFBConfig m_fbconfig;
   Window m_window;



More information about the Bf-blender-cvs mailing list