Permalink
Browse files

weave with shader

  • Loading branch information...
FernetMenta committed Jun 15, 2012
1 parent 44fef67 commit 975d03b504b51d81acd627489255d9a2d70f7e46
@@ -32,12 +32,21 @@ varying vec2 m_cordY;
varying vec2 m_cordU;
varying vec2 m_cordV;
+uniform sampler2D m_sampY2;
+uniform sampler2D m_sampU2;
+uniform sampler2D m_sampV2;
+varying vec2 m_cordY2;
+varying vec2 m_cordU2;
+varying vec2 m_cordV2;
+
uniform vec2 m_step;
uniform mat4 m_yuvmat;
uniform float m_stretch;
+uniform int m_weave;
+
vec2 stretch(vec2 pos)
{
#if (XBMC_STRETCH)
@@ -73,14 +82,24 @@ void main()
#elif defined(XBMC_VDPAU_NV12)
vec4 yuv, rgb;
- yuv.rgba = vec4( texture2D(m_sampY, stretch(m_cordY)).r
- , texture2D(m_sampU, stretch(m_cordU)).r
- , texture2D(m_sampV, stretch(m_cordV)).g
- , 1.0 );
-
+
+ if (mod(gl_FragCoord.y, 2.0) < 1.0 || (m_weave == 0))
+ {
+ yuv.rgba = vec4( texture2D(m_sampY, stretch(m_cordY)).r
+ , texture2D(m_sampU, stretch(m_cordU)).r
+ , texture2D(m_sampV, stretch(m_cordV)).g
+ , 1.0 );
+ }
+ else
+ {
+ yuv.rgba = vec4( texture2D(m_sampY2, stretch(m_cordY2)).r
+ , texture2D(m_sampU2, stretch(m_cordU2)).r
+ , texture2D(m_sampV2, stretch(m_cordV2)).g
+ , 1.0 );
+ }

This comment has been minimized.

Show comment Hide comment
@elupus

elupus Jun 17, 2012

This will slow down the normal shader in the non weave case. This should be a #if()

@elupus

elupus Jun 17, 2012

This will slow down the normal shader in the non weave case. This should be a #if()

This comment has been minimized.

Show comment Hide comment
@FernetMenta

FernetMenta Jun 17, 2012

Owner

ok.

rgb = m_yuvmat * yuv;
rgb.a = gl_Color.a;
- gl_FragColor = rgb;
+ gl_FragColor = rgb;
#elif defined(XBMC_YUY2) || defined(XBMC_UYVY)
@@ -22,6 +22,9 @@
varying vec2 m_cordY;
varying vec2 m_cordU;
varying vec2 m_cordV;
+varying vec2 m_cordY2;
+varying vec2 m_cordU2;
+varying vec2 m_cordV2;
void main()
{
@@ -33,6 +36,9 @@ void main()
m_cordY = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
m_cordU = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
m_cordV = vec2(gl_TextureMatrix[2] * gl_MultiTexCoord2);
+ m_cordY2 = vec2(gl_TextureMatrix[3] * gl_MultiTexCoord3);
+ m_cordU2 = vec2(gl_TextureMatrix[4] * gl_MultiTexCoord4);
+ m_cordV2 = vec2(gl_TextureMatrix[5] * gl_MultiTexCoord5);
#endif
gl_Position = ftransform();
gl_FrontColor = gl_Color;
Oops, something went wrong.

0 comments on commit 975d03b

Please sign in to comment.