opengl: expose functions to call sampler callbacks
authorRomain Vimont <rom1v@videolabs.io>
Wed, 5 Feb 2020 14:24:37 +0000 (15:24 +0100)
committerAlexandre Janniaux <ajanni@videolabs.io>
Wed, 20 May 2020 12:51:56 +0000 (14:51 +0200)
The fact that the sampler use internal function pointers (instead of
if-blocks for example) is an internal detail.

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

index 6dd2684..51e3763 100644 (file)
@@ -361,7 +361,7 @@ opengl_link_program(struct vlc_gl_renderer *renderer)
 #undef GET_ULOC
 #undef GET_ALOC
 
-    int ret = sampler->pf_fetch_locations(sampler, program_id);
+    int ret = vlc_gl_sampler_FetchLocations(sampler, program_id);
     assert(ret == VLC_SUCCESS);
     if (ret != VLC_SUCCESS)
     {
@@ -831,7 +831,8 @@ static void DrawWithShaders(struct vlc_gl_renderer *renderer)
 {
     struct vlc_gl_sampler *sampler = renderer->sampler;
     const opengl_vtable_t *vt = renderer->vt;
-    sampler->pf_prepare_shader(sampler);
+
+    vlc_gl_sampler_PrepareShader(sampler);
 
     vt->BindBuffer(GL_ARRAY_BUFFER, renderer->texture_buffer_object);
     assert(renderer->aloc.PicCoordsIn != -1);
index 7ef2d95..b5b2968 100644 (file)
@@ -129,4 +129,16 @@ vlc_gl_sampler_New(struct vlc_gl_interop *interop);
 void
 vlc_gl_sampler_Delete(struct vlc_gl_sampler *sampler);
 
+static inline int
+vlc_gl_sampler_FetchLocations(struct vlc_gl_sampler *sampler, GLuint program)
+{
+    return sampler->pf_fetch_locations(sampler, program);
+}
+
+static inline void
+vlc_gl_sampler_PrepareShader(const struct vlc_gl_sampler *sampler)
+{
+    sampler->pf_prepare_shader(sampler);
+}
+
 #endif