diff options
author | Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> | 2019-06-10 16:45:23 +0200 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2019-07-01 09:51:44 +0200 |
commit | 22b21623f3136951be120c1a48499868d4550001 (patch) | |
tree | 2869e668dce48010654a6e6571068a6842a2bbba | |
parent | f6c959afaaef5d84dd86bee8b9a5e2a7e14f3182 (diff) | |
download | mesa-22b21623f3136951be120c1a48499868d4550001.tar.gz |
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.
Fixes: 593e36f956 (st/mesa: implement "zombie" sampler views (v2))
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110944
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit c37f03d46480e73d7c0cbfe93e91cd8d69d47220)
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 875be9d0029..3c48d176ca4 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -913,6 +913,19 @@ destroy_tex_sampler_cb(GLuint id, void *data, void *userData) st_texture_release_context_sampler_view(st, st_texture_object(texObj)); } +static void +destroy_framebuffer_attachment_sampler_cb(GLuint id, void *data, void *userData) +{ + struct gl_framebuffer* glfb = (struct gl_framebuffer*) data; + struct st_context *st = (struct st_context *) userData; + + for (unsigned i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &glfb->Attachment[i]; + if (att->Texture) { + st_texture_release_context_sampler_view(st, st_texture_object(att->Texture)); + } + } +} void st_destroy_context(struct st_context *st) @@ -971,6 +984,8 @@ st_destroy_context(struct st_context *st) st_framebuffer_reference(&stfb, NULL); } + _mesa_HashWalk(ctx->Shared->FrameBuffers, destroy_framebuffer_attachment_sampler_cb, st); + pipe_sampler_view_reference(&st->pixel_xfer.pixelmap_sampler_view, NULL); pipe_resource_reference(&st->pixel_xfer.pixelmap_texture, NULL); |