mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
gallium: Fix leak of bound SSBOs at CSO context destruction.
Cc: mesa-stable Reviewed-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7695>
This commit is contained in:
parent
311470fa64
commit
634384e4a0
1 changed files with 7 additions and 0 deletions
|
|
@ -371,6 +371,7 @@ void cso_destroy_context( struct cso_context *ctx )
|
|||
|
||||
{
|
||||
static struct pipe_sampler_view *views[PIPE_MAX_SHADER_SAMPLER_VIEWS] = { NULL };
|
||||
static struct pipe_shader_buffer ssbos[PIPE_MAX_SHADER_BUFFERS] = { 0 };
|
||||
static void *zeros[PIPE_MAX_SAMPLERS] = { NULL };
|
||||
struct pipe_screen *scr = ctx->pipe->screen;
|
||||
enum pipe_shader_type sh;
|
||||
|
|
@ -379,14 +380,20 @@ void cso_destroy_context( struct cso_context *ctx )
|
|||
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS);
|
||||
int maxview = scr->get_shader_param(scr, sh,
|
||||
PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS);
|
||||
int maxssbo = scr->get_shader_param(scr, sh,
|
||||
PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
|
||||
assert(maxsam <= PIPE_MAX_SAMPLERS);
|
||||
assert(maxview <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
|
||||
assert(maxssbo <= PIPE_MAX_SHADER_BUFFERS);
|
||||
if (maxsam > 0) {
|
||||
ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, maxsam, zeros);
|
||||
}
|
||||
if (maxview > 0) {
|
||||
ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, maxview, views);
|
||||
}
|
||||
if (maxssbo > 0) {
|
||||
ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue