Mesa (master): llvmpipe: fixup context leaks.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 15 04:49:32 UTC 2020
Module: Mesa
Branch: master
Commit: f4edc6f8bd89e97047b79a4685640d0546e90a10
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4edc6f8bd89e97047b79a4685640d0546e90a10
Author: Dave Airlie <airlied at redhat.com>
Date: Wed Apr 15 07:17:20 2020 +1000
llvmpipe: fixup context leaks.
Make sure we unreference all resources for all shaders on context
destruction.
Fixes: eb5227173f03 (llvmpipe: add support for tessellation shaders)
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4560>
---
src/gallium/drivers/llvmpipe/lp_context.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index a9c6ae6f11d..66d72b947e1 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -55,7 +55,7 @@
static void llvmpipe_destroy( struct pipe_context *pipe )
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
- uint i, j;
+ uint i;
lp_print_counters();
@@ -80,21 +80,18 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL);
- for (i = 0; i < ARRAY_SIZE(llvmpipe->sampler_views[0]); i++) {
- pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL);
- }
-
- for (i = 0; i < ARRAY_SIZE(llvmpipe->sampler_views[0]); i++) {
- pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], NULL);
- }
-
- for (i = 0; i < ARRAY_SIZE(llvmpipe->sampler_views[0]); i++) {
- pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_GEOMETRY][i], NULL);
- }
-
- for (i = 0; i < ARRAY_SIZE(llvmpipe->constants); i++) {
- for (j = 0; j < ARRAY_SIZE(llvmpipe->constants[i]); j++) {
- pipe_resource_reference(&llvmpipe->constants[i][j].buffer, NULL);
+ for (enum pipe_shader_type s = PIPE_SHADER_VERTEX; s < PIPE_SHADER_TYPES; s++) {
+ for (i = 0; i < ARRAY_SIZE(llvmpipe->sampler_views[0]); i++) {
+ pipe_sampler_view_reference(&llvmpipe->sampler_views[s][i], NULL);
+ }
+ for (i = 0; i < LP_MAX_TGSI_SHADER_IMAGES; i++) {
+ pipe_resource_reference(&llvmpipe->images[s][i].resource, NULL);
+ }
+ for (i = 0; i < LP_MAX_TGSI_SHADER_BUFFERS; i++) {
+ pipe_resource_reference(&llvmpipe->ssbos[s][i].buffer, NULL);
+ }
+ for (i = 0; i < ARRAY_SIZE(llvmpipe->constants[s]); i++) {
+ pipe_resource_reference(&llvmpipe->constants[s][i].buffer, NULL);
}
}
More information about the mesa-commit
mailing list