From ef5bce9253e2221ef8df0764447cb02c02fa2a16 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Oct 2020 11:25:08 -0700 Subject: [PATCH] intel: Drop the last uses of a mem_ctx in nir_builder_init_simple_shader(). These two consumers were the only ones out of the ~65 calls to init_simple_shader, so there's a pretty clear consensus on how to allocate simple shaders. I suspect that actually these would be just fine with b.shader being the mem_ctx, but that would take a bit more rework. Acked-by: Lionel Landwerlin Part-of: --- src/intel/blorp/blorp_nir_builder.h | 3 ++- src/intel/compiler/brw_nir.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/intel/blorp/blorp_nir_builder.h b/src/intel/blorp/blorp_nir_builder.h index aa729607cca..2f9464fee6f 100644 --- a/src/intel/blorp/blorp_nir_builder.h +++ b/src/intel/blorp/blorp_nir_builder.h @@ -29,7 +29,8 @@ blorp_nir_init_shader(nir_builder *b, gl_shader_stage stage, const char *name) { - *b = nir_builder_init_simple_shader(mem_ctx, stage, NULL); + *b = nir_builder_init_simple_shader(NULL, stage, NULL); + ralloc_adopt(mem_ctx, b->shader); if (name != NULL) b->shader->info.name = ralloc_strdup(b->shader, name); if (stage == MESA_SHADER_FRAGMENT) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index b245a36b03c..ff4730a221a 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -1475,8 +1475,9 @@ brw_nir_create_passthrough_tcs(void *mem_ctx, const struct brw_compiler *compile const nir_shader_compiler_options *options, const struct brw_tcs_prog_key *key) { - nir_builder b = nir_builder_init_simple_shader(mem_ctx, MESA_SHADER_TESS_CTRL, + nir_builder b = nir_builder_init_simple_shader(NULL, MESA_SHADER_TESS_CTRL, options); + ralloc_adopt(mem_ctx, b.shader); nir_shader *nir = b.shader; nir_variable *var; nir_intrinsic_instr *load;