Commit 3306c8c4 authored by Thomas Guillem's avatar Thomas Guillem

opengl: converter: merge rgba and yuv init functions

parent 4df4a4d1
......@@ -771,27 +771,8 @@ common_init(opengl_tex_converter_t *tc)
}
GLuint
opengl_tex_converter_rgba_init(const video_format_t *fmt,
opengl_tex_converter_t *tc)
{
GLuint fragment_shader =
opengl_fragment_shader_init(tc, GL_TEXTURE_2D, fmt->i_chroma,
COLOR_SPACE_UNDEF);
if (fragment_shader == 0)
return 0;
if (common_init(tc) != VLC_SUCCESS)
{
tc->api->DeleteShader(fragment_shader);
return 0;
}
return fragment_shader;
}
GLuint
opengl_tex_converter_yuv_init(const video_format_t *fmt,
opengl_tex_converter_t *tc)
opengl_tex_converter_generic_init(const video_format_t *fmt,
opengl_tex_converter_t *tc)
{
GLuint fragment_shader = 0;
if (vlc_fourcc_IsYUV(fmt->i_chroma))
......@@ -813,7 +794,13 @@ opengl_tex_converter_yuv_init(const video_format_t *fmt,
return 0;
}
else
return 0;
{
fragment_shader =
opengl_fragment_shader_init(tc, GL_TEXTURE_2D, fmt->i_chroma,
COLOR_SPACE_UNDEF);
if (fragment_shader == 0)
return 0;
}
if (common_init(tc) != VLC_SUCCESS)
{
......
......@@ -306,11 +306,9 @@ opengl_fragment_shader_init(opengl_tex_converter_t *tc, GLenum tex_target,
vlc_fourcc_t chroma, video_color_space_t yuv_space);
extern GLuint
opengl_tex_converter_rgba_init(const video_format_t *,
opengl_tex_converter_t *);
extern GLuint
opengl_tex_converter_yuv_init(const video_format_t *,
opengl_tex_converter_t *);
opengl_tex_converter_generic_init(const video_format_t *,
opengl_tex_converter_t *);
extern GLuint
opengl_tex_converter_xyz12_init(const video_format_t *,
opengl_tex_converter_t *);
......
......@@ -50,9 +50,8 @@
static opengl_tex_converter_init_cb opengl_tex_converter_init_cbs[] =
{
opengl_tex_converter_yuv_init,
opengl_tex_converter_generic_init,
opengl_tex_converter_xyz12_init,
opengl_tex_converter_rgba_init,
#ifdef __ANDROID__
opengl_tex_converter_anop_init,
#endif
......@@ -555,7 +554,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
};
/* RGBA is needed for subpictures or for non YUV pictures */
sub_fragment_shader = opengl_tex_converter_rgba_init(&vgl->fmt, &sub_tex_conv);
sub_fragment_shader = opengl_tex_converter_generic_init(&vgl->fmt, &sub_tex_conv);
if (sub_fragment_shader == 0)
{
msg_Err(gl, "RGBA shader failed");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment