diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2021-10-02 21:22:46 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2021-10-16 20:33:53 +0000 |
commit | 538fb6541e621fd6eb1c0fe42bb88520e8e45dda (patch) | |
tree | 9cdf85b6194fe0ee154ba975309e15658661e324 /video/out/opengl/egl_helpers.c | |
parent | e3883512b119429004376cefff8a29043dbaff8d (diff) | |
download | mpv-538fb6541e621fd6eb1c0fe42bb88520e8e45dda.tar.bz2 mpv-538fb6541e621fd6eb1c0fe42bb88520e8e45dda.tar.xz |
video: opengl: rework and remove ra_gl_ctx_test_version()
The ra_gl_ctx_test_version() helper is quite clunky, in that it pushes a
simple check too deep into the call chain. As such it makes it hard to
reason, let alone have the GLX and EGL code paths symmetrical.
Introduce a simple helper ra_gl_ctx_get_glesmode() which returns the
current glesmode, so the platforms can clearly reason about should and
should not be executed.
v2:
- mpgl_preferred_gl_versions -> mpgl_min_required_gl_versions
- 320 -> 300 (in glx code path)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'video/out/opengl/egl_helpers.c')
-rw-r--r-- | video/out/opengl/egl_helpers.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c index 834ec25166..68cfa8e55d 100644 --- a/video/out/opengl/egl_helpers.c +++ b/video/out/opengl/egl_helpers.c @@ -164,9 +164,6 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, EGLContext *egl_ctx = NULL; if (es) { - if (!ra_gl_ctx_test_version(ctx, MPGL_VER(2, 0), true)) - return false; - EGLint attrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE @@ -176,8 +173,6 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, } else { for (int n = 0; mpgl_min_required_gl_versions[n]; n++) { int ver = mpgl_min_required_gl_versions[n]; - if (!ra_gl_ctx_test_version(ctx, ver, false)) - continue; EGLint attrs[] = { EGL_CONTEXT_MAJOR_VERSION, MPGL_VER_GET_MAJOR(ver), @@ -199,9 +194,7 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, GL *gl = talloc_zero(ctx, struct GL); mpgl_check_version(gl, mpegl_get_proc_address, NULL); - if (gl->version < 210 || - !ra_gl_ctx_test_version(ctx, gl->version, false)) - { + if (gl->version < 210) { eglDestroyContext(display, egl_ctx); egl_ctx = NULL; } @@ -246,9 +239,14 @@ bool mpegl_create_context_cb(struct ra_ctx *ctx, EGLDisplay display, MP_VERBOSE(ctx, "EGL_VERSION=%s\nEGL_VENDOR=%s\nEGL_CLIENT_APIS=%s\n", STR_OR_ERR(version), STR_OR_ERR(vendor), STR_OR_ERR(apis)); - if (create_context(ctx, display, false, cb, out_context, out_config)) + enum gles_mode mode = ra_gl_ctx_get_glesmode(ctx); + + if ((mode == GLES_NO || mode == GLES_AUTO) && + create_context(ctx, display, false, cb, out_context, out_config)) return true; - if (create_context(ctx, display, true, cb, out_context, out_config)) + + if ((mode == GLES_YES || mode == GLES_AUTO) && + create_context(ctx, display, true, cb, out_context, out_config)) return true; int msgl = ctx->opts.probing ? MSGL_V : MSGL_ERR; |