aboutsummaryrefslogtreecommitdiff
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
parent4a30fe719e5a57fc4d3ec350b307c4903e684445 (diff)
shaders: move GLES shaders to subdirectory
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-4x4.glsl (renamed from system/shaders/convolution-4x4.glsl)72
-rw-r--r--system/shaders/GLES/2.0/gles_convolution-6x6.glsl (renamed from system/shaders/convolution-6x6.glsl)78
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_default.glsl (renamed from system/shaders/guishader_frag_default.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl (renamed from system/shaders/guishader_frag_fonts.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl (renamed from system/shaders/guishader_frag_multi.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl (renamed from system/shaders/guishader_frag_multi_blendcolor.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl (renamed from system/shaders/guishader_frag_rgba.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl (renamed from system/shaders/guishader_frag_rgba_blendcolor.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl (renamed from system/shaders/guishader_frag_rgba_bob.glsl)4
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl (renamed from system/shaders/guishader_frag_rgba_bob_oes.glsl)6
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl (renamed from system/shaders/guishader_frag_rgba_oes.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl (renamed from system/shaders/guishader_frag_texture.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl (renamed from system/shaders/guishader_frag_texture_noblend.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_guishader_vert.glsl (renamed from system/shaders/guishader_vert.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_basic.glsl (renamed from system/shaders/yuv2rgb_basic.glsl)65
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl (renamed from system/shaders/yuv2rgb_bob_gles.glsl)2
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl (renamed from system/shaders/yuv2rgb_vertex_gles.glsl)2
17 files changed, 73 insertions, 176 deletions
diff --git a/system/shaders/convolution-4x4.glsl b/system/shaders/GLES/2.0/gles_convolution-4x4.glsl
index 6413cd6819..89e5b8d58d 100644
--- a/system/shaders/convolution-4x4.glsl
+++ b/system/shaders/GLES/2.0/gles_convolution-4x4.glsl
@@ -18,69 +18,31 @@
*
*/
-#ifdef GL_ES
- precision highp float;
-#endif
+#version 100
+
+precision highp float;
uniform sampler2D img;
uniform vec2 stepxy;
-uniform float m_stretch;
varying vec2 cord;
+uniform float m_alpha;
+uniform sampler2D kernelTex;
-#ifdef GL_ES
- uniform float m_alpha;
-#endif
-
-#if (USE1DTEXTURE)
- uniform sampler1D kernelTex;
-#else
- uniform sampler2D kernelTex;
-#endif
-
-//nvidia's half is a 16 bit float and can bring some speed improvements
-//without affecting quality
-#ifndef __GLSL_CG_DATA_TYPES
- #define half float
- #define half3 vec3
- #define half4 vec4
-#endif
-
-half4 weight(float pos)
+vec4 weight(float pos)
{
#if (HAS_FLOAT_TEXTURE)
- #if (USE1DTEXTURE)
- return texture1D(kernelTex, pos);
- #else
- return texture2D(kernelTex, vec2(pos, 0.5));
- #endif
-#else
- #if (USE1DTEXTURE)
- return texture1D(kernelTex, pos) * 2.0 - 1.0;
- #else
- return texture2D(kernelTex, vec2(pos, 0.5)) * 2.0 - 1.0;
- #endif
-#endif
-}
-
-vec2 stretch(vec2 pos)
-{
-#if (XBMC_STRETCH)
- // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
- // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
- // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
- float x = pos.x - 0.5;
- return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);
+ return texture2D(kernelTex, vec2(pos - 0.5));
#else
- return pos;
+ return texture2D(kernelTex, vec2(pos - 0.5)) * 2.0 - 1.0;
#endif
}
-half3 pixel(float xpos, float ypos)
+vec3 pixel(float xpos, float ypos)
{
return texture2D(img, vec2(xpos, ypos)).rgb;
}
-half3 line (float ypos, vec4 xpos, half4 linetaps)
+vec3 line (float ypos, vec4 xpos, vec4 linetaps)
{
return
pixel(xpos.r, ypos) * linetaps.r +
@@ -89,14 +51,14 @@ half3 line (float ypos, vec4 xpos, half4 linetaps)
pixel(xpos.a, ypos) * linetaps.a;
}
-vec4 process()
+void main()
{
vec4 rgb;
- vec2 pos = stretch(cord) + stepxy * 0.5;
+ vec2 pos = cord + stepxy * 0.5;
vec2 f = fract(pos / stepxy);
- half4 linetaps = weight(1.0 - f.x);
- half4 columntaps = weight(1.0 - f.y);
+ 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;
@@ -111,12 +73,8 @@ vec4 process()
line(xystart.y + stepxy.y * 2.0, xpos, linetaps) * columntaps.b +
line(xystart.y + stepxy.y * 3.0, xpos, linetaps) * columntaps.a;
-#ifdef GL_ES
rgb.a = m_alpha;
-#else
- rgb.a = gl_Color.a;
-#endif
- return rgb;
+ gl_FragColor = rgb;
}
diff --git a/system/shaders/convolution-6x6.glsl b/system/shaders/GLES/2.0/gles_convolution-6x6.glsl
index fed2332801..8333d51f32 100644
--- a/system/shaders/convolution-6x6.glsl
+++ b/system/shaders/GLES/2.0/gles_convolution-6x6.glsl
@@ -18,69 +18,31 @@
*
*/
-#ifdef GL_ES
- precision highp float;
-#endif
+#version 100
+
+precision highp float;
uniform sampler2D img;
uniform vec2 stepxy;
-uniform float m_stretch;
varying vec2 cord;
+uniform float m_alpha;
+uniform sampler2D kernelTex;
-#ifdef GL_ES
- uniform float m_alpha;
-#endif
-
-#if (USE1DTEXTURE)
- uniform sampler1D kernelTex;
-#else
- uniform sampler2D kernelTex;
-#endif
-
-//nvidia's half is a 16 bit float and can bring some speed improvements
-//without affecting quality
-#ifndef __GLSL_CG_DATA_TYPES
- #define half float
- #define half3 vec3
- #define half4 vec4
-#endif
-
-half3 weight(float pos)
+vec3 weight(float pos)
{
#if (HAS_FLOAT_TEXTURE)
- #if (USE1DTEXTURE)
- return texture1D(kernelTex, pos).rgb;
- #else
- return texture2D(kernelTex, vec2(pos, 0.5)).rgb;
- #endif
-#else
- #if (USE1DTEXTURE)
- return texture1D(kernelTex, pos).rgb * 2.0 - 1.0;
- #else
- return texture2D(kernelTex, vec2(pos, 0.5)).rgb * 2.0 - 1.0;
- #endif
-#endif
-}
-
-vec2 stretch(vec2 pos)
-{
-#if (XBMC_STRETCH)
- // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
- // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
- // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
- float x = pos.x - 0.5;
- return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);
+ return texture2D(kernelTex, vec2(pos - 0.5)).rgb;
#else
- return pos;
+ return texture2D(kernelTex, vec2(pos - 0.5)).rgb * 2.0 - 1.0;
#endif
}
-half3 pixel(float xpos, float ypos)
+vec3 pixel(float xpos, float ypos)
{
return texture2D(img, vec2(xpos, ypos)).rgb;
}
-half3 line (float ypos, vec3 xpos1, vec3 xpos2, half3 linetaps1, half3 linetaps2)
+vec3 line (float ypos, vec3 xpos1, vec3 xpos2, vec3 linetaps1, vec3 linetaps2)
{
return
pixel(xpos1.r, ypos) * linetaps1.r +
@@ -91,19 +53,19 @@ half3 line (float ypos, vec3 xpos1, vec3 xpos2, half3 linetaps1, half3 linetaps2
pixel(xpos2.b, ypos) * linetaps2.b;
}
-vec4 process()
+void main()
{
vec4 rgb;
- vec2 pos = stretch(cord) + stepxy * 0.5;
+ vec2 pos = cord + stepxy * 0.5;
vec2 f = fract(pos / stepxy);
- half3 linetaps1 = weight((1.0 - f.x) / 2.0);
- half3 linetaps2 = weight((1.0 - f.x) / 2.0 + 0.5);
- half3 columntaps1 = weight((1.0 - f.y) / 2.0);
- half3 columntaps2 = weight((1.0 - f.y) / 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
- half sum = linetaps1.r + linetaps1.g + linetaps1.b + linetaps2.r + linetaps2.g + linetaps2.b;
+ 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;
@@ -122,12 +84,8 @@ vec4 process()
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;
-#ifdef GL_ES
rgb.a = m_alpha;
-#else
- rgb.a = gl_Color.a;
-#endif
- return rgb;
+ gl_FragColor = rgb;
}
diff --git a/system/shaders/guishader_frag_default.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_default.glsl
index 3e36a3d0d3..6f4ae0b19c 100644
--- a/system/shaders/guishader_frag_default.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_default.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform lowp vec4 m_unicol;
diff --git a/system/shaders/guishader_frag_fonts.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl
index 1af73b0b34..953d81dbc2 100644
--- a/system/shaders/guishader_frag_fonts.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_fonts.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
varying vec4 m_cord0;
diff --git a/system/shaders/guishader_frag_multi.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl
index 7dcb290730..49202d2848 100644
--- a/system/shaders/guishader_frag_multi.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_multi.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
diff --git a/system/shaders/guishader_frag_multi_blendcolor.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl
index eff9783b2d..c01ecd29e7 100644
--- a/system/shaders/guishader_frag_multi_blendcolor.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_multi_blendcolor.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
diff --git a/system/shaders/guishader_frag_rgba.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl
index bbda050a9c..d5d7ffb3e6 100644
--- a/system/shaders/guishader_frag_rgba.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
diff --git a/system/shaders/guishader_frag_rgba_blendcolor.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl
index 033e647934..329cc408cc 100644
--- a/system/shaders/guishader_frag_rgba_blendcolor.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_blendcolor.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
diff --git a/system/shaders/guishader_frag_rgba_bob.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl
index d2d75f977b..b1c1628204 100644
--- a/system/shaders/guishader_frag_rgba_bob.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision highp float;
uniform sampler2D m_samp0;
uniform sampler2D m_samp1;
@@ -35,7 +37,7 @@ 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;
diff --git a/system/shaders/guishader_frag_rgba_bob_oes.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl
index 767e553587..bbab5c4091 100644
--- a/system/shaders/guishader_frag_rgba_bob_oes.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_bob_oes.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
#extension GL_OES_EGL_image_external : require
precision highp float;
@@ -37,11 +39,11 @@ 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);
diff --git a/system/shaders/guishader_frag_rgba_oes.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl
index a47f46e86a..55e311cf1e 100644
--- a/system/shaders/guishader_frag_rgba_oes.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_rgba_oes.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
#extension GL_OES_EGL_image_external : require
precision mediump float;
diff --git a/system/shaders/guishader_frag_texture.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl
index 9939feb470..82b60d9a02 100644
--- a/system/shaders/guishader_frag_texture.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_texture.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
uniform lowp vec4 m_unicol;
diff --git a/system/shaders/guishader_frag_texture_noblend.glsl b/system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl
index ee476e90d1..7072a167f0 100644
--- a/system/shaders/guishader_frag_texture_noblend.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_frag_texture_noblend.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision mediump float;
uniform sampler2D m_samp0;
varying vec4 m_cord0;
diff --git a/system/shaders/guishader_vert.glsl b/system/shaders/GLES/2.0/gles_guishader_vert.glsl
index 46f3399521..018961f556 100644
--- a/system/shaders/guishader_vert.glsl
+++ b/system/shaders/GLES/2.0/gles_guishader_vert.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
attribute vec4 m_attrpos;
attribute vec4 m_attrcol;
attribute vec4 m_attrcord0;
diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.glsl
index 7141ffe68d..575aa42e9c 100644
--- a/system/shaders/yuv2rgb_basic.glsl
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_basic.glsl
@@ -18,15 +18,9 @@
*
*/
-#if(XBMC_texture_rectangle)
-# extension GL_ARB_texture_rectangle : enable
-# define texture2D texture2DRect
-# define sampler2D sampler2DRect
-#endif
+#version 100
-#ifdef GL_ES
- precision mediump float;
-#endif
+precision mediump float;
uniform sampler2D m_sampY;
uniform sampler2D m_sampU;
@@ -37,47 +31,22 @@ varying vec2 m_cordV;
uniform vec2 m_step;
uniform mat4 m_yuvmat;
uniform float m_stretch;
+uniform float m_alpha;
-#ifdef GL_ES
- uniform float m_alpha;
-#endif
-
-vec2 stretch(vec2 pos)
-{
-#if (XBMC_STRETCH)
- // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
- // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
- // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
- #if(XBMC_texture_rectangle)
- float x = (pos.x * m_step.x) - 0.5;
- return vec2((mix(2.0 * x * abs(x), x, m_stretch) + 0.5) / m_step.x, pos.y);
- #else
- float x = pos.x - 0.5;
- return vec2(mix(2.0 * x * abs(x), x, m_stretch) + 0.5, pos.y);
- #endif
-#else
- return pos;
-#endif
-}
-
-vec4 process()
+void main()
{
vec4 rgb;
#if defined(XBMC_YV12) || defined(XBMC_NV12)
vec4 yuv;
- yuv.rgba = vec4( texture2D(m_sampY, stretch(m_cordY)).r
- , texture2D(m_sampU, stretch(m_cordU)).g
- , texture2D(m_sampV, stretch(m_cordV)).a
+ 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;
-#ifdef GL_ES
rgb.a = m_alpha;
-#else
- rgb.a = gl_Color.a;
-#endif
#elif defined(XBMC_NV12_RRG)
@@ -89,25 +58,14 @@ vec4 process()
rgb = m_yuvmat * yuv;
-#ifdef GL_ES
rgb.a = m_alpha;
-#else
- rgb.a = gl_Color.a;
-#endif
#elif defined(XBMC_YUY2) || defined(XBMC_UYVY)
-#if(XBMC_texture_rectangle)
- vec2 stepxy = vec2(1.0, 1.0);
- vec2 pos = stretch(m_cordY);
- pos = vec2(pos.x - 0.25, pos.y);
- vec2 f = fract(pos);
-#else
vec2 stepxy = m_step;
- vec2 pos = stretch(m_cordY);
+ vec2 pos = m_cordY;
pos = vec2(pos.x - stepxy.x * 0.25, pos.y);
vec2 f = fract(pos / stepxy);
-#endif
//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
@@ -132,14 +90,9 @@ vec4 process()
vec4 yuv = vec4(outY, outUV, 1.0);
rgb = m_yuvmat * yuv;
-#ifdef GL_ES
rgb.a = m_alpha;
-#else
- rgb.a = gl_Color.a;
-#endif
-
#endif
- return rgb;
+ gl_FragColor = rgb;
}
diff --git a/system/shaders/yuv2rgb_bob_gles.glsl b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl
index f76b5a5ebc..28254e26af 100644
--- a/system/shaders/yuv2rgb_bob_gles.glsl
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.glsl
@@ -18,6 +18,8 @@
*
*/
+#version 100
+
precision highp float;
uniform sampler2D m_sampY;
uniform sampler2D m_sampU;
diff --git a/system/shaders/yuv2rgb_vertex_gles.glsl b/system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl
index cdf3c56a71..481c9d3d99 100644
--- a/system/shaders/yuv2rgb_vertex_gles.glsl
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb_vertex.glsl
@@ -18,6 +18,8 @@
*
*/
+ #version 100
+
attribute vec4 m_attrpos;
attribute vec2 m_attrcordY;
attribute vec2 m_attrcordU;