diff options
author | wm4 <wm4@nowhere> | 2014-12-19 01:03:08 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-19 01:21:19 +0100 |
commit | a0051b9da28fb67cebae1fef322603ddb8f619f8 (patch) | |
tree | 206133468f186beb262e4a35d3462f06882df465 /video/out/gl_video.c | |
parent | fe35130ba9079c09c74a5f5334584f1ccca15e52 (diff) | |
download | mpv-a0051b9da28fb67cebae1fef322603ddb8f619f8.tar.bz2 mpv-a0051b9da28fb67cebae1fef322603ddb8f619f8.tar.xz |
vo_opengl: add GLES 2 support
Rather basic support. Almost nothing works, and even if it does, it's
bound to be inefficient (due to texture upload). This was tested with
the nVidia desktop binary drivers, which provide GLES 2 support only.
However, nVidia is not known to be very strict about OpenGL, and the
driver is very new too, so the vo_opengl code will have bugs too.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r-- | video/out/gl_video.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 8d4682bfe7..5f8925bcb6 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -244,6 +244,17 @@ static const struct fmt_entry gl_byte_formats_gles3[] = { {0, 0, 0, 0}, // 4 x 16 }; +static const struct fmt_entry gl_byte_formats_gles2[] = { + {0, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE}, // 1 x 8 + {0, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE}, // 2 x 8 + {0, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE}, // 3 x 8 + {0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE}, // 4 x 8 + {0, 0, 0, 0}, // 1 x 16 + {0, 0, 0, 0}, // 2 x 16 + {0, 0, 0, 0}, // 3 x 16 + {0, 0, 0, 0}, // 4 x 16 +}; + static const struct fmt_entry gl_byte_formats_legacy[] = { {0, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE}, // 1 x 8 {0, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE}, // 2 x 8 @@ -399,8 +410,10 @@ static const struct fmt_entry *find_tex_format(GL *gl, int bytes_per_comp, assert(bytes_per_comp == 1 || bytes_per_comp == 2); assert(n_channels >= 1 && n_channels <= 4); const struct fmt_entry *fmts = gl_byte_formats; - if (gl->es) { + if (gl->es >= 300) { fmts = gl_byte_formats_gles3; + } else if (gl->es) { + fmts = gl_byte_formats_gles2; } else if (!(gl->mpgl_caps & MPGL_CAP_TEX_RG)) { fmts = gl_byte_formats_legacy; } @@ -941,7 +954,7 @@ static void compile_shaders(struct gl_video *p) talloc_asprintf(tmp, "#version %d%s\n" "#define HAVE_RG %d\n" "%s%s", - gl->glsl_version, gl->es ? " es" : "", + gl->glsl_version, gl->es >= 300 ? " es" : "", rg, shader_prelude, PRELUDE_END); bool use_cms = p->opts.srgb || p->use_lut_3d; @@ -2102,7 +2115,8 @@ static void check_gl_features(struct gl_video *p) } } - // GLES doesn't provide filtered 16 bit integer textures + // GLES3 doesn't provide filtered 16 bit integer textures + // GLES2 doesn't even provide 3D textures if (p->use_lut_3d && gl->es) { p->use_lut_3d = false; disabled[n_disabled++] = "color management (GLES unsupported)"; |