Mesa (20.3): gallium: Fix leak of currently bound UBOs 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: 01f9a5e82275dfe8ea0df2c480719b199155cd6d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=01f9a5e82275dfe8ea0df2c480719b199155cd6d
Author: Eric Anholt <eric at anholt.net>
Date: Wed Nov 18 11:31:33 2020 -0800
gallium: Fix leak of currently bound UBOs 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 daaf5f1d1868bebec7931a51753236a850ebbd24)
---
.pick_status.json | 2 +-
src/gallium/auxiliary/cso_cache/cso_context.c | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 2db41ddf5f4..d0918e40308 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
"description": "gallium: Fix leak of currently bound UBOs 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 c204adf63fb..eda13c4e301 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -382,6 +382,8 @@ void cso_destroy_context( struct cso_context *ctx )
PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS);
int maxssbo = scr->get_shader_param(scr, sh,
PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
+ int maxcb = scr->get_shader_param(scr, sh,
+ PIPE_SHADER_CAP_MAX_CONST_BUFFERS);
assert(maxsam <= PIPE_MAX_SAMPLERS);
assert(maxview <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
assert(maxssbo <= PIPE_MAX_SHADER_BUFFERS);
@@ -394,6 +396,9 @@ void cso_destroy_context( struct cso_context *ctx )
if (maxssbo > 0) {
ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0);
}
+ for (int i = 0; i < maxcb; i++) {
+ ctx->pipe->set_constant_buffer(ctx->pipe, sh, i, NULL);
+ }
}
}
@@ -404,17 +409,13 @@ void cso_destroy_context( struct cso_context *ctx )
ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_VERTEX, 0, NULL);
if (ctx->has_geometry_shader) {
ctx->pipe->bind_gs_state(ctx->pipe, NULL);
- ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_GEOMETRY, 0, NULL);
}
if (ctx->has_tessellation) {
ctx->pipe->bind_tcs_state(ctx->pipe, NULL);
- ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_TESS_CTRL, 0, NULL);
ctx->pipe->bind_tes_state(ctx->pipe, NULL);
- ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_TESS_EVAL, 0, NULL);
}
if (ctx->has_compute_shader) {
ctx->pipe->bind_compute_state(ctx->pipe, NULL);
- ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_COMPUTE, 0, NULL);
}
ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL );
More information about the mesa-commit
mailing list