opengl: remove interop reference from renderer
authorRomain Vimont <rom1v@videolabs.io>
Mon, 3 Feb 2020 16:00:15 +0000 (17:00 +0100)
committerAlexandre Janniaux <ajanni@videolabs.io>
Wed, 20 May 2020 12:51:56 +0000 (14:51 +0200)
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.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
modules/video_output/opengl/fragment_shaders.c
modules/video_output/opengl/renderer.c
modules/video_output/opengl/renderer.h

index 68b12ae..6c6b4ce 100644 (file)
@@ -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;
     }
index 51e3763..659c6f7 100644 (file)
@@ -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
index a75db93..23017a5 100644 (file)
@@ -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;