Module: Mesa
Branch: main
Commit: 68babdd2271d9aa87d4a294b0a7322c837b606f0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=68babdd2271d9aa87d4a294b0a7322c837b606f0

Author: Patrick Lerda <[email protected]>
Date:   Mon Mar 20 23:34:36 2023 +0100

r600: fix refcnt imbalance related to shader

Indeed, gs_copy_shader was not freed.

Fixes: commit 1371d65a7fbd695d3516861fe733685569d890d0
    r600g: initial support for geometry shaders on evergreen (v2)

For instance, with "piglit/bin/shader_runner 
generated_tests/spec/arb_gpu_shader_int64/execution/built-in-functions/gs-abs-i64vec2.shader_test
 -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Signed-off-by: Patrick Lerda <[email protected]>
Reviewed-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22087>

---

 src/gallium/drivers/r600/r600_state_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index 31a9b728e5e..ef2e6a6e8da 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1178,6 +1178,10 @@ void r600_delete_shader_selector(struct pipe_context 
*ctx,
        struct r600_pipe_shader *p = sel->current, *c;
        while (p) {
                c = p->next_variant;
+               if (p->gs_copy_shader) {
+                       r600_pipe_shader_destroy(ctx, p->gs_copy_shader);
+                       free(p->gs_copy_shader);
+               }
                r600_pipe_shader_destroy(ctx, p);
                free(p);
                p = c;

Reply via email to