Mesa (20.3): gallium: Fix leak of bound SSBOs at CSO context destruction.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 3 17:59:32 UTC 2020
Module: Mesa
Branch: 20.3
Commit: 8258c5867afe168fc95d9272aa39b9d1834e03de
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8258c5867afe168fc95d9272aa39b9d1834e03de
Author: Eric Anholt <eric at anholt.net>
Date: Wed Nov 18 11:23:30 2020 -0800
gallium: Fix leak of bound SSBOs at CSO context destruction.
Cc: mesa-stable
Reviewed-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7695>
(cherry picked from commit 634384e4a09d897e0f045e6e99b787804ef4fe40)
---
.pick_status.json | 2 +-
src/gallium/auxiliary/cso_cache/cso_context.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index a705a5f2b12..57db1a934c4 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -31,7 +31,7 @@
"description": "gallium: Fix leak of bound SSBOs at CSO 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 3911ee73d30..c204adf63fb 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -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);
+ }
}
}
More information about the mesa-commit
mailing list