Mesa (main): r600: Delete possible old NIR variant when translating from TGSI

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jul 24 18:45:34 UTC 2022


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sun Jul 24 13:49:37 2022 +0200

r600: Delete possible old NIR variant when translating from TGSI

With shader variants it may happen that we already translated a TGSI
shader for the current selector, so delete the old nir shader if we
already had one.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17729>

---

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

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index eb281adb1c7..74bf8182b4a 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -195,6 +195,8 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
 		}
 	} else {
 		if (sel->ir_type == PIPE_SHADER_IR_TGSI) {
+			if (sel->nir)
+				ralloc_free(sel->nir);
 			sel->nir = tgsi_to_nir(sel->tokens, ctx->screen, true);
                         const nir_shader_compiler_options *nir_options =
                               (const nir_shader_compiler_options *)



More information about the mesa-commit mailing list