mesa: release references to image textures when a context is destroyed
authorGert Wollny <gert.wollny@collabora.com>
Sat, 2 Feb 2019 12:17:16 +0000 (13:17 +0100)
committerGert Wollny <gw.fossdev@gmail.com>
Tue, 5 Feb 2019 10:53:41 +0000 (10:53 +0000)
commitb0b3de2be750966343fca96b7123340f8656f056
tree36507c22af4d85973ff32f612cf0037900248402
parentf1f3640f6fe841942a7de6a74f7a5c9996077e6b
mesa: release references to image textures when a context is destroyed

When a texture is still bound as an image and the context it was bound in
is destroyed but not the texture, then the texture will still hold the
resource and will not be freed when it is finally destroyed. Hence, release
these references when the context is destroyed.

This leak was triggered by virglrenderer:
https://gitlab.freedesktop.org/virgl/virglrenderer/issues/86

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/context.c
src/mesa/main/shaderimage.c
src/mesa/main/shaderimage.h