summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2021-10-03 13:14:03 +0100
committerDudemanguy <random342@airmail.cc>2021-10-16 20:33:53 +0000
commite992ebe1287e9183a51cc771e76de5bdf7e0626f (patch)
tree227d6ea0e71a28d88e87d7b4ecff381f76b5a7bf
parent0b918edfb59d071c561a19b7d1a454cdbfd80e70 (diff)
downloadmpv-e992ebe1287e9183a51cc771e76de5bdf7e0626f.tar.bz2
mpv-e992ebe1287e9183a51cc771e76de5bdf7e0626f.tar.xz
egl_helpers: remove explicit GLES 3 request
Alike the GL commit earlier - the EGL spec essentially mandates that implementation will return GLES 3.0+ (if supported by the driver), even though only GLES 2 is requested. The only thing we should watch out is - we should add both ES2_BIT and ES3_BIT as EGL_RENDERABLE_TYPE. This has been verified against the Mesa drivers (i965, iris, swrast) and Nvidia binary drivers. v2: - int es_version -> bool es - unloop create_context() execution Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--video/out/opengl/egl_helpers.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c
index 2bdf3df0f2..834ec25166 100644
--- a/video/out/opengl/egl_helpers.c
+++ b/video/out/opengl/egl_helpers.c
@@ -92,9 +92,8 @@ static void *mpegl_get_proc_address(void *ctx, const char *name)
return p;
}
-// es_version: 0 (core), 2 or 3
static bool create_context(struct ra_ctx *ctx, EGLDisplay display,
- int es_version, struct mpegl_cb cb,
+ bool es, struct mpegl_cb cb,
EGLContext *out_context, EGLConfig *out_config)
{
int msgl = ctx->opts.probing ? MSGL_V : MSGL_FATAL;
@@ -103,23 +102,14 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display,
EGLint rend;
const char *name;
- switch (es_version) {
- case 0:
+ if (!es) {
api = EGL_OPENGL_API;
rend = EGL_OPENGL_BIT;
name = "Desktop OpenGL";
- break;
- case 2:
- api = EGL_OPENGL_ES_API;
- rend = EGL_OPENGL_ES2_BIT;
- name = "GLES 2.x";
- break;
- case 3:
+ } else {
api = EGL_OPENGL_ES_API;
- rend = EGL_OPENGL_ES3_BIT;
- name = "GLES 3.x";
- break;
- default: abort();
+ rend = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
+ name = "GLES 2.x +";
}
MP_VERBOSE(ctx, "Trying to create %s context.\n", name);
@@ -173,12 +163,12 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display,
EGLContext *egl_ctx = NULL;
- if (es_version) {
- if (!ra_gl_ctx_test_version(ctx, MPGL_VER(es_version, 0), true))
+ if (es) {
+ if (!ra_gl_ctx_test_version(ctx, MPGL_VER(2, 0), true))
return false;
EGLint attrs[] = {
- EGL_CONTEXT_CLIENT_VERSION, es_version,
+ EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
@@ -256,11 +246,10 @@ 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));
- int es[] = {0, 3, 2}; // preference order
- for (int i = 0; i < MP_ARRAY_SIZE(es); i++) {
- if (create_context(ctx, display, es[i], cb, out_context, out_config))
- return true;
- }
+ if (create_context(ctx, display, false, cb, out_context, out_config))
+ return true;
+ if (create_context(ctx, display, true, cb, out_context, out_config))
+ return true;
int msgl = ctx->opts.probing ? MSGL_V : MSGL_ERR;
MP_MSG(ctx, msgl, "Could not create a GL context.\n");