diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2013-02-20 14:00:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-23 01:34:25 +0100 |
commit | f2b26af2b4db25aeb74279a40365b76f0406a018 (patch) | |
tree | d45e7dc1c84e096413e164a5d366008e246caaac | |
parent | 7e5750101699a408356439126649e8f49010d1df (diff) |
Enforce OpenGL context creation under XCB
We don't support other context types, so fail in those cases.
Also, return OpenGL as the rendereable type of our surface.
Change-Id: Ic7b5ed0ec5eaf5c0f88f50f5bceb697ea414c696
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
-rw-r--r-- | src/platformsupport/glxconvenience/qglxconvenience.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.cpp | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp index e885ecc105..9ce74f55fe 100644 --- a/src/platformsupport/glxconvenience/qglxconvenience.cpp +++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp @@ -224,6 +224,8 @@ XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *f QSurfaceFormat qglx_surfaceFormatFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext) { QSurfaceFormat format; + format.setRenderableType(QSurfaceFormat::OpenGL); + int redSize = 0; int greenSize = 0; int blueSize = 0; diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 854f7bcd17..db942fc3ad 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -270,14 +270,19 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat : QPlatformOpenGLContext() , m_screen(screen) , m_context(0) + , m_shareContext(0) , m_format(format) , m_isPBufferCurrent(false) { - m_shareContext = 0; + if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType) + m_format.setRenderableType(QSurfaceFormat::OpenGL); + if (m_format.renderableType() != QSurfaceFormat::OpenGL) + return; + if (share) m_shareContext = static_cast<const QGLXContext*>(share)->glxContext(); - GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format); + GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),m_format); XVisualInfo *visualInfo = 0; Window window = 0; // Temporary window used to query OpenGL context @@ -297,7 +302,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat // context format that that which was requested and is supported by the driver const int maxSupportedVersion = (defaultContextInfo->format.majorVersion() << 8) + defaultContextInfo->format.minorVersion(); - const int requestedVersion = qMin((format.majorVersion() << 8) + format.minorVersion(), + const int requestedVersion = qMin((m_format.majorVersion() << 8) + m_format.minorVersion(), maxSupportedVersion); const int majorVersion = requestedVersion >> 8; const int minorVersion = requestedVersion & 0xFF; |