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

Romain Vimont rom1v at videolabs.io
Thu Apr 2 14:24:29 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 9fd50c8600..97e2fea52b 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -502,8 +502,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);
@@ -521,7 +521,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 51e3763aec..659c6f7ca5 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 a75db93d05..23017a5428 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.0



More information about the vlc-devel mailing list