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:
authorCampbell Barton <campbellbarton>2022-07-26 16:08:40 +0300
committerJeroen Bakker <jeroen@blender.org>2022-07-26 16:08:40 +0300
commit6bd38ccbb5e876fa5fcc05fa830c8348c8ad716e (patch)
treebc03410c738e816710d577ff4875f4de6a0b04ed /intern/ghost
parentbf49e6040caac1e975982375731c348a1fcb11c1 (diff)
replace GLEW with libepoxytemp-libepoxy
As discussed in https://developer.blender.org/D12034#412258, GLEW should be replaced by libepoxy to enable dynamic loading of OpenGL. Build: ```sh make lite debug ninja BUILD_CMAKE_ARGS="-DWITH_GHOST_X11=OFF -DWITH_GHOST_WAYLAND=ON -DWITH_GHOST_WAYLAND_LIBDECOR=ON -DPYTHON_VERSION=3.10" BUILD_DIR="../blender_build" ``` Verify that there are no X11 dependencies any more: ```sh lddtree ./blender_build/bin/blender ``` and: ```sh ./blender_build/bin/blender ``` should then start a pure Wayland client. This also works with GLX (`-DWITH_GHOST_X11=ON -DWITH_GHOST_WAYLAND=OFF`). This has not been tested on other systems (Windows, macOS) as I do not have access to those systems and the build bot does not allow me to trigger experimental builds any more (I get "you need to have role 'any-control'"). Reviewed By: campbellbarton, brecht, jbakker Differential Revision: https://developer.blender.org/D15291
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/CMakeLists.txt6
-rw-r--r--intern/ghost/intern/GHOST_Context.cpp7
-rw-r--r--intern/ghost/intern/GHOST_Context.h4
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm2
-rw-r--r--intern/ghost/intern/GHOST_ContextD3D.cpp3
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.cpp57
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.h5
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.cpp16
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.h4
-rw-r--r--intern/ghost/intern/GHOST_ContextSDL.cpp2
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp49
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp10
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.cpp1
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp10
-rw-r--r--intern/ghost/intern/GHOST_Xr_openxr_includes.h6
-rw-r--r--intern/ghost/test/CMakeLists.txt19
17 files changed, 45 insertions, 160 deletions
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index c681dc368bb..b854908da78 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -4,13 +4,12 @@
set(INC
.
../clog
- ../glew-mx
../../source/blender/imbuf
../../source/blender/makesdna
)
set(INC_SYS
- ${GLEW_INCLUDE_PATH}
+ ${Epoxy_INCLUDE_DIRS}
)
set(SRC
@@ -71,8 +70,7 @@ set(SRC
)
set(LIB
- bf_intern_glew_mx
- ${GLEW_LIBRARY}
+ ${Epoxy_LIBRARIES}
)
if(WITH_GHOST_DEBUG)
diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index f9aa80dc13d..689b3240da3 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -10,7 +10,7 @@
#include "GHOST_Context.h"
#ifdef _WIN32
-# include <GL/wglew.h> // only for symbolic constants, do not use API functions
+# include <epoxy/wgl.h>
# include <tchar.h>
#
# ifndef ERROR_PROFILE_DOES_NOT_MATCH_DEVICE
@@ -122,11 +122,6 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
#endif // _WIN32
-void GHOST_Context::initContextGLEW()
-{
- GLEW_CHK(glewInit());
-}
-
void GHOST_Context::initClearGL()
{
glClearColor(0.294, 0.294, 0.294, 0.000);
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index e707f1c3475..3546fb6bbc7 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -11,7 +11,7 @@
#include "GHOST_IContext.h"
#include "GHOST_Types.h"
-#include "glew-mx.h"
+#include <epoxy/gl.h>
#include <cstdlib> // for NULL
@@ -136,8 +136,6 @@ class GHOST_Context : public GHOST_IContext {
}
protected:
- void initContextGLEW();
-
bool m_stereoVisual;
/** Caller specified, not for internal use. */
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index dd800ef52a3..19df38abb0a 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -274,8 +274,6 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
}
#endif
- initContextGLEW();
-
if (m_metalView) {
if (m_defaultFramebuffer == 0) {
/* Create a virtual frame-buffer. */
diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp b/intern/ghost/intern/GHOST_ContextD3D.cpp
index ded76daa145..4fc05cf912c 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -10,8 +10,7 @@
#include <iostream>
#include <string>
-#include <GL/glew.h>
-#include <GL/wglew.h>
+#include <epoxy/wgl.h>
#include "GHOST_ContextD3D.h"
#include "GHOST_ContextWGL.h" /* For shared drawing */
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 8c44dfe0158..c29e11ccb1d 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -151,15 +151,6 @@ static bool egl_chk(bool result,
# define EGL_CHK(x) egl_chk(x)
#endif
-static inline bool bindAPI(EGLenum api)
-{
- if (EGLEW_VERSION_1_2) {
- return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
- }
-
- return false;
-}
-
#ifdef WITH_GL_ANGLE
HMODULE GHOST_ContextEGL::s_d3dcompiler = nullptr;
#endif
@@ -256,7 +247,7 @@ GHOST_TSuccess GHOST_ContextEGL::swapBuffers()
GHOST_TSuccess GHOST_ContextEGL::setSwapInterval(int interval)
{
- if (EGLEW_VERSION_1_1) {
+ if (epoxy_egl_version(m_display) >= 11) {
if (EGL_CHK(::eglSwapInterval(m_display, interval))) {
m_swap_interval = interval;
@@ -313,26 +304,13 @@ GHOST_TSuccess GHOST_ContextEGL::releaseDrawingContext()
return GHOST_kFailure;
}
-bool GHOST_ContextEGL::initContextEGLEW()
+inline bool GHOST_ContextEGL::bindAPI(EGLenum api)
{
- /* We have to manually get this function before we can call eglewInit, since
- * it requires a display argument. glewInit() does the same, but we only want
- * to initialize EGLEW here. */
- eglGetDisplay = (PFNEGLGETDISPLAYPROC)eglGetProcAddress("eglGetDisplay");
- if (eglGetDisplay == nullptr) {
- return false;
- }
-
- if (!EGL_CHK((m_display = ::eglGetDisplay(m_nativeDisplay)) != EGL_NO_DISPLAY)) {
- return false;
- }
-
- if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK) {
- fprintf(stderr, "Warning! EGLEW failed to initialize properly.\n");
- return false;
+ if (epoxy_egl_version(m_display) >= 12) {
+ return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
}
- return true;
+ return false;
}
static const std::string &api_string(EGLenum api)
@@ -355,10 +333,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
}
m_stereoVisual = false; /* It doesn't matter what the Window wants. */
- if (!initContextEGLEW()) {
- return GHOST_kFailure;
- }
-
#ifdef WITH_GL_ANGLE
/* `d3dcompiler_XX.dll` needs to be loaded before ANGLE will work. */
if (s_d3dcompiler == nullptr) {
@@ -380,6 +354,10 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
EGLint egl_major, egl_minor;
+ if (!EGL_CHK((m_display = ::eglGetDisplay(m_nativeDisplay)) != EGL_NO_DISPLAY)) {
+ goto error;
+ }
+
if (!EGL_CHK(::eglInitialize(m_display, &egl_major, &egl_minor))) {
goto error;
}
@@ -398,7 +376,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
attrib_list.reserve(20);
- if (m_api == EGL_OPENGL_ES_API && EGLEW_VERSION_1_2) {
+ if (m_api == EGL_OPENGL_ES_API && epoxy_egl_version(m_display) >= 12) {
/* According to the spec it seems that you are required to set EGL_RENDERABLE_TYPE,
* but some implementations (ANGLE) do not seem to care. */
@@ -421,9 +399,11 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
m_contextMinorVersion);
}
- if (!((m_contextMajorVersion == 1) || (m_contextMajorVersion == 2 && EGLEW_VERSION_1_3) ||
- (m_contextMajorVersion == 3 && /*EGLEW_VERSION_1_4 &&*/ EGLEW_KHR_create_context) ||
- (m_contextMajorVersion == 3 && EGLEW_VERSION_1_5))) {
+ if (!((m_contextMajorVersion == 1) ||
+ (m_contextMajorVersion == 2 && epoxy_egl_version(m_display) >= 13) ||
+ (m_contextMajorVersion == 3 &&
+ epoxy_has_egl_extension(m_display, "KHR_create_context")) ||
+ (m_contextMajorVersion == 3 && epoxy_egl_version(m_display) >= 15))) {
fprintf(stderr,
"Warning! May not be able to create a version %d.%d ES context with version %d.%d "
"of EGL\n",
@@ -488,7 +468,8 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
}
attrib_list.clear();
- if (EGLEW_VERSION_1_5 || EGLEW_KHR_create_context) {
+ if (epoxy_egl_version(m_display) >= 15 ||
+ epoxy_has_egl_extension(m_display, "KHR_create_context")) {
if (m_api == EGL_OPENGL_API || m_api == EGL_OPENGL_ES_API) {
if (m_contextMajorVersion != 0) {
attrib_list.push_back(EGL_CONTEXT_MAJOR_VERSION_KHR);
@@ -530,7 +511,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
}
}
- if (m_api == EGL_OPENGL_API || EGLEW_VERSION_1_5) {
+ if (m_api == EGL_OPENGL_API || epoxy_egl_version(m_display) >= 15) {
if (m_contextResetNotificationStrategy != 0) {
attrib_list.push_back(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR);
attrib_list.push_back(m_contextResetNotificationStrategy);
@@ -598,8 +579,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
goto error;
}
- initContextGLEW();
-
initClearGL();
::eglSwapBuffers(m_display, m_surface);
diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h
index 3250dc94978..662ffa94aec 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.h
+++ b/intern/ghost/intern/GHOST_ContextEGL.h
@@ -10,7 +10,8 @@
#include "GHOST_Context.h"
#include "GHOST_System.h"
-#include <GL/eglew.h>
+#include <epoxy/egl.h>
+#include <epoxy/gl.h>
#ifndef GHOST_OPENGL_EGL_CONTEXT_FLAGS
# define GHOST_OPENGL_EGL_CONTEXT_FLAGS 0
@@ -96,7 +97,7 @@ class GHOST_ContextEGL : public GHOST_Context {
EGLContext getContext() const;
private:
- bool initContextEGLEW();
+ bool bindAPI(EGLenum api);
const GHOST_System *const m_system;
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;
diff --git a/intern/ghost/intern/GHOST_ContextSDL.cpp b/intern/ghost/intern/GHOST_ContextSDL.cpp
index 5b02fe1c1e6..63b5927895d 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.cpp
+++ b/intern/ghost/intern/GHOST_ContextSDL.cpp
@@ -138,8 +138,6 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
success = (SDL_GL_MakeCurrent(m_window, m_context) < 0) ? GHOST_kFailure : GHOST_kSuccess;
- initContextGLEW();
-
initClearGL();
SDL_GL_SwapWindow(m_window);
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 7417358e9ae..ac56ed45fcb 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -87,7 +87,7 @@ GHOST_TSuccess GHOST_ContextWGL::swapBuffers()
GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval)
{
- if (WGLEW_EXT_swap_control)
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control"))
return WIN32_CHK(::wglSwapIntervalEXT(interval)) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
else
return GHOST_kFailure;
@@ -95,7 +95,7 @@ GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval)
GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut)
{
- if (WGLEW_EXT_swap_control) {
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control")) {
intervalOut = ::wglGetSwapIntervalEXT();
return GHOST_kSuccess;
}
@@ -266,7 +266,7 @@ static HWND clone_window(HWND hWnd, LPVOID lpParam)
return hwndCloned;
}
-void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
+void GHOST_ContextWGL::initContext(PIXELFORMATDESCRIPTOR &preferredPFD)
{
HWND dummyHWND = NULL;
@@ -319,12 +319,6 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
goto finalize;
- if (GLEW_CHK(glewInit()) != GLEW_OK) {
- fprintf(stderr, "Warning! Dummy GLEW/WGLEW failed to initialize properly.\n");
- }
-
- /* The following are not technically WGLEW, but they also require a context to work. */
-
#ifndef NDEBUG
free((void *)m_dummyRenderer);
free((void *)m_dummyVendor);
@@ -493,11 +487,11 @@ int GHOST_ContextWGL::choose_pixel_format(bool stereoVisual, bool needAlpha)
0 /* layer, visible, and damage masks (ignored) */
};
- initContextWGLEW(preferredPFD);
+ initContext(preferredPFD);
int iPixelFormat = 0;
- if (WGLEW_ARB_pixel_format)
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_pixel_format"))
iPixelFormat = choose_pixel_format_arb(stereoVisual, needAlpha);
if (iPixelFormat == 0)
@@ -526,7 +520,7 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
HDC prevHDC = ::wglGetCurrentDC();
WIN32_CHK(GetLastError() == NO_ERROR);
- if (!WGLEW_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) {
+ if (!epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context") || ::GetPixelFormat(m_hDC) == 0) {
const bool needAlpha = m_alphaBackground;
int iPixelFormat;
int lastPFD;
@@ -554,41 +548,24 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
}
}
- if (WGLEW_ARB_create_context) {
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context")) {
int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
-#ifdef WITH_GLEW_ES
- int profileBitES = m_contextProfileMask & WGL_CONTEXT_ES_PROFILE_BIT_EXT;
-#endif
-
- if (!WGLEW_ARB_create_context_profile && profileBitCore)
+ if (!epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_profile") && profileBitCore)
fprintf(stderr, "Warning! OpenGL core profile not available.\n");
- if (!WGLEW_ARB_create_context_profile && profileBitCompat)
+ if (!epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_profile") && profileBitCompat)
fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n");
-#ifdef WITH_GLEW_ES
- if (!WGLEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1)
- fprintf(stderr, "Warning! OpenGL ES profile not available.\n");
-
- if (!WGLEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2)
- fprintf(stderr, "Warning! OpenGL ES2 profile not available.\n");
-#endif
-
int profileMask = 0;
- if (WGLEW_ARB_create_context_profile && profileBitCore)
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_profile") && profileBitCore)
profileMask |= profileBitCore;
- if (WGLEW_ARB_create_context_profile && profileBitCompat)
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_profile") && profileBitCompat)
profileMask |= profileBitCompat;
-#ifdef WITH_GLEW_ES
- if (WGLEW_EXT_create_context_es_profile && profileBitES)
- profileMask |= profileBitES;
-#endif
-
if (profileMask != m_contextProfileMask)
fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits.");
@@ -615,7 +592,7 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
}
if (m_contextResetNotificationStrategy != 0) {
- if (WGLEW_ARB_create_context_robustness) {
+ if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_robustness")) {
iAttributes.push_back(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB);
iAttributes.push_back(m_contextResetNotificationStrategy);
}
@@ -651,8 +628,6 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
goto error;
}
- initContextGLEW();
-
if (is_crappy_intel_card()) {
/* Some Intel cards with context 4.1 or 4.2
* don't have the point sprite enabled by default.
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h
index ca0bf70b128..3c65cb0b74e 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -11,7 +11,7 @@
#include "GHOST_Context.h"
-#include <GL/wglew.h>
+#include <epoxy/wgl.h>
#ifndef GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
# define GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY 0
@@ -90,7 +90,7 @@ class GHOST_ContextWGL : public GHOST_Context {
int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
int _choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha);
- void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);
+ void initContext(PIXELFORMATDESCRIPTOR &preferredPFD);
HWND m_hWnd;
HDC m_hDC;
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 00cc5f3af8f..d5ab1aef607 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -394,16 +394,6 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
-#if defined(WITH_GL_PROFILE_CORE)
- {
- const char *version_major = (char *)glewGetString(GLEW_VERSION_MAJOR);
- if (version_major != nullptr && version_major[0] == '1') {
- fprintf(stderr, "Error: GLEW version 2.0 and above is required.\n");
- abort();
- }
- }
-#endif
-
const int profile_mask =
#ifdef WITH_GL_EGL
# if defined(WITH_GL_PROFILE_CORE)
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index 09192d989e4..59dc80cf7e6 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -6,7 +6,6 @@
#include "GHOST_WindowSDL.h"
#include "SDL_mouse.h"
-#include "glew-mx.h"
#include "GHOST_ContextSDL.h"
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 01045c516c1..9c56a0634ff 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1299,16 +1299,6 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
* - Try 3.3 core profile
* - No fall-backs. */
-#if defined(WITH_GL_PROFILE_CORE)
- {
- const char *version_major = (char *)glewGetString(GLEW_VERSION_MAJOR);
- if (version_major != nullptr && version_major[0] == '1') {
- fprintf(stderr, "Error: GLEW version 2.0 and above is required.\n");
- abort();
- }
- }
-#endif
-
const int profile_mask =
#ifdef WITH_GL_EGL
# if defined(WITH_GL_PROFILE_CORE)
diff --git a/intern/ghost/intern/GHOST_Xr_openxr_includes.h b/intern/ghost/intern/GHOST_Xr_openxr_includes.h
index 9706f51c027..9f993ae45c2 100644
--- a/intern/ghost/intern/GHOST_Xr_openxr_includes.h
+++ b/intern/ghost/intern/GHOST_Xr_openxr_includes.h
@@ -29,11 +29,9 @@
#endif
#ifdef WITH_GHOST_X11
# ifdef WITH_GL_EGL
-/* TODO: Why do we have to create this typedef manually? */
-typedef void (*(*PFNEGLGETPROCADDRESSPROC)(const char *procname))(void);
-# include <GL/eglew.h>
+# include <epoxy/egl.h>
# else
-# include <GL/glxew.h>
+# include <epoxy/glx.h>
# endif
#endif
diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt
index 9cc406313c7..95415f4e9b9 100644
--- a/intern/ghost/test/CMakeLists.txt
+++ b/intern/ghost/test/CMakeLists.txt
@@ -155,13 +155,6 @@ suffix_relpaths(SRC_NEW "${SRC}" "../../../extern/wcwidth/")
include_directories(${INC_NEW})
add_library(wcwidth_lib ${SRC_NEW})
-# glew-mx
-include(${CMAKE_SOURCE_DIR}/../../../intern/glew-mx/CMakeLists.txt)
-suffix_relpaths(INC_NEW "${INC}" "../../../intern/glew-mx/")
-suffix_relpaths(SRC_NEW "${SRC}" "../../../intern/glew-mx/")
-include_directories(${INC_NEW})
-add_library(glewmx_lib ${SRC_NEW})
-
# grr, blenfont needs BLI
include_directories(
"../../../source/blender/blenlib"
@@ -217,21 +210,12 @@ endif()
if(UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
- find_package(GLEW)
-
- if(NOT GLEW_FOUND)
- message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
- endif()
set(PLATFORM_LINKLIBS
${X11_X11_LIB}
${X11_Xinput_LIB}
- ${GLEW_LIBRARY}
-lpthread
)
-else()
- # set(GLEW_LIBRARY "") # unused
- set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
endif()
string(APPEND CMAKE_C_FLAGS " ${PLATFORM_CFLAGS}")
@@ -246,7 +230,6 @@ add_executable(gears_c
target_link_libraries(gears_c
ghost_lib
- glewmx_lib
string_lib
${OPENGL_gl_LIBRARY}
${CMAKE_DL_LIBS}
@@ -260,7 +243,6 @@ add_executable(gears_cpp
target_link_libraries(gears_cpp
ghost_lib
- glewmx_lib
string_lib
${OPENGL_gl_LIBRARY}
${CMAKE_DL_LIBS}
@@ -287,7 +269,6 @@ target_link_libraries(multitest_c
# imbuf_lib
ghost_lib
bli_lib # again...
- glewmx_lib
string_lib
numaapi_lib
guardedalloc_lib