[Bf-blender-cvs] [a8dee3a] soc-2014-viewport_fx: GHOST Refactor for EGL Contexts
Jason Wilkins
noreply at git.blender.org
Thu Jun 12 03:28:15 CEST 2014
Commit: a8dee3a614692b7e4f4a897cc32f85a19c965dff
Author: Jason Wilkins
Date: Wed Jun 11 20:26:22 2014 -0500
https://developer.blender.org/rBa8dee3a614692b7e4f4a897cc32f85a19c965dff
GHOST Refactor for EGL Contexts
Documentation to appear here:
http://wiki.blender.org/index.php/User:Jwilkins/VFX/GHOST_Refactor_for_EGL
Missing from this commit is support for systems other than Windows.
This also only builds with CMake.
===================================================================
M CMakeLists.txt
A build_files/cmake/Modules/FindOpenGLES.cmake
M build_files/cmake/macros.cmake
M extern/CMakeLists.txt
A extern/glew-es/CMakeLists.txt
A extern/glew-es/include/GL/eglew.h
A extern/glew-es/include/GL/glesew.h
A extern/glew-es/include/GL/glew.h
A extern/glew-es/include/GL/glxew.h
A extern/glew-es/include/GL/wglew.h
A extern/glew-es/src/glew.c
M extern/glew/CMakeLists.txt
M intern/CMakeLists.txt
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/render/CMakeLists.txt
M intern/cycles/util/CMakeLists.txt
M intern/cycles/util/util_opengl.h
M intern/cycles/util/util_view.cpp
M intern/ghost/CMakeLists.txt
A intern/ghost/intern/GHOST_Context.cpp
A intern/ghost/intern/GHOST_Context.h
A intern/ghost/intern/GHOST_ContextCGL.h
A intern/ghost/intern/GHOST_ContextCGL.mm
A intern/ghost/intern/GHOST_ContextEGL.cpp
A intern/ghost/intern/GHOST_ContextEGL.h
A intern/ghost/intern/GHOST_ContextNone.cpp
A intern/ghost/intern/GHOST_ContextNone.h
A intern/ghost/intern/GHOST_ContextWGL.cpp
A intern/ghost/intern/GHOST_ContextWGL.h
A intern/ghost/intern/GHOST_ContextXGL.cpp
A intern/ghost/intern/GHOST_ContextXGL.h
M intern/ghost/intern/GHOST_SystemWin32.cpp
M intern/ghost/intern/GHOST_Window.cpp
M intern/ghost/intern/GHOST_Window.h
M intern/ghost/intern/GHOST_WindowCocoa.h
M intern/ghost/intern/GHOST_WindowCocoa.mm
M intern/ghost/intern/GHOST_WindowSDL.cpp
M intern/ghost/intern/GHOST_WindowWin32.cpp
M intern/ghost/intern/GHOST_WindowWin32.h
A intern/glew-mx/CMakeLists.txt
A intern/glew-mx/glew-mx.h
A intern/glew-mx/intern/glew-mx.c
M intern/opencolorio/CMakeLists.txt
M intern/opencolorio/ocio_impl.cc
M intern/opencolorio/ocio_impl_glsl.cc
M source/blender/blenfont/CMakeLists.txt
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/DerivedMesh.c
M source/blender/blenkernel/intern/cdderivedmesh.c
M source/blender/blenkernel/intern/editderivedmesh.c
M source/blender/blenkernel/intern/pbvh.c
M source/blender/blenkernel/intern/smoke.c
M source/blender/blenkernel/intern/subsurf_ccg.c
M source/blender/editors/animation/CMakeLists.txt
M source/blender/editors/armature/CMakeLists.txt
M source/blender/editors/gpencil/CMakeLists.txt
M source/blender/editors/include/BIF_gl.h
M source/blender/editors/interface/CMakeLists.txt
M source/blender/editors/mask/CMakeLists.txt
M source/blender/editors/mesh/CMakeLists.txt
M source/blender/editors/object/CMakeLists.txt
M source/blender/editors/physics/CMakeLists.txt
M source/blender/editors/render/CMakeLists.txt
M source/blender/editors/render/render_opengl.c
M source/blender/editors/screen/CMakeLists.txt
M source/blender/editors/sculpt_paint/CMakeLists.txt
M source/blender/editors/space_action/CMakeLists.txt
M source/blender/editors/space_buttons/CMakeLists.txt
M source/blender/editors/space_clip/CMakeLists.txt
M source/blender/editors/space_console/CMakeLists.txt
M source/blender/editors/space_file/CMakeLists.txt
M source/blender/editors/space_graph/CMakeLists.txt
M source/blender/editors/space_image/CMakeLists.txt
M source/blender/editors/space_info/CMakeLists.txt
M source/blender/editors/space_logic/CMakeLists.txt
M source/blender/editors/space_nla/CMakeLists.txt
M source/blender/editors/space_node/CMakeLists.txt
M source/blender/editors/space_outliner/CMakeLists.txt
M source/blender/editors/space_script/CMakeLists.txt
M source/blender/editors/space_sequencer/CMakeLists.txt
M source/blender/editors/space_text/CMakeLists.txt
M source/blender/editors/space_time/CMakeLists.txt
M source/blender/editors/space_view3d/CMakeLists.txt
M source/blender/editors/transform/CMakeLists.txt
M source/blender/editors/util/CMakeLists.txt
M source/blender/editors/uvedit/CMakeLists.txt
M source/blender/gpu/CMakeLists.txt
A source/blender/gpu/GPU_glew.h
M source/blender/gpu/intern/gpu_buffers.c
M source/blender/gpu/intern/gpu_codegen.c
M source/blender/gpu/intern/gpu_codegen.h
M source/blender/gpu/intern/gpu_draw.c
M source/blender/gpu/intern/gpu_extensions.c
M source/blender/gpu/intern/gpu_material.c
M source/blender/gpu/intern/gpu_simple_shader.c
M source/blender/makesrna/intern/CMakeLists.txt
M source/blender/modifiers/CMakeLists.txt
M source/blender/nodes/CMakeLists.txt
M source/blender/python/generic/CMakeLists.txt
M source/blender/python/generic/bgl.c
M source/blender/python/intern/CMakeLists.txt
M source/blender/windowmanager/CMakeLists.txt
M source/blender/windowmanager/intern/wm_draw.c
M source/blenderplayer/CMakeLists.txt
M source/creator/CMakeLists.txt
M source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
M source/gameengine/BlenderRoutines/CMakeLists.txt
M source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
M source/gameengine/GamePlayer/common/CMakeLists.txt
M source/gameengine/GamePlayer/common/GPC_Canvas.h
M source/gameengine/GamePlayer/ghost/CMakeLists.txt
M source/gameengine/GamePlayer/ghost/GPG_Application.cpp
M source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
M source/gameengine/Ketsji/BL_Shader.cpp
M source/gameengine/Ketsji/BL_Texture.cpp
M source/gameengine/Ketsji/CMakeLists.txt
M source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M source/gameengine/Ketsji/KX_Camera.cpp
M source/gameengine/Ketsji/KX_Dome.cpp
M source/gameengine/Ketsji/KX_Dome.h
M source/gameengine/Ketsji/KX_PythonInit.cpp
M source/gameengine/Physics/Bullet/CMakeLists.txt
M source/gameengine/Rasterizer/CMakeLists.txt
M source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
M source/gameengine/VideoTexture/CMakeLists.txt
M source/gameengine/VideoTexture/ImageBase.cpp
M source/gameengine/VideoTexture/ImageRender.cpp
M source/gameengine/VideoTexture/ImageViewport.cpp
M source/gameengine/VideoTexture/Texture.cpp
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 893440e..161d0b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -160,12 +160,15 @@ option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)"
if(UNIX AND NOT APPLE)
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_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)
+ option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON)
option(WITH_GHOST_XDND "Enable drag'n'drop support on X11 using XDND protocol" ON)
else()
# not an option for other OS's
set(WITH_SYSTEM_GLEW OFF)
+ set(WITH_SYSTEM_GLES OFF)
endif()
@@ -295,6 +298,35 @@ if(CMAKE_COMPILER_IS_GNUCC)
mark_as_advanced(WITH_GCC_MUDFLAP)
endif()
+# OpenGL
+
+option(WITH_GLEW_MX "Support multiple GLEW contexts (experimental)" 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_GLU "Provide the GL Utility Library (GLU). Only works with the 'compatibiity' profile. (deprecated)" ON )
+option(WITH_GL_CONTEXT_DESKTOP "Support using the AGL/WGL/XGL system library to initialize OpenGL. Can access 3.2+ core, compatibility, and 2.0 ES profiles." ON )
+option(WITH_GL_CONTEXT_EMBEDDED "Support using the EGL system library to initialize OpenGL ES." OFF)
+option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
+option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF)
+option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
+
+mark_as_advanced(
+ WITH_GLEW_MX
+ WITH_GLEW_ES
+ WITH_GLU
+ WITH_GL_CONTEXT_DESKTOP
+ WITH_GL_CONTEXT_EMBEDDED
+ WITH_GL_PROFILE_COMPAT
+ WITH_GL_PROFILE_CORE
+ WITH_GL_PROFILE_ES20
+)
+
+if(WIN32)
+ option(WITH_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_ANGLE)
+endif()
+
+# Apple
+
if(APPLE)
cmake_minimum_required(VERSION 2.8.8)
cmake_policy(VERSION 2.8.8)
@@ -2014,10 +2046,110 @@ endif()
#-----------------------------------------------------------------------------
# Configure OpenGL.
-find_package(OpenGL)
-blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
-# unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake
-# unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
+
+if(WITH_GL_CONTEXT_DESKTOP OR (WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI))
+ find_package(OpenGL)
+endif()
+
+if(WITH_GL_CONTEXT_DESKTOP)
+ set(BLENDER_GL_LIBRARIES "${OPENGL_gl_LIBRARY}")
+
+ if(WITH_GLU)
+ list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_glu_LIBRARY}")
+
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GLU")
+
+ endif()
+
+elseif(WITH_GL_CONTEXT_EMBEDDED)
+ if(WITH_SYSTEM_GLES)
+ find_package_wrapper(OpenGLES)
+
+ if(OPENGLES_FOUND)
+ set(BLENDER_GL_LIBRARIES OPENGLES_LIBRARIES)
+ else()
+ message(FATAL_ERROR "Unable to find OpenGL ES libraries. Install them or disable WITH_SYSTEM_GLES.")
+ endif()
+
+ else()
+ set(OPENGLES_LIBRARY "" CACHE FILEPATH "OpenGL ES 2.0 library file")
+ set(OPENGLES_EGL_LIBRARY "" CACHE FILEPATH "EGL library file")
+
+ mark_as_advanced(
+ OPENGLES_LIBRARY
+ OPENGLES_EGL_LIBRARY
+ )
+
+ list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}" "${OPENGLES_EGL_LIBRARY}")
+
+ if (OPENGLES_LIBRARY STREQUAL "")
+ message(FATAL_ERROR "To compile WITH_GL_CONTEXT_EMBEDDED you need to set OPENGLES_LIBRARY to the file path of an OpenGL ES 2.0 library.")
+ endif()
+
+ if (OPENGLES_EGL_LIBRARY STREQUAL "")
+ message(FATAL_ERROR "To compile WITH_GL_CONTEXT_EMBEDDED 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_DLL "" CACHE FILEPATH "OpenGL ES 2.0 redistributable DLL file")
+ set(OPENGLES_EGL_DLL "" CACHE FILEPATH "EGL redistributable DLL file")
+
+ mark_as_advanced(
+ OPENGLES_DLL
+ OPENGLES_EGL_DLL
+ )
+
+ if (OPENGLES_DLL STREQUAL "")
+ message(FATAL_ERROR "To compile WITH_GL_CONTEXT_EMBEDDED you need to set OPENGLES_DLL to the file path of an OpenGL ES runtime dynamic link library (DLL).")
+ endif()
+
+ if (OPENGLES_EGL_DLL STREQUAL "")
+ message(FATAL_ERROR "To compile WITH_GL_CONTEXT_EMBEDDED you need to set OPENGLES_EGL_DLL to the file path of an EGL runtime dynamic link library (DLL).")
+ endif()
+
+ if(WITH_ANGLE)
+ set(GL_DEFINITIONS "${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)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DD3DCOMPILER=\"\\\"${D3DCOMPILER_FILENAME}\\\"\"")
+
+ mark_as_advanced(D3DCOMPILER_DLL)
+
+ if (D3DCOMPILER_DLL STREQUAL "")
+ message(FATAL_ERROR "To compile WITH_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()
+
+endif()
+
+if(WITH_GL_PROFILE_COMPAT)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GL_PROFILE_COMPAT")
+endif()
+
+if(WITH_GL_PROFILE_CORE)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GL_PROFILE_CORE")
+endif()
+
+if(WITH_GL_PROFILE_ES20)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GL_PROFILE_ES20")
+endif()
+
+if(WITH_GL_CONTEXT_DESKTOP)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GL_CONTEXT_DESKTOP")
+endif()
+
+if(WITH_GL_CONTEXT_EMBEDDED)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GL_CONTEXT_EMBEDDED")
+endif()
#-----------------------------------------------------------------------------
# Configure OpenMP.
@@ -2043,22 +2175,84 @@ endif()
#-----------------------------------------------------------------------------
# Configure GLEW
+if(WITH_GLEW_MX)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_MX")
+endif()
+
if(WITH_SYSTEM_GLEW)
find_package(GLEW)
+ # Note: There is an assumption here that the system GLEW is not a static library.
+
if(NOT GLEW_FOUND)
- message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
+ message(FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW.")
endif()
mark_as_advanced(
GLEW_LIBRARY
GLEW_INCLUDE_PATH
)
+
+ set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
+
else()
- # set(GLEW_LIBRARY "") # unused
- set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
+ if(WITH_GLEW_ES)
+ set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
+
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_STATIC -DWITH_GLEW_ES")
+
+ # These definitions remove APIs from glew.h, making GLEW smaller, and catching unguarded API usage
+ if(NOT WITH_GL_PROFILE_ES20)
+ # No ES functions are needed
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_NO_ES")
+ elseif(NOT (WITH_GL_PROFILE_CORE OR WITH_GL_PROFILE_COMPAT))
+ # ES is enabled, but the other functions are all disabled
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_ES_ONLY")
+ endif()
+
+ if(WITH_GL_PROFILE_ES20)
+ if(WITH_GL_CONTEXT_EMBEDDED)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_USE_LIB_ES20")
+ endif()
+
+ # XXX: This is an experiment to eliminate ES 1 symbols,
+ # GLEW doesn't really properly provide this level of control
+ # (for example, without modification it eliminates too many symbols)
+ # so there are lots of modifications to GLEW to make this work,
+ # and no attempt to make it work beyond Blender at this point.
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_1_0=0")
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_CL_1_1=0")
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_CM_1_1=0")
+ endif()
+
+ if(WITH_GL_CONTEXT_EMBEDDED)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_INC_EGL")
+ endif()
+
+ set(BLENDER_GLEW_LIBRARIES extern_glew_es bf_intern_glew_mx)
+
+ else()
+ set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
+
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_STATIC")
+
+ # This won't affect the non-experimental glew library,
+ # but is used for conditional compilation elsewhere.
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_NO_ES")
+
+ set(BLENDER_GLEW_LIBRARIES extern_glew)
+
+ endif()
+
endif()
+if(WITH_GLEW_MX)
+ list(APPEND BLENDER_GLEW_LIBRARIES bf_intern_glew_mx)
+endif()
+
+if(NOT WITH_GLU)
+ set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_NO_GLU")
+endif()
#-----------------------------------------------------------------------------
# Configure Bullet
@@ -2456,6 +2650,18 @@ if(FIRST_RUN)
info_cfg_option(WITH_MOD_FLUID)
info_cfg_option(WITH_MOD_OCEANSIM)
+ info_cfg_text("OpenGL:")
+ info_cfg_option(WITH_GLEW_ES)
+ info_cfg_option(WITH_GLU)
+ info_cfg_option(WITH_GL_CONTEXT_DESKTOP)
+ info_cfg_option(WITH_GL_CONTEXT_EMBEDDED)
+ info_cfg_option(WITH_GL_PROFILE_COMPAT)
+ info_cfg_option(WITH_GL_PROFILE_CORE)
+ info_cfg_option(WITH_GL_PROFILE_ES20)
+ if(WIN32)
+ info_cfg_option(WITH_ANGLE)
+ endif()
+
info_cfg_text("Other:")
info_cfg_option(WITH_OPENNL)
diff --git a/build_files/cmake/Modules/FindOpenGLES.cmake b/build_files/cmake/Modules/FindOpenGLES.cmake
new file mode 100644
index 0000000..981a1ab
--- /dev/null
+++ b/build_files/cmake/Modules/FindOpenGLES.cmake
@@ -0,0 +1,51 @@
+# - Try to find OpenGLES
+# Once done this will define
+#
+# OPENGLES_FOUND - system has OpenGLES and EGL
+# OPENGL_EGL_FOUND - system has EGL
+# O
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list