Mesa (master): mesa/st: Free the NIR builtins TGSI tokens after passing to the driver.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 12 20:03:35 UTC 2021
Module: Mesa
Branch: master
Commit: 4ddcd9cf165deba2605f5729a0af2f7ded0baad9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ddcd9cf165deba2605f5729a0af2f7ded0baad9
Author: Eric Anholt <eric at anholt.net>
Date: Mon Jan 11 11:09:12 2021 -0800
mesa/st: Free the NIR builtins TGSI tokens after passing to the driver.
The driver interface doesn't take ownership of the TGSI tokens, so free
our temporary.
Fixes: 57effa342b75 ("st/mesa: Drop the TGSI paths for PBOs and use nir-to-tgsi if needed.")
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8422>
---
src/mesa/state_tracker/st_nir_builtins.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/mesa/state_tracker/st_nir_builtins.c b/src/mesa/state_tracker/st_nir_builtins.c
index 2f7520b9dce..cdeb5a0cd88 100644
--- a/src/mesa/state_tracker/st_nir_builtins.c
+++ b/src/mesa/state_tracker/st_nir_builtins.c
@@ -26,6 +26,7 @@
#include "compiler/nir/nir_builder.h"
#include "compiler/glsl/gl_nir.h"
#include "nir/nir_to_tgsi.h"
+#include "tgsi/tgsi_parse.h"
struct pipe_shader_state *
st_nir_finish_builtin_shader(struct st_context *st,
@@ -81,21 +82,32 @@ st_nir_finish_builtin_shader(struct st_context *st,
ralloc_free(nir);
}
+ struct pipe_shader_state *shader;
switch (stage) {
case MESA_SHADER_VERTEX:
- return pipe->create_vs_state(pipe, &state);
+ shader = pipe->create_vs_state(pipe, &state);
+ break;
case MESA_SHADER_TESS_CTRL:
- return pipe->create_tcs_state(pipe, &state);
+ shader = pipe->create_tcs_state(pipe, &state);
+ break;
case MESA_SHADER_TESS_EVAL:
- return pipe->create_tes_state(pipe, &state);
+ shader = pipe->create_tes_state(pipe, &state);
+ break;
case MESA_SHADER_GEOMETRY:
- return pipe->create_gs_state(pipe, &state);
+ shader = pipe->create_gs_state(pipe, &state);
+ break;
case MESA_SHADER_FRAGMENT:
- return pipe->create_fs_state(pipe, &state);
+ shader = pipe->create_fs_state(pipe, &state);
+ break;
default:
unreachable("unsupported shader stage");
return NULL;
}
+
+ if (state.type == PIPE_SHADER_IR_TGSI)
+ tgsi_free_tokens(state.tokens);
+
+ return shader;
}
/**
More information about the mesa-commit
mailing list