[vlc-commits] vout/opengl: pool: gen textures before creating the pool
Thomas Guillem
git at videolan.org
Mon Dec 19 12:06:41 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec 14 17:03:12 2016 +0100| [67a899056d286a925c03e1d1b5b0176b2c9e4e68] | committer: Thomas Guillem
vout/opengl: pool: gen textures before creating the pool
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=67a899056d286a925c03e1d1b5b0176b2c9e4e68
---
modules/video_output/opengl/vout_helper.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index ca45875..388ffcd 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -913,34 +913,41 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
if (vgl->pool)
return vgl->pool;
+ /* Allocates our textures */
+ for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++)
+ GenTextures(vgl->tex_target, vgl->tex_internal, vgl->tex_format,
+ vgl->tex_type, vgl->chroma->plane_count,
+ vgl->tex_width, vgl->tex_height, vgl->texture[i]);
+
/* Allocate our pictures */
picture_t *picture[VLCGL_PICTURE_MAX] = {NULL, };
unsigned count;
-
- for (count = 0; count < __MIN(VLCGL_PICTURE_MAX, requested_count); count++) {
+ for (count = 0; count < __MIN(VLCGL_PICTURE_MAX, requested_count); count++)
+ {
picture[count] = picture_NewFromFormat(&vgl->fmt);
if (!picture[count])
break;
}
if (count <= 0)
- return NULL;
+ goto error;
/* Wrap the pictures into a pool */
vgl->pool = picture_pool_New(count, picture);
if (!vgl->pool)
+ {
+ for (unsigned i = 0; i < count; i++)
+ picture_Release(picture[i]);
goto error;
-
- /* Allocates our textures */
- for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++)
- GenTextures(vgl->tex_target, vgl->tex_internal, vgl->tex_format,
- vgl->tex_type, vgl->chroma->plane_count,
- vgl->tex_width, vgl->tex_height, vgl->texture[i]);
+ }
return vgl->pool;
error:
- for (unsigned i = 0; i < count; i++)
- picture_Release(picture[i]);
+ for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++)
+ {
+ glDeleteTextures(vgl->chroma->plane_count, vgl->texture[i]);
+ memset(vgl->texture[i], 0, PICTURE_PLANE_MAX * sizeof(GLuint));
+ }
return NULL;
}
More information about the vlc-commits
mailing list