summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-10 20:18:48 +0200
committerwm4 <wm4@nowhere>2016-05-10 20:19:25 +0200
commit4b3faf9dc1487d3a84ecc605e88452b30bc65d13 (patch)
treebac4274ad3f95aa99b03a37c5d0918d078274176
parent12ae19c449c162b805de446cb8afa450b3d9f5da (diff)
downloadmpv-4b3faf9dc1487d3a84ecc605e88452b30bc65d13.tar.bz2
mpv-4b3faf9dc1487d3a84ecc605e88452b30bc65d13.tar.xz
vo_opengl: add an angle-es2 backend
It forces es2 mode on ANGLE. Only useful for testing. Since the normal "angle" backend already falls back to es2 if es3 does not work, this new backend always exit when autoprobing it.
-rw-r--r--video/out/opengl/context.c2
-rw-r--r--video/out/opengl/context_angle.c24
2 files changed, 25 insertions, 1 deletions
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index 77e9709426..186211da2f 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -42,6 +42,7 @@ extern const struct mpgl_driver mpgl_driver_cocoa;
extern const struct mpgl_driver mpgl_driver_wayland;
extern const struct mpgl_driver mpgl_driver_w32;
extern const struct mpgl_driver mpgl_driver_angle;
+extern const struct mpgl_driver mpgl_driver_angle_es2;
extern const struct mpgl_driver mpgl_driver_dxinterop;
extern const struct mpgl_driver mpgl_driver_rpi;
@@ -54,6 +55,7 @@ static const struct mpgl_driver *const backends[] = {
#endif
#if HAVE_EGL_ANGLE
&mpgl_driver_angle,
+ &mpgl_driver_angle_es2,
#endif
#if HAVE_GL_WIN32
&mpgl_driver_w32,
diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c
index f75dc34f91..fb2fb4b888 100644
--- a/video/out/opengl/context_angle.c
+++ b/video/out/opengl/context_angle.c
@@ -33,6 +33,7 @@ struct priv {
EGLDisplay egl_display;
EGLContext egl_context;
EGLSurface egl_surface;
+ bool use_es2;
};
static void angle_uninit(MPGLContext *ctx)
@@ -183,7 +184,7 @@ static int angle_init(struct MPGLContext *ctx, int flags)
goto fail;
}
- if (!create_context_egl(ctx, config, 3) &&
+ if (!(!p->use_es2 && create_context_egl(ctx, config, 3)) &&
!create_context_egl(ctx, config, 2))
{
MP_FATAL(ctx->vo, "Could not create EGL context!\n");
@@ -199,6 +200,17 @@ fail:
return -1;
}
+static int angle_init_es2(struct MPGLContext *ctx, int flags)
+{
+ struct priv *p = ctx->priv;
+ p->use_es2 = true;
+ if (ctx->vo->probing) {
+ MP_VERBOSE(ctx->vo, "Not using this by default.\n");
+ return -1;
+ }
+ return angle_init(ctx, flags);
+}
+
static int angle_reconfig(struct MPGLContext *ctx)
{
vo_w32_config(ctx->vo);
@@ -225,3 +237,13 @@ const struct mpgl_driver mpgl_driver_angle = {
.control = angle_control,
.uninit = angle_uninit,
};
+
+const struct mpgl_driver mpgl_driver_angle_es2 = {
+ .name = "angle-es2",
+ .priv_size = sizeof(struct priv),
+ .init = angle_init_es2,
+ .reconfig = angle_reconfig,
+ .swap_buffers = angle_swap_buffers,
+ .control = angle_control,
+ .uninit = angle_uninit,
+};