[vlc-devel] [PATCH 40/41] opengl: merge DrawWithShaders() into _Draw()

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


The function vlc_gl_renderer_Draw() (almost) just called
DrawWithShaders(). There is no need for a separate function.
---
 modules/video_output/opengl/renderer.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 9fa95d5031..4132880b7d 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -738,12 +738,16 @@ static int SetupCoords(struct vlc_gl_renderer *renderer)
     return VLC_SUCCESS;
 }
 
-static void DrawWithShaders(struct vlc_gl_renderer *renderer)
+int
+vlc_gl_renderer_Draw(struct vlc_gl_renderer *renderer)
 {
-    struct vlc_gl_sampler *sampler = renderer->sampler;
     const opengl_vtable_t *vt = renderer->vt;
 
-    vlc_gl_sampler_PrepareShader(sampler);
+    vt->Clear(GL_COLOR_BUFFER_BIT);
+
+    vt->UseProgram(renderer->program_id);
+
+    vlc_gl_sampler_PrepareShader(renderer->sampler);
 
     vt->BindBuffer(GL_ARRAY_BUFFER, renderer->texture_buffer_object);
     assert(renderer->aloc.PicCoordsIn != -1);
@@ -765,18 +769,6 @@ static void DrawWithShaders(struct vlc_gl_renderer *renderer)
                          renderer->var.ZoomMatrix);
 
     vt->DrawElements(GL_TRIANGLES, renderer->nb_indices, GL_UNSIGNED_SHORT, 0);
-}
-
-int
-vlc_gl_renderer_Draw(struct vlc_gl_renderer *renderer)
-{
-    const opengl_vtable_t *vt = renderer->vt;
-
-    vt->Clear(GL_COLOR_BUFFER_BIT);
-
-    vt->UseProgram(renderer->program_id);
-
-    DrawWithShaders(renderer);
 
     return VLC_SUCCESS;
 }
-- 
2.25.0



More information about the vlc-devel mailing list