vo_opengl: change user options for requesting GLES
Instead of having separate backends, make use of GLES a flag. This reduces the number of backends and the resulting annoyances. Also, nobody cares about using GLES, so there's no backward compatibility either.
This commit is contained in:
1 parent
27da344e6f
commit
10de9b091a
7 files changed
+16
-40
No files matched your search
+7
-4
@@ -573,12 +573,15 @@ Available video output drivers are:
|
||||
Cocoa/OS X
|
||||
win
|
||||
Win32/WGL
|
||||
x11, x11es
|
||||
X11/GLX (the ``es`` variant forces GLES)
|
||||
x11
|
||||
X11/GLX
|
||||
wayland
|
||||
Wayland/EGL
|
||||
x11egl, x11egles
|
||||
X11/EGL (the ``es`` variant forces GLES)
|
||||
x11egl
|
||||
X11/EGL
|
||||
|
||||
``es``
|
||||
Force or prefer GLES2/3 over desktop OpenGL, if supported.
|
||||
|
||||
``fbo-format=<fmt>``
|
||||
Selects the internal format of textures used for FBOs. The format can
|
||||
|
||||
@@ -544,13 +544,10 @@ static const struct backend backends[] = {
|
||||
#endif
|
||||
#if HAVE_GL_X11
|
||||
{"x11", mpgl_set_backend_x11},
|
||||
{"x11es", mpgl_set_backend_x11es},
|
||||
#endif
|
||||
#if HAVE_EGL_X11
|
||||
{"x11egl", mpgl_set_backend_x11egl},
|
||||
{"x11egles", mpgl_set_backend_x11egles},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
|
||||
int mpgl_find_backend(const char *name)
|
||||
|
||||
@@ -128,9 +128,7 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt,
|
||||
void mpgl_set_backend_cocoa(MPGLContext *ctx);
|
||||
void mpgl_set_backend_w32(MPGLContext *ctx);
|
||||
void mpgl_set_backend_x11(MPGLContext *ctx);
|
||||
void mpgl_set_backend_x11es(MPGLContext *ctx);
|
||||
void mpgl_set_backend_x11egl(MPGLContext *ctx);
|
||||
void mpgl_set_backend_x11egles(MPGLContext *ctx);
|
||||
void mpgl_set_backend_wayland(MPGLContext *ctx);
|
||||
void mpgl_set_backend_rpi(MPGLContext *ctx);
|
||||
|
||||
|
||||
+1
-9
@@ -33,7 +33,6 @@ struct glx_context {
|
||||
XVisualInfo *vinfo;
|
||||
GLXContext context;
|
||||
GLXFBConfig fbc;
|
||||
bool force_es;
|
||||
};
|
||||
|
||||
static bool create_context_x11_old(struct MPGLContext *ctx)
|
||||
@@ -252,7 +251,7 @@ static bool config_window_x11(struct MPGLContext *ctx, int flags)
|
||||
|
||||
int gl_version = ctx->requested_gl_version;
|
||||
bool success = false;
|
||||
if (!glx_ctx->force_es) {
|
||||
if (!(flags & VOFLAG_GLES)) {
|
||||
success = create_context_x11_gl3(ctx, flags, gl_version, false);
|
||||
if (!success)
|
||||
success = create_context_x11_old(ctx);
|
||||
@@ -295,10 +294,3 @@ void mpgl_set_backend_x11(MPGLContext *ctx)
|
||||
ctx->vo_uninit = vo_x11_uninit;
|
||||
ctx->vo_control = vo_x11_control;
|
||||
}
|
||||
|
||||
void mpgl_set_backend_x11es(MPGLContext *ctx)
|
||||
{
|
||||
mpgl_set_backend_x11(ctx);
|
||||
struct glx_context *glx_ctx = ctx->priv;
|
||||
glx_ctx->force_es = true;
|
||||
}
|
||||
+2
-22
@@ -93,10 +93,11 @@ static bool create_context_egl(MPGLContext *ctx, EGLConfig config,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool config_window_x11_egl_(struct MPGLContext *ctx, int flags, bool es)
|
||||
static bool config_window_x11_egl(struct MPGLContext *ctx, int flags)
|
||||
{
|
||||
struct priv *p = ctx->priv;
|
||||
struct vo *vo = ctx->vo;
|
||||
bool es = flags & VOFLAG_GLES;
|
||||
|
||||
if (p->egl_context) {
|
||||
vo_x11_config_vo_window(vo, NULL, flags, "gl");
|
||||
@@ -140,16 +141,6 @@ static bool config_window_x11_egl_(struct MPGLContext *ctx, int flags, bool es)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool config_window_x11_egl(struct MPGLContext *ctx, int flags)
|
||||
{
|
||||
return config_window_x11_egl_(ctx, flags, false);
|
||||
}
|
||||
|
||||
static bool config_window_x11_egles(struct MPGLContext *ctx, int flags)
|
||||
{
|
||||
return config_window_x11_egl_(ctx, flags, true);
|
||||
}
|
||||
|
||||
static void releaseGlContext_egl(MPGLContext *ctx)
|
||||
{
|
||||
struct priv *p = ctx->priv;
|
||||
@@ -177,14 +168,3 @@ void mpgl_set_backend_x11egl(MPGLContext *ctx)
|
||||
ctx->vo_uninit = vo_x11_uninit;
|
||||
ctx->vo_control = vo_x11_control;
|
||||
}
|
||||
|
||||
void mpgl_set_backend_x11egles(MPGLContext *ctx)
|
||||
{
|
||||
ctx->priv = talloc_zero(ctx, struct priv);
|
||||
ctx->config_window = config_window_x11_egles;
|
||||
ctx->releaseGlContext = releaseGlContext_egl;
|
||||
ctx->swapGlBuffers = swapGlBuffers_egl;
|
||||
ctx->vo_init = vo_x11_init;
|
||||
ctx->vo_uninit = vo_x11_uninit;
|
||||
ctx->vo_control = vo_x11_control;
|
||||
}
|
||||
@@ -131,6 +131,7 @@ struct voctrl_get_equalizer_args {
|
||||
#define VO_NOTIMPL -3
|
||||
|
||||
#define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
|
||||
#define VOFLAG_GLES 0x20 // Hint to prefer GLES2 if possible
|
||||
#define VOFLAG_GL_DEBUG 0x40 // Hint to request debug OpenGL context
|
||||
#define VOFLAG_ALPHA 0x80 // Hint to request alpha framebuffer
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ struct gl_priv {
|
||||
int dwm_flush;
|
||||
|
||||
char *backend;
|
||||
int es;
|
||||
|
||||
bool frame_started;
|
||||
|
||||
@@ -415,6 +416,9 @@ static int preinit(struct vo *vo)
|
||||
if (p->use_gl_debug)
|
||||
vo_flags |= VOFLAG_GL_DEBUG;
|
||||
|
||||
if (p->es)
|
||||
vo_flags |= VOFLAG_GLES;
|
||||
|
||||
if (p->allow_sw)
|
||||
vo->probing = false;
|
||||
|
||||
@@ -467,6 +471,7 @@ static const struct m_option options[] = {
|
||||
OPT_FLAG("debug", use_gl_debug, 0),
|
||||
OPT_STRING_VALIDATE("backend", backend, 0, mpgl_validate_backend_opt),
|
||||
OPT_FLAG("sw", allow_sw, 0),
|
||||
OPT_FLAG("es", es, 0),
|
||||
OPT_INTPAIR("check-pattern", opt_pattern, 0),
|
||||
|
||||
OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0),
|
||||
|
||||
Reference in new issue
Block a user