Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-02-05 03:35:54 +0300
committerMike Erwin <significant.bit@gmail.com>2017-02-05 03:35:54 +0300
commit627566cb9ac771c209508b3793f0c9456fb24798 (patch)
tree03948002bd14b54390f99415eee3ee7edc2199f6 /intern/ghost/intern/GHOST_WindowX11.cpp
parent520ced4ad504bfcbcf0e86ff07651736dc51b8f0 (diff)
OpenGL: use GL4 on Linux when available
Minimum target is still 3.3 On AMD pro driver, asking for a 3.3 context gives us *exactly* 3.3, not 3.3+ as desired. Have not tested proprietary NV or Intel drivers, but this fix should work on all vendors.
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowX11.cpp')
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp60
1 files changed, 41 insertions, 19 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 992200a0b09..8cee785cdf6 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1316,10 +1316,12 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
if (type == GHOST_kDrawingContextTypeOpenGL) {
// During development:
+ // try 4.x compatibility profile
// try 3.3 compatibility profile
// fall back to 3.0 if needed
//
// Final Blender 2.8:
+ // try 4.x core profile
// try 3.3 core profile
// no fallbacks
@@ -1332,24 +1334,9 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
# error // must specify either core or compat at build time
#endif
- GHOST_Context *context = new GHOST_ContextGLX(
- m_wantStereoVisual,
- m_wantNumOfAASamples,
- m_window,
- m_display,
- m_visualInfo,
- (GLXFBConfig)m_fbconfig,
- profile_mask,
- 3, 3,
- GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
- GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
+ GHOST_Context *context;
- if (context->initializeDrawingContext())
- return context;
- else {
- delete context;
-
- // since that failed try 3.0 (mostly for Mesa, which doesn't implement compatibility profile)
+ for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextGLX(
m_wantStereoVisual,
m_wantNumOfAASamples,
@@ -1357,8 +1344,8 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
m_display,
m_visualInfo,
(GLXFBConfig)m_fbconfig,
- 0, // no profile bit
- 3, 0,
+ profile_mask,
+ 4, minor,
GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
@@ -1367,6 +1354,41 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
else
delete context;
}
+
+ context = new GHOST_ContextGLX(
+ m_wantStereoVisual,
+ m_wantNumOfAASamples,
+ m_window,
+ m_display,
+ m_visualInfo,
+ (GLXFBConfig)m_fbconfig,
+ profile_mask,
+ 3, 3,
+ 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;
+
+ // 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;