aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 6c4c91b0927..44eade4e25a 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -90,6 +90,8 @@ static unsigned slot_pack_map[] = {
#define NTV_MIN_RESERVED_SLOTS 11
struct ntv_context {
+ void *mem_ctx;
+
struct spirv_builder builder;
SpvId GLSL_std_450;
@@ -2168,6 +2170,7 @@ nir_to_spirv(struct nir_shader *s, const struct pipe_stream_output_info *so_info
struct spirv_shader *ret = NULL;
struct ntv_context ctx = {};
+ ctx.mem_ctx = ralloc_context(NULL);
switch (s->info.stage) {
case MESA_SHADER_VERTEX:
@@ -2233,10 +2236,10 @@ nir_to_spirv(struct nir_shader *s, const struct pipe_stream_output_info *so_info
SpvId entry_point = spirv_builder_new_id(&ctx.builder);
spirv_builder_emit_name(&ctx.builder, entry_point, "main");
- ctx.vars = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
+ ctx.vars = _mesa_hash_table_create(ctx.mem_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- ctx.so_outputs = _mesa_hash_table_create(NULL, _mesa_hash_u32,
+ ctx.so_outputs = _mesa_hash_table_create(ctx.mem_ctx, _mesa_hash_u32,
_mesa_key_u32_equal);
nir_foreach_variable(var, &s->inputs)
@@ -2332,19 +2335,16 @@ nir_to_spirv(struct nir_shader *s, const struct pipe_stream_output_info *so_info
ret->num_words = spirv_builder_get_words(&ctx.builder, ret->words, num_words);
assert(ret->num_words == num_words);
+ ralloc_free(ctx.mem_ctx);
+
return ret;
fail:
+ ralloc_free(ctx.mem_ctx);
if (ret)
spirv_shader_delete(ret);
- if (ctx.vars)
- _mesa_hash_table_destroy(ctx.vars, NULL);
-
- if (ctx.so_outputs)
- _mesa_hash_table_destroy(ctx.so_outputs, NULL);
-
return NULL;
}