glsl: Use nir_remove_non_entrypoints to simplify the code

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>
This commit is contained in:
Yonggang Luo
2023-06-29 01:06:53 +08:00
committed by Marge Bot
parent 1238a65251
commit c545c39c7e

View File

@@ -249,14 +249,12 @@ glsl_to_nir(const struct gl_constants *consts,
nir_validate_shader(shader, "after function inlining and return lowering");
/* Now that we have inlined everything remove all of the functions except
* main().
/* We set func->is_entrypoint after nir_function_create if the function
* is named "main", so we can use nir_remove_non_entrypoints() for this.
* Now that we have inlined everything remove all of the functions except
* func->is_entrypoint.
*/
foreach_list_typed_safe(nir_function, function, node, &(shader)->functions){
if (strcmp("main", function->name) != 0) {
exec_node_remove(&function->node);
}
}
nir_remove_non_entrypoints(shader);
shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
if (shader_prog->Label)