X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=shared%2Fcontext.cpp;h=db4babbab4c82007158df23d472c9a2d9fcdb2b8;hb=e15251d2787cb8e6b677af801de6180e55171763;hp=0b17bfa56893ec065b5f96efbe1a95a1a6a687c7;hpb=eeda8995329601f9f4e35047358400833eeae68e;p=nageru diff --git a/shared/context.cpp b/shared/context.cpp index 0b17bfa..db4babb 100644 --- a/shared/context.cpp +++ b/shared/context.cpp @@ -24,7 +24,7 @@ QSurface *create_surface() surface->create(); if (!surface->isValid()) { fprintf(stderr, "ERROR: surface not valid!\n"); - exit(1); + abort(); } return surface; } @@ -36,7 +36,7 @@ QSurface *create_surface(const QSurfaceFormat &format) surface->create(); if (!surface->isValid()) { fprintf(stderr, "ERROR: surface not valid!\n"); - exit(1); + abort(); } return surface; } @@ -50,7 +50,20 @@ QOpenGLContext *create_context(const QSurface *surface) { QOpenGLContext *context = new QOpenGLContext; context->setShareContext(global_share_widget->context()->contextHandle()); - context->setFormat(surface->format()); + + // Qt has a bug (QTBUG-76299) where, when using EGL, the surface ignores + // the requested OpenGL context version and just becomes 2.0. Mesa honors + // this and gives us a 3.0 compatibility context, but then has a bug related + // to its shader cache (Mesa bug #110872) that causes spurious linker failures + // when we need to re-link a Movit shader in the same context. However, + // the surface itself doesn't use the OpenGL version in its format for anything, + // so we can just override it and get a proper context. + QSurfaceFormat fmt = surface->format(); + fmt.setProfile(QSurfaceFormat::CoreProfile); + fmt.setMajorVersion(4); + fmt.setMinorVersion(5); + context->setFormat(fmt); + context->create(); return context; }