aboutsummaryrefslogtreecommitdiff
path: root/system/shaders/GLES/2.0
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2018-01-22 20:22:56 -0800
committerLukas Rusak <lorusak@gmail.com>2018-01-27 12:46:45 -0800
commit51d75a44410222c1e2914c5fe4c2bfd6f81a587b (patch)
treebf746b0cb640dd7fe05b18d71eaedacca76a4f8c /system/shaders/GLES/2.0
parent4a30fe719e5a57fc4d3ec350b307c4903e684445 (diff)
shaders: move GLES shaders to subdirectory
Diffstat (limited to 'system/shaders/GLES/2.0')
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-4x4.glsl80
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-6x6.glsl91
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_default.glsl30
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl35
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl33
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl34
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl41
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl35
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl56
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl58
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl39
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl32
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl31
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_vert.glsl41
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_basic.glsl98
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl76
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl40
17 files changed, 850 insertions, 0 deletions
diff --git a/system/shaders/GLES/2.0/gles_convolution-4x4.glsl b/system/shaders/GLES/2.0/gles_convolution-4x4.glsl
new file mode 100644
index 0000000000..89e5b8d58d
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_convolution-4x4.glsl
@@ -0,0 +1,80 @@
+/*
+ * 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 (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.glsl b/system/shaders/GLES/2.0/gles_convolution-6x6.glsl
new file mode 100644
index 0000000000..8333d51f32
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_convolution-6x6.glsl
@@ -0,0 +1,91 @@
+/*
+ * 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 (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_guishader_frag_default.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_default.glsl
new file mode 100644
index 0000000000..6f4ae0b19c
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_default.glsl
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+// SM_DEFAULT shader
+void main ()
+{
+ gl_FragColor = m_unicol;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl
new file mode 100644
index 0000000000..953d81dbc2
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+// SM_FONTS shader
+void main ()
+{
+ gl_FragColor.r = m_colour.r;
+ gl_FragColor.g = m_colour.g;
+ gl_FragColor.b = m_colour.b;
+ gl_FragColor.a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl
new file mode 100644
index 0000000000..49202d2848
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+// SM_MULTI shader
+void main ()
+{
+ gl_FragColor.rgba = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).rgba;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl
new file mode 100644
index 0000000000..c01ecd29e7
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+// SM_MULTI shader
+void main ()
+{
+ gl_FragColor.rgba = m_unicol * texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy);
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl
new file mode 100644
index 0000000000..d5d7ffb3e6
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl
@@ -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;
+varying lowp vec4 m_colour;
+uniform int m_method;
+
+uniform float m_brightness;
+uniform float m_contrast;
+
+void main ()
+{
+ vec4 color = texture2D(m_samp0, m_cord0.xy).rgba;
+ color = color * m_contrast;
+ color = color + m_brightness;
+
+ gl_FragColor.rgba = color;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl
new file mode 100644
index 0000000000..329cc408cc
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+// SM_TEXTURE
+void main ()
+{
+ gl_FragColor.rgba = vec4(texture2D(m_samp0, m_cord0.xy).rgba * m_colour);
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl
new file mode 100644
index 0000000000..b1c1628204
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl
@@ -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 = color * m_contrast;
+ color = color + m_brightness;
+
+ gl_FragColor.rgba = color;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl
new file mode 100644
index 0000000000..bbab5c4091
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl
@@ -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 = color * m_contrast;
+ color = color + m_brightness;
+
+ gl_FragColor.rgba = color;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl
new file mode 100644
index 0000000000..55e311cf1e
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl
@@ -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
+
+#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 color = texture2D(m_samp0, m_cord0.xy).rgba;
+ color = color * m_contrast;
+ color = color + m_brightness;
+
+ gl_FragColor.rgba = color;
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl
new file mode 100644
index 0000000000..82b60d9a02
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+// SM_TEXTURE shader
+void main ()
+{
+ gl_FragColor.rgba = vec4(texture2D(m_samp0, m_cord0.xy).rgba * m_unicol);
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl
new file mode 100644
index 0000000000..7072a167f0
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+// SM_TEXTURE_NOBLEND shader
+void main ()
+{
+ gl_FragColor.rgba = vec4(texture2D(m_samp0, m_cord0.xy).rgba);
+}
diff --git a/system/shaders/GLES/2.0/gles_guishader_vert.glsl b/system/shaders/GLES/2.0/gles_guishader_vert.glsl
new file mode 100644
index 0000000000..018961f556
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_guishader_vert.glsl
@@ -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_yuv2rgb_basic.glsl b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.glsl
new file mode 100644
index 0000000000..575aa42e9c
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.glsl
@@ -0,0 +1,98 @@
+/*
+ * 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 float m_stretch;
+uniform float m_alpha;
+
+void main()
+{
+ vec4 rgb;
+#if defined(XBMC_YV12) || defined(XBMC_NV12)
+
+ vec4 yuv;
+ yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r
+ , texture2D(m_sampU, m_cordU).g
+ , texture2D(m_sampV, m_cordV).a
+ , 1.0 );
+
+ rgb = m_yuvmat * yuv;
+
+ rgb.a = m_alpha;
+
+#elif defined(XBMC_NV12_RRG)
+
+ vec4 yuv;
+ yuv.rgba = vec4( texture2D(m_sampY, stretch(m_cordY)).r
+ , texture2D(m_sampU, stretch(m_cordU)).r
+ , texture2D(m_sampV, stretch(m_cordV)).g
+ , 1.0 );
+
+ rgb = m_yuvmat * yuv;
+
+ rgb.a = m_alpha;
+
+#elif defined(XBMC_YUY2) || defined(XBMC_UYVY)
+
+ vec2 stepxy = m_step;
+ vec2 pos = m_cordY;
+ pos = vec2(pos.x - stepxy.x * 0.25, pos.y);
+ vec2 f = fract(pos / stepxy);
+
+ //y axis will be correctly interpolated by opengl
+ //x axis will not, so we grab two pixels at the center of two columns and interpolate ourselves
+ vec4 c1 = texture2D(m_sampY, vec2(pos.x + (0.5 - f.x) * stepxy.x, pos.y));
+ vec4 c2 = texture2D(m_sampY, vec2(pos.x + (1.5 - f.x) * stepxy.x, pos.y));
+
+ /* each pixel has two Y subpixels and one UV subpixel
+ YUV Y YUV
+ check if we're left or right of the middle Y subpixel and interpolate accordingly*/
+#ifdef XBMC_YUY2 //BGRA = YUYV
+ float leftY = mix(c1.b, c1.r, f.x * 2.0);
+ float rightY = mix(c1.r, c2.b, f.x * 2.0 - 1.0);
+ vec2 outUV = mix(c1.ga, c2.ga, f.x);
+#else //BGRA = UYVY
+ float leftY = mix(c1.g, c1.a, f.x * 2.0);
+ float rightY = mix(c1.a, c2.g, f.x * 2.0 - 1.0);
+ vec2 outUV = mix(c1.br, c2.br, f.x);
+#endif //XBMC_YUY2
+
+ float outY = mix(leftY, rightY, step(0.5, f.x));
+
+ vec4 yuv = vec4(outY, outUV, 1.0);
+ rgb = m_yuvmat * yuv;
+
+ rgb.a = m_alpha;
+#endif
+
+ gl_FragColor = rgb;
+}
+
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl
new file mode 100644
index 0000000000..28254e26af
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl
@@ -0,0 +1,76 @@
+/*
+ * 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;
+
+void main()
+{
+ vec4 yuv, 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 yuvBelow, rgbBelow;
+
+ yuv.rgba = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).g, texture2D(m_sampV, offsetV).a, 1.0);
+ rgb = m_yuvmat * yuv;
+ rgb.a = m_alpha;
+
+ yuvBelow.rgba = 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;
+
+ gl_FragColor.rgba = mix(rgb, rgbBelow, 0.5);
+}
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl b/system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl
new file mode 100644
index 0000000000..481c9d3d99
--- /dev/null
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl
@@ -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;
+}