[Bf-blender-cvs] [2658c67] decklink: Merge remote-tracking branch 'origin/master' into decklink ce/blender/python/generic/bgl.c

Benoit Bolsee noreply at git.blender.org
Tue Sep 29 11:43:29 CEST 2015


Commit: 2658c67165138c68e01ed1b23606558cde432936
Author: Benoit Bolsee
Date:   Tue Sep 29 11:42:12 2015 +0200
Branches: decklink
https://developer.blender.org/rB2658c67165138c68e01ed1b23606558cde432936

Merge remote-tracking branch 'origin/master' into decklink
ce/blender/python/generic/bgl.c

Conflicts:
	build_files/cmake/macros.cmake
	intern/atomic/atomic_ops.h
	intern/ghost/GHOST_ISystem.h
	intern/ghost/GHOST_Types.h
	intern/ghost/intern/GHOST_ContextGLX.cpp
	intern/ghost/intern/GHOST_ContextWGL.cpp
	intern/ghost/intern/GHOST_ContextWGL.h
	intern/ghost/intern/GHOST_SystemX11.cpp
	intern/ghost/intern/GHOST_WindowX11.cpp
	intern/ghost/intern/GHOST_WindowX11.h
	source/blenderplayer/CMakeLists.txt

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



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

diff --cc CMakeLists.txt
index 0cc04f0,deafa90..f5079b4
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -220,9 -225,16 +225,17 @@@ option(WITH_SYSTEM_BULLET "Use the syst
  mark_as_advanced(WITH_SYSTEM_BULLET)
  option(WITH_GAMEENGINE    "Enable Game Engine" ${_init_GAMEENGINE})
  option(WITH_PLAYER        "Build Player" OFF)
 +option(WITH_DECKLINK      "Support BlackMagicDesign DeckLink cards in the BGE" OFF)
  option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
- option(WITH_COMPOSITOR    "Enable the tile based nodal compositor" ON)
+ 
+ # Compositor
+ option(WITH_COMPOSITOR         "Enable the tile based nodal compositor" ON)
+ option(WITH_COMPOSITOR_WERROR  "Treat warnings as errors in compositor code" OFF)
+ mark_as_advanced(WITH_COMPOSITOR_WERROR)
+ 
+ option(WITH_OPENSUBDIV    "Enable OpenSubdiv for surface subdivision" _init_OPENSUBDIV)
+ option(WITH_SUBSURF_WERROR  "Treat warnings as errors in subsurf code" OFF)
+ mark_as_advanced(WITH_COMPOSITOR_WERROR)
  
  # GHOST Windowing Library Options
  option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
@@@ -799,18 -844,16 +847,26 @@@ if(WITH_X11
  		endif()
  	endif()
  
 +	if(WITH_X11_ALPHA)
 +		find_library(X11_Xrender_LIB Xrender  ${X11_LIB_SEARCH_PATH})
 +		mark_as_advanced(X11_Xrender_LIB)
 +		if (X11_Xrender_LIB)
 +			list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB})
 +		else()
 +			set(WITH_X11_ALPHA OFF)
 +		endif()
 +	endif()
 +
  endif()
  
+ 
+ # ----------------------------------------------------------------------------
+ # Main Platform Checks
+ #
+ # - UNIX
+ # - WIN32
+ # - APPLE
+ 
  if(UNIX AND NOT APPLE)
  	macro(find_package_wrapper)
  		if(WITH_STATIC_LIBS)
diff --cc build_files/cmake/macros.cmake
index 007d19f,90c4fbd..55bb7b4
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@@ -672,14 -688,10 +687,18 @@@ function(SETUP_BLENDER_SORTED_LIBS
  		list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
  	endif()
  
 +	if(WITH_DECKLINK)
 +		list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
 +	endif()
 +
 +	if(WIN32)
 +		list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
 +	endif()
 +
+ 	if(WITH_OPENSUBDIV)
+ 		list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
+ 	endif()
+ 
  	foreach(SORTLIB ${BLENDER_SORTED_LIBS})
  		set(REMLIB ${SORTLIB})
  		foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
diff --cc intern/CMakeLists.txt
index dc915c3,4ee3dff..bba12de
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@@ -81,10 -77,11 +81,13 @@@ if(WITH_OPENNL
  	add_subdirectory(opennl)
  endif()
  
+ if(WITH_OPENSUBDIV)
+ 	add_subdirectory(opensubdiv)
+ endif()
+ 
  # only windows needs utf16 converter
 +# gpudirect is a runtime interface to the nVidia's DVP driver, only for windows
  if(WIN32)
  	add_subdirectory(utfconv)
 +	add_subdirectory(gpudirect)
  endif()
- 
diff --cc intern/ghost/GHOST_Types.h
index ce0a014,7a73af3..49e765c
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@@ -58,7 -58,7 +58,8 @@@ typedef struct 
  typedef enum {
  	GHOST_glStereoVisual = (1 << 0),
  	GHOST_glWarnSupport  = (1 << 1),
- 	GHOST_glAlphaBackground = (1 << 2),
+ 	GHOST_glDebugContext = (1 << 2),
++	GHOST_glAlphaBackground = (1 << 3),
  } GHOST_GLFlags;
  
  
diff --cc intern/ghost/intern/GHOST_ContextGLX.cpp
index 5adac99,02b43ab..9ab1fbd
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@@ -155,25 -154,105 +157,111 @@@ GHOST_TSuccess GHOST_ContextGLX::initia
  	XIOErrorHandler old_handler_io = XSetIOErrorHandler(GHOST_X11_ApplicationIOErrorHandler);
  #endif
  
+ 	/* needed so 'GLXEW_ARB_create_context' is valid */
+ 	mxIgnoreNoVersion(1);
+ 	initContextGLXEW();
+ 	mxIgnoreNoVersion(0);
+ 
+ 	if (GLXEW_ARB_create_context) {
+ 		int profileBitCore   = m_contextProfileMask & GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
+ 		int profileBitCompat = m_contextProfileMask & GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ 
+ #ifdef WITH_GLEW_ES
+ 		int profileBitES     = m_contextProfileMask & GLX_CONTEXT_ES_PROFILE_BIT_EXT;
+ #endif
+ 
+ 		if (!GLXEW_ARB_create_context_profile && profileBitCore)
+ 			fprintf(stderr, "Warning! OpenGL core profile not available.\n");
+ 
+ 		if (!GLXEW_ARB_create_context_profile && profileBitCompat)
+ 			fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n");
+ 
+ #ifdef WITH_GLEW_ES
+ 		if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1)
+ 			fprintf(stderr, "Warning! OpenGL ES profile not available.\n");
+ 
+ 		if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2)
+ 			fprintf(stderr, "Warning! OpenGL ES2 profile not available.\n");
+ #endif
+ 
+ 		int profileMask = 0;
+ 
+ 		if (GLXEW_ARB_create_context_profile && profileBitCore)
+ 			profileMask |= profileBitCore;
+ 
+ 		if (GLXEW_ARB_create_context_profile && profileBitCompat)
+ 			profileMask |= profileBitCompat;
+ 
+ #ifdef WITH_GLEW_ES
+ 		if (GLXEW_EXT_create_context_es_profile && profileBitES)
+ 			profileMask |= profileBitES;
+ #endif
+ 
+ 		if (profileMask != m_contextProfileMask)
+ 			fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits.");
+ 
+ 
+ 		/* max 10 attributes plus terminator */
+ 		int attribs[11];
+ 		int i = 0;
+ 
+ 		if (profileMask) {
+ 			attribs[i++] = GLX_CONTEXT_PROFILE_MASK_ARB;
+ 			attribs[i++] = profileMask;
+ 		}
+ 
+ 		if (m_contextMajorVersion != 0) {
+ 			attribs[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
+ 			attribs[i++] = m_contextMajorVersion;
+ 		}
+ 
+ 		if (m_contextMinorVersion != 0) {
+ 			attribs[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;
+ 			attribs[i++] = m_contextMinorVersion;
+ 		}
  
- #ifdef WITH_X11_ALPHA
- 	if(m_fbconfig
- 	   && (glXCreateContextAttribsARB ||
- 		   (glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddressARB((const GLubyte *)"glXCreateContextAttribsARB")) != NULL)
- 	   ) {
- 		std::cout << "Detected GLXEW_ARB_create_context" << std::endl;
- 		int context_attribs[] =
+ 		if (m_contextFlags != 0) {
+ 			attribs[i++] = GLX_CONTEXT_FLAGS_ARB;
+ 			attribs[i++] = m_contextFlags;
+ 		}
+ 
+ 		if (m_contextResetNotificationStrategy != 0) {
+ 			if (GLXEW_ARB_create_context_robustness) {
+ 				attribs[i++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB;
+ 				attribs[i++] = m_contextResetNotificationStrategy;
+ 			}
+ 			else {
+ 				fprintf(stderr, "Warning! Cannot set the reset notification strategy.");
+ 			}
+ 		}
+ 		attribs[i++] = 0;
+ 
+ 		/* Create a GL 3.x context */
 -		GLXFBConfig *framebuffer_config = NULL;
++		if (m_fbconfig)
  		{
- 			GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
- 			GLX_CONTEXT_MINOR_VERSION_ARB, 0,
- 			//GLX_CONTEXT_FLAGS_ARB        , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
- 			None
- 		};
- 		m_context = glXCreateContextAttribsARB( m_display, m_fbconfig, 0, True, context_attribs );
 -			int glx_attribs[64];
 -			int fbcount = 0;
++			m_context = glXCreateContextAttribsARB(m_display, m_fbconfig, s_sharedContext, True, attribs);
++		}
++		else {
++			GLXFBConfig *framebuffer_config = NULL;
++			{
++				int glx_attribs[64];
++				int fbcount = 0;
+ 
 -			GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_numOfAASamples, m_stereoVisual, true);
++				GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_numOfAASamples, m_stereoVisual, false, true);
+ 
 -			framebuffer_config = glXChooseFBConfig(m_display, DefaultScreen(m_display), glx_attribs, &fbcount);
 -		}
++				framebuffer_config = glXChooseFBConfig(m_display, DefaultScreen(m_display), glx_attribs, &fbcount);
++			}
+ 
 -		if (framebuffer_config) {
 -			m_context = glXCreateContextAttribsARB(m_display, framebuffer_config[0], s_sharedContext, True, attribs);
 -			XFree(framebuffer_config);
++			if (framebuffer_config) {
++				m_context = glXCreateContextAttribsARB(m_display, framebuffer_config[0], s_sharedContext, True, attribs);
++				XFree(framebuffer_config);
++			}
+ 		}
  	}
- #endif
- 	if (!m_context)
+ 	else {
+ 		/* Create legacy context */
  		m_context = glXCreateContext(m_display, m_visualInfo, s_sharedContext, True);
+ 	}
  
  	GHOST_TSuccess success;
  
@@@ -244,3 -323,89 +332,84 @@@ GHOST_TSuccess GHOST_ContextGLX::getSwa
  		return GHOST_kFailure;
  	}
  }
+ 
+ /**
+  * Utility function to get GLX attributes.
+  *
+  * \param for_fb_config: There are some small differences in
+  * #glXChooseVisual and #glXChooseFBConfig's attribute encoding.
+  *
+  * \note Similar to SDL's 'X11_GL_GetAttributes'
+  */
+ int GHOST_X11_GL_GetAttributes(
+         int *attribs, int attribs_max,
+         int samples, bool is_stereo_visual,
++	bool need_alpha,
+         bool for_fb_config)
+ {
+ 	int i = 0;
+ 
 -#ifdef GHOST_OPENGL_ALPHA
 -	const bool need_alpha = true;
 -#else
 -	const bool need_alpha = false;
 -#endif
 -
+ #ifdef GHOST_OPENGL_STENCIL
+ 	const bool need_stencil = true;
+ #else
+ 	const bool need_stencil = false;
+ #endif
+ 
+ 	if (is_stereo_visual) {
+ 		attribs[i++] = GLX_STEREO;
+ 		if (for_fb_config) {
+ 			attribs[i++] = True;
+ 		}
+ 	}
+ 
+ 	if (for_fb_config) {
+ 		attribs[i++] = GLX_RENDER_TYPE;
+ 		attribs[i++] = GLX_RGBA_BIT;
+ 	}
+ 	else {
+ 		attribs[i++] = GLX_RGBA;
+ 	}
+ 
+ 	attribs[i++] = GLX_DOUBLEBUFFER;
+ 	if (for_fb_config) {
+ 		attribs[i++] = True;
+ 	}
+ 
+ 	attribs[i++] = GLX_RED_SIZE;
+ 	attribs[i++] = True;
+ 
+ 	attribs[i++] = GLX_BLUE_SIZE;
+ 	attribs[i++] = True;
+ 
+ 	attribs[i++] = GLX_GREEN_SIZE;
+ 	attribs[i++] = True;
+ 
+ 	attribs[i++] = GLX_DEPTH_SIZE;
+ 	attribs[i++] = True;
+ 
+ 	if (need_alpha) {
+ 		attribs[i++] = GLX_ALPHA_SIZE;
+ 		attribs[i++] = True;
+ 	}
+ 
+ 	if (need_stencil) {
+ 		attribs[i++] = GLX_STENCIL_SIZE;
+ 		attribs[i++] = True;
+ 	}
+ 
+ 	if (samples) {
+ 		attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
+ 		attribs[i++] = True;
+ 
+ 		attribs[i++] = GLX_SAMPLES_ARB;
+ 		attribs[i++] = samples;
+ 	}
+ 
+ 	attribs[i++] = 0;
+ 
+ 	GHOST_ASSERT(i <= attribs_max, "attribute size too small");
+ 
+ 	(void)attribs_max;
+ 
+ 	return i;
+ }
diff --cc intern/ghost/intern/GHOST_ContextGLX.h
index 4e2ff51,8c2231a..f0f010d
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@@ -153,4 -147,10 +149,11 @@@ private
  	static int 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list