[vlc-devel] [PATCH 07/18] opengl: split xyz12_init()

Romain Vimont rom1v at videolabs.io
Fri Dec 20 15:48:49 CET 2019


Extract the importer-specific implementation to a separate function.
---
 modules/video_output/opengl/fragment_shaders.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index b57ec134a9..d64af63b56 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -457,17 +457,19 @@ tc_xyz12_prepare_shader(const opengl_tex_converter_t *tc,
     tc->vt->Uniform1i(tc->uloc.Texture[0], 0);
 }
 
-static GLuint
-xyz12_shader_init(opengl_tex_converter_t *tc)
+static void
+importer_xyz12_init(struct vlc_gl_importer *imp)
 {
-    struct vlc_gl_importer *imp = &tc->importer;
-
     imp->tex_count = 1;
     imp->tex_target = GL_TEXTURE_2D;
     imp->texs[0] = (struct vlc_gl_tex_cfg) {
         { 1, 1 }, { 1, 1 }, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT
     };
+}
 
+static GLuint
+xyz12_shader_init(opengl_tex_converter_t *tc)
+{
     tc->pf_fetch_locations = tc_xyz12_fetch_locations;
     tc->pf_prepare_shader = tc_xyz12_prepare_shader;
 
@@ -535,7 +537,10 @@ opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum tex_target,
         return 0;
 
     if (chroma == VLC_CODEC_XYZ12)
+    {
+        importer_xyz12_init(&tc->importer);
         return xyz12_shader_init(tc);
+    }
 
     if (is_yuv)
     {
-- 
2.24.1



More information about the vlc-devel mailing list