[vlc-devel] [PATCH] opengl: fix framebuffer initialization

Alexandre Janniaux ajanni at videolabs.io
Tue Oct 20 14:18:39 CEST 2020


Hi,

LGTM, 0 is not «the default» framebuffer and some platforms have
no concept of «default» framebuffer.

Regards,
--
Alexandre Janniaux
Videolabs

On Tue, Oct 20, 2020 at 02:06:19PM +0200, Romain Vimont wrote:
> The caller does not expect the current bindings to change when calling
> vlc_gl_filters_InitFramebuffers().
> ---
>  modules/video_output/opengl/filters.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/modules/video_output/opengl/filters.c b/modules/video_output/opengl/filters.c
> index 13088f44e9..493bfd5193 100644
> --- a/modules/video_output/opengl/filters.c
> +++ b/modules/video_output/opengl/filters.c
> @@ -200,7 +200,6 @@ InitFramebufferOut(struct vlc_gl_filter_priv *priv)
>      if (status != GL_FRAMEBUFFER_COMPLETE)
>          return VLC_EGENERIC;
>
> -    vt->BindFramebuffer(GL_FRAMEBUFFER, 0);
>      return VLC_SUCCESS;
>  }
>
> @@ -228,7 +227,6 @@ InitFramebufferMSAA(struct vlc_gl_filter_priv *priv, unsigned msaa_level)
>      if (status != GL_FRAMEBUFFER_COMPLETE)
>          return VLC_EGENERIC;
>
> -    vt->BindFramebuffer(GL_FRAMEBUFFER, 0);
>      return VLC_SUCCESS;
>  }
>
> @@ -368,6 +366,14 @@ vlc_gl_filters_InitFramebuffers(struct vlc_gl_filters *filters)
>      struct vlc_gl_filter_priv *priv = NULL;
>      struct vlc_gl_filter_priv *subfilter_priv;
>
> +    const opengl_vtable_t *vt = &filters->api->vt;
> +
> +    /* Save the current bindings to restore them at the end */
> +    GLint renderbuffer;
> +    GLint draw_framebuffer;
> +    vt->GetIntegerv(GL_RENDERBUFFER_BINDING, &renderbuffer);
> +    vt->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer);
> +
>      vlc_list_foreach(priv, &filters->list, node)
>      {
>          /* Compute the highest msaa_level among the filter and its subfilters */
> @@ -426,6 +432,10 @@ vlc_gl_filters_InitFramebuffers(struct vlc_gl_filters *filters)
>          }
>      }
>
> +    /* Restore bindings */
> +    vt->BindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_framebuffer);
> +    vt->BindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
> +
>      return VLC_SUCCESS;
>  }
>
> --
> 2.28.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list