aboutsummaryrefslogtreecommitdiff
path: root/system/shaders
diff options
context:
space:
mode:
authorLauri Myllari <lauri.myllari@gmail.com>2015-05-04 22:30:47 -0700
committerRainer Hochecker <fernetmenta@online.de>2015-12-06 19:55:21 +0100
commit0b280bab2b7cc93944ea4b0d8ecf8b441051499b (patch)
tree8f4a5e629b2d933e06b2f646d289ccfe8c8b5dc8 /system/shaders
parent18cefe61b4e3ec562caa64427a5fd3ce9993a099 (diff)
gl: split output stage from yuv2rgb shader
In preparation for new features, create a separate output stage that can be attached either to yuv2rgb or convolution filter shader. This stage will include things like color management, RGB range conversion and dithering.
Diffstat (limited to 'system/shaders')
-rw-r--r--system/shaders/output.glsl6
-rw-r--r--system/shaders/yuv2rgb_basic.glsl18
2 files changed, 15 insertions, 9 deletions
diff --git a/system/shaders/output.glsl b/system/shaders/output.glsl
new file mode 100644
index 0000000000..53c89935ae
--- /dev/null
+++ b/system/shaders/output.glsl
@@ -0,0 +1,6 @@
+void main()
+{
+ vec4 rgb = process();
+
+ gl_FragColor = rgb;
+}
diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl
index 13fe0ec5df..59cac3eaa8 100644
--- a/system/shaders/yuv2rgb_basic.glsl
+++ b/system/shaders/yuv2rgb_basic.glsl
@@ -55,11 +55,12 @@ vec2 stretch(vec2 pos)
#endif
}
-void main()
+vec4 process()
{
+ vec4 rgb;
#if defined(XBMC_YV12) || defined(XBMC_NV12)
- vec4 yuv, rgb;
+ 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
@@ -67,11 +68,10 @@ void main()
rgb = m_yuvmat * yuv;
rgb.a = gl_Color.a;
- gl_FragColor = rgb;
#elif defined(XBMC_NV12_RRG)
- vec4 yuv, rgb;
+ 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
@@ -79,7 +79,6 @@ void main()
rgb = m_yuvmat * yuv;
rgb.a = gl_Color.a;
- gl_FragColor = rgb;
#elif defined(XBMC_YUY2) || defined(XBMC_UYVY)
@@ -116,10 +115,11 @@ void main()
float outY = mix(leftY, rightY, step(0.5, f.x));
vec4 yuv = vec4(outY, outUV, 1.0);
- vec4 rgb = m_yuvmat * yuv;
-
- gl_FragColor = rgb;
- gl_FragColor.a = gl_Color.a;
+ rgb = m_yuvmat * yuv;
+ rgb.a = gl_Color.a;
#endif
+
+ return rgb;
}
+