[Bf-blender-cvs] [8ffc11dbcb2] master: Cleanup OpenGL linking and related code after libepoxy merge

Sebastian Parborg noreply at git.blender.org
Mon Aug 15 16:58:58 CEST 2022


Commit: 8ffc11dbcb21e81634e8f22cd65fdc921c7320d1
Author: Sebastian Parborg
Date:   Mon Aug 15 16:44:24 2022 +0200
Branches: master
https://developer.blender.org/rB8ffc11dbcb21e81634e8f22cd65fdc921c7320d1

Cleanup OpenGL linking and related code after libepoxy merge

This cleans up the OpenGL build flags and linking.
It additionally also removes some dead code.

One of these dead code paths is WITH_X11_ALPHA which actually never was
active even with the build flag on. The call to use this was never
called because the default initializer for GHOST was set to have it off
per default. Nothing called this function with a boolean value to enable it.

These cleanups are needed to support true headless OpenGL rendering.
Without these cleanups libepoxy will fail to load the correct OpenGL
Libraries as we have already linked them to the blender binary.

Reviewed By: Brecht, Campbell, Jeroen

Differential Revision: http://developer.blender.org/D15554

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

M	CMakeLists.txt
D	build_files/cmake/Modules/FindOpenGLES.cmake
M	intern/cycles/app/CMakeLists.txt
M	intern/cycles/blender/CMakeLists.txt
M	intern/cycles/cmake/external_libs.cmake
M	intern/cycles/device/CMakeLists.txt
M	intern/cycles/hydra/CMakeLists.txt
M	intern/cycles/scene/CMakeLists.txt
M	intern/cycles/session/CMakeLists.txt
M	intern/cycles/util/CMakeLists.txt
M	intern/ghost/CMakeLists.txt
M	intern/ghost/GHOST_ISystem.h
M	intern/ghost/GHOST_Types.h
M	intern/ghost/intern/GHOST_ContextCGL.h
M	intern/ghost/intern/GHOST_ContextCGL.mm
M	intern/ghost/intern/GHOST_ContextEGL.cpp
M	intern/ghost/intern/GHOST_ContextEGL.h
M	intern/ghost/intern/GHOST_IXrGraphicsBinding.h
M	intern/ghost/intern/GHOST_System.cpp
M	intern/ghost/intern/GHOST_System.h
M	intern/ghost/intern/GHOST_SystemWayland.cpp
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowX11.cpp
M	intern/ghost/intern/GHOST_WindowX11.h
M	intern/ghost/intern/GHOST_XrContext.cpp
M	intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
M	intern/ghost/intern/GHOST_Xr_openxr_includes.h
M	intern/ghost/test/CMakeLists.txt
M	intern/opencolorio/CMakeLists.txt
M	intern/opensubdiv/CMakeLists.txt
M	source/blender/gpencil_modifiers/CMakeLists.txt
M	source/blender/gpu/CMakeLists.txt
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/python/generic/CMakeLists.txt
M	source/blender/python/gpu/CMakeLists.txt
M	source/creator/CMakeLists.txt

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd14feaeb25..f72521266aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,13 +25,6 @@ endif()
 
 cmake_minimum_required(VERSION 3.10)
 
-# Prefer LEGACY OpenGL to be compatible with all the existing releases and
-# platforms which don't have GLVND yet. Only do it if preference was not set
-# externally.
-if(NOT DEFINED OpenGL_GL_PREFERENCE)
-  set(OpenGL_GL_PREFERENCE "LEGACY")
-endif()
-
 if(NOT EXECUTABLE_OUTPUT_PATH)
   set(FIRST_RUN TRUE)
 else()
@@ -262,7 +255,6 @@ if(WITH_GHOST_X11)
   option(WITH_X11_XINPUT    "Enable X11 Xinput (tablet support and unicode input)"  ON)
   option(WITH_X11_XF86VMODE "Enable X11 video mode switching"                       ON)
   option(WITH_X11_XFIXES    "Enable X11 XWayland cursor warping workaround"         ON)
-  option(WITH_X11_ALPHA     "Enable X11 transparent background"                     ON)
 endif()
 
 if(UNIX AND NOT APPLE)
@@ -536,29 +528,11 @@ endif()
 
 # OpenGL
 
-# Experimental EGL option.
-option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, GLX or WGL)" OFF)
-mark_as_advanced(WITH_GL_EGL)
-
-if(WITH_GHOST_WAYLAND)
-  # Wayland can only use EGL to create OpenGL contexts, not GLX.
-  set(WITH_GL_EGL ON)
-endif()
-
-if(UNIX AND NOT APPLE)
-  option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON)
-else()
-  # System GLES not an option on other platforms.
-  set(WITH_SYSTEM_GLES OFF)
-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_GL_PROFILE_ES20     "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)"                               OFF)
 option(WITH_GPU_BUILDTIME_SHADER_BUILDER  "Shader builder is a developer option enabling linting on GLSL during compilation"                                  OFF)
 
 mark_as_advanced(
   WITH_OPENGL
-  WITH_GL_PROFILE_ES20
   WITH_GPU_BUILDTIME_SHADER_BUILDER
 )
 
@@ -579,11 +553,6 @@ if(WITH_METAL_BACKEND)
   set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
 endif()
 
-if(WIN32)
-  option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF)
-  mark_as_advanced(WITH_GL_ANGLE)
-endif()
-
 if(WIN32)
   getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
   set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
@@ -880,7 +849,6 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
   set(WITH_X11_XINPUT    OFF)
   set(WITH_X11_XF86VMODE OFF)
   set(WITH_X11_XFIXES    OFF)
-  set(WITH_X11_ALPHA     OFF)
   set(WITH_GHOST_XDND    OFF)
   set(WITH_INPUT_IME     OFF)
   set(WITH_XR_OPENXR     OFF)
@@ -1195,139 +1163,10 @@ endif()
 #-----------------------------------------------------------------------------
 # Configure OpenGL.
 
-find_package(OpenGL)
-blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
-
 if(WITH_OPENGL)
   add_definitions(-DWITH_OPENGL)
 endif()
 
-if(WITH_SYSTEM_GLES)
-  find_package_wrapper(OpenGLES)
-endif()
-
-if(WITH_GL_PROFILE_ES20)
-  if(WITH_SYSTEM_GLES)
-    if(NOT OPENGLES_LIBRARY)
-      message(FATAL_ERROR
-        "Unable to find OpenGL ES libraries. "
-        "Install them or disable WITH_SYSTEM_GLES."
-      )
-    endif()
-
-    list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}")
-
-  else()
-    set(OPENGLES_LIBRARY "" CACHE FILEPATH "OpenGL ES 2.0 library file")
-    mark_as_advanced(OPENGLES_LIBRARY)
-
-    list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}")
-
-    if(NOT OPENGLES_LIBRARY)
-      message(FATAL_ERROR
-        "To compile WITH_GL_EGL you need to set OPENGLES_LIBRARY "
-        "to the file path of an OpenGL ES 2.0 library."
-      )
-    endif()
-
-  endif()
-
-  if(WIN32)
-    # Setup paths to files needed to install and redistribute Windows Blender with OpenGL ES
-
-    set(OPENGLES_DLL "" CACHE FILEPATH "OpenGL ES 2.0 redistributable DLL file")
-    mark_as_advanced(OPENGLES_DLL)
-
-    if(NOT OPENGLES_DLL)
-      message(FATAL_ERROR
-        "To compile WITH_GL_PROFILE_ES20 you need to set OPENGLES_DLL to the file "
-        "path of an OpenGL ES 2.0 runtime dynamic link library (DLL)."
-      )
-    endif()
-
-    if(WITH_GL_ANGLE)
-      list(APPEND GL_DEFINITIONS -DWITH_ANGLE)
-
-      set(D3DCOMPILER_DLL "" CACHE FILEPATH "Direct3D Compiler redistributable DLL file (needed by ANGLE)")
-
-      get_filename_component(D3DCOMPILER_FILENAME "${D3DCOMPILER_DLL}" NAME)
-      list(APPEND GL_DEFINITIONS "-DD3DCOMPILER=\"\\\"${D3DCOMPILER_FILENAME}\\\"\"")
-
-      mark_as_advanced(D3DCOMPILER_DLL)
-
-      if(D3DCOMPILER_DLL STREQUAL "")
-        message(FATAL_ERROR
-          "To compile WITH_GL_ANGLE you need to set D3DCOMPILER_DLL to the file "
-          "path of a copy of the DirectX redistributable DLL file: D3DCompiler_46.dll"
-        )
-      endif()
-
-    endif()
-
-  endif()
-
-else()
-  if(OpenGL_GL_PREFERENCE STREQUAL "LEGACY" AND OPENGL_gl_LIBRARY)
-    list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_gl_LIBRARY})
-  else()
-    list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY})
-  endif()
-endif()
-
-if(WITH_GL_EGL)
-  find_package(OpenGL REQUIRED EGL)
-  list(APPEND BLENDER_GL_LIBRARIES OpenGL::EGL)
-
-  list(APPEND GL_DEFINITIONS -DWITH_GL_EGL)
-
-  if(WITH_SYSTEM_GLES)
-    if(NOT OPENGLES_EGL_LIBRARY)
-      message(FATAL_ERROR
-        "Unable to find OpenGL ES libraries. "
-        "Install them or disable WITH_SYSTEM_GLES."
-      )
-    endif()
-
-    list(APPEND BLENDER_GL_LIBRARIES ${OPENGLES_EGL_LIBRARY})
-
-  else()
-    set(OPENGLES_EGL_LIBRARY "" CACHE FILEPATH "EGL library file")
-    mark_as_advanced(OPENGLES_EGL_LIBRARY)
-
-    list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}" "${OPENGLES_EGL_LIBRARY}")
-
-    if(NOT OPENGLES_EGL_LIBRARY)
-      message(FATAL_ERROR
-        "To compile WITH_GL_EGL you need to set OPENGLES_EGL_LIBRARY "
-        "to the file path of an EGL library."
-      )
-    endif()
-
-  endif()
-
-  if(WIN32)
-    # Setup paths to files needed to install and redistribute Windows Blender with OpenGL ES
-
-    set(OPENGLES_EGL_DLL "" CACHE FILEPATH "EGL redistributable DLL file")
-    mark_as_advanced(OPENGLES_EGL_DLL)
-
-    if(NOT OPENGLES_EGL_DLL)
-      message(FATAL_ERROR
-        "To compile WITH_GL_EGL you need to set OPENGLES_EGL_DLL "
-        "to the file path of an EGL runtime dynamic link library (DLL)."
-      )
-    endif()
-
-  endif()
-
-endif()
-
-if(WITH_GL_PROFILE_ES20)
-  list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_ES20)
-else()
-  list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
-endif()
-
 #-----------------------------------------------------------------------------
 # Configure Metal.
 if(WITH_METAL_BACKEND)
@@ -2005,7 +1844,6 @@ if(FIRST_RUN)
   info_cfg_option(WITH_INSTALL_PORTABLE)
   info_cfg_option(WITH_MEM_JEMALLOC)
   info_cfg_option(WITH_MEM_VALGRIND)
-  info_cfg_option(WITH_X11_ALPHA)
   info_cfg_option(WITH_X11_XF86VMODE)
   info_cfg_option(WITH_X11_XFIXES)
   info_cfg_option(WITH_X11_XINPUT)
@@ -2052,13 +1890,6 @@ if(FIRST_RUN)
   info_cfg_option(WITH_MOD_OCEANSIM)
   info_cfg_option(WITH_MOD_REMESH)
 
-  info_cfg_text("OpenGL:")
-  if(WIN32)
-    info_cfg_option(WITH_GL_ANGLE)
-  endif()
-  info_cfg_option(WITH_GL_EGL)
-  info_cfg_option(WITH_GL_PROFILE_ES20)
-
   info_cfg_text("")
 
   message("${_config_msg}")
diff --git a/build_files/cmake/Modules/FindOpenGLES.cmake b/build_files/cmake/Modules/FindOpenGLES.cmake
deleted file mode 100644
index 5e82984bed6..00000000000
--- a/build_files/cmake/Modules/FindOpenGLES.cmake
+++ /dev/null
@@ -1,80 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2014 Blender Foundation.
-
-# - Try to find OpenGLES
-# Once done this will define
-#
-#  OPENGLES_FOUND           - system has OpenGLES and EGL
-#  OPENGL_EGL_FOUND         - system has EGL
-#  OPENGLES_INCLUDE_DIR     - the GLES include directory
-#  OPENGLES_LIBRARY         - the GLES library
-#  OPENGLES_EGL_INCLUDE_DIR - the EGL include directory
-#  OPENGLES_EGL_LIBRARY     - the EGL library
-#  OPENGLES_LIBRARIES       - all libraries needed for OpenGLES
-#  OPENGLES_INCLUDES        - all includes needed for OpenGLES
-
-# If OPENGLES_ROOT_DIR was defined in the environment, use it.
-IF(NOT OPENGLES_ROOT_DIR AND NOT $ENV{OPENGLES_ROOT_DIR} STREQUAL "")
-  SET(OPENGLES_ROOT_DIR $ENV{OPENGLES_ROOT_DIR})
-ENDIF()
-
-SET(_opengles_SEARCH_DIRS
-  ${OPENGLES_ROOT_DIR}
-)
-
-FIND_PATH(OPENGLES_INCLUDE_DIR
-  NAMES
-    GLES2/gl2.h
-  HINTS
-    ${_opengles_SEARCH_DIRS}
-)
-
-FIND_LIBRARY(OPENGLES_LIBRARY
-  NAMES
-    GLESv2
-  PATHS
-    ${_opengles_SEARCH_DIRS}
-  PATH_SUFFIXES
-    lib64 lib
-)
-
-FIND_PATH(OPENGLES_EGL_INCLUDE_DIR
-  NAMES
-    EGL/egl.h
-  HINTS
-    ${_opengles_SEARCH_DIRS}
-)
-
-FIND_LIBRARY(OPENGLES_EGL_LIBRARY
-  NAMES
-    EGL
-  HINTS
-    ${_opengles_SEARCH_DIRS}
-  PATH_SUFFIXES
-    lib64 lib
-)
-
-IF(OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
-  SET(OPENGL_EGL_FOUND "YES")
-ELSE()
-  SET(OPENGL_EGL_FOUND "NO")
-ENDIF()
-
-IF(OPENGLES_LIBRARY AND OPENGLES_INCLUDE_DIR AND
-   OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
-  SET(OPENGLES_LIBRARIES ${OPENGLES_LIBRARY} ${OPENGLES_LIBRARIES}
-                           ${OPENGLES_EGL_LIBRARY})
-  SET(OPENGLES_INCLUDES ${OPENGLES_INCLUDE_DIR} ${OPENGLES_EGL_INCLUDE_DIR})
-  SET(OPENGLES_FOUND "YES")
-ELSE()
-  SET(OPENGLES_FOUND "NO")
-ENDIF()
-
-MARK_AS_ADVANCED(
-  OPENGLES_EGL_INCLUDE_DIR
-  OPENGLES_EGL_LIBRARY
-  OPENGLES_LIBRARY
-  OPENGLES_INCLUDE_DIR
-)
-
-UNSET(_opengles_SEARCH_DIRS)
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index d46ece55256..0988b1c0ac4 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -43,9 +43,8 @@ else()
 endif()
 
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
-  add_definitions(${GL_DEFINITIONS})
   list(APPEND INC_SYS ${Epoxy_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
-  list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${Epoxy_LIBRARIES} ${SDL2_LIBRARIES})
+  list(

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list