summaryrefslogtreecommitdiffstats
path: root/system/shaders/GLES
diff options
context:
space:
mode:
Diffstat (limited to 'system/shaders/GLES')
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-4x4.frag78
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-6x6.frag89
-rw-r--r--system/shaders/GLES/2.0/gles_shader.vert41
-rw-r--r--system/shaders/GLES/2.0/gles_shader_default.frag38
-rw-r--r--system/shaders/GLES/2.0/gles_shader_fonts.frag41
-rw-r--r--system/shaders/GLES/2.0/gles_shader_multi.frag41
-rw-r--r--system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag42
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba.frag43
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag43
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_bob.frag56
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag58
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_oes.frag41
-rw-r--r--system/shaders/GLES/2.0/gles_shader_texture.frag40
-rw-r--r--system/shaders/GLES/2.0/gles_shader_texture_noalpha.frag25
-rw-r--r--system/shaders/GLES/2.0/gles_shader_texture_noblend.frag39
-rw-r--r--system/shaders/GLES/2.0/gles_tonemap.frag50
-rw-r--r--system/shaders/GLES/2.0/gles_videofilter.frag11
-rw-r--r--system/shaders/GLES/2.0/gles_videofilter.vert14
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb.vert40
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag93
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag113
21 files changed, 1036 insertions, 0 deletions
diff --git a/system/shaders/GLES/2.0/gles_convolution-4x4.frag b/system/shaders/GLES/2.0/gles_convolution-4x4.frag
new file mode 100644
index 0000000..3043b10
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_convolution-4x4.frag
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision highp float;
+
+uniform sampler2D img;
+uniform vec2 stepxy;
+varying vec2 cord;
+uniform float m_alpha;
+uniform sampler2D kernelTex;
+
+vec4 weight(float pos)
+{
+#if defined(HAS_FLOAT_TEXTURE)
+ return texture2D(kernelTex, vec2(pos, 0.5));
+#else
+ return texture2D(kernelTex, vec2(pos - 0.5)) * 2.0 - 1.0;
+#endif
+}
+
+vec3 pixel(float xpos, float ypos)
+{
+ return texture2D(img, vec2(xpos, ypos)).rgb;
+}
+
+vec3 line (float ypos, vec4 xpos, vec4 linetaps)
+{
+ return pixel(xpos.r, ypos) * linetaps.r +
+ pixel(xpos.g, ypos) * linetaps.g +
+ pixel(xpos.b, ypos) * linetaps.b +
+ pixel(xpos.a, ypos) * linetaps.a;
+}
+
+void main()
+{
+ vec4 rgb;
+ vec2 pos = cord + stepxy * 0.5;
+ vec2 f = fract(pos / stepxy);
+
+ vec4 linetaps = weight(1.0 - f.x);
+ vec4 columntaps = weight(1.0 - f.y);
+
+ // make sure all taps added together is exactly 1.0, otherwise some (very small) distortion can occur
+ linetaps /= linetaps.r + linetaps.g + linetaps.b + linetaps.a;
+ columntaps /= columntaps.r + columntaps.g + columntaps.b + columntaps.a;
+
+ vec2 xystart = (-1.5 - f) * stepxy + pos;
+ vec4 xpos = vec4(xystart.x, xystart.x + stepxy.x, xystart.x + stepxy.x * 2.0, xystart.x + stepxy.x * 3.0);
+
+ rgb.rgb = line(xystart.y, xpos, linetaps) * columntaps.r +
+ line(xystart.y + stepxy.y, xpos, linetaps) * columntaps.g +
+ line(xystart.y + stepxy.y * 2.0, xpos, linetaps) * columntaps.b +
+ line(xystart.y + stepxy.y * 3.0, xpos, linetaps) * columntaps.a;
+
+ rgb.a = m_alpha;
+
+ gl_FragColor = rgb;
+}
+
diff --git a/system/shaders/GLES/2.0/gles_convolution-6x6.frag b/system/shaders/GLES/2.0/gles_convolution-6x6.frag
new file mode 100644
index 0000000..d043c75
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_convolution-6x6.frag
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision highp float;
+
+uniform sampler2D img;
+uniform vec2 stepxy;
+varying vec2 cord;
+uniform float m_alpha;
+uniform sampler2D kernelTex;
+
+vec3 weight(float pos)
+{
+#if defined(HAS_FLOAT_TEXTURE)
+ return texture2D(kernelTex, vec2(pos, 0.5)).rgb;
+#else
+ return texture2D(kernelTex, vec2(pos - 0.5)).rgb * 2.0 - 1.0;
+#endif
+}
+
+vec3 pixel(float xpos, float ypos)
+{
+ return texture2D(img, vec2(xpos, ypos)).rgb;
+}
+
+vec3 line (float ypos, vec3 xpos1, vec3 xpos2, vec3 linetaps1, vec3 linetaps2)
+{
+ return pixel(xpos1.r, ypos) * linetaps1.r +
+ pixel(xpos1.g, ypos) * linetaps2.r +
+ pixel(xpos1.b, ypos) * linetaps1.g +
+ pixel(xpos2.r, ypos) * linetaps2.g +
+ pixel(xpos2.g, ypos) * linetaps1.b +
+ pixel(xpos2.b, ypos) * linetaps2.b;
+}
+
+void main()
+{
+ vec4 rgb;
+ vec2 pos = cord + stepxy * 0.5;
+ vec2 f = fract(pos / stepxy);
+
+ vec3 linetaps1 = weight((1.0 - f.x) / 2.0);
+ vec3 linetaps2 = weight((1.0 - f.x) / 2.0 + 0.5);
+ vec3 columntaps1 = weight((1.0 - f.y) / 2.0);
+ vec3 columntaps2 = weight((1.0 - f.y) / 2.0 + 0.5);
+
+ // make sure all taps added together is exactly 1.0, otherwise some (very small) distortion can occur
+ float sum = linetaps1.r + linetaps1.g + linetaps1.b + linetaps2.r + linetaps2.g + linetaps2.b;
+ linetaps1 /= sum;
+ linetaps2 /= sum;
+ sum = columntaps1.r + columntaps1.g + columntaps1.b + columntaps2.r + columntaps2.g + columntaps2.b;
+ columntaps1 /= sum;
+ columntaps2 /= sum;
+
+ vec2 xystart = (-2.5 - f) * stepxy + pos;
+ vec3 xpos1 = vec3(xystart.x, xystart.x + stepxy.x, xystart.x + stepxy.x * 2.0);
+ vec3 xpos2 = vec3(xystart.x + stepxy.x * 3.0, xystart.x + stepxy.x * 4.0, xystart.x + stepxy.x * 5.0);
+
+ rgb.rgb = line(xystart.y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r +
+ line(xystart.y + stepxy.y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r +
+ line(xystart.y + stepxy.y * 2.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g +
+ line(xystart.y + stepxy.y * 3.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g +
+ line(xystart.y + stepxy.y * 4.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b +
+ line(xystart.y + stepxy.y * 5.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b;
+
+ rgb.a = m_alpha;
+
+ gl_FragColor = rgb;
+}
+
diff --git a/system/shaders/GLES/2.0/gles_shader.vert b/system/shaders/GLES/2.0/gles_shader.vert
new file mode 100644
index 0000000..890acbb
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader.vert
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+attribute vec4 m_attrpos;
+attribute vec4 m_attrcol;
+attribute vec4 m_attrcord0;
+attribute vec4 m_attrcord1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+varying lowp vec4 m_colour;
+uniform mat4 m_proj;
+uniform mat4 m_model;
+uniform mat4 m_coord0Matrix;
+
+void main ()
+{
+ mat4 mvp = m_proj * m_model;
+ gl_Position = mvp * m_attrpos;
+ m_colour = m_attrcol;
+ m_cord0 = m_coord0Matrix * m_attrcord0;
+ m_cord1 = m_attrcord1;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_default.frag b/system/shaders/GLES/2.0/gles_shader_default.frag
new file mode 100644
index 0000000..f213360
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_default.frag
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform lowp vec4 m_unicol;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = m_unicol;
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_fonts.frag b/system/shaders/GLES/2.0/gles_shader_fonts.frag
new file mode 100644
index 0000000..075d26f
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_fonts.frag
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+varying vec4 m_cord0;
+varying lowp vec4 m_colour;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb.rgb = m_colour.rgb;
+ rgb.a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_multi.frag b/system/shaders/GLES/2.0/gles_shader_multi.frag
new file mode 100644
index 0000000..9f28898
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_multi.frag
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy);
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag b/system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag
new file mode 100644
index 0000000..35153da
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+uniform lowp vec4 m_unicol;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = m_unicol * texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy);
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_rgba.frag b/system/shaders/GLES/2.0/gles_shader_rgba.frag
new file mode 100644
index 0000000..cdbb076
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_rgba.frag
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+varying lowp vec4 m_colour;
+uniform int m_method;
+
+uniform float m_brightness;
+uniform float m_contrast;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy);
+ rgb *= m_contrast;
+ rgb += m_brightness;
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag b/system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag
new file mode 100644
index 0000000..3f08da0
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+varying lowp vec4 m_colour;
+uniform int m_method;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy).rgba * m_colour;
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_rgba_bob.frag b/system/shaders/GLES/2.0/gles_shader_rgba_bob.frag
new file mode 100644
index 0000000..fd4a83b
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_bob.frag
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision highp float;
+uniform sampler2D m_samp0;
+uniform sampler2D m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+varying lowp vec4 m_colour;
+uniform int m_method;
+uniform int m_field;
+uniform float m_step;
+
+uniform float m_brightness;
+uniform float m_contrast;
+
+void main ()
+{
+ vec2 source;
+ source = m_cord0.xy;
+
+ float temp1 = mod(source.y, 2.0 * m_step);
+ float temp2 = source.y - temp1;
+ source.y = temp2 + m_step / 2.0 - float(m_field) * m_step;
+
+ // Blend missing line
+ vec2 below;
+ float bstep = step(m_step, temp1);
+ below.x = source.x;
+ below.y = source.y + (2.0 * m_step * bstep);
+
+ vec4 color = mix(texture2D(m_samp0, source), texture2D(m_samp0, below), 0.5);
+ color *= m_contrast;
+ color += m_brightness;
+
+ gl_FragColor = color;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag b/system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag
new file mode 100644
index 0000000..16894af
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+#extension GL_OES_EGL_image_external : require
+
+precision highp float;
+uniform samplerExternalOES m_samp0;
+uniform samplerExternalOES m_samp1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
+varying lowp vec4 m_colour;
+uniform int m_method;
+uniform int m_field;
+uniform float m_step;
+
+uniform float m_brightness;
+uniform float m_contrast;
+
+void main ()
+{
+ vec2 source;
+ source = m_cord0.xy;
+
+ float temp1 = mod(source.y, 2.0 * m_step);
+ float temp2 = source.y - temp1;
+ source.y = temp2 + m_step / 2.0 - float(m_field) * m_step;
+
+ // Blend missing line
+ vec2 below;
+ float bstep = step(m_step, temp1);
+ below.x = source.x;
+ below.y = source.y + (2.0*m_step * bstep);
+
+ vec4 color = mix(texture2D(m_samp0, source), texture2D(m_samp0, below), 0.5);
+ color *= m_contrast;
+ color += m_brightness;
+
+ gl_FragColor = color;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_rgba_oes.frag b/system/shaders/GLES/2.0/gles_shader_rgba_oes.frag
new file mode 100644
index 0000000..2936954
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_oes.frag
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+#extension GL_OES_EGL_image_external : require
+
+precision mediump float;
+uniform samplerExternalOES m_samp0;
+varying vec4 m_cord0;
+
+uniform float m_brightness;
+uniform float m_contrast;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy);
+ rgb *= m_contrast;
+ rgb += m_brightness;
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_texture.frag b/system/shaders/GLES/2.0/gles_shader_texture.frag
new file mode 100644
index 0000000..a2ac2de
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_texture.frag
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+uniform lowp vec4 m_unicol;
+varying vec4 m_cord0;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy).rgba * m_unicol;
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_texture_noalpha.frag b/system/shaders/GLES/2.0/gles_shader_texture_noalpha.frag
new file mode 100644
index 0000000..9f478ed
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_texture_noalpha.frag
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2019 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+varying vec4 m_cord0;
+
+void main ()
+{
+ vec3 rgb = texture2D(m_samp0, m_cord0.xy).rgb;
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb *= (235.0 - 16.0) / 255.0;
+ rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = vec4(rgb, 1.0);
+}
diff --git a/system/shaders/GLES/2.0/gles_shader_texture_noblend.frag b/system/shaders/GLES/2.0/gles_shader_texture_noblend.frag
new file mode 100644
index 0000000..8cc66c9
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_shader_texture_noblend.frag
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+uniform sampler2D m_samp0;
+varying vec4 m_cord0;
+
+void main ()
+{
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy);
+
+#if defined(KODI_LIMITED_RANGE)
+ rgb.rgb *= (235.0 - 16.0) / 255.0;
+ rgb.rgb += 16.0 / 255.0;
+#endif
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/GLES/2.0/gles_tonemap.frag b/system/shaders/GLES/2.0/gles_tonemap.frag
new file mode 100644
index 0000000..28b2402
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_tonemap.frag
@@ -0,0 +1,50 @@
+#if (defined(KODI_TONE_MAPPING_ACES) || defined(KODI_TONE_MAPPING_HABLE))
+const float ST2084_m1 = 2610.0 / (4096.0 * 4.0);
+const float ST2084_m2 = (2523.0 / 4096.0) * 128.0;
+const float ST2084_c1 = 3424.0 / 4096.0;
+const float ST2084_c2 = (2413.0 / 4096.0) * 32.0;
+const float ST2084_c3 = (2392.0 / 4096.0) * 32.0;
+#endif
+
+#if defined(KODI_TONE_MAPPING_REINHARD)
+float reinhard(float x)
+{
+ return x * (1.0 + x / (m_toneP1 * m_toneP1)) / (1.0 + x);
+}
+#endif
+
+#if defined(KODI_TONE_MAPPING_ACES)
+vec3 aces(vec3 x)
+{
+ float A = 2.51;
+ float B = 0.03;
+ float C = 2.43;
+ float D = 0.59;
+ float E = 0.14;
+ return (x * (A * x + B)) / (x * (C * x + D) + E);
+}
+#endif
+
+#if defined(KODI_TONE_MAPPING_HABLE)
+vec3 hable(vec3 x)
+{
+ float A = 0.15;
+ float B = 0.5;
+ float C = 0.1;
+ float D = 0.2;
+ float E = 0.02;
+ float F = 0.3;
+ return ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F;
+}
+#endif
+
+#if (defined(KODI_TONE_MAPPING_ACES) || defined(KODI_TONE_MAPPING_HABLE))
+vec3 inversePQ(vec3 x)
+{
+ x = pow(max(x, 0.0), vec3(1.0 / ST2084_m2));
+ x = max(x - ST2084_c1, 0.0) / (ST2084_c2 - ST2084_c3 * x);
+ x = pow(x, vec3(1.0 / ST2084_m1));
+ return x;
+}
+#endif
+
diff --git a/system/shaders/GLES/2.0/gles_videofilter.frag b/system/shaders/GLES/2.0/gles_videofilter.frag
new file mode 100644
index 0000000..d4c15ee
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_videofilter.frag
@@ -0,0 +1,11 @@
+#version 100
+
+precision mediump float;
+
+uniform sampler2D img;
+varying vec2 cord;
+
+void main()
+{
+ gl_FragColor = texture2D(img, cord);
+} \ No newline at end of file
diff --git a/system/shaders/GLES/2.0/gles_videofilter.vert b/system/shaders/GLES/2.0/gles_videofilter.vert
new file mode 100644
index 0000000..2d5a0f9
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_videofilter.vert
@@ -0,0 +1,14 @@
+#version 100
+
+attribute vec4 m_attrpos;
+attribute vec2 m_attrcord;
+varying vec2 cord;
+uniform mat4 m_proj;
+uniform mat4 m_model;
+
+void main ()
+{
+ mat4 mvp = m_proj * m_model;
+ gl_Position = mvp * m_attrpos;
+ cord = m_attrcord.xy;
+}
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb.vert b/system/shaders/GLES/2.0/gles_yuv2rgb.vert
new file mode 100644
index 0000000..bc437af
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb.vert
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+attribute vec4 m_attrpos;
+attribute vec2 m_attrcordY;
+attribute vec2 m_attrcordU;
+attribute vec2 m_attrcordV;
+varying vec2 m_cordY;
+varying vec2 m_cordU;
+varying vec2 m_cordV;
+uniform mat4 m_proj;
+uniform mat4 m_model;
+
+void main ()
+{
+ mat4 mvp = m_proj * m_model;
+ gl_Position = mvp * m_attrpos;
+ m_cordY = m_attrcordY;
+ m_cordU = m_attrcordU;
+ m_cordV = m_attrcordV;
+}
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag
new file mode 100644
index 0000000..d76a3b8
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision mediump float;
+
+uniform sampler2D m_sampY;
+uniform sampler2D m_sampU;
+uniform sampler2D m_sampV;
+varying vec2 m_cordY;
+varying vec2 m_cordU;
+varying vec2 m_cordV;
+uniform vec2 m_step;
+uniform mat4 m_yuvmat;
+uniform mat3 m_primMat;
+uniform float m_gammaDstInv;
+uniform float m_gammaSrc;
+uniform float m_toneP1;
+uniform float m_luminance;
+uniform vec3 m_coefsDst;
+uniform float m_alpha;
+
+void main()
+{
+ vec4 rgb;
+ vec4 yuv;
+
+#if defined(XBMC_YV12) || defined(XBMC_NV12)
+
+ yuv = vec4(texture2D(m_sampY, m_cordY).r,
+ texture2D(m_sampU, m_cordU).g,
+ texture2D(m_sampV, m_cordV).a,
+ 1.0);
+
+#elif defined(XBMC_NV12_RRG)
+
+ yuv = vec4(texture2D(m_sampY, m_cordY).r,
+ texture2D(m_sampU, m_cordU).r,
+ texture2D(m_sampV, m_cordV).g,
+ 1.0);
+
+#endif
+
+ rgb = m_yuvmat * yuv;
+ rgb.a = m_alpha;
+
+#if defined(XBMC_COL_CONVERSION)
+ rgb.rgb = pow(max(vec3(0), rgb.rgb), vec3(m_gammaSrc));
+ rgb.rgb = max(vec3(0), m_primMat * rgb.rgb);
+ rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv));
+
+#if defined(KODI_TONE_MAPPING_REINHARD)
+ float luma = dot(rgb.rgb, m_coefsDst);
+ rgb.rgb *= reinhard(luma) / luma;
+
+#elif defined(KODI_TONE_MAPPING_ACES)
+ rgb.rgb = inversePQ(rgb.rgb);
+ rgb.rgb *= (10000.0 / m_luminance) * (2.0 / m_toneP1);
+ rgb.rgb = aces(rgb.rgb);
+ rgb.rgb *= (1.24 / m_toneP1);
+ rgb.rgb = pow(rgb.rgb, vec3(0.27));
+
+#elif defined(KODI_TONE_MAPPING_HABLE)
+ rgb.rgb = inversePQ(rgb.rgb);
+ rgb.rgb *= m_toneP1;
+ float wp = m_luminance / 100.0;
+ rgb.rgb = hable(rgb.rgb * wp) / hable(vec3(wp));
+ rgb.rgb = pow(rgb.rgb, vec3(1.0 / 2.2));
+#endif
+
+#endif
+
+ gl_FragColor = rgb;
+}
+
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag
new file mode 100644
index 0000000..a82de9d
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2010-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#version 100
+
+precision highp float;
+uniform sampler2D m_sampY;
+uniform sampler2D m_sampU;
+uniform sampler2D m_sampV;
+varying vec2 m_cordY;
+varying vec2 m_cordU;
+varying vec2 m_cordV;
+uniform float m_alpha;
+uniform mat4 m_yuvmat;
+uniform float m_stepX;
+uniform float m_stepY;
+uniform int m_field;
+uniform mat3 m_primMat;
+uniform float m_gammaDstInv;
+uniform float m_gammaSrc;
+uniform float m_toneP1;
+uniform float m_luminance;
+uniform vec3 m_coefsDst;
+
+void main()
+{
+ vec4 rgb;
+
+ vec2 offsetY;
+ vec2 offsetU;
+ vec2 offsetV;
+ float temp1 = mod(m_cordY.y, 2.0 * m_stepY);
+
+ offsetY = m_cordY;
+ offsetU = m_cordU;
+ offsetV = m_cordV;
+
+ offsetY.y -= (temp1 - m_stepY / 2.0 + float(m_field) * m_stepY);
+ offsetU.y -= (temp1 - m_stepY / 2.0 + float(m_field) * m_stepY) / 2.0;
+ offsetV.y -= (temp1 - m_stepY / 2.0 + float(m_field) * m_stepY) / 2.0;
+
+ float bstep = step(m_stepY, temp1);
+
+ // Blend missing line
+ vec2 belowY, belowU, belowV;
+
+ belowY.x = offsetY.x;
+ belowY.y = offsetY.y + (2.0 * m_stepY * bstep);
+ belowU.x = offsetU.x;
+ belowU.y = offsetU.y + (m_stepY * bstep);
+ belowV.x = offsetV.x;
+ belowV.y = offsetV.y + (m_stepY * bstep);
+
+ vec4 rgbAbove;
+ vec4 rgbBelow;
+ vec4 yuvAbove;
+ vec4 yuvBelow;
+
+ yuvAbove = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).g, texture2D(m_sampV, offsetV).a, 1.0);
+ rgbAbove = m_yuvmat * yuvAbove;
+ rgbAbove.a = m_alpha;
+
+ yuvBelow = vec4(texture2D(m_sampY, belowY).r, texture2D(m_sampU, belowU).g, texture2D(m_sampV, belowV).a, 1.0);
+ rgbBelow = m_yuvmat * yuvBelow;
+ rgbBelow.a = m_alpha;
+
+ rgb = mix(rgb, rgbBelow, 0.5);
+
+#if defined(XBMC_COL_CONVERSION)
+ rgb.rgb = pow(max(vec3(0), rgb.rgb), vec3(m_gammaSrc));
+ rgb.rgb = max(vec3(0), m_primMat * rgb.rgb);
+ rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv));
+
+#if defined(KODI_TONE_MAPPING_REINHARD)
+ float luma = dot(rgb.rgb, m_coefsDst);
+ rgb.rgb *= reinhard(luma) / luma;
+
+#elif defined(KODI_TONE_MAPPING_ACES)
+ rgb.rgb = inversePQ(rgb.rgb);
+ rgb.rgb *= (10000.0 / m_luminance) * (2.0 / m_toneP1);
+ rgb.rgb = aces(rgb.rgb);
+ rgb.rgb *= (1.24 / m_toneP1);
+ rgb.rgb = pow(rgb.rgb, vec3(0.27));
+
+#elif defined(KODI_TONE_MAPPING_HABLE)
+ rgb.rgb = inversePQ(rgb.rgb);
+ rgb.rgb *= m_toneP1;
+ float wp = m_luminance / 100.0;
+ rgb.rgb = hable(rgb.rgb * wp) / hable(vec3(wp));
+ rgb.rgb = pow(rgb.rgb, vec3(1.0 / 2.2));
+#endif
+
+#endif
+
+ gl_FragColor = rgb;
+}