[vlc-devel] [PATCH v2 16/17] opengl: remove interop reference from renderer

Romain Vimont rom1v at videolabs.io
Thu May 14 15:38:14 CEST 2020


Remove the (weak) reference to the interop from the renderer structure.

The interop is still accessed explicitly from the renderer via the
sampler structure for now.
---
 modules/video_output/opengl/fragment_shaders.c |  4 ++--
 modules/video_output/opengl/renderer.c         | 10 +++++-----
 modules/video_output/opengl/renderer.h         |  1 -
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 68b12ae4e7d..6c6b4ceaf6f 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -503,8 +503,8 @@ char *
 opengl_fragment_shader_init(struct vlc_gl_renderer *renderer, GLenum tex_target,
                             vlc_fourcc_t chroma, video_color_space_t yuv_space)
 {
-    struct vlc_gl_interop *interop = renderer->interop;
     struct vlc_gl_sampler *sampler = renderer->sampler;
+    struct vlc_gl_interop *interop = sampler->interop;
 
     const char *swizzle_per_tex[PICTURE_PLANE_MAX] = { NULL, };
     const bool is_yuv = vlc_fourcc_IsYUV(chroma);
@@ -522,7 +522,7 @@ opengl_fragment_shader_init(struct vlc_gl_renderer *renderer, GLenum tex_target,
         ret = renderer_yuv_base_init(renderer, chroma, desc, yuv_space);
         if (ret != VLC_SUCCESS)
             return NULL;
-        ret = opengl_init_swizzle(renderer->interop, swizzle_per_tex, chroma, desc);
+        ret = opengl_init_swizzle(interop, swizzle_per_tex, chroma, desc);
         if (ret != VLC_SUCCESS)
             return NULL;
     }
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 51e3763aec0..659c6f7ca52 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -261,14 +261,15 @@ BuildVertexShader(const struct vlc_gl_renderer *renderer)
 
     if (renderer->b_dump_shaders)
         msg_Dbg(renderer->gl, "\n=== Vertex shader for fourcc: %4.4s ===\n%s\n",
-                (const char *) &renderer->interop->fmt.i_chroma, code);
+                (const char *) &renderer->sampler->interop->fmt.i_chroma, code);
     return code;
 }
 
 static char *
 BuildFragmentShader(struct vlc_gl_renderer *renderer)
 {
-    struct vlc_gl_interop *interop = renderer->interop;
+    const struct vlc_gl_sampler *sampler = renderer->sampler;
+    const struct vlc_gl_interop *interop = sampler->interop;
     char *vlc_texture =
         opengl_fragment_shader_init(renderer, interop->tex_target,
                                     interop->sw_fmt.i_chroma,
@@ -309,8 +310,8 @@ BuildFragmentShader(struct vlc_gl_renderer *renderer)
 static int
 opengl_link_program(struct vlc_gl_renderer *renderer)
 {
-    struct vlc_gl_interop *interop = renderer->interop;
     struct vlc_gl_sampler *sampler = renderer->sampler;
+    struct vlc_gl_interop *interop = sampler->interop;
     const opengl_vtable_t *vt = renderer->vt;
 
     char *vertex_shader = BuildVertexShader(renderer);
@@ -417,7 +418,6 @@ vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
     }
 
     renderer->sampler = sampler;
-    renderer->interop = interop;
 
     renderer->gl = gl;
     renderer->api = api;
@@ -859,8 +859,8 @@ static void DrawWithShaders(struct vlc_gl_renderer *renderer)
 int
 vlc_gl_renderer_Prepare(struct vlc_gl_renderer *renderer, picture_t *picture)
 {
-    const struct vlc_gl_interop *interop = renderer->interop;
     struct vlc_gl_sampler *sampler = renderer->sampler;
+    const struct vlc_gl_interop *interop = sampler->interop;
     const video_format_t *source = &picture->format;
 
     if (source->i_x_offset != sampler->last_source.i_x_offset
diff --git a/modules/video_output/opengl/renderer.h b/modules/video_output/opengl/renderer.h
index a75db93d05f..23017a54280 100644
--- a/modules/video_output/opengl/renderer.h
+++ b/modules/video_output/opengl/renderer.h
@@ -77,7 +77,6 @@ struct vlc_gl_renderer
         GLint VertexPosition;
     } aloc;
 
-    struct vlc_gl_interop *interop;
     struct vlc_gl_sampler *sampler;
 
     video_format_t fmt;
-- 
2.26.2



More information about the vlc-devel mailing list