[vlc-devel] [PATCH 28/41] opengl: expose functions to call sampler callbacks

Romain Vimont rom1v at videolabs.io
Fri Feb 7 17:42:14 CET 2020


The fact that the sampler use internal function pointers (instead of
if-blocks for example) is an internal detail.
---
 modules/video_output/opengl/renderer.c |  5 +++--
 modules/video_output/opengl/sampler.h  | 12 ++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 122535d835..cb235d1041 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -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)
     {
@@ -834,7 +834,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);
diff --git a/modules/video_output/opengl/sampler.h b/modules/video_output/opengl/sampler.h
index 794f32df69..cec8e68e72 100644
--- a/modules/video_output/opengl/sampler.h
+++ b/modules/video_output/opengl/sampler.h
@@ -130,4 +130,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(struct vlc_gl_sampler *sampler)
+{
+    sampler->pf_prepare_shader(sampler);
+}
+
 #endif
-- 
2.25.0



More information about the vlc-devel mailing list