diff options
author | elupus <elupus@svn> | 2010-03-06 05:06:02 +0000 |
---|---|---|
committer | elupus <elupus@svn> | 2010-03-06 05:06:02 +0000 |
commit | 5e931c98c93222e544d0fcaa232de4f3e936f2f7 (patch) | |
tree | 28e666d55a7bfaa29c1cb3c230266f3389748e8f /system/shaders/yuv2rgb_basic.glsl | |
parent | 1f624edc041b8e3ac41538f24059cdb7ce27e257 (diff) |
fixed: mesa in jaunty doesn't support preprocessor macros in glsl
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28425 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'system/shaders/yuv2rgb_basic.glsl')
-rw-r--r-- | system/shaders/yuv2rgb_basic.glsl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl index 1527a7a4d1..c5aac46af0 100644 --- a/system/shaders/yuv2rgb_basic.glsl +++ b/system/shaders/yuv2rgb_basic.glsl @@ -15,26 +15,25 @@ uniform mat4 m_yuvmat; uniform float m_stretch; +vec2 stretch(vec2 pos) +{ #if (XBMC_STRETCH) - #define POSITION(pos) stretch(pos) - vec2 stretch(vec2 pos) - { - // 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(2.0 * x * abs(x), x, m_stretch) + 0.5, pos.y); - } + // 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(2.0 * x * abs(x), x, m_stretch) + 0.5, pos.y); #else - #define POSITION(pos) (pos) + return pos; #endif +} void main() { vec4 yuv, rgb; - yuv.rgba = vec4( texture2D(m_sampY, POSITION(m_cordY)).r - , texture2D(m_sampU, POSITION(m_cordU)).r - , texture2D(m_sampV, POSITION(m_cordV)).a + yuv.rgba = vec4( texture2D(m_sampY, stretch(m_cordY)).r + , texture2D(m_sampU, stretch(m_cordU)).r + , texture2D(m_sampV, stretch(m_cordV)).a , 1.0 ); rgb = m_yuvmat * yuv; |