summaryrefslogtreecommitdiffstats
path: root/video/out/gl_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-17 21:48:23 +0100
committerwm4 <wm4@nowhere>2014-12-17 21:48:23 +0100
commit10befa26d952ac2c403da1adcb3d36c300af0567 (patch)
tree4560871956886679f1a0292cde3a50571f433280 /video/out/gl_common.c
parent07975877be410ed07d3110dc2a5350246360acd0 (diff)
downloadmpv-10befa26d952ac2c403da1adcb3d36c300af0567.tar.bz2
mpv-10befa26d952ac2c403da1adcb3d36c300af0567.tar.xz
vo_opengl: GLES 3 support
Tested with MESA on software emulation. Seems to work well, although the default FBO format in opengl-hq disables most interesting features. I have no idea how well it will work on real hardware (or if it does at all). Unfortunately, some features, including playback of 10 bit video, are not supported. Not sure what to do about this. GLES 2 or 1 do not work.
Diffstat (limited to 'video/out/gl_common.c')
-rw-r--r--video/out/gl_common.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/video/out/gl_common.c b/video/out/gl_common.c
index d9df1aa7ee..2af96cab5a 100644
--- a/video/out/gl_common.c
+++ b/video/out/gl_common.c
@@ -495,9 +495,20 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
int major = 0, minor = 0;
const char *version = gl->GetString(GL_VERSION);
+ if (strncmp(version, "OpenGL ES ", 10) == 0) {
+ version += 10;
+ gl->es = true;
+ }
sscanf(version, "%d.%d", &major, &minor);
gl->version = MPGL_VER(major, minor);
- mp_verbose(log, "Detected OpenGL %d.%d.\n", major, minor);
+ mp_verbose(log, "Detected OpenGL %d.%d (%s).\n", major, minor,
+ gl->es ? "GLES" : "desktop");
+
+ if (gl->es && gl->version < MPGL_VER(3, 0)) {
+ mp_warn(log, "At least GLESv3 required.\n");
+ gl->version = 0;
+ return;
+ }
mp_verbose(log, "GL_VENDOR='%s'\n", gl->GetString(GL_VENDOR));
mp_verbose(log, "GL_RENDERER='%s'\n", gl->GetString(GL_RENDERER));
@@ -607,16 +618,21 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
}
gl->glsl_version = 0;
- if (gl->version >= MPGL_VER(2, 0))
- gl->glsl_version = 110;
- if (gl->version >= MPGL_VER(2, 1))
- gl->glsl_version = 120;
- if (gl->version >= MPGL_VER(3, 0))
- gl->glsl_version = 130;
- // Specifically needed for OSX (normally we request 3.0 contexts only, but
- // OSX always creates 3.2 contexts when requesting a core context).
- if (gl->version >= MPGL_VER(3, 2))
- gl->glsl_version = 150;
+ if (gl->es) {
+ if (gl->version >= MPGL_VER(3, 0))
+ gl->glsl_version = 300;
+ } else {
+ if (gl->version >= MPGL_VER(2, 0))
+ gl->glsl_version = 110;
+ if (gl->version >= MPGL_VER(2, 1))
+ gl->glsl_version = 120;
+ if (gl->version >= MPGL_VER(3, 0))
+ gl->glsl_version = 130;
+ // Specifically needed for OSX (normally we request 3.0 contexts only, but
+ // OSX always creates 3.2 contexts when requesting a core context).
+ if (gl->version >= MPGL_VER(3, 2))
+ gl->glsl_version = 150;
+ }
if (!is_software_gl(gl))
gl->mpgl_caps |= MPGL_CAP_NO_SW;
@@ -678,14 +694,18 @@ int glFmt2bpp(GLenum format, GLenum type)
return 2;
case GL_RGB:
case GL_BGR:
+ case GL_RGB_INTEGER:
return 3 * component_size;
case GL_RGBA:
case GL_BGRA:
+ case GL_RGBA_INTEGER:
return 4 * component_size;
case GL_RED:
+ case GL_RED_INTEGER:
return component_size;
case GL_RG:
case GL_LUMINANCE_ALPHA:
+ case GL_RG_INTEGER:
return 2 * component_size;
}
abort(); // unknown
@@ -817,6 +837,7 @@ static const struct backend backends[] = {
#endif
#if HAVE_EGL_X11
{"x11egl", mpgl_set_backend_x11egl},
+ {"x11egles", mpgl_set_backend_x11egles},
#endif
{0}
};