summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_glx.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/context_glx.c')
-rw-r--r--video/out/opengl/context_glx.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/video/out/opengl/context_glx.c b/video/out/opengl/context_glx.c
index 529991fac2..e4e23c7b86 100644
--- a/video/out/opengl/context_glx.c
+++ b/video/out/opengl/context_glx.c
@@ -69,41 +69,6 @@ static void glx_uninit(struct ra_ctx *ctx)
vo_x11_uninit(ctx->vo);
}
-static bool create_context_x11_old(struct ra_ctx *ctx, GL *gl)
-{
- struct priv *p = ctx->priv;
- Display *display = ctx->vo->x11->display;
- struct vo *vo = ctx->vo;
-
- if (p->context)
- return true;
-
- if (!p->vinfo) {
- MP_FATAL(vo, "Can't create a legacy GLX context without X visual\n");
- return false;
- }
-
- GLXContext new_context = glXCreateContext(display, p->vinfo, NULL, True);
- if (!new_context) {
- MP_FATAL(vo, "Could not create GLX context!\n");
- return false;
- }
-
- if (!glXMakeCurrent(display, ctx->vo->x11->window, new_context)) {
- MP_FATAL(vo, "Could not set GLX context!\n");
- glXDestroyContext(display, new_context);
- return false;
- }
-
- const char *glxstr = glXQueryExtensionsString(display, ctx->vo->x11->screen);
-
- mpgl_load_functions(gl, (void *)glXGetProcAddressARB, glxstr, vo->log);
-
- p->context = new_context;
-
- return true;
-}
-
typedef GLXContext (*glXCreateContextAttribsARBProc)
(Display*, GLXFBConfig, GLXContext, Bool, const int*);
@@ -122,9 +87,14 @@ static bool create_context_x11_gl3(struct ra_ctx *ctx, GL *gl, int gl_version,
const char *glxstr =
glXQueryExtensionsString(vo->x11->display, vo->x11->screen);
- bool have_ctx_ext = glxstr && !!strstr(glxstr, "GLX_ARB_create_context");
+ if (!glxstr) {
+ MP_ERR(ctx, "GLX did not advertise any extensions\n");
+ return false;
+ }
- if (!(have_ctx_ext && glXCreateContextAttribsARB)) {
+ if (!strstr(glxstr, "GLX_ARB_create_context") ||
+ !glXCreateContextAttribsARB) {
+ MP_ERR(ctx, "GLX does not support GLX_ARB_create_context\n");
return false;
}
@@ -133,7 +103,7 @@ static bool create_context_x11_gl3(struct ra_ctx *ctx, GL *gl, int gl_version,
if (es) {
profile_mask = GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
- if (!(glxstr && strstr(glxstr, "GLX_EXT_create_context_es2_profile")))
+ if (!strstr(glxstr, "GLX_EXT_create_context_es2_profile"))
return false;
}
@@ -316,11 +286,7 @@ static bool glx_init(struct ra_ctx *ctx)
int version = mpgl_min_required_gl_versions[n];
MP_VERBOSE(ctx, "Creating OpenGL %d.%d context...\n",
MPGL_VER_P(version));
- if (version >= 300) {
- success = create_context_x11_gl3(ctx, gl, version, false);
- } else {
- success = create_context_x11_old(ctx, gl);
- }
+ success = create_context_x11_gl3(ctx, gl, version, false);
if (success)
break;
}