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>
This commit is contained in:
parent
7e57501016
commit
f2b26af2b4
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user