intel: fix leaking memory on shader creation
ralloc_adopt takes care of all the shader's children, but shader itsel ends up
orphaned and never gets free'd.
Fixes: ef5bce9253
("intel: Drop the last uses of a mem_ctx in nir_builder_init_simple_shader().")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4951
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11651>
This commit is contained in:
@@ -30,7 +30,7 @@ blorp_nir_init_shader(nir_builder *b,
|
|||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
*b = nir_builder_init_simple_shader(stage, NULL, "%s", name ? name : "");
|
*b = nir_builder_init_simple_shader(stage, NULL, "%s", name ? name : "");
|
||||||
ralloc_adopt(mem_ctx, b->shader);
|
ralloc_steal(mem_ctx, b->shader);
|
||||||
if (stage == MESA_SHADER_FRAGMENT)
|
if (stage == MESA_SHADER_FRAGMENT)
|
||||||
b->shader->info.fs.origin_upper_left = true;
|
b->shader->info.fs.origin_upper_left = true;
|
||||||
}
|
}
|
||||||
|
@@ -1523,7 +1523,7 @@ brw_nir_create_passthrough_tcs(void *mem_ctx, const struct brw_compiler *compile
|
|||||||
{
|
{
|
||||||
nir_builder b = nir_builder_init_simple_shader(MESA_SHADER_TESS_CTRL,
|
nir_builder b = nir_builder_init_simple_shader(MESA_SHADER_TESS_CTRL,
|
||||||
options, "passthrough TCS");
|
options, "passthrough TCS");
|
||||||
ralloc_adopt(mem_ctx, b.shader);
|
ralloc_steal(mem_ctx, b.shader);
|
||||||
nir_shader *nir = b.shader;
|
nir_shader *nir = b.shader;
|
||||||
nir_variable *var;
|
nir_variable *var;
|
||||||
nir_ssa_def *load;
|
nir_ssa_def *load;
|
||||||
|
Reference in New Issue
Block a user