0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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.
This commit is contained in:
wm4 2016-05-10 20:18:48 +02:00
parent 12ae19c449
commit 4b3faf9dc1
2 changed files with 25 additions and 1 deletions

View File

@ -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,

View File

@ -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,
};