diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index ed0b0d4747..1a5efe0460 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -486,27 +486,6 @@ static const struct gl_functions gl_functions[] = { #undef DEF_FN #undef DEF_FN_NAME -void mpgl_check_version(GL *gl, void *(*get_fn)(void *ctx, const char *n), - void *fn_ctx) -{ - gl->GetString = get_fn(fn_ctx, "glGetString"); - if (!gl->GetString) { - gl->version = 0; - return; - } - const char *version_string = gl->GetString(GL_VERSION); - if (!version_string) { - gl->version = 0; - return; - } - int major = 0, minor = 0; - if (sscanf(version_string, "%d.%d", &major, &minor) < 2) { - gl->version = 0; - return; - } - gl->version = MPGL_VER(major, minor); -} - // Fill the GL struct with function pointers and extensions from the current // GL context. Called by the backend. // get_fn: function to resolve function names diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h index c3691cfaf8..38414fe18b 100644 --- a/video/out/opengl/common.h +++ b/video/out/opengl/common.h @@ -70,8 +70,6 @@ enum { #define MPGL_VER_P(ver) MPGL_VER_GET_MAJOR(ver), MPGL_VER_GET_MINOR(ver) -void mpgl_check_version(GL *gl, void *(*get_fn)(void *ctx, const char *n), - void *fn_ctx); void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), const char *ext2, struct mp_log *log); void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c index 68cfa8e55d..ac40ac4146 100644 --- a/video/out/opengl/egl_helpers.c +++ b/video/out/opengl/egl_helpers.c @@ -163,14 +163,7 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, EGLContext *egl_ctx = NULL; - if (es) { - EGLint attrs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - - egl_ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, attrs); - } else { + if (!es) { for (int n = 0; mpgl_min_required_gl_versions[n]; n++) { int ver = mpgl_min_required_gl_versions[n]; @@ -186,20 +179,15 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, if (egl_ctx) break; } + } + if (!egl_ctx) { + // Fallback for EGL 1.4 without EGL_KHR_create_context or GLES + EGLint attrs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; - if (!egl_ctx) { - // Fallback for EGL 1.4 without EGL_KHR_create_context. - EGLint attrs[] = { EGL_NONE }; - egl_ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, attrs); - - GL *gl = talloc_zero(ctx, struct GL); - mpgl_check_version(gl, mpegl_get_proc_address, NULL); - if (gl->version < 210) { - eglDestroyContext(display, egl_ctx); - egl_ctx = NULL; - } - talloc_free(gl); - } + egl_ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, attrs); } if (!egl_ctx) {