summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-21 21:54:50 +0100
committerwm4 <wm4@nowhere>2014-12-21 23:46:54 +0100
commitd5a7ad630f27999355d0a6c25affd10bfabd1d43 (patch)
tree920706c5b8502fae4effdd8a5634c4f8577c518c /video/out/gl_video.c
parentec4bbbb69b83b781972ff4e81a8ea44d62b91c56 (diff)
downloadmpv-d5a7ad630f27999355d0a6c25affd10bfabd1d43.tar.bz2
mpv-d5a7ad630f27999355d0a6c25affd10bfabd1d43.tar.xz
vo_opengl: improve fallback handling with GLES
Whether we have texture_rg doesn't matter much anymore; the scaler should be fine with this. But on ES 2.0, 1st class arrays are missing, so even if filterable float textures should be available, it won't work. Dithering (at least the "fruit" variant) will not work either, because it uses floats.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r--video/out/gl_video.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 970681b38f..62b7f11584 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -949,13 +949,17 @@ static void compile_shaders(struct gl_video *p)
char *shader_prelude = get_section(tmp, src, "prelude");
char *s_video = get_section(tmp, src, "frag_video");
- int rg = !!(gl->mpgl_caps & MPGL_CAP_TEX_RG);
+ bool rg = gl->mpgl_caps & MPGL_CAP_TEX_RG;
+ bool tex3d = gl->mpgl_caps & MPGL_CAP_3D_TEX;
+ bool arrays = gl->mpgl_caps & MPGL_CAP_1ST_CLASS_ARRAYS;
char *header =
talloc_asprintf(tmp, "#version %d%s\n"
"#define HAVE_RG %d\n"
+ "#define HAVE_3DTEX %d\n"
+ "#define HAVE_ARRAYS %d\n"
"%s%s",
gl->glsl_version, gl->es >= 300 ? " es" : "",
- rg, shader_prelude, PRELUDE_END);
+ rg, tex3d, arrays, shader_prelude, PRELUDE_END);
bool use_cms = p->opts.srgb || p->use_lut_3d;
@@ -2088,7 +2092,7 @@ static void check_gl_features(struct gl_video *p)
bool have_float_tex = gl->mpgl_caps & MPGL_CAP_FLOAT_TEX;
bool have_fbo = gl->mpgl_caps & MPGL_CAP_FB;
bool have_srgb = gl->mpgl_caps & MPGL_CAP_SRGB_TEX;
- bool have_rg = gl->mpgl_caps & MPGL_CAP_TEX_RG;
+ bool have_arrays = gl->mpgl_caps & MPGL_CAP_1ST_CLASS_ARRAYS;
bool have_mix = gl->glsl_version >= 130;
char *disabled[10];
@@ -2106,23 +2110,33 @@ static void check_gl_features(struct gl_video *p)
// because they will be slow (not critically slow, but still slower).
// Without FP textures, we must always disable them.
// I don't know if luminance alpha float textures exist, so disregard them.
- if (!have_float_tex || !have_rg || (!have_fbo && p->opts.scale_sep)) {
+ if (!have_float_tex || !have_arrays || (!have_fbo && p->opts.scale_sep)) {
for (int n = 0; n < 2; n++) {
if (mp_find_filter_kernel(p->opts.scalers[n])) {
p->opts.scalers[n] = "bilinear";
- disabled[n_disabled++]
- = have_float_tex ? "scaler (FBO)" : "scaler (float tex.)";
+ char *reason = "scaler (FBO)";
+ if (!have_float_tex)
+ reason = "scaler (float tex.)";
+ if (!have_arrays)
+ reason = "scaler (no GLSL support)";
+ disabled[n_disabled++] = reason;
}
}
}
// GLES3 doesn't provide filtered 16 bit integer textures
// GLES2 doesn't even provide 3D textures
- if (p->use_lut_3d && gl->es) {
+ if (p->use_lut_3d && (gl->es < 300 || !have_float_tex)) {
p->use_lut_3d = false;
disabled[n_disabled++] = "color management (GLES unsupported)";
}
+ // Missing float textures etc. (maybe ordered would actually work)
+ if (p->opts.dither_algo >= 0 && gl->es) {
+ p->opts.dither_algo = -1;
+ disabled[n_disabled++] = "dithering (GLES unsupported)";
+ }
+
int use_cms = p->opts.srgb || p->use_lut_3d;
// srgb_compand() not available