mirror of https://code.videolan.org/videolan/vlc
opengl: interop: add texture deallocate callback
some interop may require resources to be cleanup before the texture is released
This commit is contained in:
parent
3c98b62c10
commit
e0a1e90229
|
@ -47,6 +47,16 @@ struct vlc_gl_interop_ops {
|
|||
uint32_t textures[], const int32_t tex_width[],
|
||||
const int32_t tex_height[]);
|
||||
|
||||
/**
|
||||
* Callback to deallocate data for bound texture
|
||||
*
|
||||
* This function pointer can be NULL. it will be called before calling glDeleteTextures
|
||||
*
|
||||
* \param interop the OpenGL interop
|
||||
* \param textures array of textures to bind (one per plane)
|
||||
*/
|
||||
void (*deallocate_textures)(const struct vlc_gl_interop *interop, uint32_t textures[]);
|
||||
|
||||
/**
|
||||
* Callback to update a picture
|
||||
*
|
||||
|
|
|
@ -98,6 +98,8 @@ vlc_gl_interop_DeleteTextures(const struct vlc_gl_interop *interop,
|
|||
{
|
||||
struct vlc_gl_interop_private *priv =
|
||||
container_of(interop, struct vlc_gl_interop_private, interop);
|
||||
if (interop->ops->deallocate_textures != NULL)
|
||||
interop->ops->deallocate_textures(interop, textures);
|
||||
priv->gl.DeleteTextures(interop->tex_count, textures);
|
||||
memset(textures, 0, interop->tex_count * sizeof(GLuint));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue