From 4b3faf9dc1487d3a84ecc605e88452b30bc65d13 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 May 2016 20:18:48 +0200 Subject: 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. --- video/out/opengl/context.c | 2 ++ video/out/opengl/context_angle.c | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) 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, +}; -- cgit v1.2.3