r600: Delete possible old NIR variant when translating from TGSI
authorGert Wollny <gert.wollny@collabora.com>
Sun, 24 Jul 2022 11:49:37 +0000 (13:49 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sun, 24 Jul 2022 18:39:13 +0000 (18:39 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17729>

src/gallium/drivers/r600/r600_shader.c

index eb281ad..74bf818 100644 (file)
@@ -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 *)