nir: Add and use a nir_variable_list_for_mode helper

We also add a new list iterator which takes a modes bitfield and
automatically figures out which list to use.  In the future, this
iterator will work for multiple modes but today it assumes a single mode
thanks to the behavior of nir_variable_list_for_mode.  This also doesn't
work for function_temp variables.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
This commit is contained in:
Jason Ekstrand
2020-07-20 14:32:01 -05:00
committed by Marge Bot
parent e3e1c50067
commit 6f6f7a34c5
3 changed files with 46 additions and 25 deletions

View File

@@ -128,8 +128,7 @@ nir_remove_unused_io_vars(nir_shader *shader,
uint64_t *used;
assert(mode == nir_var_shader_in || mode == nir_var_shader_out);
struct exec_list *var_list =
mode == nir_var_shader_in ? &shader->inputs : &shader->outputs;
struct exec_list *var_list = nir_variable_list_for_mode(shader, mode);
nir_foreach_variable_safe(var, var_list) {
if (var->data.patch)