diff options
author | Christian Rauch <Rauch.Christian@gmx.de> | 2022-08-15 15:58:04 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-15 17:10:29 +0300 |
commit | a296b8f694d1a93d40da78312758580f69b43be7 (patch) | |
tree | fd5791d3227411c905c7c728f2d97fe19e28156f /intern | |
parent | 90be364ca9b86f6dac78925166ba3ea567fc950d (diff) |
GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.
This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.
libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.
Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.
Ref T76428
Differential Revision: https://developer.blender.org/D15291
Diffstat (limited to 'intern')
38 files changed, 258 insertions, 1648 deletions
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt index 6387fd016ba..e1dfc7043e9 100644 --- a/intern/CMakeLists.txt +++ b/intern/CMakeLists.txt @@ -11,7 +11,6 @@ add_subdirectory(memutil) add_subdirectory(opencolorio) add_subdirectory(opensubdiv) add_subdirectory(mikktspace) -add_subdirectory(glew-mx) add_subdirectory(eigen) add_subdirectory(sky) diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt index 6aea962eab5..d46ece55256 100644 --- a/intern/cycles/app/CMakeLists.txt +++ b/intern/cycles/app/CMakeLists.txt @@ -44,8 +44,8 @@ endif() if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) add_definitions(${GL_DEFINITIONS}) - list(APPEND INC_SYS ${GLEW_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}) - list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${CYCLES_GLEW_LIBRARIES} ${SDL2_LIBRARIES}) + list(APPEND INC_SYS ${Epoxy_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS}) + list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${Epoxy_LIBRARIES} ${SDL2_LIBRARIES}) endif() cycles_external_libraries_append(LIB) diff --git a/intern/cycles/app/opengl/display_driver.cpp b/intern/cycles/app/opengl/display_driver.cpp index 8b99f3b6feb..d9c72c07ae4 100644 --- a/intern/cycles/app/opengl/display_driver.cpp +++ b/intern/cycles/app/opengl/display_driver.cpp @@ -7,8 +7,8 @@ #include "util/log.h" #include "util/string.h" -#include <GL/glew.h> #include <SDL.h> +#include <epoxy/gl.h> CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/app/opengl/shader.cpp b/intern/cycles/app/opengl/shader.cpp index 9db9ea7fce9..4d22fc2b763 100644 --- a/intern/cycles/app/opengl/shader.cpp +++ b/intern/cycles/app/opengl/shader.cpp @@ -6,7 +6,7 @@ #include "util/log.h" #include "util/string.h" -#include <GL/glew.h> +#include <epoxy/gl.h> CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/app/opengl/window.cpp b/intern/cycles/app/opengl/window.cpp index 7351ae3eecd..f3352decd08 100644 --- a/intern/cycles/app/opengl/window.cpp +++ b/intern/cycles/app/opengl/window.cpp @@ -11,8 +11,8 @@ #include "util/time.h" #include "util/version.h" -#include <GL/glew.h> #include <SDL.h> +#include <epoxy/gl.h> CCL_NAMESPACE_BEGIN @@ -294,7 +294,6 @@ void window_main_loop(const char *title, SDL_RaiseWindow(V.window); V.gl_context = SDL_GL_CreateContext(V.window); - glewInit(); SDL_GL_MakeCurrent(V.window, nullptr); window_reshape(width, height); diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index 63d89221d20..095615f15d5 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -3,7 +3,6 @@ set(INC .. - ../../glew-mx ../../guardedalloc ../../mikktspace ../../../source/blender/makesdna @@ -13,8 +12,8 @@ set(INC ) set(INC_SYS + ${Epoxy_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} - ${GLEW_INCLUDE_DIR} ) set(SRC @@ -64,6 +63,7 @@ set(LIB cycles_subd cycles_util + ${Epoxy_LIBRARIES} ${PYTHON_LINKFLAGS} ${PYTHON_LIBRARIES} ) diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 51830250f2e..bc859d830ba 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -505,26 +505,19 @@ if(CYCLES_STANDALONE_REPOSITORY) endif() ########################################################################### -# GLEW +# Epoxy ########################################################################### if(CYCLES_STANDALONE_REPOSITORY) if((WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) OR WITH_CYCLES_HYDRA_RENDER_DELEGATE) if(MSVC AND EXISTS ${_cycles_lib_dir}) - set(GLEW_LIBRARY "${_cycles_lib_dir}/opengl/lib/glew.lib") - set(GLEW_INCLUDE_DIR "${_cycles_lib_dir}/opengl/include") - add_definitions(-DGLEW_STATIC) + set(Epoxy_LIBRARIES "${_cycles_lib_dir}/epoxy/lib/epoxy.lib") + set(Epoxy_INCLUDE_DIRS "${_cycles_lib_dir}/epoxy/include") else() - find_package(GLEW REQUIRED) + find_package(Epoxy REQUIRED) endif() - - set(CYCLES_GLEW_LIBRARIES ${GLEW_LIBRARY}) endif() -else() - # Workaround for unconventional variable name use in Blender. - set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_PATH}") - set(CYCLES_GLEW_LIBRARIES bf_intern_glew_mx ${BLENDER_GLEW_LIBRARIES}) endif() ########################################################################### diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt index 6418801c572..71789a76406 100644 --- a/intern/cycles/device/CMakeLists.txt +++ b/intern/cycles/device/CMakeLists.txt @@ -3,12 +3,9 @@ set(INC .. - ../../glew-mx ) -set(INC_SYS - ${GLEW_INCLUDE_DIR} -) +set(INC_SYS ) if(WITH_CYCLES_DEVICE_OPTIX OR WITH_CYCLES_DEVICE_CUDA) if(WITH_CUDA_DYNLOAD) diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp index 82db55ea715..a84f1edd70e 100644 --- a/intern/cycles/device/hip/device_impl.cpp +++ b/intern/cycles/device/hip/device_impl.cpp @@ -16,7 +16,6 @@ # include "util/log.h" # include "util/map.h" # include "util/md5.h" -# include "util/opengl.h" # include "util/path.h" # include "util/string.h" # include "util/system.h" diff --git a/intern/cycles/hydra/CMakeLists.txt b/intern/cycles/hydra/CMakeLists.txt index aa194fb936e..60bb40a0d63 100644 --- a/intern/cycles/hydra/CMakeLists.txt +++ b/intern/cycles/hydra/CMakeLists.txt @@ -10,14 +10,14 @@ set(INC ) set(INC_SYS ${USD_INCLUDE_DIRS} - ${GLEW_INCLUDE_DIR} + ${Epoxy_INCLUDE_DIRS} ) set(LIB cycles_scene cycles_session cycles_graph - ${CYCLES_GLEW_LIBRARIES} + ${Epoxy_LIBRARIES} ) cycles_external_libraries_append(LIB) diff --git a/intern/cycles/hydra/display_driver.cpp b/intern/cycles/hydra/display_driver.cpp index 0c0b577c358..1a989605335 100644 --- a/intern/cycles/hydra/display_driver.cpp +++ b/intern/cycles/hydra/display_driver.cpp @@ -11,7 +11,7 @@ #include "hydra/render_buffer.h" #include "hydra/session.h" -#include <GL/glew.h> +#include <epoxy/gl.h> #include <pxr/imaging/hgiGL/texture.h> HDCYCLES_NAMESPACE_OPEN_SCOPE diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 81a7607baab..2dafe729dfe 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -3,7 +3,6 @@ set(INC .. - ../../glew-mx ) set(INC_SYS diff --git a/intern/cycles/util/opengl.h b/intern/cycles/util/opengl.h index 090deb861c4..fefee4ec022 100644 --- a/intern/cycles/util/opengl.h +++ b/intern/cycles/util/opengl.h @@ -7,6 +7,6 @@ /* OpenGL header includes, used everywhere we use OpenGL, to deal with * platform differences in one central place. */ -#include <GL/glew.h> +#include <epoxy/gl.h> #endif /* __UTIL_OPENGL_H__ */ diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 0ac3a234946..8b19aad7043 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -4,14 +4,13 @@ set(INC . ../clog - ../glew-mx ../../source/blender/blenlib ../../source/blender/imbuf ../../source/blender/makesdna ) set(INC_SYS - ${GLEW_INCLUDE_PATH} + ${Epoxy_INCLUDE_DIRS} ) set(SRC @@ -74,8 +73,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 f4b3d08ffc5..aa379efbc1f 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 @@ -123,11 +123,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..d3c190a13b1 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,89 +266,6 @@ static HWND clone_window(HWND hWnd, LPVOID lpParam) return hwndCloned; } -void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD) -{ - HWND dummyHWND = NULL; - - HDC dummyHDC = NULL; - HGLRC dummyHGLRC = NULL; - - HDC prevHDC; - HGLRC prevHGLRC; - - int iPixelFormat; - - SetLastError(NO_ERROR); - - prevHDC = ::wglGetCurrentDC(); - WIN32_CHK(GetLastError() == NO_ERROR); - - prevHGLRC = ::wglGetCurrentContext(); - WIN32_CHK(GetLastError() == NO_ERROR); - - iPixelFormat = choose_pixel_format_legacy(m_hDC, preferredPFD); - - if (iPixelFormat == 0) - goto finalize; - - PIXELFORMATDESCRIPTOR chosenPFD; - if (!WIN32_CHK( - ::DescribePixelFormat(m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD))) - goto finalize; - - if (m_hWnd) { - dummyHWND = clone_window(m_hWnd, NULL); - - if (dummyHWND == NULL) - goto finalize; - - dummyHDC = GetDC(dummyHWND); - } - - if (!WIN32_CHK(dummyHDC != NULL)) - goto finalize; - - if (!WIN32_CHK(::SetPixelFormat(dummyHDC, iPixelFormat, &chosenPFD))) - goto finalize; - - dummyHGLRC = ::wglCreateContext(dummyHDC); - - if (!WIN32_CHK(dummyHGLRC != NULL)) - goto finalize; - - 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); - free((void *)m_dummyVersion); - - m_dummyRenderer = _strdup(reinterpret_cast<const char *>(glGetString(GL_RENDERER))); - m_dummyVendor = _strdup(reinterpret_cast<const char *>(glGetString(GL_VENDOR))); - m_dummyVersion = _strdup(reinterpret_cast<const char *>(glGetString(GL_VERSION))); -#endif - -finalize: - WIN32_CHK(::wglMakeCurrent(prevHDC, prevHGLRC)); - - if (dummyHGLRC != NULL) - WIN32_CHK(::wglDeleteContext(dummyHGLRC)); - - if (dummyHWND != NULL) { - if (dummyHDC != NULL) - WIN32_CHK(::ReleaseDC(dummyHWND, dummyHDC)); - - WIN32_CHK(::DestroyWindow(dummyHWND)); - } -} - static void makeAttribList(std::vector<int> &out, bool stereoVisual, bool needAlpha) { out.clear(); @@ -385,6 +302,130 @@ static void makeAttribList(std::vector<int> &out, bool stereoVisual, bool needAl out.push_back(0); } +/* Temporary context used to create the actual context. We need ARB pixel format + * and context extensions, which are only available within a context. */ +struct DummyContextWGL { + HWND dummyHWND = NULL; + + HDC dummyHDC = NULL; + HGLRC dummyHGLRC = NULL; + + HDC prevHDC = NULL; + HGLRC prevHGLRC = NULL; + + int dummyPixelFormat = 0; + + PIXELFORMATDESCRIPTOR preferredPFD; + + bool has_WGL_ARB_pixel_format = false; + bool has_WGL_ARB_create_context = false; + bool has_WGL_ARB_create_context_profile = false; + bool has_WGL_ARB_create_context_robustness = false; + + DummyContextWGL(HDC hDC, HWND hWnd, bool stereoVisual, bool needAlpha) + { + preferredPFD = { + sizeof(PIXELFORMATDESCRIPTOR), /* size */ + 1, /* version */ + (DWORD)(PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | + PFD_DOUBLEBUFFER | /* support double-buffering */ + (stereoVisual ? PFD_STEREO : 0) | /* support stereo */ + ( +#ifdef WIN32_COMPOSITING + /* Support composition for transparent background. */ + needAlpha ? PFD_SUPPORT_COMPOSITION : +#endif + 0)), + PFD_TYPE_RGBA, /* color type */ + (BYTE)(needAlpha ? 32 : 24), /* preferred color depth */ + 0, + 0, + 0, + 0, + 0, + 0, /* color bits (ignored) */ + (BYTE)(needAlpha ? 8 : 0), /* alpha buffer */ + 0, /* alpha shift (ignored) */ + 0, /* no accumulation buffer */ + 0, + 0, + 0, + 0, /* accum bits (ignored) */ + 0, /* depth buffer */ + 0, /* stencil buffer */ + 0, /* no auxiliary buffers */ + PFD_MAIN_PLANE, /* main layer */ + 0, /* reserved */ + 0, + 0, + 0 /* layer, visible, and damage masks (ignored) */ + }; + + SetLastError(NO_ERROR); + + prevHDC = ::wglGetCurrentDC(); + WIN32_CHK(GetLastError() == NO_ERROR); + + prevHGLRC = ::wglGetCurrentContext(); + WIN32_CHK(GetLastError() == NO_ERROR); + + dummyPixelFormat = choose_pixel_format_legacy(hDC, preferredPFD); + + if (dummyPixelFormat == 0) + return; + + PIXELFORMATDESCRIPTOR chosenPFD; + if (!WIN32_CHK(::DescribePixelFormat( + hDC, dummyPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD))) + return; + + if (hWnd) { + dummyHWND = clone_window(hWnd, NULL); + + if (dummyHWND == NULL) + return; + + dummyHDC = GetDC(dummyHWND); + } + + if (!WIN32_CHK(dummyHDC != NULL)) + return; + + if (!WIN32_CHK(::SetPixelFormat(dummyHDC, dummyPixelFormat, &chosenPFD))) + return; + + dummyHGLRC = ::wglCreateContext(dummyHDC); + + if (!WIN32_CHK(dummyHGLRC != NULL)) + return; + + if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC))) + return; + + has_WGL_ARB_pixel_format = epoxy_has_wgl_extension(hDC, "WGL_ARB_pixel_format"); + has_WGL_ARB_create_context = epoxy_has_wgl_extension(hDC, "WGL_ARB_create_context"); + has_WGL_ARB_create_context_profile = epoxy_has_wgl_extension(hDC, + "WGL_ARB_create_context_profile"); + has_WGL_ARB_create_context_robustness = epoxy_has_wgl_extension( + hDC, "WGL_ARB_create_context_robustness"); + } + + ~DummyContextWGL() + { + WIN32_CHK(::wglMakeCurrent(prevHDC, prevHGLRC)); + + if (dummyHGLRC != NULL) + WIN32_CHK(::wglDeleteContext(dummyHGLRC)); + + if (dummyHWND != NULL) { + if (dummyHDC != NULL) + WIN32_CHK(::ReleaseDC(dummyHWND, dummyHDC)); + + WIN32_CHK(::DestroyWindow(dummyHWND)); + } + } +}; + int GHOST_ContextWGL::_choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha) { std::vector<int> iAttributes; @@ -454,58 +495,6 @@ int GHOST_ContextWGL::choose_pixel_format_arb(bool stereoVisual, bool needAlpha) return iPixelFormat; } -int GHOST_ContextWGL::choose_pixel_format(bool stereoVisual, bool needAlpha) -{ - PIXELFORMATDESCRIPTOR preferredPFD = { - sizeof(PIXELFORMATDESCRIPTOR), /* size */ - 1, /* version */ - (DWORD)(PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | - PFD_DOUBLEBUFFER | /* support double-buffering */ - (stereoVisual ? PFD_STEREO : 0) | /* support stereo */ - ( -#ifdef WIN32_COMPOSITING - /* Support composition for transparent background. */ - needAlpha ? PFD_SUPPORT_COMPOSITION : -#endif - 0)), - PFD_TYPE_RGBA, /* color type */ - (BYTE)(needAlpha ? 32 : 24), /* preferred color depth */ - 0, - 0, - 0, - 0, - 0, - 0, /* color bits (ignored) */ - (BYTE)(needAlpha ? 8 : 0), /* alpha buffer */ - 0, /* alpha shift (ignored) */ - 0, /* no accumulation buffer */ - 0, - 0, - 0, - 0, /* accum bits (ignored) */ - 0, /* depth buffer */ - 0, /* stencil buffer */ - 0, /* no auxiliary buffers */ - PFD_MAIN_PLANE, /* main layer */ - 0, /* reserved */ - 0, - 0, - 0 /* layer, visible, and damage masks (ignored) */ - }; - - initContextWGLEW(preferredPFD); - - int iPixelFormat = 0; - - if (WGLEW_ARB_pixel_format) - iPixelFormat = choose_pixel_format_arb(stereoVisual, needAlpha); - - if (iPixelFormat == 0) - iPixelFormat = choose_pixel_format_legacy(m_hDC, preferredPFD); - - return iPixelFormat; -} - #ifndef NDEBUG static void reportContextString(const char *name, const char *dummy, const char *context) { @@ -526,107 +515,96 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext() HDC prevHDC = ::wglGetCurrentDC(); WIN32_CHK(GetLastError() == NO_ERROR); - if (!WGLEW_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) { + { const bool needAlpha = m_alphaBackground; - int iPixelFormat; - int lastPFD; - - PIXELFORMATDESCRIPTOR chosenPFD; - - iPixelFormat = choose_pixel_format(m_stereoVisual, needAlpha); + DummyContextWGL dummy(m_hDC, m_hWnd, m_stereoVisual, needAlpha); - if (iPixelFormat == 0) { - goto error; - } + if (!dummy.has_WGL_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) { + int iPixelFormat = 0; - lastPFD = ::DescribePixelFormat( - m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD); - - if (!WIN32_CHK(lastPFD != 0)) { - goto error; - } + if (dummy.has_WGL_ARB_pixel_format) + iPixelFormat = choose_pixel_format_arb(m_stereoVisual, needAlpha); - if (needAlpha && chosenPFD.cAlphaBits == 0) - fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n"); + if (iPixelFormat == 0) + iPixelFormat = choose_pixel_format_legacy(m_hDC, dummy.preferredPFD); - if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) { - goto error; - } - } + if (iPixelFormat == 0) { + goto error; + } - if (WGLEW_ARB_create_context) { - int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB; - int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + PIXELFORMATDESCRIPTOR chosenPFD; + int lastPFD = ::DescribePixelFormat( + m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD); -#ifdef WITH_GLEW_ES - int profileBitES = m_contextProfileMask & WGL_CONTEXT_ES_PROFILE_BIT_EXT; -#endif + if (!WIN32_CHK(lastPFD != 0)) { + goto error; + } - if (!WGLEW_ARB_create_context_profile && profileBitCore) - fprintf(stderr, "Warning! OpenGL core profile not available.\n"); + if (needAlpha && chosenPFD.cAlphaBits == 0) + fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n"); - if (!WGLEW_ARB_create_context_profile && profileBitCompat) - fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n"); + if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) { + goto error; + } + } -#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 (dummy.has_WGL_ARB_create_context) { + int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - if (!WGLEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2) - fprintf(stderr, "Warning! OpenGL ES2 profile not available.\n"); -#endif + if (!dummy.has_WGL_ARB_create_context_profile && profileBitCore) + fprintf(stderr, "Warning! OpenGL core profile not available.\n"); - int profileMask = 0; + if (!dummy.has_WGL_ARB_create_context_profile && profileBitCompat) + fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n"); - if (WGLEW_ARB_create_context_profile && profileBitCore) - profileMask |= profileBitCore; + int profileMask = 0; - if (WGLEW_ARB_create_context_profile && profileBitCompat) - profileMask |= profileBitCompat; + if (dummy.has_WGL_ARB_create_context_profile && profileBitCore) + profileMask |= profileBitCore; -#ifdef WITH_GLEW_ES - if (WGLEW_EXT_create_context_es_profile && profileBitES) - profileMask |= profileBitES; -#endif + if (dummy.has_WGL_ARB_create_context_profile && profileBitCompat) + profileMask |= profileBitCompat; - if (profileMask != m_contextProfileMask) - fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits."); + if (profileMask != m_contextProfileMask) + fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits."); - std::vector<int> iAttributes; + std::vector<int> iAttributes; - if (profileMask) { - iAttributes.push_back(WGL_CONTEXT_PROFILE_MASK_ARB); - iAttributes.push_back(profileMask); - } - - if (m_contextMajorVersion != 0) { - iAttributes.push_back(WGL_CONTEXT_MAJOR_VERSION_ARB); - iAttributes.push_back(m_contextMajorVersion); - } + if (profileMask) { + iAttributes.push_back(WGL_CONTEXT_PROFILE_MASK_ARB); + iAttributes.push_back(profileMask); + } - if (m_contextMinorVersion != 0) { - iAttributes.push_back(WGL_CONTEXT_MINOR_VERSION_ARB); - iAttributes.push_back(m_contextMinorVersion); - } + if (m_contextMajorVersion != 0) { + iAttributes.push_back(WGL_CONTEXT_MAJOR_VERSION_ARB); + iAttributes.push_back(m_contextMajorVersion); + } - if (m_contextFlags != 0) { - iAttributes.push_back(WGL_CONTEXT_FLAGS_ARB); - iAttributes.push_back(m_contextFlags); - } + if (m_contextMinorVersion != 0) { + iAttributes.push_back(WGL_CONTEXT_MINOR_VERSION_ARB); + iAttributes.push_back(m_contextMinorVersion); + } - if (m_contextResetNotificationStrategy != 0) { - if (WGLEW_ARB_create_context_robustness) { - iAttributes.push_back(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); - iAttributes.push_back(m_contextResetNotificationStrategy); + if (m_contextFlags != 0) { + iAttributes.push_back(WGL_CONTEXT_FLAGS_ARB); + iAttributes.push_back(m_contextFlags); } - else { - fprintf(stderr, "Warning! Cannot set the reset notification strategy."); + + if (m_contextResetNotificationStrategy != 0) { + if (dummy.has_WGL_ARB_create_context_robustness) { + iAttributes.push_back(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); + iAttributes.push_back(m_contextResetNotificationStrategy); + } + else { + fprintf(stderr, "Warning! Cannot set the reset notification strategy."); + } } - } - iAttributes.push_back(0); + iAttributes.push_back(0); - m_hGLRC = ::wglCreateContextAttribsARB(m_hDC, NULL, &(iAttributes[0])); + m_hGLRC = ::wglCreateContextAttribsARB(m_hDC, NULL, &(iAttributes[0])); + } } /* Silence warnings interpreted as errors by users when trying to get @@ -651,8 +629,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..c02c0616422 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 @@ -86,12 +86,9 @@ class GHOST_ContextWGL : public GHOST_Context { GHOST_TSuccess getSwapInterval(int &intervalOut); private: - int choose_pixel_format(bool stereoVisual, bool needAlpha); int choose_pixel_format_arb(bool stereoVisual, bool needAlpha); int _choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha); - void initContextWGLEW(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 0494e462bfc..0c29a825b8c 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 83c608435b0..5057989d864 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -1307,16 +1307,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 diff --git a/intern/glew-mx/CMakeLists.txt b/intern/glew-mx/CMakeLists.txt deleted file mode 100644 index 49e9762672f..00000000000 --- a/intern/glew-mx/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright 2014 Blender Foundation. All rights reserved. - -set(INC - . -) - -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - -set(SRC - intern/glew-mx.c - - glew-mx.h - intern/gl-deprecated.h - intern/symbol-binding.h -) - -set(LIB -) - -add_definitions(${GL_DEFINITIONS}) - -blender_add_lib(bf_intern_glew_mx "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/glew-mx/glew-mx.h b/intern/glew-mx/glew-mx.h deleted file mode 100644 index e7972697010..00000000000 --- a/intern/glew-mx/glew-mx.h +++ /dev/null @@ -1,57 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright 2014 Blender Foundation. All rights reserved. */ - -/** \file - * \ingroup intern_glew-mx - * - * Support for GLEW Multiple rendering conteXts (MX) - * Maintained as a Blender Library. - * - * Different rendering contexts may have different entry points - * to extension functions of the same name. So it can cause - * problems if, for example, a second context uses a pointer to - * say, glActiveTextureARB, that was queried from the first context. - * - * GLEW has basic support for multiple contexts by enabling WITH_GLEW_MX, - * but it does not provide a full implementation. This is because - * there are too many questions about thread safety and memory - * allocation that are up to the user of GLEW. - * - * This implementation is very basic and isn't thread safe. - * For a single context the overhead should be - * no more than using GLEW without WITH_GLEW_MX enabled. - */ - -#ifndef __GLEW_MX_H__ -#define __GLEW_MX_H__ - -#include <GL/glew.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#include "intern/symbol-binding.h" - -/* If compiling only for OpenGL 3.2 Core Profile then we should make sure - * no legacy API entries or symbolic constants are used. - */ -#if (!defined(WITH_LEGACY_OPENGL)) || defined(WITH_GL_PROFILE_CORE) && \ - !defined(WITH_GL_PROFILE_COMPAT) && \ - !defined(WITH_GL_PROFILE_ES20) -# include "intern/gl-deprecated.h" -#endif - -GLenum glew_chk(GLenum error, const char *file, int line, const char *text); - -#ifndef NDEBUG -# define GLEW_CHK(x) glew_chk((x), __FILE__, __LINE__, # x) -#else -# define GLEW_CHK(x) glew_chk((x), NULL, 0, NULL) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __GLEW_MX_H__ */ diff --git a/intern/glew-mx/intern/gl-deprecated.h b/intern/glew-mx/intern/gl-deprecated.h deleted file mode 100644 index 762699d74d2..00000000000 --- a/intern/glew-mx/intern/gl-deprecated.h +++ /dev/null @@ -1,848 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright 2014 Blender Foundation. All rights reserved. */ - -/** \file - * \ingroup intern_glew-mx - * Utility used to check for use of deprecated functions. - */ - -#ifndef __GL_DEPRECATED_H__ -#define __GL_DEPRECATED_H__ - -// GL Version 1.0 -#undef glAccum -#define glAccum DO_NOT_USE_glAccum -#undef glAlphaFunc -#define glAlphaFunc DO_NOT_USE_glAlphaFunc -#undef glBegin -#define glBegin DO_NOT_USE_glBegin -#undef glBitmap -#define glBitmap DO_NOT_USE_glBitmap -#undef glCallList -#define glCallList DO_NOT_USE_glCallList -#undef glCallLists -#define glCallLists DO_NOT_USE_glCallLists -#undef glClearAccum -#define glClearAccum DO_NOT_USE_glClearAccum -#undef glClearIndex -#define glClearIndex DO_NOT_USE_glClearIndex -#undef glClipPlane -#define glClipPlane DO_NOT_USE_glClipPlane -#undef glColor3b -#define glColor3b DO_NOT_USE_glColor3b -#undef glColor3bv -#define glColor3bv DO_NOT_USE_glColor3bv -#undef glColor3d -#define glColor3d DO_NOT_USE_glColor3d -#undef glColor3dv -#define glColor3dv DO_NOT_USE_glColor3dv -#undef glColor3f -#define glColor3f DO_NOT_USE_glColor3f -#undef glColor3fv -#define glColor3fv DO_NOT_USE_glColor3fv -#undef glColor3i -#define glColor3i DO_NOT_USE_glColor3i -#undef glColor3iv -#define glColor3iv DO_NOT_USE_glColor3iv -#undef glColor3s -#define glColor3s DO_NOT_USE_glColor3s -#undef glColor3sv -#define glColor3sv DO_NOT_USE_glColor3sv -#undef glColor3ub -#define glColor3ub DO_NOT_USE_glColor3ub -#undef glColor3ubv -#define glColor3ubv DO_NOT_USE_glColor3ubv -#undef glColor3ui -#define glColor3ui DO_NOT_USE_glColor3ui -#undef glColor3uiv -#define glColor3uiv DO_NOT_USE_glColor3uiv -#undef glColor3us -#define glColor3us DO_NOT_USE_glColor3us -#undef glColor3usv -#define glColor3usv DO_NOT_USE_glColor3usv -#undef glColor4b -#define glColor4b DO_NOT_USE_glColor4b -#undef glColor4bv -#define glColor4bv DO_NOT_USE_glColor4bv -#undef glColor4d -#define glColor4d DO_NOT_USE_glColor4d -#undef glColor4dv -#define glColor4dv DO_NOT_USE_glColor4dv -#undef glColor4f -#define glColor4f DO_NOT_USE_glColor4f -#undef glColor4fv -#define glColor4fv DO_NOT_USE_glColor4fv -#undef glColor4i -#define glColor4i DO_NOT_USE_glColor4i -#undef glColor4iv -#define glColor4iv DO_NOT_USE_glColor4iv -#undef glColor4s -#define glColor4s DO_NOT_USE_glColor4s -#undef glColor4sv -#define glColor4sv DO_NOT_USE_glColor4sv -#undef glColor4ub -#define glColor4ub DO_NOT_USE_glColor4ub -#undef glColor4ubv -#define glColor4ubv DO_NOT_USE_glColor4ubv -#undef glColor4ui -#define glColor4ui DO_NOT_USE_glColor4ui -#undef glColor4uiv -#define glColor4uiv DO_NOT_USE_glColor4uiv -#undef glColor4us -#define glColor4us DO_NOT_USE_glColor4us -#undef glColor4usv -#define glColor4usv DO_NOT_USE_glColor4usv -#undef glColorMaterial -#define glColorMaterial DO_NOT_USE_glColorMaterial -#undef glCopyPixels -#define glCopyPixels DO_NOT_USE_glCopyPixels -#undef glDeleteLists -#define glDeleteLists DO_NOT_USE_glDeleteLists -#undef glDrawPixels -#define glDrawPixels DO_NOT_USE_glDrawPixels -#undef glEdgeFlag -#define glEdgeFlag DO_NOT_USE_glEdgeFlag -#undef glEdgeFlagv -#define glEdgeFlagv DO_NOT_USE_glEdgeFlagv -#undef glEnd -#define glEnd DO_NOT_USE_glEnd -#undef glEndList -#define glEndList DO_NOT_USE_glEndList -#undef glEvalCoord1d -#define glEvalCoord1d DO_NOT_USE_glEvalCoord1d -#undef glEvalCoord1dv -#define glEvalCoord1dv DO_NOT_USE_glEvalCoord1dv -#undef glEvalCoord1f -#define glEvalCoord1f DO_NOT_USE_glEvalCoord1f -#undef glEvalCoord1fv -#define glEvalCoord1fv DO_NOT_USE_glEvalCoord1fv -#undef glEvalCoord2d -#define glEvalCoord2d DO_NOT_USE_glEvalCoord2d -#undef glEvalCoord2dv -#define glEvalCoord2dv DO_NOT_USE_glEvalCoord2dv -#undef glEvalCoord2f -#define glEvalCoord2f DO_NOT_USE_glEvalCoord2f -#undef glEvalCoord2fv -#define glEvalCoord2fv DO_NOT_USE_glEvalCoord2fv -#undef glEvalMesh1 -#define glEvalMesh1 DO_NOT_USE_glEvalMesh1 -#undef glEvalMesh2 -#define glEvalMesh2 DO_NOT_USE_glEvalMesh2 -#undef glEvalPoint1 -#define glEvalPoint1 DO_NOT_USE_glEvalPoint1 -#undef glEvalPoint2 -#define glEvalPoint2 DO_NOT_USE_glEvalPoint2 -#undef glFeedbackBuffer -#define glFeedbackBuffer DO_NOT_USE_glFeedbackBuffer -#undef glFogf -#define glFogf DO_NOT_USE_glFogf -#undef glFogfv -#define glFogfv DO_NOT_USE_glFogfv -#undef glFogi -#define glFogi DO_NOT_USE_glFogi -#undef glFogiv -#define glFogiv DO_NOT_USE_glFogiv -#undef glFrustum -#define glFrustum DO_NOT_USE_glFrustum -#undef glGenLists -#define glGenLists DO_NOT_USE_glGenLists -#undef glGetClipPlane -#define glGetClipPlane DO_NOT_USE_glGetClipPlane -#undef glGetLightfv -#define glGetLightfv DO_NOT_USE_glGetLightfv -#undef glGetLightiv -#define glGetLightiv DO_NOT_USE_glGetLightiv -#undef glGetMapdv -#define glGetMapdv DO_NOT_USE_glGetMapdv -#undef glGetMapfv -#define glGetMapfv DO_NOT_USE_glGetMapfv -#undef glGetMapiv -#define glGetMapiv DO_NOT_USE_glGetMapiv -#undef glGetMaterialfv -#define glGetMaterialfv DO_NOT_USE_glGetMaterialfv -#undef glGetMaterialiv -#define glGetMaterialiv DO_NOT_USE_glGetMaterialiv -#undef glGetPixelMapfv -#define glGetPixelMapfv DO_NOT_USE_glGetPixelMapfv -#undef glGetPixelMapuiv -#define glGetPixelMapuiv DO_NOT_USE_glGetPixelMapuiv -#undef glGetPixelMapusv -#define glGetPixelMapusv DO_NOT_USE_glGetPixelMapusv -#undef glGetPolygonStipple -#define glGetPolygonStipple DO_NOT_USE_glGetPolygonStipple -#undef glGetTexEnvfv -#define glGetTexEnvfv DO_NOT_USE_glGetTexEnvfv -#undef glGetTexEnviv -#define glGetTexEnviv DO_NOT_USE_glGetTexEnviv -#undef glGetTexGendv -#define glGetTexGendv DO_NOT_USE_glGetTexGendv -#undef glGetTexGenfv -#define glGetTexGenfv DO_NOT_USE_glGetTexGenfv -#undef glGetTexGeniv -#define glGetTexGeniv DO_NOT_USE_glGetTexGeniv -#undef glIndexMask -#define glIndexMask DO_NOT_USE_glIndexMask -#undef glIndexd -#define glIndexd DO_NOT_USE_glIndexd -#undef glIndexdv -#define glIndexdv DO_NOT_USE_glIndexdv -#undef glIndexf -#define glIndexf DO_NOT_USE_glIndexf -#undef glIndexfv -#define glIndexfv DO_NOT_USE_glIndexfv -#undef glIndexi -#define glIndexi DO_NOT_USE_glIndexi -#undef glIndexiv -#define glIndexiv DO_NOT_USE_glIndexiv -#undef glIndexs -#define glIndexs DO_NOT_USE_glIndexs -#undef glIndexsv -#define glIndexsv DO_NOT_USE_glIndexsv -#undef glInitNames -#define glInitNames DO_NOT_USE_glInitNames -#undef glIsList -#define glIsList DO_NOT_USE_glIsList -#undef glLightModelf -#define glLightModelf DO_NOT_USE_glLightModelf -#undef glLightModelfv -#define glLightModelfv DO_NOT_USE_glLightModelfv -#undef glLightModeli -#define glLightModeli DO_NOT_USE_glLightModeli -#undef glLightModeliv -#define glLightModeliv DO_NOT_USE_glLightModeliv -#undef glLightf -#define glLightf DO_NOT_USE_glLightf -#undef glLightfv -#define glLightfv DO_NOT_USE_glLightfv -#undef glLighti -#define glLighti DO_NOT_USE_glLighti -#undef glLightiv -#define glLightiv DO_NOT_USE_glLightiv -#undef glLineStipple -#define glLineStipple DO_NOT_USE_glLineStipple -#undef glListBase -#define glListBase DO_NOT_USE_glListBase -#undef glLoadIdentity -#define glLoadIdentity DO_NOT_USE_glLoadIdentity -#undef glLoadMatrixd -#define glLoadMatrixd DO_NOT_USE_glLoadMatrixd -#undef glLoadMatrixf -#define glLoadMatrixf DO_NOT_USE_glLoadMatrixf -#undef glLoadName -#define glLoadName DO_NOT_USE_glLoadName -#undef glMap1d -#define glMap1d DO_NOT_USE_glMap1d -#undef glMap1f -#define glMap1f DO_NOT_USE_glMap1f -#undef glMap2d -#define glMap2d DO_NOT_USE_glMap2d -#undef glMap2f -#define glMap2f DO_NOT_USE_glMap2f -#undef glMapGrid1d -#define glMapGrid1d DO_NOT_USE_glMapGrid1d -#undef glMapGrid1f -#define glMapGrid1f DO_NOT_USE_glMapGrid1f -#undef glMapGrid2d -#define glMapGrid2d DO_NOT_USE_glMapGrid2d -#undef glMapGrid2f -#define glMapGrid2f DO_NOT_USE_glMapGrid2f -#undef glMaterialf -#define glMaterialf DO_NOT_USE_glMaterialf -#undef glMaterialfv -#define glMaterialfv DO_NOT_USE_glMaterialfv -#undef glMateriali -#define glMateriali DO_NOT_USE_glMateriali -#undef glMaterialiv -#define glMaterialiv DO_NOT_USE_glMaterialiv -#undef glMatrixMode -#define glMatrixMode DO_NOT_USE_glMatrixMode -#undef glMultMatrixd -#define glMultMatrixd DO_NOT_USE_glMultMatrixd -#undef glMultMatrixf -#define glMultMatrixf DO_NOT_USE_glMultMatrixf -#undef glNewList -#define glNewList DO_NOT_USE_glNewList -#undef glNormal3b -#define glNormal3b DO_NOT_USE_glNormal3b -#undef glNormal3bv -#define glNormal3bv DO_NOT_USE_glNormal3bv -#undef glNormal3d -#define glNormal3d DO_NOT_USE_glNormal3d -#undef glNormal3dv -#define glNormal3dv DO_NOT_USE_glNormal3dv -#undef glNormal3f -#define glNormal3f DO_NOT_USE_glNormal3f -#undef glNormal3fv -#define glNormal3fv DO_NOT_USE_glNormal3fv -#undef glNormal3i -#define glNormal3i DO_NOT_USE_glNormal3i -#undef glNormal3iv -#define glNormal3iv DO_NOT_USE_glNormal3iv -#undef glNormal3s -#define glNormal3s DO_NOT_USE_glNormal3s -#undef glNormal3sv -#define glNormal3sv DO_NOT_USE_glNormal3sv -#undef glOrtho -#define glOrtho DO_NOT_USE_glOrtho -#undef glPassThrough -#define glPassThrough DO_NOT_USE_glPassThrough -#undef glPixelMapfv -#define glPixelMapfv DO_NOT_USE_glPixelMapfv -#undef glPixelMapuiv -#define glPixelMapuiv DO_NOT_USE_glPixelMapuiv -#undef glPixelMapusv -#define glPixelMapusv DO_NOT_USE_glPixelMapusv -#undef glPixelTransferf -#define glPixelTransferf DO_NOT_USE_glPixelTransferf -#undef glPixelTransferi -#define glPixelTransferi DO_NOT_USE_glPixelTransferi -#undef glPixelZoom -#define glPixelZoom DO_NOT_USE_glPixelZoom -#undef glPolygonStipple -#define glPolygonStipple DO_NOT_USE_glPolygonStipple -#undef glPopAttrib -#define glPopAttrib DO_NOT_USE_glPopAttrib -#undef glPopMatrix -#define glPopMatrix DO_NOT_USE_glPopMatrix -#undef glPopName -#define glPopName DO_NOT_USE_glPopName -#undef glPushAttrib -#define glPushAttrib DO_NOT_USE_glPushAttrib -#undef glPushMatrix -#define glPushMatrix DO_NOT_USE_glPushMatrix -#undef glPushName -#define glPushName DO_NOT_USE_glPushName -#undef glRasterPos2d -#define glRasterPos2d DO_NOT_USE_glRasterPos2d -#undef glRasterPos2dv -#define glRasterPos2dv DO_NOT_USE_glRasterPos2dv -#undef glRasterPos2f -#define glRasterPos2f DO_NOT_USE_glRasterPos2f -#undef glRasterPos2fv -#define glRasterPos2fv DO_NOT_USE_glRasterPos2fv -#undef glRasterPos2i -#define glRasterPos2i DO_NOT_USE_glRasterPos2i -#undef glRasterPos2iv -#define glRasterPos2iv DO_NOT_USE_glRasterPos2iv -#undef glRasterPos2s -#define glRasterPos2s DO_NOT_USE_glRasterPos2s -#undef glRasterPos2sv -#define glRasterPos2sv DO_NOT_USE_glRasterPos2sv -#undef glRasterPos3d -#define glRasterPos3d DO_NOT_USE_glRasterPos3d -#undef glRasterPos3dv -#define glRasterPos3dv DO_NOT_USE_glRasterPos3dv -#undef glRasterPos3f -#define glRasterPos3f DO_NOT_USE_glRasterPos3f -#undef glRasterPos3fv -#define glRasterPos3fv DO_NOT_USE_glRasterPos3fv -#undef glRasterPos3i -#define glRasterPos3i DO_NOT_USE_glRasterPos3i -#undef glRasterPos3iv -#define glRasterPos3iv DO_NOT_USE_glRasterPos3iv -#undef glRasterPos3s -#define glRasterPos3s DO_NOT_USE_glRasterPos3s -#undef glRasterPos3sv -#define glRasterPos3sv DO_NOT_USE_glRasterPos3sv -#undef glRasterPos4d -#define glRasterPos4d DO_NOT_USE_glRasterPos4d -#undef glRasterPos4dv -#define glRasterPos4dv DO_NOT_USE_glRasterPos4dv -#undef glRasterPos4f -#define glRasterPos4f DO_NOT_USE_glRasterPos4f -#undef glRasterPos4fv -#define glRasterPos4fv DO_NOT_USE_glRasterPos4fv -#undef glRasterPos4i -#define glRasterPos4i DO_NOT_USE_glRasterPos4i -#undef glRasterPos4iv -#define glRasterPos4iv DO_NOT_USE_glRasterPos4iv -#undef glRasterPos4s -#define glRasterPos4s DO_NOT_USE_glRasterPos4s -#undef glRasterPos4sv -#define glRasterPos4sv DO_NOT_USE_glRasterPos4sv -#undef glRectd -#define glRectd DO_NOT_USE_glRectd -#undef glRectdv -#define glRectdv DO_NOT_USE_glRectdv -#undef glRectf -#define glRectf DO_NOT_USE_glRectf -#undef glRectfv -#define glRectfv DO_NOT_USE_glRectfv -#undef glRecti -#define glRecti DO_NOT_USE_glRecti -#undef glRectiv -#define glRectiv DO_NOT_USE_glRectiv -#undef glRects -#define glRects DO_NOT_USE_glRects -#undef glRectsv -#define glRectsv DO_NOT_USE_glRectsv -#undef glRenderMode -#define glRenderMode DO_NOT_USE_glRenderMode -#undef glRotated -#define glRotated DO_NOT_USE_glRotated -#undef glRotatef -#define glRotatef DO_NOT_USE_glRotatef -#undef glScaled -#define glScaled DO_NOT_USE_glScaled -#undef glScalef -#define glScalef DO_NOT_USE_glScalef -#undef glSelectBuffer -#define glSelectBuffer DO_NOT_USE_glSelectBuffer -#undef glShadeModel -#define glShadeModel DO_NOT_USE_glShadeModel -#undef glTexCoord1d -#define glTexCoord1d DO_NOT_USE_glTexCoord1d -#undef glTexCoord1dv -#define glTexCoord1dv DO_NOT_USE_glTexCoord1dv -#undef glTexCoord1f -#define glTexCoord1f DO_NOT_USE_glTexCoord1f -#undef glTexCoord1fv -#define glTexCoord1fv DO_NOT_USE_glTexCoord1fv -#undef glTexCoord1i -#define glTexCoord1i DO_NOT_USE_glTexCoord1i -#undef glTexCoord1iv -#define glTexCoord1iv DO_NOT_USE_glTexCoord1iv -#undef glTexCoord1s -#define glTexCoord1s DO_NOT_USE_glTexCoord1s -#undef glTexCoord1sv -#define glTexCoord1sv DO_NOT_USE_glTexCoord1sv -#undef glTexCoord2d -#define glTexCoord2d DO_NOT_USE_glTexCoord2d -#undef glTexCoord2dv -#define glTexCoord2dv DO_NOT_USE_glTexCoord2dv -#undef glTexCoord2f -#define glTexCoord2f DO_NOT_USE_glTexCoord2f -#undef glTexCoord2fv -#define glTexCoord2fv DO_NOT_USE_glTexCoord2fv -#undef glTexCoord2i -#define glTexCoord2i DO_NOT_USE_glTexCoord2i -#undef glTexCoord2iv -#define glTexCoord2iv DO_NOT_USE_glTexCoord2iv -#undef glTexCoord2s -#define glTexCoord2s DO_NOT_USE_glTexCoord2s -#undef glTexCoord2sv -#define glTexCoord2sv DO_NOT_USE_glTexCoord2sv -#undef glTexCoord3d -#define glTexCoord3d DO_NOT_USE_glTexCoord3d -#undef glTexCoord3dv -#define glTexCoord3dv DO_NOT_USE_glTexCoord3dv -#undef glTexCoord3f -#define glTexCoord3f DO_NOT_USE_glTexCoord3f -#undef glTexCoord3fv -#define glTexCoord3fv DO_NOT_USE_glTexCoord3fv -#undef glTexCoord3i -#define glTexCoord3i DO_NOT_USE_glTexCoord3i -#undef glTexCoord3iv -#define glTexCoord3iv DO_NOT_USE_glTexCoord3iv -#undef glTexCoord3s -#define glTexCoord3s DO_NOT_USE_glTexCoord3s -#undef glTexCoord3sv -#define glTexCoord3sv DO_NOT_USE_glTexCoord3sv -#undef glTexCoord4d -#define glTexCoord4d DO_NOT_USE_glTexCoord4d -#undef glTexCoord4dv -#define glTexCoord4dv DO_NOT_USE_glTexCoord4dv -#undef glTexCoord4f -#define glTexCoord4f DO_NOT_USE_glTexCoord4f -#undef glTexCoord4fv -#define glTexCoord4fv DO_NOT_USE_glTexCoord4fv -#undef glTexCoord4i -#define glTexCoord4i DO_NOT_USE_glTexCoord4i -#undef glTexCoord4iv -#define glTexCoord4iv DO_NOT_USE_glTexCoord4iv -#undef glTexCoord4s -#define glTexCoord4s DO_NOT_USE_glTexCoord4s -#undef glTexCoord4sv -#define glTexCoord4sv DO_NOT_USE_glTexCoord4sv -#undef glTexEnvf -#define glTexEnvf DO_NOT_USE_glTexEnvf -#undef glTexEnvfv -#define glTexEnvfv DO_NOT_USE_glTexEnvfv -#undef glTexEnvi -#define glTexEnvi DO_NOT_USE_glTexEnvi -#undef glTexEnviv -#define glTexEnviv DO_NOT_USE_glTexEnviv -#undef glTexGend -#define glTexGend DO_NOT_USE_glTexGend -#undef glTexGendv -#define glTexGendv DO_NOT_USE_glTexGendv -#undef glTexGenf -#define glTexGenf DO_NOT_USE_glTexGenf -#undef glTexGenfv -#define glTexGenfv DO_NOT_USE_glTexGenfv -#undef glTexGeni -#define glTexGeni DO_NOT_USE_glTexGeni -#undef glTexGeniv -#define glTexGeniv DO_NOT_USE_glTexGeniv -#undef glTranslated -#define glTranslated DO_NOT_USE_glTranslated -#undef glTranslatef -#define glTranslatef DO_NOT_USE_glTranslatef -#undef glVertex2d -#define glVertex2d DO_NOT_USE_glVertex2d -#undef glVertex2dv -#define glVertex2dv DO_NOT_USE_glVertex2dv -#undef glVertex2f -#define glVertex2f DO_NOT_USE_glVertex2f -#undef glVertex2fv -#define glVertex2fv DO_NOT_USE_glVertex2fv -#undef glVertex2i -#define glVertex2i DO_NOT_USE_glVertex2i -#undef glVertex2iv -#define glVertex2iv DO_NOT_USE_glVertex2iv -#undef glVertex2s -#define glVertex2s DO_NOT_USE_glVertex2s -#undef glVertex2sv -#define glVertex2sv DO_NOT_USE_glVertex2sv -#undef glVertex3d -#define glVertex3d DO_NOT_USE_glVertex3d -#undef glVertex3dv -#define glVertex3dv DO_NOT_USE_glVertex3dv -#undef glVertex3f -#define glVertex3f DO_NOT_USE_glVertex3f -#undef glVertex3fv -#define glVertex3fv DO_NOT_USE_glVertex3fv -#undef glVertex3i -#define glVertex3i DO_NOT_USE_glVertex3i -#undef glVertex3iv -#define glVertex3iv DO_NOT_USE_glVertex3iv -#undef glVertex3s -#define glVertex3s DO_NOT_USE_glVertex3s -#undef glVertex3sv -#define glVertex3sv DO_NOT_USE_glVertex3sv -#undef glVertex4d -#define glVertex4d DO_NOT_USE_glVertex4d -#undef glVertex4dv -#define glVertex4dv DO_NOT_USE_glVertex4dv -#undef glVertex4f -#define glVertex4f DO_NOT_USE_glVertex4f -#undef glVertex4fv -#define glVertex4fv DO_NOT_USE_glVertex4fv -#undef glVertex4i -#define glVertex4i DO_NOT_USE_glVertex4i -#undef glVertex4iv -#define glVertex4iv DO_NOT_USE_glVertex4iv -#undef glVertex4s -#define glVertex4s DO_NOT_USE_glVertex4s -#undef glVertex4sv -#define glVertex4sv DO_NOT_USE_glVertex4sv - -// GL Version 1.1 -#undef glAreTexturesResident -#define glAreTexturesResident DO_NOT_USE_glAreTexturesResident -#undef glArrayElement -#define glArrayElement DO_NOT_USE_glArrayElement -#undef glColorPointer -#define glColorPointer DO_NOT_USE_glColorPointer -#undef glDisableClientState -#define glDisableClientState DO_NOT_USE_glDisableClientState -#undef glEdgeFlagPointer -#define glEdgeFlagPointer DO_NOT_USE_glEdgeFlagPointer -#undef glEnableClientState -#define glEnableClientState DO_NOT_USE_glEnableClientState -#undef glIndexPointer -#define glIndexPointer DO_NOT_USE_glIndexPointer -#undef glIndexub -#define glIndexub DO_NOT_USE_glIndexub -#undef glIndexubv -#define glIndexubv DO_NOT_USE_glIndexubv -#undef glInterleavedArrays -#define glInterleavedArrays DO_NOT_USE_glInterleavedArrays -#undef glNormalPointer -#define glNormalPointer DO_NOT_USE_glNormalPointer -#undef glPopClientAttrib -#define glPopClientAttrib DO_NOT_USE_glPopClientAttrib -#undef glPrioritizeTextures -#define glPrioritizeTextures DO_NOT_USE_glPrioritizeTextures -#undef glPushClientAttrib -#define glPushClientAttrib DO_NOT_USE_glPushClientAttrib -#undef glTexCoordPointer -#define glTexCoordPointer DO_NOT_USE_glTexCoordPointer -#undef glVertexPointer -#define glVertexPointer DO_NOT_USE_glVertexPointer - -// GL Version1.2 -#undef glColorSubTable -#define glColorSubTable DO_NOT_USE_glColorSubTable -#undef glColorTable -#define glColorTable DO_NOT_USE_glColorTable -#undef glColorTableParameterfv -#define glColorTableParameterfv DO_NOT_USE_glColorTableParameterfv -#undef glColorTableParameteriv -#define glColorTableParameteriv DO_NOT_USE_glColorTableParameteriv -#undef glConvolutionFilter1D -#define glConvolutionFilter1D DO_NOT_USE_glConvolutionFilter1D -#undef glConvolutionFilter2D -#define glConvolutionFilter2D DO_NOT_USE_glConvolutionFilter2D -#undef glConvolutionParameterf -#define glConvolutionParameterf DO_NOT_USE_glConvolutionParameterf -#undef glConvolutionParameterfv -#define glConvolutionParameterfv DO_NOT_USE_glConvolutionParameterfv -#undef glConvolutionParameteri -#define glConvolutionParameteri DO_NOT_USE_glConvolutionParameteri -#undef glConvolutionParameteriv -#define glConvolutionParameteriv DO_NOT_USE_glConvolutionParameteriv -#undef glCopyColorSubTable -#define glCopyColorSubTable DO_NOT_USE_glCopyColorSubTable -#undef glCopyColorTable -#define glCopyColorTable DO_NOT_USE_glCopyColorTable -#undef glCopyConvolutionFilter1D -#define glCopyConvolutionFilter1D DO_NOT_USE_glCopyConvolutionFilter1D -#undef glCopyConvolutionFilter2D -#define glCopyConvolutionFilter2D DO_NOT_USE_glCopyConvolutionFilter2D -#undef glGetColorTable -#define glGetColorTable DO_NOT_USE_glGetColorTable -#undef glGetColorTableParameterfv -#define glGetColorTableParameterfv DO_NOT_USE_glGetColorTableParameterfv -#undef glGetColorTableParameteriv -#define glGetColorTableParameteriv DO_NOT_USE_glGetColorTableParameteriv -#undef glGetConvolutionFilter -#define glGetConvolutionFilter DO_NOT_USE_glGetConvolutionFilter -#undef glGetConvolutionParameterfv -#define glGetConvolutionParameterfv DO_NOT_USE_glGetConvolutionParameterfv -#undef glGetConvolutionParameteriv -#define glGetConvolutionParameteriv DO_NOT_USE_glGetConvolutionParameteriv -#undef glGetHistogram -#define glGetHistogram DO_NOT_USE_glGetHistogram -#undef glGetHistogramParameterfv -#define glGetHistogramParameterfv DO_NOT_USE_glGetHistogramParameterfv -#undef glGetHistogramParameteriv -#define glGetHistogramParameteriv DO_NOT_USE_glGetHistogramParameteriv -#undef glGetMinmax -#define glGetMinmax DO_NOT_USE_glGetMinmax -#undef glGetMinmaxParameterfv -#define glGetMinmaxParameterfv DO_NOT_USE_glGetMinmaxParameterfv -#undef glGetMinmaxParameteriv -#define glGetMinmaxParameteriv DO_NOT_USE_glGetMinmaxParameteriv -#undef glGetSeparableFilter -#define glGetSeparableFilter DO_NOT_USE_glGetSeparableFilter -#undef glHistogram -#define glHistogram DO_NOT_USE_glHistogram -#undef glMinmax -#define glMinmax DO_NOT_USE_glMinmax -#undef glResetHistogram -#define glResetHistogram DO_NOT_USE_glResetHistogram -#undef glResetMinmax -#define glResetMinmax DO_NOT_USE_glResetMinmax -#undef glSeparableFilter2D -#define glSeparableFilter2D DO_NOT_USE_glSeparableFilter2D - -// GL Version1.3 -#undef glClientActiveTexture -#define glClientActiveTexture DO_NOT_USE_glClientActiveTexture -#undef glLoadTransposeMatrixd -#define glLoadTransposeMatrixd DO_NOT_USE_glLoadTransposeMatrixd -#undef glLoadTransposeMatrixf -#define glLoadTransposeMatrixf DO_NOT_USE_glLoadTransposeMatrixf -#undef glMultTransposeMatrixd -#define glMultTransposeMatrixd DO_NOT_USE_glMultTransposeMatrixd -#undef glMultTransposeMatrixf -#define glMultTransposeMatrixf DO_NOT_USE_glMultTransposeMatrixf -#undef glMultiTexCoord1d -#define glMultiTexCoord1d DO_NOT_USE_glMultiTexCoord1d -#undef glMultiTexCoord1dv -#define glMultiTexCoord1dv DO_NOT_USE_glMultiTexCoord1dv -#undef glMultiTexCoord1f -#define glMultiTexCoord1f DO_NOT_USE_glMultiTexCoord1f -#undef glMultiTexCoord1fv -#define glMultiTexCoord1fv DO_NOT_USE_glMultiTexCoord1fv -#undef glMultiTexCoord1i -#define glMultiTexCoord1i DO_NOT_USE_glMultiTexCoord1i -#undef glMultiTexCoord1iv -#define glMultiTexCoord1iv DO_NOT_USE_glMultiTexCoord1iv -#undef glMultiTexCoord1s -#define glMultiTexCoord1s DO_NOT_USE_glMultiTexCoord1s -#undef glMultiTexCoord1sv -#define glMultiTexCoord1sv DO_NOT_USE_glMultiTexCoord1sv -#undef glMultiTexCoord2d -#define glMultiTexCoord2d DO_NOT_USE_glMultiTexCoord2d -#undef glMultiTexCoord2dv -#define glMultiTexCoord2dv DO_NOT_USE_glMultiTexCoord2dv -#undef glMultiTexCoord2f -#define glMultiTexCoord2f DO_NOT_USE_glMultiTexCoord2f -#undef glMultiTexCoord2fv -#define glMultiTexCoord2fv DO_NOT_USE_glMultiTexCoord2fv -#undef glMultiTexCoord2i -#define glMultiTexCoord2i DO_NOT_USE_glMultiTexCoord2i -#undef glMultiTexCoord2iv -#define glMultiTexCoord2iv DO_NOT_USE_glMultiTexCoord2iv -#undef glMultiTexCoord2s -#define glMultiTexCoord2s DO_NOT_USE_glMultiTexCoord2s -#undef glMultiTexCoord2sv -#define glMultiTexCoord2sv DO_NOT_USE_glMultiTexCoord2sv -#undef glMultiTexCoord3d -#define glMultiTexCoord3d DO_NOT_USE_glMultiTexCoord3d -#undef glMultiTexCoord3dv -#define glMultiTexCoord3dv DO_NOT_USE_glMultiTexCoord3dv -#undef glMultiTexCoord3f -#define glMultiTexCoord3f DO_NOT_USE_glMultiTexCoord3f -#undef glMultiTexCoord3fv -#define glMultiTexCoord3fv DO_NOT_USE_glMultiTexCoord3fv -#undef glMultiTexCoord3i -#define glMultiTexCoord3i DO_NOT_USE_glMultiTexCoord3i -#undef glMultiTexCoord3iv -#define glMultiTexCoord3iv DO_NOT_USE_glMultiTexCoord3iv -#undef glMultiTexCoord3s -#define glMultiTexCoord3s DO_NOT_USE_glMultiTexCoord3s -#undef glMultiTexCoord3sv -#define glMultiTexCoord3sv DO_NOT_USE_glMultiTexCoord3sv -#undef glMultiTexCoord4d -#define glMultiTexCoord4d DO_NOT_USE_glMultiTexCoord4d -#undef glMultiTexCoord4dv -#define glMultiTexCoord4dv DO_NOT_USE_glMultiTexCoord4dv -#undef glMultiTexCoord4f -#define glMultiTexCoord4f DO_NOT_USE_glMultiTexCoord4f -#undef glMultiTexCoord4fv -#define glMultiTexCoord4fv DO_NOT_USE_glMultiTexCoord4fv -#undef glMultiTexCoord4i -#define glMultiTexCoord4i DO_NOT_USE_glMultiTexCoord4i -#undef glMultiTexCoord4iv -#define glMultiTexCoord4iv DO_NOT_USE_glMultiTexCoord4iv -#undef glMultiTexCoord4s -#define glMultiTexCoord4s DO_NOT_USE_glMultiTexCoord4s -#undef glMultiTexCoord4sv -#define glMultiTexCoord4sv DO_NOT_USE_glMultiTexCoord4sv - -// GL Version 1.4 -#undef glFogCoordPointer -#define glFogCoordPointer DO_NOT_USE_glFogCoordPointer -#undef glFogCoordd -#define glFogCoordd DO_NOT_USE_glFogCoordd -#undef glFogCoorddv -#define glFogCoorddv DO_NOT_USE_glFogCoorddv -#undef glFogCoordf -#define glFogCoordf DO_NOT_USE_glFogCoordf -#undef glFogCoordfv -#define glFogCoordfv DO_NOT_USE_glFogCoordfv -#undef glSecondaryColor3b -#define glSecondaryColor3b DO_NOT_USE_glSecondaryColor3b -#undef glSecondaryColor3bv -#define glSecondaryColor3bv DO_NOT_USE_glSecondaryColor3bv -#undef glSecondaryColor3d -#define glSecondaryColor3d DO_NOT_USE_glSecondaryColor3d -#undef glSecondaryColor3dv -#define glSecondaryColor3dv DO_NOT_USE_glSecondaryColor3dv -#undef glSecondaryColor3f -#define glSecondaryColor3f DO_NOT_USE_glSecondaryColor3f -#undef glSecondaryColor3fv -#define glSecondaryColor3fv DO_NOT_USE_glSecondaryColor3fv -#undef glSecondaryColor3i -#define glSecondaryColor3i DO_NOT_USE_glSecondaryColor3i -#undef glSecondaryColor3iv -#define glSecondaryColor3iv DO_NOT_USE_glSecondaryColor3iv -#undef glSecondaryColor3s -#define glSecondaryColor3s DO_NOT_USE_glSecondaryColor3s -#undef glSecondaryColor3sv -#define glSecondaryColor3sv DO_NOT_USE_glSecondaryColor3sv -#undef glSecondaryColor3ub -#define glSecondaryColor3ub DO_NOT_USE_glSecondaryColor3ub -#undef glSecondaryColor3ubv -#define glSecondaryColor3ubv DO_NOT_USE_glSecondaryColor3ubv -#undef glSecondaryColor3ui -#define glSecondaryColor3ui DO_NOT_USE_glSecondaryColor3ui -#undef glSecondaryColor3uiv -#define glSecondaryColor3uiv DO_NOT_USE_glSecondaryColor3uiv -#undef glSecondaryColor3us -#define glSecondaryColor3us DO_NOT_USE_glSecondaryColor3us -#undef glSecondaryColor3usv -#define glSecondaryColor3usv DO_NOT_USE_glSecondaryColor3usv -#undef glSecondaryColorPointer -#define glSecondaryColorPointer DO_NOT_USE_glSecondaryColorPointer -#undef glWindowPos2d -#define glWindowPos2d DO_NOT_USE_glWindowPos2d -#undef glWindowPos2dv -#define glWindowPos2dv DO_NOT_USE_glWindowPos2dv -#undef glWindowPos2f -#define glWindowPos2f DO_NOT_USE_glWindowPos2f -#undef glWindowPos2fv -#define glWindowPos2fv DO_NOT_USE_glWindowPos2fv -#undef glWindowPos2i -#define glWindowPos2i DO_NOT_USE_glWindowPos2i -#undef glWindowPos2iv -#define glWindowPos2iv DO_NOT_USE_glWindowPos2iv -#undef glWindowPos2s -#define glWindowPos2s DO_NOT_USE_glWindowPos2s -#undef glWindowPos2sv -#define glWindowPos2sv DO_NOT_USE_glWindowPos2sv -#undef glWindowPos3d -#define glWindowPos3d DO_NOT_USE_glWindowPos3d -#undef glWindowPos3dv -#define glWindowPos3dv DO_NOT_USE_glWindowPos3dv -#undef glWindowPos3f -#define glWindowPos3f DO_NOT_USE_glWindowPos3f -#undef glWindowPos3fv -#define glWindowPos3fv DO_NOT_USE_glWindowPos3fv -#undef glWindowPos3i -#define glWindowPos3i DO_NOT_USE_glWindowPos3i -#undef glWindowPos3iv -#define glWindowPos3iv DO_NOT_USE_glWindowPos3iv -#undef glWindowPos3s -#define glWindowPos3s DO_NOT_USE_glWindowPos3s -#undef glWindowPos3sv -#define glWindowPos3sv DO_NOT_USE_glWindowPos3sv - -// Old Token Names 1.2 -#undef GL_POINT_SIZE_RANGE -#define GL_POINT_SIZE_RANGE DO_NOT_USE_GL_POINT_SIZE_RANGE -#undef GL_POINT_SIZE_GRANULARITY -#define GL_POINT_SIZE_GRANULARITY DO_NOT_USE_GL_POINT_SIZE_GRANULARITY - -// Old Token Names 1.5 -#undef GL_CURRENT_FOG_COORDINATE -#define GL_CURRENT_FOG_COORDINATE DO_NOT_USE_GL_CURRENT_FOG_COORDINATE -#undef GL_FOG_COORDINATE -#define GL_FOG_COORDINATE DO_NOT_USE_GL_FOG_COORDINATE -#undef GL_FOG_COORDINATE_ARRAY -#define GL_FOG_COORDINATE_ARRAY DO_NOT_USE_GL_FOG_COORDINATE_ARRAY -#undef GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING -#undef GL_FOG_COORDINATE_ARRAY_POINTER -#define GL_FOG_COORDINATE_ARRAY_POINTER DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_POINTER -#undef GL_FOG_COORDINATE_ARRAY_STRIDE -#define GL_FOG_COORDINATE_ARRAY_STRIDE DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_STRIDE -#undef GL_FOG_COORDINATE_ARRAY_TYPE -#define GL_FOG_COORDINATE_ARRAY_TYPE DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_TYPE -#undef GL_FOG_COORDINATE_SOURCE -#define GL_FOG_COORDINATE_SOURCE DO_NOT_USE_GL_FOG_COORDINATE_SOURCE -#undef GL_SOURCE0_ALPHA -#define GL_SOURCE0_ALPHA DO_NOT_USE_GL_SOURCE0_ALPHA -#undef GL_SOURCE0_RGB -#define GL_SOURCE0_RGB DO_NOT_USE_GL_SOURCE0_RGB -#if 0 /* Those are reused as new valid enum! GL_SRC1_COLOR etc... */ -# undef GL_SOURCE1_ALPHA -# define GL_SOURCE1_ALPHA DO_NOT_USE_GL_SOURCE1_ALPHA -# undef GL_SOURCE1_RGB -# define GL_SOURCE1_RGB DO_NOT_USE_GL_SOURCE1_RGB -#endif -#undef GL_SOURCE2_ALPHA -#define GL_SOURCE2_ALPHA DO_NOT_USE_GL_SOURCE2_ALPHA -#undef GL_SOURCE2_RGB -#define GL_SOURCE2_RGB DO_NOT_USE_GL_SOURCE2_RGB - -#if 0 /* Those are deprecated but still valid */ -// Old Token Names 3.0 -# undef GL_CLIP_PLANE0 -# define GL_CLIP_PLANE0 USE_GL_CLIP_DISTANCE0 -# undef GL_CLIP_PLANE1 -# define GL_CLIP_PLANE1 USE_GL_CLIP_DISTANCE1 -# undef GL_CLIP_PLANE2 -# define GL_CLIP_PLANE2 USE_GL_CLIP_DISTANCE2 -# undef GL_CLIP_PLANE3 -# define GL_CLIP_PLANE3 USE_GL_CLIP_DISTANCE3 -# undef GL_CLIP_PLANE4 -# define GL_CLIP_PLANE4 USE_GL_CLIP_DISTANCE4 -# undef GL_CLIP_PLANE5 -# define GL_CLIP_PLANE5 USE_GL_CLIP_DISTANCE5 -# undef GL_COMPARE_R_TO_TEXTURE -# define GL_COMPARE_R_TO_TEXTURE USE_GL_COMPARE_REF_TO_TEXTURE -# undef GL_MAX_CLIP_PLANES -# define GL_MAX_CLIP_PLANES USE_GL_MAX_CLIP_DISTANCES -# undef GL_MAX_VARYING_FLOATS -# define GL_MAX_VARYING_FLOATS USE__MAX_VARYING_COMPONENTS - -// Old Token Names 3.2 -# undef GL_VERTEX_PROGRAM_POINT_SIZE -# define GL_VERTEX_PROGRAM_POINT_SIZE USE_GL_PROGRAM_POINT_SIZE -#endif - -#endif /* __GL_DEPRECATED_H__ */ diff --git a/intern/glew-mx/intern/glew-mx.c b/intern/glew-mx/intern/glew-mx.c deleted file mode 100644 index c6992c8ae25..00000000000 --- a/intern/glew-mx/intern/glew-mx.c +++ /dev/null @@ -1,66 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright 2014 Blender Foundation. All rights reserved. */ - -/** \file - * \ingroup intern_glew-mx - */ - -#include "glew-mx.h" - -#include <stdio.h> -#include <stdlib.h> - -#define CASE_CODE_RETURN_STR(code) \ - case code: \ - return #code; - -static const char *get_glew_error_enum_string(GLenum error) -{ - switch (error) { - CASE_CODE_RETURN_STR(GLEW_OK) /* also GLEW_NO_ERROR */ - CASE_CODE_RETURN_STR(GLEW_ERROR_NO_GL_VERSION) - CASE_CODE_RETURN_STR(GLEW_ERROR_GL_VERSION_10_ONLY) - CASE_CODE_RETURN_STR(GLEW_ERROR_GLX_VERSION_11_ONLY) -#ifdef WITH_GLEW_ES - CASE_CODE_RETURN_STR(GLEW_ERROR_NOT_GLES_VERSION) - CASE_CODE_RETURN_STR(GLEW_ERROR_GLES_VERSION) - CASE_CODE_RETURN_STR(GLEW_ERROR_NO_EGL_VERSION) - CASE_CODE_RETURN_STR(GLEW_ERROR_EGL_VERSION_10_ONLY) -#endif - default: - return NULL; - } -} - -GLenum glew_chk(GLenum error, const char *file, int line, const char *text) -{ - if (error != GLEW_OK) { - const char *code = get_glew_error_enum_string(error); - const char *msg = (const char *)glewGetErrorString(error); - - if (error == GLEW_ERROR_NO_GL_VERSION) - return GLEW_OK; - -#ifndef NDEBUG - fprintf(stderr, - "%s(%d):[%s] -> GLEW Error (0x%04X): %s: %s\n", - file, - line, - text, - error, - code ? code : "<no symbol>", - msg ? msg : "<no message>"); -#else - (void)file; - (void)line; - (void)text; - fprintf(stderr, - "GLEW Error (0x%04X): %s: %s\n", - error, - code ? code : "<no symbol>", - msg ? msg : "<no message>"); -#endif - } - - return error; -} diff --git a/intern/glew-mx/intern/symbol-binding.h b/intern/glew-mx/intern/symbol-binding.h deleted file mode 100644 index b7993993739..00000000000 --- a/intern/glew-mx/intern/symbol-binding.h +++ /dev/null @@ -1,275 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright 2014 Blender Foundation. All rights reserved. */ - -/** \file - * \ingroup intern_glew-mx - * - * This file is for any simple stuff that is missing from GLEW when - * compiled with either the GLEW_ES_ONLY or the GLEW_NO_ES flag. - * - * Should be limited to symbolic constants. - * - * This file is NOT for checking DEPRECATED OpenGL symbolic constants. - */ - -#ifndef __SYMBOL_BINDING_H__ -#define __SYMBOL_BINDING_H__ - -#ifndef __GLEW_MX_H__ -# error This file is meant to be included from glew-mx.h -#endif - -#ifdef GLEW_ES_ONLY - -/* ES does not support the GLdouble type. */ -# ifndef GLdouble -# define GLdouble double -# endif - -/* - * Need stubs for these version checks if compiling with only ES support. - * Rely on compiler to eliminate unreachable code when version checks become constants. - */ - -# ifndef GLEW_VERSION_1_1 -# define GLEW_VERSION_1_1 0 -# endif - -# ifndef GLEW_VERSION_1_2 -# define GLEW_VERSION_1_2 0 -# endif - -# ifndef GLEW_VERSION_1_3 -# define GLEW_VERSION_1_3 0 -# endif - -# ifndef GLEW_VERSION_1_4 -# define GLEW_VERSION_1_4 0 -# endif - -# ifndef GLEW_VERSION_1_5 -# define GLEW_VERSION_1_5 0 -# endif - -# ifndef GLEW_VERSION_2_0 -# define GLEW_VERSION_2_0 0 -# endif - -# ifndef GLEW_VERSION_3_0 -# define GLEW_VERSION_3_0 0 -# endif - -# ifndef GLEW_ARB_shader_objects -# define GLEW_ARB_shader_objects 0 -# endif - -# ifndef GLEW_ARB_vertex_shader -# define GLEW_ARB_vertex_shader 0 -# endif - -# ifndef GLEW_ARB_vertex_program -# define GLEW_ARB_vertex_program 0 -# endif - -# ifndef GLEW_ARB_fragment_program -# define GLEW_ARB_fragment_program 0 -# endif - -# ifndef GLEW_ARB_vertex_buffer_object -# define GLEW_ARB_vertex_buffer_object 0 -# endif - -# ifndef GLEW_ARB_framebuffer_object -# define GLEW_ARB_framebuffer_object 0 -# endif - -# ifndef GLEW_ARB_multitexture -# define GLEW_ARB_multitexture 0 -# endif - -# ifndef GLEW_EXT_framebuffer_object -# define GLEW_EXT_framebuffer_object 0 -# endif - -# ifndef GLEW_ARB_depth_texture -# define GLEW_ARB_depth_texture 0 -# endif - -# ifndef GLEW_ARB_shadow -# define GLEW_ARB_shadow 0 -# endif - -# ifndef GLEW_ARB_texture_float -# define GLEW_ARB_texture_float 0 -# endif - -# ifndef GLEW_ARB_texture_non_power_of_two -# define GLEW_ARB_texture_non_power_of_two 0 -# endif - -# ifndef GLEW_ARB_texture3D -# define GLEW_ARB_texture3D 0 -# endif - -# ifndef GLEW_EXT_texture3D -# define GLEW_EXT_texture3D 0 -# endif - -# ifndef GLEW_ARB_texture_rg -# define GLEW_ARB_texture_rg 0 -# endif - -# ifndef GLEW_ARB_texture_query_lod -# define GLEW_ARB_texture_query_lod 0 -# endif - -/* - * The following symbolic constants are missing from an ES only header, - * so alias them to their (same valued) extension versions which are available in the header. - * - * Be careful that this does not lead to unguarded use of what are extensions in ES! - * - * Some of these may be here simply to patch inconsistencies in the header files. - */ - -# ifndef GL_TEXTURE_3D -# define GL_TEXTURE_3D GL_TEXTURE_3D_OES -# endif - -# ifndef GL_TEXTURE_WRAP_R -# define GL_TEXTURE_WRAP_R GL_TEXTURE_WRAP_R_OES -# endif - -# ifndef GL_TEXTURE_COMPARE_MODE -# define GL_TEXTURE_COMPARE_MODE GL_TEXTURE_COMPARE_MODE_EXT -# endif - -# ifndef GL_COMPARE_REF_TO_TEXTURE -# define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_REF_TO_TEXTURE_EXT -# endif - -# ifndef GL_TEXTURE_COMPARE_FUNC -# define GL_TEXTURE_COMPARE_FUNC GL_TEXTURE_COMPARE_FUNC_EXT -# endif - -# ifndef GL_RGBA8 -# define GL_RGBA8 GL_RGBA8_OES -# endif - -# ifndef GL_RGBA16F -# define GL_RGBA16F GL_RGBA16F_EXT -# endif - -# ifndef GL_RG32F -# define GL_RG32F GL_RG32F_EXT -# endif - -# ifndef GL_RGB8 -# define GL_RGB8 GL_RGB8_OES -# endif - -# ifndef GL_RG -# define GL_RG GL_RG_EXT -# endif - -# ifndef GL_RED -# define GL_RED GL_RED_EXT -# endif - -# ifndef GL_FRAMEBUFFER_INCOMPLETE_FORMATS -# define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES -# endif - -# ifndef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER -# define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES -# endif - -# ifndef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER -# define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES -# endif - -# ifndef GL_WRITE_ONLY -# define GL_WRITE_ONLY GL_WRITE_ONLY_OES -# endif - -# ifndef GLEW_ARB_vertex_array_object -# define GLEW_ARB_vertex_array_object 0 -# endif - -/* end of ifdef GLEW_ES_ONLY */ -#elif defined(GLEW_NO_ES) - -/* - * Need stubs for these version checks if compiling without any support. - * Rely on compiler to eliminate unreachable code when version checks become constants - */ - -# ifndef GLEW_ES_VERSION_2_0 -# define GLEW_ES_VERSION_2_0 0 -# endif - -# ifndef GLEW_EXT_texture_storage -# define GLEW_EXT_texture_storage 0 -# endif - -# ifndef GLEW_OES_framebuffer_object -# define GLEW_OES_framebuffer_object 0 -# endif - -# ifndef GLEW_OES_mapbuffer -# define GLEW_OES_mapbuffer 0 -# endif - -# ifndef GLEW_OES_required_internalformat -# define GLEW_OES_required_internalformat 0 -# endif - -# ifndef GLEW_EXT_color_buffer_half_float -# define GLEW_EXT_color_buffer_half_float 0 -# endif - -# ifndef GLEW_OES_depth_texture -# define GLEW_OES_depth_texture 0 -# endif - -# ifndef GLEW_EXT_shadow_samplers -# define GLEW_EXT_shadow_samplers 0 -# endif - -# ifndef GLEW_ARB_texture3D -# define GLEW_ARB_texture3D 0 -# endif - -# ifndef GLEW_OES_texture_3D -# define GLEW_OES_texture_3D 0 -# endif - -# ifndef GLEW_EXT_texture_rg -# define GLEW_EXT_texture_rg 0 -# endif - -# ifndef GLEW_OES_vertex_array_object -# define GLEW_OES_vertex_array_object 0 -# endif - -/* - * The following symbolic constants are missing when there is no ES support, - * so alias them to their (same valued) extension versions which are available in the header. - * - * Desktop GL typically does not have any extensions that originated from ES, - * unlike ES which has many extensions to replace what was taken out. - * - * For that reason these aliases are more likely just patching inconsistencies in the header files. - */ - -# ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS -# define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT -# endif - -# ifndef GL_FRAMEBUFFER_INCOMPLETE_FORMATS -# define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT -# endif - -#endif /* ifdef GLEW_NO_ES */ - -#endif /* __SYMBOL_BINDING_H__*/ diff --git a/intern/opencolorio/CMakeLists.txt b/intern/opencolorio/CMakeLists.txt index be6ccc5c2c5..d676079f3c2 100644 --- a/intern/opencolorio/CMakeLists.txt +++ b/intern/opencolorio/CMakeLists.txt @@ -3,7 +3,6 @@ set(INC . - ../glew-mx ../guardedalloc ../../source/blender/blenlib ../../source/blender/gpu @@ -37,7 +36,7 @@ if(WITH_OPENCOLORIO) list(APPEND INC_SYS ${OPENCOLORIO_INCLUDE_DIRS} - ${GLEW_INCLUDE_PATH} + ${Epoxy_INCLUDE_DIRS} ) list(APPEND SRC diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt index 14cc6a70cd5..058e29ea71c 100644 --- a/intern/opensubdiv/CMakeLists.txt +++ b/intern/opensubdiv/CMakeLists.txt @@ -29,7 +29,7 @@ if(WITH_OPENSUBDIV) list(APPEND INC_SYS ${OPENSUBDIV_INCLUDE_DIRS} - ${GLEW_INCLUDE_PATH} + ${Epoxy_INCLUDE_DIRS} ) list(APPEND SRC @@ -88,7 +88,6 @@ if(WITH_OPENSUBDIV) OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE) add_definitions(${GL_DEFINITIONS}) - add_definitions(-DOSD_USES_GLEW) if(WIN32) add_definitions(-DNOMINMAX) diff --git a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc index c2ab2a522d2..148770b0d39 100644 --- a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc +++ b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc @@ -22,9 +22,23 @@ // language governing permissions and limitations under the Apache License. // -#include "gl_compute_evaluator.h" +#include <epoxy/gl.h> + +/* There are few aspects here: + * - macOS is strict about including both gl.h and gl3.h + * - libepoxy only pretends to be a replacement for gl.h + * - OpenSubdiv internally uses `OpenGL/gl3.h` on macOS + * + * In order to silence the warning pretend that gl3 has been included, fully relying on symbols + * from the epoxy. + * + * This works differently from how OpenSubdiv internally will use `OpenGL/gl3.h` without epoxy. + * Sounds fragile, but so far things seems to work. */ +#if defined(__APPLE__) +# define __gl3_h_ +#endif -#include <GL/glew.h> +#include "gl_compute_evaluator.h" #include <opensubdiv/far/error.h> #include <opensubdiv/far/patchDescriptor.h> @@ -57,7 +71,7 @@ template<class T> GLuint createSSBO(std::vector<T> const &src) GLuint devicePtr = 0; #if defined(GL_ARB_direct_state_access) - if (GLEW_ARB_direct_state_access) { + if (epoxy_has_gl_extension("GL_ARB_direct_state_access")) { glCreateBuffers(1, &devicePtr); glNamedBufferData(devicePtr, src.size() * sizeof(T), &src.at(0), GL_STATIC_DRAW); } |