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:
@@ -249,14 +249,12 @@ glsl_to_nir(const struct gl_constants *consts,
|
|||||||
|
|
||||||
nir_validate_shader(shader, "after function inlining and return lowering");
|
nir_validate_shader(shader, "after function inlining and return lowering");
|
||||||
|
|
||||||
/* Now that we have inlined everything remove all of the functions except
|
/* We set func->is_entrypoint after nir_function_create if the function
|
||||||
* main().
|
* 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){
|
nir_remove_non_entrypoints(shader);
|
||||||
if (strcmp("main", function->name) != 0) {
|
|
||||||
exec_node_remove(&function->node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
|
shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
|
||||||
if (shader_prog->Label)
|
if (shader_prog->Label)
|
||||||
|
Reference in New Issue
Block a user