aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2018-10-24 21:28:01 -0700
committerLukas Rusak <lorusak@gmail.com>2018-10-25 08:51:18 -0700
commitb7ce0080227458d1b93fd62297dd8d22945aa245 (patch)
tree716e1c5c77dd3bf19bb5e3f253434edda9123aab /system
parentc82cb54d5ddc525f6f60dd900718f1132c8f0764 (diff)
[GLES] cleanup shaders
Diffstat (limited to 'system')
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-4x4.frag30
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-6x6.frag40
-rw-r--r--system/shaders/GLES/2.0/gles_shader.vert18
-rw-r--r--system/shaders/GLES/2.0/gles_shader_default.frag12
-rw-r--r--system/shaders/GLES/2.0/gles_shader_fonts.frag24
-rw-r--r--system/shaders/GLES/2.0/gles_shader_multi.frag22
-rw-r--r--system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag24
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba.frag20
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag18
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_bob.frag26
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag26
-rw-r--r--system/shaders/GLES/2.0/gles_shader_rgba_oes.frag16
-rw-r--r--system/shaders/GLES/2.0/gles_shader_texture.frag20
-rw-r--r--system/shaders/GLES/2.0/gles_shader_texture_noblend.frag18
-rw-r--r--system/shaders/GLES/2.0/gles_tonemap.frag2
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb.vert8
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag28
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag36
18 files changed, 207 insertions, 181 deletions
diff --git a/system/shaders/GLES/2.0/gles_convolution-4x4.frag b/system/shaders/GLES/2.0/gles_convolution-4x4.frag
index 89e5b8d58d..85bec53d4f 100644
--- a/system/shaders/GLES/2.0/gles_convolution-4x4.frag
+++ b/system/shaders/GLES/2.0/gles_convolution-4x4.frag
@@ -23,14 +23,14 @@
precision highp float;
uniform sampler2D img;
-uniform vec2 stepxy;
-varying vec2 cord;
-uniform float m_alpha;
+uniform vec2 stepxy;
+varying vec2 cord;
+uniform float m_alpha;
uniform sampler2D kernelTex;
vec4 weight(float pos)
{
-#if (HAS_FLOAT_TEXTURE)
+#if defined(HAS_FLOAT_TEXTURE)
return texture2D(kernelTex, vec2(pos - 0.5));
#else
return texture2D(kernelTex, vec2(pos - 0.5)) * 2.0 - 1.0;
@@ -44,11 +44,10 @@ vec3 pixel(float xpos, float ypos)
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;
+ 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()
@@ -57,21 +56,20 @@ void main()
vec2 pos = cord + stepxy * 0.5;
vec2 f = fract(pos / stepxy);
- vec4 linetaps = weight(1.0 - f.x);
+ 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
+ // 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.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;
diff --git a/system/shaders/GLES/2.0/gles_convolution-6x6.frag b/system/shaders/GLES/2.0/gles_convolution-6x6.frag
index 8333d51f32..c992b4b4a9 100644
--- a/system/shaders/GLES/2.0/gles_convolution-6x6.frag
+++ b/system/shaders/GLES/2.0/gles_convolution-6x6.frag
@@ -23,14 +23,14 @@
precision highp float;
uniform sampler2D img;
-uniform vec2 stepxy;
-varying vec2 cord;
-uniform float m_alpha;
+uniform vec2 stepxy;
+varying vec2 cord;
+uniform float m_alpha;
uniform sampler2D kernelTex;
vec3 weight(float pos)
{
-#if (HAS_FLOAT_TEXTURE)
+#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;
@@ -44,13 +44,12 @@ vec3 pixel(float xpos, float ypos)
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;
+ 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()
@@ -59,12 +58,12 @@ void main()
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 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
+ // 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;
@@ -76,13 +75,12 @@ void main()
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.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;
diff --git a/system/shaders/GLES/2.0/gles_shader.vert b/system/shaders/GLES/2.0/gles_shader.vert
index 018961f556..890acbbb81 100644
--- a/system/shaders/GLES/2.0/gles_shader.vert
+++ b/system/shaders/GLES/2.0/gles_shader.vert
@@ -24,18 +24,18 @@ 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 vec4 m_cord0;
+varying vec4 m_cord1;
varying lowp vec4 m_colour;
-uniform mat4 m_proj;
-uniform mat4 m_model;
-uniform mat4 m_coord0Matrix;
+uniform mat4 m_proj;
+uniform mat4 m_model;
+uniform mat4 m_coord0Matrix;
void main ()
{
- mat4 mvp = m_proj * m_model;
+ 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;
+ 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
index 0983b85c5c..f213360454 100644
--- a/system/shaders/GLES/2.0/gles_shader_default.frag
+++ b/system/shaders/GLES/2.0/gles_shader_default.frag
@@ -23,12 +23,16 @@
precision mediump float;
uniform lowp vec4 m_unicol;
-// SM_DEFAULT shader
void main ()
{
- gl_FragColor = m_unicol;
+ vec4 rgb;
+
+ rgb = m_unicol;
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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
index 36dfd6c740..075d26f67a 100644
--- a/system/shaders/GLES/2.0/gles_shader_fonts.frag
+++ b/system/shaders/GLES/2.0/gles_shader_fonts.frag
@@ -20,20 +20,22 @@
#version 100
-precision mediump float;
-uniform sampler2D m_samp0;
-varying vec4 m_cord0;
-varying lowp vec4 m_colour;
+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;
+ vec4 rgb;
+
+ rgb.rgb = m_colour.rgb;
+ rgb.a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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
index 7f76358124..9f288982ec 100644
--- a/system/shaders/GLES/2.0/gles_shader_multi.frag
+++ b/system/shaders/GLES/2.0/gles_shader_multi.frag
@@ -20,18 +20,22 @@
#version 100
-precision mediump float;
-uniform sampler2D m_samp0;
-uniform sampler2D m_samp1;
-varying vec4 m_cord0;
-varying vec4 m_cord1;
+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;
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy);
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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
index 062f292f28..35153da34c 100644
--- a/system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag
+++ b/system/shaders/GLES/2.0/gles_shader_multi_blendcolor.frag
@@ -20,19 +20,23 @@
#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;
+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);
+ vec4 rgb;
+
+ rgb = m_unicol * texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy);
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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
index d5d7ffb3e6..cdbb076fb4 100644
--- a/system/shaders/GLES/2.0/gles_shader_rgba.frag
+++ b/system/shaders/GLES/2.0/gles_shader_rgba.frag
@@ -23,19 +23,21 @@
precision mediump float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
-varying vec4 m_cord0;
-varying vec4 m_cord1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
varying lowp vec4 m_colour;
-uniform int m_method;
+uniform int m_method;
-uniform float m_brightness;
-uniform float m_contrast;
+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;
+ vec4 rgb;
- gl_FragColor.rgba = color;
+ 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
index 5c4e89990b..3f08da0fd7 100644
--- a/system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_blendcolor.frag
@@ -23,17 +23,21 @@
precision mediump float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
-varying vec4 m_cord0;
-varying vec4 m_cord1;
+varying vec4 m_cord0;
+varying vec4 m_cord1;
varying lowp vec4 m_colour;
-uniform int m_method;
+uniform int m_method;
-// SM_TEXTURE
void main ()
{
- gl_FragColor.rgba = vec4(texture2D(m_samp0, m_cord0.xy).rgba * m_colour);
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy).rgba * m_colour;
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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
index b1c1628204..fd4a83babc 100644
--- a/system/shaders/GLES/2.0/gles_shader_rgba_bob.frag
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_bob.frag
@@ -23,34 +23,34 @@
precision highp float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
-varying vec4 m_cord0;
-varying vec4 m_cord1;
+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 int m_method;
+uniform int m_field;
+uniform float m_step;
-uniform float m_brightness;
-uniform float m_contrast;
+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 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;
+ 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);
+ 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;
+ color *= m_contrast;
+ color += m_brightness;
- gl_FragColor.rgba = color;
+ 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
index bbab5c4091..16894affb6 100644
--- a/system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_bob_oes.frag
@@ -25,34 +25,34 @@
precision highp float;
uniform samplerExternalOES m_samp0;
uniform samplerExternalOES m_samp1;
-varying vec4 m_cord0;
-varying vec4 m_cord1;
+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 int m_method;
+uniform int m_field;
+uniform float m_step;
-uniform float m_brightness;
-uniform float m_contrast;
+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 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;
+ 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);
+ 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;
+ color *= m_contrast;
+ color += m_brightness;
- gl_FragColor.rgba = color;
+ 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
index 55e311cf1e..2936954235 100644
--- a/system/shaders/GLES/2.0/gles_shader_rgba_oes.frag
+++ b/system/shaders/GLES/2.0/gles_shader_rgba_oes.frag
@@ -24,16 +24,18 @@
precision mediump float;
uniform samplerExternalOES m_samp0;
-varying vec4 m_cord0;
+varying vec4 m_cord0;
-uniform float m_brightness;
-uniform float m_contrast;
+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;
+ vec4 rgb;
- gl_FragColor.rgba = color;
+ 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
index e664330ffd..a2ac2de79b 100644
--- a/system/shaders/GLES/2.0/gles_shader_texture.frag
+++ b/system/shaders/GLES/2.0/gles_shader_texture.frag
@@ -20,17 +20,21 @@
#version 100
-precision mediump float;
-uniform sampler2D m_samp0;
-uniform lowp vec4 m_unicol;
-varying vec4 m_cord0;
+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);
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy).rgba * m_unicol;
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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_noblend.frag b/system/shaders/GLES/2.0/gles_shader_texture_noblend.frag
index 1752c4cc03..8cc66c94c9 100644
--- a/system/shaders/GLES/2.0/gles_shader_texture_noblend.frag
+++ b/system/shaders/GLES/2.0/gles_shader_texture_noblend.frag
@@ -20,16 +20,20 @@
#version 100
-precision mediump float;
-uniform sampler2D m_samp0;
-varying vec4 m_cord0;
+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);
+ vec4 rgb;
+
+ rgb = texture2D(m_samp0, m_cord0.xy);
+
#if defined(KODI_LIMITED_RANGE)
- gl_FragColor.rgb *= (235.0-16.0) / 255.0;
- gl_FragColor.rgb += 16.0 / 255.0;
+ 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
index 40c261cb76..4a98f56dbb 100644
--- a/system/shaders/GLES/2.0/gles_tonemap.frag
+++ b/system/shaders/GLES/2.0/gles_tonemap.frag
@@ -1,4 +1,4 @@
float tonemap(float val)
{
- return val * (1.0 + val/(m_toneP1*m_toneP1))/(1.0 + val);
+ return val * (1.0 + val / (m_toneP1 * m_toneP1)) / (1.0 + val);
}
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb.vert b/system/shaders/GLES/2.0/gles_yuv2rgb.vert
index 43b4b06dcc..bc437afdc3 100644
--- a/system/shaders/GLES/2.0/gles_yuv2rgb.vert
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb.vert
@@ -32,9 +32,9 @@ uniform mat4 m_model;
void main ()
{
- mat4 mvp = m_proj * m_model;
+ mat4 mvp = m_proj * m_model;
gl_Position = mvp * m_attrpos;
- m_cordY = m_attrcordY;
- m_cordU = m_attrcordU;
- m_cordV = m_attrcordV;
+ 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
index eede848567..ecd82b13ca 100644
--- a/system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.frag
@@ -25,17 +25,17 @@ 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;
+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 vec3 m_coefsDst;
-uniform float m_alpha;
+uniform float m_alpha;
void main()
{
@@ -44,17 +44,17 @@ void main()
#if defined(XBMC_YV12) || defined(XBMC_NV12)
- yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r
- , texture2D(m_sampU, m_cordU).g
- , texture2D(m_sampV, m_cordV).a
- , 1.0 );
+ 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.rgba = vec4( texture2D(m_sampY, m_cordY).r
- , texture2D(m_sampU, m_cordU).r
- , texture2D(m_sampV, m_cordV).g
- , 1.0 );
+ yuv = vec4(texture2D(m_sampY, m_cordY).r,
+ texture2D(m_sampU, m_cordU).r,
+ texture2D(m_sampV, m_cordV).g,
+ 1.0);
#endif
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag
index 609f51d774..22d672dd14 100644
--- a/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag
@@ -24,14 +24,14 @@ 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;
+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;
@@ -45,15 +45,15 @@ void main()
vec2 offsetY;
vec2 offsetU;
vec2 offsetV;
- float temp1 = mod(m_cordY.y, 2.0*m_stepY);
+ 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;
+ 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);
@@ -61,22 +61,22 @@ void main()
vec2 belowY, belowU, belowV;
belowY.x = offsetY.x;
- belowY.y = offsetY.y + (2.0*m_stepY*bstep);
+ belowY.y = offsetY.y + (2.0 * m_stepY * bstep);
belowU.x = offsetU.x;
- belowU.y = offsetU.y + (m_stepY*bstep);
+ belowU.y = offsetU.y + (m_stepY * bstep);
belowV.x = offsetV.x;
- belowV.y = offsetV.y + (m_stepY*bstep);
+ belowV.y = offsetV.y + (m_stepY * bstep);
vec4 rgbAbove;
vec4 rgbBelow;
vec4 yuvAbove;
vec4 yuvBelow;
- yuvAbove.rgba = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).g, texture2D(m_sampV, offsetV).a, 1.0);
+ 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.rgba = vec4(texture2D(m_sampY, belowY).r, texture2D(m_sampU, belowU).g, texture2D(m_sampV, belowV).a, 1.0);
+ 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;
@@ -94,5 +94,5 @@ void main()
#endif
- gl_FragColor.rgba = rgb;
+ gl_FragColor = rgb;
}