diff options
author | Lukas Rusak <lorusak@gmail.com> | 2017-09-08 12:03:43 -0700 |
---|---|---|
committer | Lukas Rusak <lorusak@gmail.com> | 2017-09-14 08:17:32 -0700 |
commit | dcd1f69bb95603daa47399dc7b704f13ebb8022f (patch) | |
tree | 9111a62c002e7fbdb56f97c650759859bf001b17 /system/shaders | |
parent | aa6c18ecca47ce9ab3393f5f9259358924505e3f (diff) |
YUV2RGBShader: split into GL and GLES files
Diffstat (limited to 'system/shaders')
-rw-r--r-- | system/shaders/yuv2rgb_basic.glsl | 26 | ||||
-rw-r--r-- | system/shaders/yuv2rgb_basic_gles.glsl | 50 |
2 files changed, 23 insertions, 53 deletions
diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl index 59cac3eaa8..7141ffe68d 100644 --- a/system/shaders/yuv2rgb_basic.glsl +++ b/system/shaders/yuv2rgb_basic.glsl @@ -24,19 +24,24 @@ # define sampler2D sampler2DRect #endif +#ifdef GL_ES + precision mediump float; +#endif + 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; +#ifdef GL_ES + uniform float m_alpha; +#endif + vec2 stretch(vec2 pos) { #if (XBMC_STRETCH) @@ -67,7 +72,12 @@ vec4 process() , 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) @@ -78,7 +88,12 @@ vec4 process() , 1.0 ); 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) @@ -117,9 +132,14 @@ 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; } diff --git a/system/shaders/yuv2rgb_basic_gles.glsl b/system/shaders/yuv2rgb_basic_gles.glsl deleted file mode 100644 index 82fa003b53..0000000000 --- a/system/shaders/yuv2rgb_basic_gles.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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/>. - * - */ - -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 float m_alpha; -uniform mat4 m_yuvmat; - -// handles both YV12 and NV12 formats -void main() -{ - vec4 yuv, rgb; -#if 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); -#else - yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r - , texture2D(m_sampU, m_cordU).g - , texture2D(m_sampV, m_cordV).a - , 1.0); -#endif - - rgb = m_yuvmat * yuv; - rgb.a = m_alpha; - gl_FragColor = rgb; -} |