summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-05-09 13:48:42 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-05-09 13:48:42 +0200
commit552c45bea924279a0a7c2d78c9d7e2959deee11f (patch)
treeee4326efe97420b1cda12118fd6309b4b6668c75 /src/plugins
parente110ab6c282790f6f035d52747b8589c448a362b (diff)
parenta7863a58545a6c59eaf16f36905efcbf0e4f94f9 (diff)
Merge remote-tracking branch 'origin/5.11.0' into 5.11
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
index baf3dbd42a..cc982b3379 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -90,10 +90,18 @@ typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXC
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#endif
+#ifndef GL_RESET_NOTIFICATION_STRATEGY_ARB
+#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#endif
+
#ifndef GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#endif
+#ifndef GL_LOSE_CONTEXT_ON_RESET_ARB
+#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#endif
+
#ifndef GLX_LOSE_CONTEXT_ON_RESET_ARB
#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#endif
@@ -157,6 +165,11 @@ static void updateFormatFromContext(QSurfaceFormat &format)
format.setOption(QSurfaceFormat::StereoBuffers);
if (format.renderableType() == QSurfaceFormat::OpenGL) {
+ GLint value = 0;
+ glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &value);
+ if (value == GL_LOSE_CONTEXT_ON_RESET_ARB)
+ format.setOption(QSurfaceFormat::ResetNotification);
+
if (format.version() < qMakePair(3, 0)) {
format.setOption(QSurfaceFormat::DeprecatedFunctions);
return;
@@ -164,7 +177,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
// Version 3.0 onwards - check if it includes deprecated functionality or is
// a debug context
- GLint value = 0;
+ value = 0;
glGetIntegerv(GL_CONTEXT_FLAGS, &value);
if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT))
format.setOption(QSurfaceFormat::DeprecatedFunctions);
@@ -302,20 +315,17 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
}
- if (supportsRobustness && supportsVideoMemoryPurge && m_format.testOption(QSurfaceFormat::ResetNotification)) {
- QVector<int> contextAttributesWithNvidiaReset = contextAttributes;
-
- contextAttributesWithNvidiaReset << GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB << GLX_LOSE_CONTEXT_ON_RESET_ARB;
- contextAttributesWithNvidiaReset << GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV << GL_TRUE;
-
- contextAttributesWithNvidiaReset << None;
- m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true, contextAttributesWithNvidiaReset.data());
- if (!m_context && m_shareContext) {
- // re-try without a shared glx context
- m_context = glXCreateContextAttribsARB(m_display, config, 0, true, contextAttributesWithNvidiaReset.data());
- if (m_context)
- m_shareContext = 0;
- }
+ if (supportsRobustness && m_format.testOption(QSurfaceFormat::ResetNotification)) {
+ QVector<int> contextAttributesWithRobustness = contextAttributes;
+ contextAttributesWithRobustness << GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB << GLX_LOSE_CONTEXT_ON_RESET_ARB;
+ if (supportsVideoMemoryPurge)
+ contextAttributesWithRobustness << GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV << GL_TRUE;
+
+ contextAttributesWithRobustness << None;
+ m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true,
+ contextAttributesWithRobustness.data());
+ // Context creation against a shared context may fail specifically due to this request, so try
+ // without before dropping sharing.
}
if (m_context) {