nir: add a nir_remove_non_entrypoints helper
This code just got duplicated a lot. There is still more, but the remaining instances do a bit more than just removing other functions. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16348>
This commit is contained in:
@@ -3516,3 +3516,12 @@ void nir_remove_sysval_output(nir_intrinsic_instr *intr)
|
||||
nir_instr_remove(&intr->instr);
|
||||
}
|
||||
}
|
||||
|
||||
void nir_remove_non_entrypoints(nir_shader *nir)
|
||||
{
|
||||
foreach_list_typed_safe(nir_function, func, node, &nir->functions) {
|
||||
if (!func->is_entrypoint)
|
||||
exec_node_remove(&func->node);
|
||||
}
|
||||
assert(exec_list_length(&nir->functions) == 1);
|
||||
}
|
||||
|
@@ -3669,6 +3669,8 @@ nir_shader_get_entrypoint(const nir_shader *shader)
|
||||
return func->impl;
|
||||
}
|
||||
|
||||
void nir_remove_non_entrypoints(nir_shader *shader);
|
||||
|
||||
nir_shader *nir_shader_create(void *mem_ctx,
|
||||
gl_shader_stage stage,
|
||||
const nir_shader_compiler_options *options,
|
||||
|
Reference in New Issue
Block a user