[Bf-blender-cvs] [ef640ecf100] blender2.8: OpenGL: remove use of GLEW MX
Mike Erwin
noreply at git.blender.org
Sat Apr 22 06:38:18 CEST 2017
Commit: ef640ecf1004f7af9cfde09f5ce1cde2fb70747f
Author: Mike Erwin
Date: Sat Apr 22 00:35:04 2017 -0400
Branches: blender2.8
https://developer.blender.org/rBef640ecf1004f7af9cfde09f5ce1cde2fb70747f
OpenGL: remove use of GLEW MX
MX (Multiple conteXt) support was dropped from the GLEW 2.0 library to make core profile support cleaner.
Our WITH_GLEW_MX build option was OFF by default already; this commit removes the inactive code paths.
I'm working on a plan for multiple GPUs, contexts, resource sharing, etc. This commit gives us a cleaner starting point for that upcoming work.
Tested on Mac, will test on Linux & Windows immediately after pushing.
===================================================================
M CMakeLists.txt
M build_files/cmake/Modules/FindGLEW.cmake
M extern/glew-es/CMakeLists.txt
M extern/glew/CMakeLists.txt
M intern/cycles/blender/blender_sync.cpp
M intern/cycles/util/util_opengl.h
M intern/cycles/util/util_view.cpp
M intern/ghost/intern/GHOST_Context.cpp
M intern/ghost/intern/GHOST_Context.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_ContextGLX.cpp
M intern/ghost/intern/GHOST_ContextGLX.h
M intern/ghost/intern/GHOST_ContextSDL.cpp
M intern/ghost/intern/GHOST_ContextWGL.cpp
M intern/ghost/intern/GHOST_ContextWGL.h
M intern/glew-mx/glew-mx.h
M intern/glew-mx/intern/glew-mx.c
M source/blender/gpu/intern/gpu_debug.c
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13171ac2780..c7209ed4819 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -466,7 +466,6 @@ endif()
# OpenGL
-option(WITH_GLEW_MX "Support multiple GLEW contexts (experimental)" OFF )
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_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
@@ -474,7 +473,6 @@ option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.3+ 'core' profile."
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_GL_EGL
WITH_GL_PROFILE_COMPAT
@@ -1224,10 +1222,6 @@ endif()
#-----------------------------------------------------------------------------
# Configure GLEW
-if(WITH_GLEW_MX)
- list(APPEND GL_DEFINITIONS -DWITH_GLEW_MX)
-endif()
-
if(WITH_SYSTEM_GLEW)
find_package(GLEW)
@@ -1237,11 +1231,7 @@ if(WITH_SYSTEM_GLEW)
message(FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW.")
endif()
- if(WITH_GLEW_MX)
- set(BLENDER_GLEW_LIBRARIES ${GLEW_MX_LIBRARY})
- else()
- set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
- endif()
+ set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
else()
if(WITH_GLEW_ES)
set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake
index 2f098d5d9a4..3057237f3c6 100644
--- a/build_files/cmake/Modules/FindGLEW.cmake
+++ b/build_files/cmake/Modules/FindGLEW.cmake
@@ -9,7 +9,6 @@
#
# also defined,
# GLEW_LIBRARY, where to find the Glew library.
-# GLEW_MX_LIBRARY, where to find the GlewMX library.
#=============================================================================
# Copyright 2014 Blender Foundation.
@@ -50,16 +49,6 @@ FIND_LIBRARY(GLEW_LIBRARY
lib64 lib
)
-
-FIND_LIBRARY(GLEW_MX_LIBRARY
- NAMES
- GLEWmx
- HINTS
- ${_glew_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
- )
-
# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
@@ -73,7 +62,6 @@ ENDIF(GLEW_FOUND)
MARK_AS_ADVANCED(
GLEW_INCLUDE_DIR
GLEW_LIBRARY
- GLEW_MX_LIBRARY
)
UNSET(_glew_SEARCH_DIRS)
diff --git a/extern/glew-es/CMakeLists.txt b/extern/glew-es/CMakeLists.txt
index ba80d3f6120..ea25425df81 100644
--- a/extern/glew-es/CMakeLists.txt
+++ b/extern/glew-es/CMakeLists.txt
@@ -49,9 +49,4 @@ set(SRC
add_definitions(${GL_DEFINITIONS})
-if(WITH_GLEW_MX)
- add_definitions(-DGLEW_MX)
-endif()
-
-
blender_add_lib(extern_glew_es "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/extern/glew/CMakeLists.txt b/extern/glew/CMakeLists.txt
index 250127f088f..c9323fa12b2 100644
--- a/extern/glew/CMakeLists.txt
+++ b/extern/glew/CMakeLists.txt
@@ -48,8 +48,4 @@ set(SRC
add_definitions(${GL_DEFINITIONS})
-if(WITH_GLEW_MX)
- add_definitions(-DGLEW_MX)
-endif()
-
blender_add_lib(extern_glew "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 3b071bf0e7d..5926b2a04a6 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -710,17 +710,8 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
params.shadingsystem = SHADINGSYSTEM_OSL;
/* color managagement */
-#ifdef GLEW_MX
- /* When using GLEW MX we need to check whether we've got an OpenGL
- * context for current window. This is because command line rendering
- * doesn't have OpenGL context actually.
- */
- if(glewGetContext() != NULL)
-#endif
- {
- params.display_buffer_linear = GLEW_ARB_half_float_pixel &&
- b_engine.support_display_space_shader(b_scene);
- }
+ params.display_buffer_linear = GLEW_ARB_half_float_pixel &&
+ b_engine.support_display_space_shader(b_scene);
if(b_engine.is_preview()) {
/* For preview rendering we're using same timeout as
diff --git a/intern/cycles/util/util_opengl.h b/intern/cycles/util/util_opengl.h
index 0b5462e0a09..7a8d5eec1f9 100644
--- a/intern/cycles/util/util_opengl.h
+++ b/intern/cycles/util/util_opengl.h
@@ -20,12 +20,6 @@
/* OpenGL header includes, used everywhere we use OpenGL, to deal with
* platform differences in one central place. */
-#ifdef WITH_GLEW_MX
-# include "glew-mx.h"
-#else
-# include <GL/glew.h>
-# define mxCreateContext() glewInit()
-# define mxMakeCurrentContext(x) (x)
-#endif
+#include <GL/glew.h>
#endif /* __UTIL_OPENGL_H__ */
diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp
index 10d86167921..7b453d123b8 100644
--- a/intern/cycles/util/util_view.cpp
+++ b/intern/cycles/util/util_view.cpp
@@ -252,7 +252,7 @@ void view_main_loop(const char *title, int width, int height,
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow(title);
- mxMakeCurrentContext(mxCreateContext());
+ glewInit();
view_reshape(width, height);
diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index f69f2181ef7..fc7193ae99b 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -143,11 +143,7 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
void GHOST_Context::initContextGLEW()
{
- mxDestroyContext(m_mxContext); // no-op if m_mxContext is NULL
-
- mxMakeCurrentContext(mxCreateContext());
-
- m_mxContext = mxGetCurrentContext();
+ GLEW_CHK(glewInit());
}
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index 18d36c40e9c..8776fa4764f 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -50,15 +50,13 @@ public:
*/
GHOST_Context(bool stereoVisual, GHOST_TUns16 numOfAASamples)
: m_stereoVisual(stereoVisual),
- m_numOfAASamples(numOfAASamples),
- m_mxContext(NULL)
+ m_numOfAASamples(numOfAASamples)
{}
/**
* Destructor.
*/
virtual ~GHOST_Context() {
- mxDestroyContext(m_mxContext);
}
/**
@@ -128,19 +126,12 @@ public:
protected:
void initContextGLEW();
- inline void activateGLEW() const {
- mxMakeCurrentContext(m_mxContext);
- }
-
bool m_stereoVisual;
GHOST_TUns16 m_numOfAASamples;
static void initClearGL();
-private:
- MXContext *m_mxContext;
-
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Context")
#endif
diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h
index 8186eaa759d..6dcc4da0f0a 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.h
+++ b/intern/ghost/intern/GHOST_ContextCGL.h
@@ -34,10 +34,6 @@
#include "GHOST_Context.h"
-//#define cglewGetContext() cglewContext
-//#include <GL/cglew.h>
-//extern "C" CGLEWContext *cglewContext;
-
#ifndef GHOST_OPENGL_CGL_CONTEXT_FLAGS
#define GHOST_OPENGL_CGL_CONTEXT_FLAGS 0
#endif
@@ -120,14 +116,7 @@ public:
*/
GHOST_TSuccess updateDrawingContext();
-//protected:
-// inline void activateCGLEW() const {
-// cglewContext = m_cglewContext;
-// }
-
private:
- //void initContextCGLEW()
-
/** The openGL view */
NSOpenGLView *m_openGLView;
@@ -136,8 +125,6 @@ private:
bool m_coreProfile;
- //static CGLEWContext *s_cglewContext;
-
const bool m_debug;
/** The first created OpenGL context (for sharing display lists) */
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index f6adb362470..03af3cc497e 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -159,9 +159,6 @@ GHOST_TSuccess GHOST_ContextCGL::activateDrawingContext()
if (m_openGLContext != nil) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[m_openGLContext makeCurrentContext];
-
- activateGLEW();
-
[pool drain];
return GHOST_kSuccess;
}
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 520aa0fffb2..a591d9b7583 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -42,11 +42,6 @@
#include <cstring>
-#ifdef WITH_GLEW_MX
-EGLEWContext *eglewContext = NULL;
-#endif
-
-
#define CASE_CODE_RETURN_STR(code) case code: return #code;
static const char *get_egl_error_enum_string(EGLenum error)
@@ -168,13 +163,8 @@ static bool egl_chk(bool result, const char *file = NULL, int line = 0, const ch
static inline bool bindAPI(EGLenum api)
{
-#ifdef WITH_GLEW_MX
- if (eglewContext != NULL)
-#endif
- {
- if (EGLEW_VERSION_1_2) {
- return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
- }
+ if (EGLEW_VERSION_1_2) {
+ return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
}
return false;
@@ -238,9 +228,6 @@ GHOST_ContextEGL::GHOST_ContextEGL(
m_surface(EGL_NO_SURFACE),
m_display(EGL_NO_DISPLAY),
m_swap_interval(1),
-#ifdef WITH_GLEW_MX
- m_eglewContext(NULL),
-#endif
m_sharedContext(choose_api(api, s_gl_sharedContext, s_gles_sharedContext, s_vg_sharedContext)),
m_sharedCount (choose_api(api, s_gl_sharedCount, s_gles_sharedCount, s_vg_sharedCount))
{
@@ -252,7 +239,6 @@ GHOST_ContextEGL::GHOST_ContextEGL(
GHOST_ContextEGL::~GHOST_ContextEGL()
{
if (m_display != EGL_NO_DISPLAY) {
- activateEGLEW();
bindAPI(m_api);
@@ -276,10 +262,6 @@ GHOST_ContextEGL::~GHOST_ContextEGL()
EGL_CHK(::eglDestroySurface(m_display, m_surface));
EGL_CHK(::eglTerminate(m_display));
-
-#ifdef WITH_GLEW_MX
- delete m_eglewContext;
-#endif
}
}
@@ -321,9 +303,6 @@ GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
GHOST
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list