Don't ignore QSurfaceFormat::Options in the XCB plugin

The XCB plugin requested a forward-compatible context regardless
of whether QSurfaceFormat::DeprecatedFunctions was set, and also
ignored the QSurfaceFormat::DebugContext option.

Change-Id: I81c737447b554b3b6f61c2725bce7583e0e887ab
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
bb10
Fredrik Höglund 2013-02-04 15:51:35 +01:00 committed by The Qt Project
parent 3a2276c6f3
commit 82eaff97d1
1 changed files with 15 additions and 5 deletions

View File

@ -305,14 +305,24 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
// If asking for OpenGL 3.2 or newer we should also specify a profile
if (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1)) {
if (m_format.profile() == QSurfaceFormat::CoreProfile) {
contextAttributes << GLX_CONTEXT_FLAGS_ARB << GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
<< GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
} else {
if (m_format.profile() == QSurfaceFormat::CoreProfile)
contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
else
contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
}
}
int flags = 0;
if (m_format.testOption(QSurfaceFormat::DebugContext))
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
// A forward-compatible context may be requested for 3.0 and later
if (m_format.majorVersion() >= 3 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions))
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (flags != 0)
contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags;
contextAttributes << None;
m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data());