diff options
author | Eric Anholt <eric@anholt.net> | 2020-12-01 14:05:30 -0800 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2021-01-26 09:05:11 -0800 |
commit | dacf8a517b095ca3978b796ddb4bf2f17f51900b (patch) | |
tree | 407eb528c3c0eccdecb3e730b2964dad132334f2 | |
parent | a132e464f8af105ceaa6665ad47f435cd1d14b3c (diff) |
gallium: Fix leak of shader images on context destruction.
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8530>
(cherry picked from commit efff70e73ff6fbb1f73ace016c8eb53920629fe8)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json index 0696dcfaaeb..1e15b8fdf1f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -427,7 +427,7 @@ "description": "gallium: Fix leak of shader images on context destruction.", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 38ab603ade5..9c8fd4d0809 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -341,10 +341,13 @@ void cso_destroy_context( struct cso_context *ctx ) PIPE_SHADER_CAP_MAX_SHADER_BUFFERS); int maxcb = scr->get_shader_param(scr, sh, PIPE_SHADER_CAP_MAX_CONST_BUFFERS); + int maximg = scr->get_shader_param(scr, sh, + PIPE_SHADER_CAP_MAX_SHADER_IMAGES); assert(maxsam <= PIPE_MAX_SAMPLERS); assert(maxview <= PIPE_MAX_SHADER_SAMPLER_VIEWS); assert(maxssbo <= PIPE_MAX_SHADER_BUFFERS); assert(maxcb <= PIPE_MAX_CONSTANT_BUFFERS); + assert(maximg <= PIPE_MAX_SHADER_IMAGES); if (maxsam > 0) { ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, maxsam, zeros); } @@ -354,6 +357,9 @@ void cso_destroy_context( struct cso_context *ctx ) if (maxssbo > 0) { ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0); } + if (maximg > 0) { + ctx->pipe->set_shader_images(ctx->pipe, sh, 0, maximg, NULL); + } for (int i = 0; i < maxcb; i++) { ctx->pipe->set_constant_buffer(ctx->pipe, sh, i, NULL); } |