[Bf-blender-cvs] [9a74c0d7626] wl_default: GHOST/X11: enable EGL

Christian Rauch noreply at git.blender.org
Sat Aug 14 22:29:25 CEST 2021


Commit: 9a74c0d76262790243f6ab9d61556309acc1df72
Author: Christian Rauch
Date:   Mon Jul 26 21:55:43 2021 +0100
Branches: wl_default
https://developer.blender.org/rB9a74c0d76262790243f6ab9d61556309acc1df72

GHOST/X11: enable EGL

This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034

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

M	CMakeLists.txt
M	build_files/build_environment/install_deps.sh
M	build_files/cmake/platform/platform_unix.cmake

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2868324bf46..db42f957ee2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -255,16 +255,6 @@ if(WITH_GHOST_X11)
   option(WITH_X11_ALPHA     "Enable X11 transparent background"                     ON)
 endif()
 
-if(UNIX AND NOT APPLE)
-  option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF)
-  option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system"           ON)
-else()
-  # not an option for other OS's
-  set(WITH_SYSTEM_GLEW OFF)
-  set(WITH_SYSTEM_GLES OFF)
-endif()
-
-
 if(UNIX AND NOT APPLE)
   option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
 endif()
@@ -493,15 +483,32 @@ endif()
 
 # OpenGL
 
+if(UNIX AND NOT APPLE)
+  # GLEW can only built with either GLX or EGL support and most binary
+  # distributions are built with GLX support. So we always compile GLEW
+  # with EGL support manually, and the options are no longer available.
+  set(WITH_SYSTEM_GLEW OFF)
+  set(WITH_SYSTEM_GLES ON)
+
+  # Always use EGL instead of GLX, for X11, Wayland and headless.
+  set(WITH_GL_EGL ON)
+else()
+  # System GLEW and GLES were never an option on other platforms.
+  set(WITH_SYSTEM_GLEW OFF)
+  set(WITH_SYSTEM_GLES OFF)
+
+  # Experimental EGL option.
+  option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL or WGL)" OFF)
+  mark_as_advanced(WITH_GL_EGL)
+endif()
+
 option(WITH_OPENGL              "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
 option(WITH_GLEW_ES             "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
-option(WITH_GL_EGL              "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)"       OFF)
 option(WITH_GL_PROFILE_ES20     "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)"                               OFF)
 
 mark_as_advanced(
   WITH_OPENGL
   WITH_GLEW_ES
-  WITH_GL_EGL
   WITH_GL_PROFILE_ES20
 )
 
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index ff4aad79bb6..cee8109ba32 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -603,9 +603,6 @@ MP3LAME_DEV=""
 OPENJPEG_USE=false
 OPENJPEG_DEV=""
 
-# Whether to use system GLEW or not (OpenSubDiv needs recent glew to work).
-NO_SYSTEM_GLEW=false
-
 # Switch to english language, else some things (like check_package_DEB()) won't work!
 LANG_BACK=$LANG
 LANG=""
@@ -4008,13 +4005,9 @@ install_DEB() {
     version_ge $_glew "1.7.0"
     if [ $? -eq 1 ]; then
       WARNING "OpenSubdiv disabled because GLEW-$_glew is not enough"
-      WARNING "Blender will not use system GLEW library"
       OSD_SKIP=true
-      NO_SYSTEM_GLEW=true
     else
       WARNING "OpenSubdiv will compile with GLEW-$_glew but with limited capability"
-      WARNING "Blender will not use system GLEW library"
-      NO_SYSTEM_GLEW=true
     fi
   fi
 
@@ -5985,12 +5978,6 @@ print_info() {
     fi
   fi
 
-  if [ "$NO_SYSTEM_GLEW" = true ]; then
-    _1="-D WITH_SYSTEM_GLEW=OFF"
-    PRINT "  $_1"
-    _buildargs="$_buildargs $_1"
-  fi
-
   if [ "$FFMPEG_SKIP" = false ]; then
     _1="-D WITH_CODEC_FFMPEG=ON"
     _2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 7f62399ac4f..ffdbbc3f8c5 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -581,8 +581,6 @@ if(WITH_GHOST_WAYLAND)
   pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
   pkg_check_modules(dbus REQUIRED dbus-1)
 
-  set(WITH_GL_EGL ON)
-
   list(APPEND PLATFORM_LINKLIBS
     ${wayland-client_LINK_LIBRARIES}
     ${wayland-egl_LINK_LIBRARIES}



More information about the Bf-blender-cvs mailing list