[vlc-commits] opengl: fix framebuffer initialization

Romain Vimont git at videolan.org
Fri Oct 23 21:37:42 CEST 2020


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Tue Oct 20 14:06:19 2020 +0200| [8bcd38ca4530d74b7362a5ecdec6505c8a5de586] | committer: Alexandre Janniaux

opengl: fix framebuffer initialization

The caller does not expect the current bindings to change when calling
vlc_gl_filters_InitFramebuffers().

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8bcd38ca4530d74b7362a5ecdec6505c8a5de586
---

 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;
 }
 



More information about the vlc-commits mailing list