vo_opengl: add a --opengl-es=force2 option

Useful for testing. Unfortunately, the nVidia EGL driver ignores this,
and returns a GLES 3.2 context anyway (which it is allowed to do). Might
still be useable with ANGLE, which will really give you a GLES 2 context
if you ask for it.
This commit is contained in:
wm4 2017-03-20 04:57:51 +01:00
parent f8861f681f
commit 7e4a73c8e4
4 changed files with 11 additions and 3 deletions

View File

@ -4451,6 +4451,8 @@ The following video options are currently all specific to ``--vo=opengl`` and
yes
Try to prefer ES over Desktop GL
forc2
Try to request a ES 2.0 context (the driver might ignore this)
no
Try to prefer desktop GL over ES
auto

View File

@ -27,12 +27,13 @@
#include "common.h"
enum {
VOFLAG_GLES = 1 << 0, // Hint to create a GLES2 context
VOFLAG_GLES = 1 << 0, // Hint to create a GLES context
VOFLAG_NO_GLES = 1 << 1, // Hint to create a desktop GL context
VOFLAG_GL_DEBUG = 1 << 2, // Hint to request debug OpenGL context
VOFLAG_ALPHA = 1 << 3, // Hint to request alpha framebuffer
VOFLAG_SW = 1 << 4, // Hint to accept a software GL renderer
VOFLAG_PROBING = 1 << 6, // The backend is being auto-probed.
VOFLAG_GLES2 = 1 << 7, // Hint for GLESv2 (needs VOFLAG_GLES)
};
extern const int mpgl_preferred_gl_versions[];

View File

@ -181,12 +181,14 @@ bool mpegl_create_context_opts(EGLDisplay display, struct mp_log *log,
return true;
}
if (try_gles) {
if (try_gles && !(opts->vo_flags & VOFLAG_GLES2)) {
// ES 3.x
if (create_context(display, log, true, 3, opts,
out_context, out_config))
return true;
}
if (try_gles) {
// ES 2.0
if (create_context(display, log, probing, 2, opts,
out_context, out_config))

View File

@ -373,6 +373,8 @@ static int preinit(struct vo *vo)
if (p->opts.es == 1)
vo_flags |= VOFLAG_GLES;
if (p->opts.es == 2)
vo_flags |= VOFLAG_GLES | VOFLAG_GLES2;
if (p->opts.es == -1)
vo_flags |= VOFLAG_NO_GLES;
@ -437,7 +439,8 @@ const struct vo_driver video_out_opengl = {
OPT_STRING_VALIDATE("opengl-backend", opts.backend, 0,
mpgl_validate_backend_opt),
OPT_FLAG("opengl-sw", opts.allow_sw, 0),
OPT_CHOICE("opengl-es", opts.es, 0, ({"no", -1}, {"auto", 0}, {"yes", 1})),
OPT_CHOICE("opengl-es", opts.es, 0, ({"no", -1}, {"auto", 0},
{"yes", 1}, {"force2", 2})),
OPT_INTPAIR("opengl-check-pattern", opts.pattern, 0),
OPT_INTRANGE("opengl-vsync-fences", opts.vsync_fences, 0,
0, NUM_VSYNC_FENCES),