mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 15:48:36 +02:00
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 efff70e73f)
This commit is contained in:
parent
70e586cd0e
commit
753f5bba85
2 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -402,10 +402,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);
|
||||
}
|
||||
|
|
@ -415,6 +418,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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue