[vlc-commits] opengl: don't keep vertex shader handle

Thomas Guillem git at videolan.org
Thu Jan 26 15:48:31 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 26 14:28:38 2017 +0100| [a19db0f5a33985354c5b0461a6b941106abfe4a7] | committer: Thomas Guillem

opengl: don't keep vertex shader handle

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

 modules/video_output/opengl/vout_helper.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 8ac8cc1..4b49f62 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -121,7 +121,6 @@ struct vout_display_opengl_t {
 
     picture_pool_t *pool;
 
-    GLuint     vertex_shader;
     /* One YUV program and one RGBA program (for subpics) */
     struct prgm prgms[2];
     struct prgm *prgm; /* Main program */
@@ -540,11 +539,12 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     assert(tex_conv.fragment_shader != 0);
 
     /* Build program if needed */
-    BuildVertexShader(vgl, &vgl->vertex_shader);
+    GLuint vertex_shader;
+    BuildVertexShader(vgl, &vertex_shader);
     GLuint shaders[3] = {
         tex_conv.fragment_shader,
         sub_tex_conv.fragment_shader,
-        vgl->vertex_shader
+        vertex_shader
     };
 
     /* Check shaders messages */
@@ -570,7 +570,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     vgl->prgm->tc = tex_conv;
     vgl->prgm->id = vgl->api.CreateProgram();
     vgl->api.AttachShader(vgl->prgm->id, tex_conv.fragment_shader);
-    vgl->api.AttachShader(vgl->prgm->id, vgl->vertex_shader);
+    vgl->api.AttachShader(vgl->prgm->id, vertex_shader);
     vgl->api.LinkProgram(vgl->prgm->id);
 
     /* Subpicture Vertex shaders */
@@ -579,9 +579,11 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     vgl->sub_prgm->tc = sub_tex_conv;
     vgl->sub_prgm->id = vgl->api.CreateProgram();
     vgl->api.AttachShader(vgl->sub_prgm->id, sub_tex_conv.fragment_shader);
-    vgl->api.AttachShader(vgl->sub_prgm->id, vgl->vertex_shader);
+    vgl->api.AttachShader(vgl->sub_prgm->id, vertex_shader);
     vgl->api.LinkProgram(vgl->sub_prgm->id);
 
+    vgl->api.DeleteShader(vertex_shader);
+
     /* Check program messages */
     for (GLuint i = 0; i < 2; i++) {
         int infoLength = 0;
@@ -747,7 +749,6 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
         opengl_tex_converter_t *tc = &vgl->prgms[i].tc;
         tc->pf_release(tc);
     }
-    vgl->api.DeleteShader(vgl->vertex_shader);
     vgl->api.DeleteBuffers(1, &vgl->vertex_buffer_object);
     vgl->api.DeleteBuffers(1, &vgl->index_buffer_object);
     if (vgl->chroma != NULL)



More information about the vlc-commits mailing list