Module: Mesa Branch: staging/21.3 Commit: ec0eefa4236ab1897fcd40d3c312a5a0a1ca9e89 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec0eefa4236ab1897fcd40d3c312a5a0a1ca9e89
Author: Dave Airlie <[email protected]> Date: Tue Feb 8 18:24:12 2022 +1000 lavapipe: fix sampler + sampler view leaks. The compute sampler views are using a different method of generation so have to be deleted explicitly. Fixes: e94fd4cc6589 ("lavapipe: rename vallium to lavapipe") Reviewed-By: Mike Blumenkrantz <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14939> (cherry picked from commit 2f9089f6de8ca29a529ef7828efbabeec58be6e8) --- .pick_status.json | 2 +- src/gallium/frontends/lavapipe/lvp_execute.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index c398548f66b..1a52a746426 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3397,7 +3397,7 @@ "description": "lavapipe: fix sampler + sampler view leaks.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "e94fd4cc65899bccceb4642363bc4376c6831580" }, diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index d1c65d5838f..30d7bf3c096 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -3910,6 +3910,18 @@ VkResult lvp_execute_cmds(struct lvp_device *device, } } + for (enum pipe_shader_type s = PIPE_SHADER_VERTEX; s < PIPE_SHADER_TYPES; s++) { + for (unsigned i = 0; i < PIPE_MAX_SAMPLERS; i++) { + if (state.sv[s][i]) + pipe_sampler_view_reference(&state.sv[s][i], NULL); + } + } + + for (unsigned i = 0; i < PIPE_MAX_SAMPLERS; i++) { + if (state.cso_ss_ptr[PIPE_SHADER_COMPUTE][i]) + state.pctx->delete_sampler_state(state.pctx, state.ss_cso[PIPE_SHADER_COMPUTE][i]); + } + free(state.imageless_views); free(state.pending_clear_aspects); free(state.cleared_views);
