summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Salerno <stps@users.noreply.github.com>2020-06-02 11:27:32 -0500
committerJan Ekström <jeebjp@gmail.com>2020-06-21 19:14:16 +0300
commit514166242763699633147e7aead31fc7ae16372e (patch)
treedb9c5b3cb569f4013c12fe64dfb70539fb065b57
parentdc24a437fb9ba2485bc8c5866542bd36254410d4 (diff)
downloadmpv-514166242763699633147e7aead31fc7ae16372e.tar.bz2
mpv-514166242763699633147e7aead31fc7ae16372e.tar.xz
vo_gpu: use highp float if available for GLES
Using mediump float on GLES causes problems with kernel resampling, PQ HDR, and possibly others. The issues are fixed by using highp, which is available when GL_FRAGMENT_PRECISION_HIGH is defined.
-rw-r--r--video/out/gpu/shader_cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/out/gpu/shader_cache.c b/video/out/gpu/shader_cache.c
index fb80e1bbff..5e96de9c99 100644
--- a/video/out/gpu/shader_cache.c
+++ b/video/out/gpu/shader_cache.c
@@ -761,7 +761,12 @@ static void gl_sc_generate(struct gl_shader_cache *sc,
for (int n = 0; n < sc->num_exts; n++)
ADD(header, "#extension %s : enable\n", sc->exts[n]);
if (glsl_es) {
+ ADD(header, "#ifdef GL_FRAGMENT_PRECISION_HIGH\n");
+ ADD(header, "precision highp float;\n");
+ ADD(header, "#else\n");
ADD(header, "precision mediump float;\n");
+ ADD(header, "#endif\n");
+
ADD(header, "precision mediump sampler2D;\n");
if (sc->ra->caps & RA_CAP_TEX_3D)
ADD(header, "precision mediump sampler3D;\n");