mesa: delete framebuffer texture attachment sampler views
When a context is destroyed the destroy_tex_sampler_cb makes sure that all the sampler views created by that context are destroyed. This is done by walking the ctx->Shared->TexObjects hash table.
In a multiple context environment the texture can be deleted by a different context, so it will be removed from the TexObjects table and will prevent the above mechanism to work. This can result in an assertion in st_save_zombie_sampler_view because the sampler_view owns a reference to a destroyed context.
This issue occurs in blender 2.80.
This commit fixes this by explicitly releasing sampler_view created by the destroyed context for all texture attachments.
Note: the comment in unbind_texobj_from_fbo
says that (last sentence):
* "If a texture object is deleted while its image is attached to one
* or more attachment points in the currently bound framebuffer, then
* it is as if FramebufferTexture* had been called, with a texture of
* zero, for each attachment point to which this image was attached in
* the currently bound framebuffer. In other words, this texture image
* is first detached from all attachment points in the currently bound
* framebuffer. Note that the texture image is specifically not
* detached from any other framebuffer objects. Detaching the texture
* image from any other framebuffer objects is the responsibility of
* the application."
so I guess that this issue is really an application bug, but it doesn't hurt to fix it in Mesa.