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/cycles | |
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/cycles')
-rw-r--r-- | intern/cycles/app/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/cycles/app/opengl/display_driver.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/app/opengl/shader.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/app/opengl/window.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/cycles/cmake/external_libs.cmake | 15 | ||||
-rw-r--r-- | intern/cycles/device/CMakeLists.txt | 5 | ||||
-rw-r--r-- | intern/cycles/device/hip/device_impl.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/hydra/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/cycles/hydra/display_driver.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/util/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/util/opengl.h | 2 |
12 files changed, 16 insertions, 29 deletions
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__ */ |