[vlc-devel] [PATCH 12/41] opengl: move paddings computation to _Prepare()
Romain Vimont
rom1v at videolabs.io
Fri Feb 7 17:41:58 CET 2020
Texture paddings were computed in _Display(), while the picture format
is known in _Prepare().
This will allow to remove the video_format_t parameter of _Display().
---
modules/video_output/opengl/renderer.c | 38 ++++++++++++++------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 88e0e3e3f8..41b9fee413 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -913,30 +913,13 @@ int
vlc_gl_renderer_Prepare(struct vlc_gl_renderer *renderer, picture_t *picture)
{
const struct vlc_gl_interop *interop = renderer->interop;
- /* Update the texture */
- return interop->ops->update_textures(interop, renderer->textures,
- renderer->tex_width,
- renderer->tex_height, picture,
- NULL);
-}
-
-int
-vlc_gl_renderer_Draw(struct vlc_gl_renderer *renderer,
- const video_format_t *source)
-{
- const opengl_vtable_t *vt = renderer->vt;
-
- vt->Clear(GL_COLOR_BUFFER_BIT);
-
- vt->UseProgram(renderer->program_id);
+ const video_format_t *source = &picture->format;
if (source->i_x_offset != renderer->last_source.i_x_offset
|| source->i_y_offset != renderer->last_source.i_y_offset
|| source->i_visible_width != renderer->last_source.i_visible_width
|| source->i_visible_height != renderer->last_source.i_visible_height)
{
- const struct vlc_gl_interop *interop = renderer->interop;
-
memset(renderer->var.TexCoordsMap, 0,
sizeof(renderer->var.TexCoordsMap));
for (unsigned j = 0; j < interop->tex_count; j++)
@@ -1011,6 +994,25 @@ vlc_gl_renderer_Draw(struct vlc_gl_renderer *renderer,
renderer->last_source.i_visible_width = source->i_visible_width;
renderer->last_source.i_visible_height = source->i_visible_height;
}
+
+ /* Update the texture */
+ return interop->ops->update_textures(interop, renderer->textures,
+ renderer->tex_width,
+ renderer->tex_height, picture,
+ NULL);
+}
+
+int
+vlc_gl_renderer_Draw(struct vlc_gl_renderer *renderer,
+ const video_format_t *source)
+{
+ (void) source;
+ 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