Commit: 0d1f0116febf7dbdeaec7cf2379ef192503d7d43
Author: Mike Erwin
Date: Wed Aug 3 17:58:24 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB0d1f0116febf7dbdeaec7cf2379ef192503d7d43
OpenGL: Blender 2.8 on X11 requires GL 3.0
Implements the Linux part of T49012.
Simplify the options for context creation. No options for legacy GL or EGL or
ES2. Select 3.2 CORE or COMPATIBILITY profile at build time.
If that fails, use a GL 3.0 context. This keeps Mesa supported while we work on
full 3.2 core elsewhere in the code.
===================================================================
M intern/ghost/intern/GHOST_ContextGLX.cpp
M intern/ghost/intern/GHOST_WindowX11.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp
b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 9ac61db..2d49894 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -255,9 +255,6 @@ const bool GLXEW_ARB_create_context_robustness =
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;
}
@@ -300,8 +297,8 @@ const bool GLXEW_ARB_create_context_robustness =
}
}
else {
- /* Create legacy context */
- m_context = glXCreateContext(m_display, m_visualInfo,
s_sharedContext, True);
+ /* Don't create legacy context */
+ fprintf(stderr, "Warning! GLX_ARB_create_context not
available.\n");
}
GHOST_TSuccess success;
@@ -328,8 +325,14 @@ const bool GLXEW_ARB_create_context_robustness =
version = glGetString(GL_VERSION);
- if (!version || version[0] < '2' || ((version[0] == '2') &&
(version[2] < '1'))) {
- fprintf(stderr, "Error! Blender requires OpenGL 2.1 to
run. Try updating your drivers.\n");
+#if 0 // enable this when Blender switches to 3.2 core profile
+ if (!version || version[0] < '3' || ((version[0] == '3') &&
(version[2] < '2'))) {
+ fprintf(stderr, "Error! Blender requires OpenGL 3.2 to
run. Try updating your drivers.\n");
+#else
+ // with Mesa, the closest thing to 3.2 compatibility profile is
3.0
+ if (!version || version[0] < '3') {
+ fprintf(stderr, "Error! Blender requires OpenGL 3.0
(soon 3.2) to run. Try updating your drivers.\n");
+#endif
fflush(stderr);
/* ugly, but we get crashes unless a whole bunch of
systems are patched. */
exit(0);
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp
b/intern/ghost/intern/GHOST_WindowX11.cpp
index fd002ce..3694bd5 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1301,33 +1301,24 @@ GHOST_WindowX11::
GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType
type)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
-#if !defined(WITH_GL_EGL)
+ // During development:
+ // try 3.2 compatibility profile
+ // fall back to 3.0 if needed
+ //
+ // Final Blender 2.8:
+ // try 3.2 core profile
+ // no fallbacks
+
+ const int profile_mask =
#if defined(WITH_GL_PROFILE_CORE)
- GHOST_Context *context = new GHOST_ContextGLX(
- m_wantStereoVisual,
- m_wantNumOfAASamples,
- m_window,
- m_display,
- m_visualInfo,
- (GLXFBConfig)m_fbconfig,
- GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- 3, 2,
- GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ?
GLX_CONTEXT_DEBUG_BIT_ARB : 0),
- GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
-#elif defined(WITH_GL_PROFILE_ES20)
- GHOST_Context *context = new GHOST_ContextGLX(
- m_wantStereoVisual,
- m_wantNumOfAASamples,
- m_window,
- m_display,
- m_visualInfo,
- (GLXFBConfig)m_fbconfig,
- GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
- 2, 0,
- GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ?
GLX_CONTEXT_DEBUG_BIT_ARB : 0),
- GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
+ GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
#elif defined(WITH_GL_PROFILE_COMPAT)
+ GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+#else
+# error // must specify either core or compat at build time
+#endif
+
GHOST_Context *context = new GHOST_ContextGLX(
m_wantStereoVisual,
m_wantNumOfAASamples,
@@ -1335,58 +1326,34 @@ GHOST_Context
*GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
m_display,
m_visualInfo,
(GLXFBConfig)m_fbconfig,
- 0, // profile bit
- 0, 0,
+ profile_mask,
+ 3, 2,
GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ?
GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
-#else
-# error
-#endif
-#else
-
-#if defined(WITH_GL_PROFILE_CORE)
- GHOST_Context *context = new GHOST_ContextEGL(
- m_wantStereoVisual,
- m_wantNumOfAASamples,
- m_window,
- m_display,
- EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
- 3, 2,
- GHOST_OPENGL_EGL_CONTEXT_FLAGS,
- GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
- EGL_OPENGL_API);
-#elif defined(WITH_GL_PROFILE_ES20)
- GHOST_Context *context = new GHOST_ContextEGL(
- m_wantStereoVisual,
- m_wantNumOfAASamples,
- m_window,
- m_display,
- 0, // profile bit
- 2, 0,
- GHOST_OPENGL_EGL_CONTEXT_FLAGS,
- GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
- EGL_OPENGL_ES_API);
-#elif defined(WITH_GL_PROFILE_COMPAT)
- GHOST_Context *context = new GHOST_ContextEGL(
- m_wantStereoVisual,
- m_wantNumOfAASamples,
- m_window,
- m_display,
- 0, // profile bit
- 0, 0,
- GHOST_OPENGL_EGL_CONTEXT_FLAGS,
- GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
- EGL_OPENGL_API);
-#else
-# error
-#endif
-
-#endif
if (context->initializeDrawingContext())
return context;
- else
+ else {
delete context;
+
+ // since that failed try 3.0 (mostly for Mesa, which
doesn't implement compatibility profile)
+ context = new GHOST_ContextGLX(
+ m_wantStereoVisual,
+ m_wantNumOfAASamples,
+ m_window,
+ m_display,
+ m_visualInfo,
+ (GLXFBConfig)m_fbconfig,
+ 0, // no profile bit
+ 3, 0,
+ GHOST_OPENGL_GLX_CONTEXT_FLAGS |
(m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
+ GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
+
+ if (context->initializeDrawingContext())
+ return context;
+ else
+ delete context;
+ }
}
return NULL;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs