Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

shaders: add support for more planar YUV formats to GLESv2.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
  • Loading branch information...
commit e6e434f1f933dcd39ae7d27f53d203056cb8ceed 1 parent 88e9842
@gbeauchesne authored
View
33 system/shaders/yuv2rgb_basic_gles.glsl
@@ -31,10 +31,41 @@ uniform mat4 m_yuvmat;
void main()
{
+#if defined(XBMC_YV12) || defined(XBMC_NV12)
+
+ vec4 yuv, rgb;
+ 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;
+ rgb.a = m_alpha;
+ gl_FragColor = rgb;
+
+#elif defined(XBMC_Y_UV)
+
vec4 yuv, rgb;
- yuv.rgba = vec4(texture2D(m_sampY, m_cordY).r, texture2D(m_sampU, m_cordU).r, texture2D(m_sampV, m_cordV).r, 1.0);
+ yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r
+ , texture2D(m_sampU, m_cordU).r
+ , texture2D(m_sampV, m_cordV).g
+ , 1.0 );
rgb = m_yuvmat * yuv;
rgb.a = m_alpha;
gl_FragColor = rgb;
+
+#elif defined(XBMC_Y_U_V)
+
+ vec4 yuv, rgb;
+ yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r
+ , texture2D(m_sampU, m_cordU).r
+ , texture2D(m_sampV, m_cordV).r
+ , 1.0 );
+
+ rgb = m_yuvmat * yuv;
+ rgb.a = m_alpha;
+ gl_FragColor = rgb;
+
+#endif
}
View
13 xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp
@@ -218,6 +218,19 @@ BaseYUV2RGBGLSLShader::BaseYUV2RGBGLSLShader(bool rect, unsigned flags, ERenderF
m_hModel = -1;
m_hAlpha = -1;
+ if (m_format == RENDER_FMT_YUV420P ||
+ m_format == RENDER_FMT_YUV420P10 ||
+ m_format == RENDER_FMT_YUV420P16)
+ m_defines += "#define XBMC_YV12\n";
+ else if (m_format == RENDER_FMT_NV12)
+ m_defines += "#define XBMC_NV12\n";
+ else if (m_format == RENDER_FMT_Y_UV)
+ m_defines += "#define XBMC_Y_UV";
+ else if (m_format == RENDER_FMT_Y_U_V)
+ m_defines += "#define XBMC_Y_U_V";
+ else
+ CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format);
+
VertexShader()->LoadSource("yuv2rgb_vertex_gles.glsl", m_defines);
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.