[vlc-devel] [PATCH v2 11/21] opengl: initialize fshader from vout_helper
Romain Vimont
rom1v at videolabs.io
Tue Jan 7 12:41:47 CET 2020
Initialize the fragment shader from the vout module directly. The
"glconv" modules are not responsible for initializing the fragment
shader anymore.
---
modules/video_output/opengl/converter_sw.c | 16 +++++-----------
modules/video_output/opengl/fragment_shaders.c | 4 ----
modules/video_output/opengl/vout_helper.c | 12 ++++++++++++
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index 5c59a53bfa..c441c68ae2 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -300,7 +300,6 @@ opengl_tex_converter_generic_init(opengl_tex_converter_t *tc, bool allow_dr)
{
struct vlc_gl_interop *interop = &tc->interop;
- GLuint fragment_shader = 0;
video_color_space_t space;
const vlc_fourcc_t *list;
@@ -326,11 +325,11 @@ opengl_tex_converter_generic_init(opengl_tex_converter_t *tc, bool allow_dr)
space = COLOR_SPACE_UNDEF;
}
+ int ret = VLC_EGENERIC;
while (*list)
{
- fragment_shader =
- opengl_fragment_shader_init(tc, GL_TEXTURE_2D, *list, space);
- if (fragment_shader != 0)
+ ret = opengl_interop_init(interop, GL_TEXTURE_2D, *list, space);
+ if (ret == VLC_SUCCESS)
{
interop->fmt.i_chroma = *list;
@@ -351,15 +350,12 @@ opengl_tex_converter_generic_init(opengl_tex_converter_t *tc, bool allow_dr)
}
list++;
}
- if (fragment_shader == 0)
- return VLC_EGENERIC;
+ if (ret != VLC_SUCCESS)
+ return ret;
struct priv *priv = interop->priv = calloc(1, sizeof(struct priv));
if (unlikely(priv == NULL))
- {
- interop->vt->DeleteShader(fragment_shader);
return VLC_ENOMEM;
- }
static const struct vlc_gl_interop_ops ops = {
.allocate_textures = tc_common_allocate_textures,
@@ -394,8 +390,6 @@ opengl_tex_converter_generic_init(opengl_tex_converter_t *tc, bool allow_dr)
}
}
- tc->fshader = fragment_shader;
-
return VLC_SUCCESS;
}
diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 77b4e98c41..9d73088509 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -578,10 +578,6 @@ opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum tex_target,
if (desc == NULL)
return 0;
- ret = opengl_interop_init_impl(&tc->interop, tex_target, chroma, yuv_space);
- if (ret != VLC_SUCCESS)
- return 0;
-
if (chroma == VLC_CODEC_XYZ12)
return xyz12_shader_init(tc);
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index a46850a6f1..7cd259cdad 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -623,6 +623,18 @@ opengl_init_program(vout_display_opengl_t *vgl, vlc_video_context *context,
return VLC_EGENERIC;
}
+ GLuint fragment_shader =
+ opengl_fragment_shader_init_impl(tc, interop->tex_target,
+ interop->sw_fmt.i_chroma,
+ interop->sw_fmt.space);
+ if (!fragment_shader)
+ {
+ vlc_object_delete(tc);
+ return VLC_EGENERIC;
+ }
+
+ tc->fshader = fragment_shader;
+
assert(tc->fshader != 0 &&
interop->tex_target != 0 &&
interop->tex_count > 0 &&
--
2.25.0.rc0
More information about the vlc-devel
mailing list